Skip to content

plexinc/moviedb-api

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MovieDB API

throttled hackable themoviedb api for node

Features:

  • smart queued / throttled requests
  • small, hackable module
  • optionally consume all api endpoints as methods

How to install

npm install moviedb-api

How to use

var Api = require('./index')

// set environment in bash: `export TMDB_API_KEY=yourKeyHere`
var apiKey = process.env.TMDB_API_KEY

// Promise
var api
api = new Api({
  consume: false,
  apiKey: apiKey
})
api.request('/movie/{id}', 'GET', {id: 293660})
.then(function(response) {
  console.log(response)
})

// Consume
var api
api = new Api({
  consume: true,
  apiKey: apiKey
})
api.movie({id: 205584})
.then(function(response) {
  console.log(response)
})

// Consume & Callback
var api
api = new Api({
  consume: true,
  apiKey: apiKey
})
api.movie({id: '76341'}, function(err, response) {
  console.log(response)
})

Consume or Specify Methods

Setting consume: true in your options will iterate through apib/endpoints.json and attach each endpoint as an instance method. If your use case needs to economise cpu time or ram then you're better off using the request method and specifying the endpoint yourself.

See apib/endpoints.json for a full list of endpoints and method names. You can place any url from there into a call to request.

License

MIT

About

Throttled hackable themoviedb api for node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%