Giter VIP home page Giter VIP logo

putio-js's People

Contributors

altaywtf avatar batuaksoy avatar berkanteber avatar boulosda avatar cenkalti avatar dependabot[bot] avatar dnicolson avatar ozhanefemeral avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

putio-js's Issues

Not a constructor error with ES6 Module import

With an index.js like this:

import PutioAPI from '@putdotio/api-client'

const putioAPI = new PutioAPI({ clientID: 'OAUTH_CLIENT_ID' })

and the following package.json:

{
  "name": "putio-test",
  "version": "1.0.0",
  "description": "Test for put.io API client library",
  "main": "index.js",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "license": "ISC",
  "dependencies": {
    "@putdotio/api-client": "^8.16.0"
  }
}

I receive the following error:

file:///putio-test/index.js:3
const putioAPI = new PutioAPI({ clientID: 'OAUTH_CLIENT_ID' })
                 ^

TypeError: PutioAPI is not a constructor
    at file:///putio-test/index.js:3:18
    at ModuleJob.run (internal/modules/esm/module_job.js:110:37)
    at async Loader.import (internal/modules/esm/loader.js:176:24)

when using node >=13 or 12 with the --experimental-modules flag.

upload method doesn't work without filename parameter

Hello,
following PR15 and this filename should be optional for Files.Upload function.
If I omit this parameter, I have an issue with FormData.
When I configure the filename parameter with anything, axios indicate error_message: 'getaddrinfo ENOTFOUND upload.put.io'
Any help?

Not matching current API spec

Some of the methods are out of date and are no longer available from the API. For example File.Delete() does not work, and Files.Delete() should be used instead.

I'll hopefully make a PR to clean up some of that soon.

PutioAPI.Files.Upload 401 but PutioAPI.Account.Info() works

Hi, I do not understand what I am doing wrong. I initialize the API client like this

      const putioConfig = this.configService.get('putio');
      this.api = new PutioAPI({
        clientID: putioConfig.clientId,
      });
      this.api.setToken(putioConfig.oAuthToken);

with this API when I call the Account.Info() it works perfectly as expected.

  const accountInfo = await putio.Account.Info();
  this.logger.log(`Uploading as ${accountInfo.data.info.username}`);

However when I call the Files.Upload(...) I get 401

      await api.Files.Upload({
        file: absolutePath,
        fileName: filename,
        parentId: targetFolderId,
      });

is there some issue with the sdk or am I doing something wrong?

Upload Method

Could you add an Upload method to the File or Files class? This would really be useful on my CLI client.
I would understand if you consider it to be outside of the scope of the library though.

typescript compiler error

> shx rm -rf dist && tsc -b

node_modules/@putdotio/api-client/dist/resources/Auth/types.d.ts:1:31 - error TS2307: Cannot find module 'utils/types' or its corresponding type declarations.

1 import { ISODateString } from 'utils/types';
                                ~~~~~~~~~~~~~


Found 1 error.

Add strict:true to tsconfig

I cannot use this library in my application without setting strict:false or skipLibCheck:true in my tsconfig becuase this library contains type errors. I suggest adding this option, then fix all of the errors reported by TypeScript compiler.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.