GithubHelp home page GithubHelp logo

node-trakt's Introduction

node-trakt

node-trakt is a wrapper for the trakt.tv API. It supports:

Install

npm install node-trakt

Example

var trakt = require("node-trakt")("api-key");

// Get movie information for The Lone Ranger (2013)
trakt.movieSummary({ title: "tt1210819" }, function(err, movie){
    console.log(movie);
});

Methods

apiMethod([params,] callback(err, data))

  • params (Optional) An object containing the parameters for the API call. Arrays will be converted/joined to strings if the method is a GET method for convenience.
  • callback Called after the request completed. If an error ocurred err will contain the Error object, otherwise it will be null. The parsed JSON data is returned in data.

API methods are generated by joining the parts of the path, uppercasing every part. (e.g. movie/summary becomes movieSummary)
If a required parameter is omitted, no request is made to the server and instead an error is returned.
This function will pass an auth header for every request if user credentials are provided.

Check out the trakt.tv API docs for documentation on all methods and their parameters.

login(username, password, callback(loggedIn))

  • username
  • password Can be either the password in plain text or the SHA1 encoded password.
  • callback Will be called after testing the credentials with loggedIn being the succes value of the login.

Sets the username and password in an options object so they can later be used in API requests. Tests if the credentials are valid using API method account/test.

isLoggedIn([confirmed])

  • confirmed (Default = true) Whether the login credentials should be confirmed for this function to regard the user logged in. If this is set to false, the function will return true if credentials were provided using login().
  • returns True if the user is logged in, false if not.

Use this to check if the user is logged in.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.