0.1.13 • Published 10 years ago

dailymotion-sdk v0.1.13

Weekly downloads
8
License
Apache 2.0
Repository
github
Last release
10 years ago

dailymotion-sdk-node

Node.js SDK for Dailymotion API

Examples

Refer to the examples folder to get a setup example

API


setScope(scope)

Sets access scope

Parameters

scope: array | function | string, Permission scopes. Can be array, function or string (separated by spaces)

setCredentials(grant_type, credentials)

Sets credentials

Parameters

grant_type: string, Can be either 'client_credentials', 'authorization_code' or 'password'

credentials: object, Credentials in the following structure

objectpassword:

  • string username
  • string password

object authorization_code:

  • string access_token
  • string refresh_token

OR

  • string redirect_uri
  • string code

object client_credentials: leave it empty

createToken(next)

Creates a token when you have 'password' grant type

Parameters

next: function, Callback for when the token is indeed refreshed. Can be called with 1 param if error

refreshToken(next)

Refreshes an expired access_token with the help of a refresh_token

Parameters

next: function, Callback for when the token is indeed refreshed. Can be called with 1 param if error

api(verb, endpoint, data, callback)

Authenticated API Request

data and callback arguments are swappable.

Parameters

verb: string, HTTP Verb to be used

endpoint: string, Endpoint path

data: object, Data to send to given endpoint

callback: function, Function called when request is done. Callback params are:

  • Error err - It should be null most of the time
  • Request r - Request object for better control
  • Object res - Parsed response body

The following methods are used to facilitate api calls

get(enpoint, data, callback)

post(enpoint, data, callback)

put(enpoint, data, callback)

delete(enpoint, data, callback)

patch(enpoint, callback)

head(enpoint, callback)


upload(options)

Uploads a video using user's auth data

Parameters

options: object, Contains the following fields :

  • string filepath - System path to video
  • object meta - Metadata for the new video (such as title, channel, tags, etc)
  • OPTIONAL function progress - Progress callback for upload progression
  • OPTIONAL function done - Called when upload is finished with new video ID and other data.

Bitdeli Badge

0.1.13

10 years ago

0.1.12

10 years ago

0.1.11

11 years ago

0.1.10

11 years ago

0.1.9

11 years ago

0.1.8

11 years ago

0.1.7

11 years ago

0.1.6

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago