404ProgramNotFound / apiWrap-Gofile

api wrapper for Gofile api
MIT License
0 stars 0 forks source link

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

apiGofile

api wrapper class for Gofile rest api

Constants

baseUri : string

Typedefs

httpsResponse : function

Callback for getting response from https call

apiGofile

api wrapper class for Gofile rest api

Kind: global class

new apiGofile([email], [token])

Param Type Default Description
[email] string "\"\"" your email
[token] string "\"\"" your apikey on profile page

apiGofile.email

Kind: instance property of apiGofile Properties

Name Description
email your account email

apiGofile.token

Kind: instance property of apiGofile Properties

Name Description
token your account apikey

apiGofile.setEmail

setter of email

Kind: instance property of apiGofile

Param Type
email string

apiGofile.getEmail ⇒ string

getter of email

Kind: instance property of apiGofile Returns: string - email

apiGofile.setToken

setter of token

Kind: instance property of apiGofile

Param Type
token string

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

Param Type Description
callback httpsResponse handles 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

Param Type Default Description
[token] string null someone's token (if null it will use the token setted in the class)
callback httpsResponse handles the https request result

apiGofile.getUploadList([token], callback)

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

Kind: instance method of apiGofile

Param Type Default Description
[token] string null someone's token (if null it will use the token setted in the class)
callback httpsResponse handles the https request result

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

It delete all upload containing the file name.

Kind: instance method of apiGofile

Param Type Default Description
[name] string null name of the file (if null it delete all upload)
[code] srting code of specific upload (if null it delete all upload with the file inside)
[token] string null someone's token (if null it will use the token setted in the class)
callback httpsResponse handles 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

Param Type Default Description
name string name of the file
[code] srting code of specific upload
[token] string null someone's token (if null it will use the token setted in the class)
callback httpsResponse handles 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

Param Type Default Description
file file Must contain one file.
[ac] string "\"\"" The admin code of an upload. If you specify it, the file will be added to this upload.
[email] string "\"\"" 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
[description] string "\"\"" Must contain description of the upload
[password] string "\"\"" Must contain password of the upload(min 6 char)
[tags] string "\"\"" Must contain tags of the upload. If multiple tags, seperate them with comma (example : tags1,tags2)
[expire] string "\"\"" Must contain expiration date of the upload in the form of timestamp.
server string the server to upload the file in
callback httpsResponse handles 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

Param Type Description
err Error error of https request
body string | * body of https response

License

MIT © BDream