package
Trakt API v2 client
npm install trakt-apiGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Node.js client for the Trakt.tv API.
Work in progress!
$ npm i trakt-apivar Trakt = require('trakt-api');
var trakt = Trakt(API_KEY[, OPTIONS]);
// Promises...
trakt.show('manhattan', { extended : 'full' }).then(function(show) {
console.log('%j', show);
}).catch(function(err) {
console.warn('oh noes', err);
});
// ...or regular callbacks
trakt.show('manhattan', { extended : 'full' }, function(err, show) {
if (err) return console.warn('oh noes', err);
console.
var trakt = Trakt(API_KEY : String [, OPTIONS : Object]);API_KEY is the Client ID value listed on your application's page. You need to create a new application before you can use this API.
OPTIONS is an optional object that may contain the following properties:
extended : String // default "extended" level (default: 'min') logLevel : String // log level (default: 'info') poolSize : Number // HTTP request pool size (default: 5) timeout : Number // HTTP timeout in ms (default: 30000) ```
Most API methods are generated from endpoints.json, although not all are implemented yet (see below). API methods generally have required and optional arguments. Required arguments are enforced and will cause an error to be thrown if not defined.
Most API methods also accept an optional OPTIONS object. There's one valid option for now:
extended: use an extended information levelHowever, this option doesn't apply to all API methods. Refer to the Trakt API documentation.
If you don't like promises, or just prefer old school callbacks, pass a function as last argument. Otherwise, all methods return a promise. See the example above.
Please refer to the API documentation for more information on each method.
trakt.search(QUERY:String[, TYPE:String][, YEAR:Number][, CALLBACK])
trakt.searchAll(QUERY:String[, YEAR:Number][, CALLBACK])
trakt.searchShow(QUERY:String[, YEAR:Number][, CALLBACK])
trakt.searchMovie(QUERY:String[, YEAR:Number][, CALLBACK])
trakt.searchEpisode(QUERY:String[, YEAR:Number][, CALLBACK])
trakt.searchPerson(QUERY:String[, YEAR:Number][, CALLBACK])
trakt.calendarMyShowsNew([START_DATE][, DAYS][, OPTIONS][, CALLBACK])
trakt.calendarMyShowsPremieres([START_DATE][, DAYS][, OPTIONS][, CALLBACK])
trakt.calendarMyMovies([START_DATE][, DAYS][, OPTIONS][, CALLBACK])
trakt.calendarAllShows([START_DATE][, DAYS][, OPTIONS][, CALLBACK])
trakt.calendarAllShowsNews([START_DATE][, DAYS][, OPTIONS][, CALLBACK])
trakt.calendarAllShowsPremieres([START_DATE][, DAYS][, OPTIONS][, CALLBACK])