1.1.2 • Published 3 years ago

gofile-apiwrapper v1.1.2

Weekly downloads
50
License
MIT
Repository
github
Last release
3 years ago

gofile-apiwrapper NPM version Build Status

api wrapper

Installation

$ npm install --save gofile-apiwrapper

Usage

const gofileApiwrapper = require('gofile-apiwrapper');
const api = new gofileApiwrapper.apiGofile("email","token");

// e.g.
api.getBestServer((err,body)=>{
    //body contain data 
    //err is null until https get request give error
});

documentation

Classes

Constants

Typedefs

apiGofile

api wrapper class for Gofile rest api

Kind: global class

new apiGofile(email, token)

ParamTypeDefaultDescription
emailstring"\"\""your email
tokenstring"\"\""your apikey on profile page

apiGofile.email

Kind: instance property of apiGofile Properties

NameDescription
emailyour account email

apiGofile.token

Kind: instance property of apiGofile Properties

NameDescription
youraccount apikey

apiGofile.setEmail

setter of email

Kind: instance property of apiGofile

ParamType
emailstring

apiGofile.getEmail ⇒ string

getter of email

Kind: instance property of apiGofile Returns: string - email

apiGofile.setToken

setter of token

Kind: instance property of apiGofile

ParamType
tokenstring

apiGofile.getToken ⇒ string

getter of token

Kind: instance property of apiGofile Returns: string - token

apiGofile.getBestServer(callback)

The server chosen with this function will have better connection quality.

Kind: instance method of apiGofile

ParamTypeDescription
callbackhttpsResponsehandles the https request result

apiGofile.getAccountInfo(token, callback)

Data returned are : email, account type (e.g. donor, standar), file count, file size.

Kind: instance method of apiGofile

ParamTypeDefaultDescription
tokenstringnullsomeone's token (if null it will use the token setted in the class)
callbackhttpsResponsehandles the https request result

apiGofile.getUploadList(token, callback)

Data returned are all upload with all data of file uploaded.

Kind: instance method of apiGofile

ParamTypeDefaultDescription
tokenstringnullsomeone's token (if null it will use the token setted in the class)
callbackhttpsResponsehandles the https request result

apiGofile.deleteUpload(name, code, token, callback)

It delete all upload containing the file name.

Kind: instance method of apiGofile

ParamTypeDefaultDescription
namestringnullname of the file (if null it delete all upload)
codesrtingcode of specific upload (if null it delete all upload with the file inside)
tokenstringnullsomeone's token (if null it will use the token setted in the class)
callbackhttpsResponsehandles the https request result

apiGofile.deleteFile(name, code, token, callback)

It delete all file in an upload or all upload if code of upload is not specified, if the upload have only 1 file use delete upload

Kind: instance method of apiGofile

ParamTypeDefaultDescription
namestringname of the file
codesrtingcode of specific upload
tokenstringnullsomeone's token (if null it will use the token setted in the class)
callbackhttpsResponsehandles the https request result

apiGofile.postUpload(file, ac, email, description, password, tags, expire, server, callback)

If you specify the adminCode of an existing upload, then the file will be added to this upload.

Kind: instance method of apiGofile

ParamTypeDefaultDescription
filefileMust contain one file.
acstring"\"\""The admin code of an upload. If you specify it, the file will be added to this upload.
emailstring"\"\""Must contain email adress syntax. The upload will be stored on this account. if is null it take the email assigned to the class in the consrtuctor or using setter
descriptionstring"\"\""Must contain description of the upload
passwordstring"\"\""Must contain password of the upload(min 6 char)
tagsstring"\"\""Must contain tags of the upload. If multiple tags, seperate them with comma (example : tags1,tags2)
expirestring"\"\""Must contain expiration date of the upload in the form of timestamp.
serverstringthe server to upload the file in
callbackhttpsResponsehandles the https request result

baseUri : string

Kind: global constant Default: "https://apiv2.gofile.io/"

httpsResponse : function

Callback for getting response from https call

Kind: global typedef

ParamTypeDescription
errErrorerror of https request
bodystring | *body of https response

License

MIT © BDream

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago