{"_id":"@dashersw/trakt.tv","_rev":"4-6b7f79c0cfba698aeece479bd3d1f811","name":"@dashersw/trakt.tv","description":"Interact with Trakt.tv API in NodeJS","dist-tags":{"latest":"5.0.1"},"versions":{"1.4.3":{"name":"@dashersw/trakt.tv","version":"1.4.3","description":"Node.js Trakt.tv api wrapper","main":"index.js","repository":{"type":"git","url":"git+https://github.com/vankasteelj/trakt.tv.git"},"keywords":["trakt.tv","trakt","tv","api","wrapper"],"contributors":{"name":"Patrick Engström"},"license":"MIT","bugs":{"url":"https://github.com/vankasteelj/trakt.tv/issues"},"dependencies":{"got":"5.x.x","object-assign":"^4.x.x","pinkie-promise":"2.x.x","sanitizer":"0.x.x"},"gitHead":"248d0e41127845a4e76f56805b753c46171f775e","homepage":"https://github.com/vankasteelj/trakt.tv#readme","_id":"@dashersw/trakt.tv@1.4.3","scripts":{},"_shasum":"6add82cd95d8c238ec0de86e9d3223985eaedf1f","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"dashersw","email":"armagan@amcalar.com"},"dist":{"shasum":"6add82cd95d8c238ec0de86e9d3223985eaedf1f","tarball":"https://registry.npmjs.org/@dashersw/trakt.tv/-/trakt.tv-1.4.3.tgz","integrity":"sha512-Gj0YjIbI2of8ssYeS+JzyojfYswn/I3tZY5CWvmZ/NgqqqeN8dXZC7woCnVnmwMX1RRxQqUggx+hzFo1LBNWvQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAJfHa16/qJiP+ex9t5OlW6ZoDG4Hs4N8UD5sZe0OldAAiAlxW+TtY9LPnnoRQM0NGv0pYC25vVc+VwTIn+2tp+8sA=="}]},"maintainers":[{"name":"dashersw","email":"armagan@amcalar.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/trakt.tv-1.4.3.tgz_1470098666754_0.18547389097511768"}},"5.0.1":{"name":"@dashersw/trakt.tv","version":"5.0.1","description":"Interact with Trakt.tv API in NodeJS","keywords":["trakt","api","wrapper","node"],"main":"trakt.js","author":{"name":"Jean van Kasteel"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/vankasteelj/trakt.tv.git"},"bugs":{"url":"https://github.com/vankasteelj/trakt.tv/issues"},"dependencies":{"got":"6.x.x","sanitizer":"0.x.x"},"gitHead":"9f8b85ea2156c7a52b22f23f106c404857f8ec8e","homepage":"https://github.com/vankasteelj/trakt.tv#readme","_id":"@dashersw/trakt.tv@5.0.1","scripts":{},"_shasum":"4aff9898c5a6af1d670226ae54f2fa63f7769bb5","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"dashersw","email":"armagan@amcalar.com"},"dist":{"shasum":"4aff9898c5a6af1d670226ae54f2fa63f7769bb5","tarball":"https://registry.npmjs.org/@dashersw/trakt.tv/-/trakt.tv-5.0.1.tgz","integrity":"sha512-eUjqaZNRivhOYTC3+mgpVQLIN+rlaFkhoFGjOnqs6+A+mbDLgxkA+tAvYndOtiodV+PV0JUBVWtYljzgl9k3LA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmL7NTpGzSE45g8iQNnLay/8VaVXr7d3BdB9fD5nAAfgIgQnHpIGBSqAenkzaj6UvGIKxomXlLl4xR5iyIkhyTmLE="}]},"maintainers":[{"name":"dashersw","email":"armagan@amcalar.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/trakt.tv-5.0.1.tgz_1492642329404_0.9771884004585445"}}},"readme":"# trakt.tv\n**Trakt.tv API wrapper for Node.js, featuring:**\n\n- [All Trakt.tv API v2 methods](https://github.com/vankasteelj/trakt.tv/wiki/Supported-methods)\n- Promises\n- Forget JSON, use Objects, Arrays and Strings directly\n- Enhanced protection against: CSRF (session riding) and XSS (content spoofing) attacks, using Crypto and Sanitizer\n- [Plugin extension](https://github.com/vankasteelj/trakt.tv/wiki/Available-plugins)\n\n*For more information about Trakt.tv API, read http://docs.trakt.apiary.io/*\n\n## Example usage\n\n#### Setup\n\n    npm install trakt.tv\n\n#### Initialize\n```js\nconst Trakt = require('trakt.tv');\n\nconst trakt = new Trakt({\n  client_id: <the_client_id>,\n  client_secret: <the_client_secret>,\n  redirect_uri: null,   // defaults to 'urn:ietf:wg:oauth:2.0:oob'\n  api_url: null         // defaults to 'https://api.trakt.tv'\n});\n```\n\n#### Generate Auth URL\n```js\nconst traktAuthUrl = trakt.get_url();\n```\n\n#### Verify code (and optionally state) from returned auth\n```js\ntrakt.exchange_code('code', 'csrf token (state)').then(result => {\n    // contains tokens & session information\n    // API can now be used with authorized requests\n});\n```\n\n#### Alternate OAUTH \"device\" method\n```js\ntrakt.get_codes().then(poll => {\n    // poll.verification_url: url to visit in a browser\n    // poll.user_code: the code the user needs to enter on trakt\n\n    // verify if app was authorized\n    return trakt.poll_access(poll);\n}).catch(error => {\n    // error.message == 'Expired' will be thrown if timeout is reached\n});\n```\n\n#### Refresh token\n```js\ntrakt.refresh_token().then(results => {\n    // results are auto-injected in the main module cache\n});\n```\n\n#### Storing token over sessions\n```js\n// get token, store it safely.\nconst token = trakt.export_token();\n\n// injects back stored token on new session.\ntrakt.import_token(token).then(newTokens => {\n    // Contains token, refreshed if needed (store it back)\n});\n```\n\n#### Actual API requests\nSee methods in [methods.json](https://github.com/vankasteelj/trakt.tv/blob/master/methods.json) or [wiki](https://github.com/vankasteelj/trakt.tv/wiki/Supported-methods).\n\n```js\ntrakt.calendars.all.shows({\n    start_date: '2015-11-13',\n    days: '7',\n    extended: 'full'\n}).then(shows => {\n    // Contains Object{} response from API (show data)\n});\n```\n\n```js\ntrakt.search.text({\n    query: 'tron',\n    type: 'movie,person'\n}).then(response => {\n    // Contains Array[] response from API (search data)\n});\n```\n\n```js\ntrakt.search.id({\n    id_type: 'imdb',\n    id: 'tt0084827'\n}).then(response => {\n    // Contains Array[] response from API (imdb data)\n});\n```\n\n#### Using pagination\nYou can extend your calls with `pagination: true` to get the extra pagination info from headers.\n\n```js\ntrakt.movies.popular({\n    pagination: true\n}).then(movies => {\n    /**\n    movies = Object {\n        data: [<actual data from API>],\n        pagination: {\n            item-count: \"80349\",\n            limit: \"10\",\n            page: \"1\",\n            page-count: \"8035\"\n        }\n    }\n    **/\n});\n```\n\nNote: _this will contain `data` and `pagination` for all calls, even if no pagination is available. it's typically for really advanced use only_\n\n#### Load plugins\nWhen calling `new Trakt()`, include desired plugins in an object (must be installed from npm):\n\n```js\nconst trakt = new Trakt({\n    client_id: <the_client_id>,\n    client_secret: <the_client_secret>,\n    plugins: {  // load plugins\n        images: require('trakt.tv-images')\n    }\n    options: {  // pass options to plugins\n        images: {\n            smallerImages: true\n        }\n    }\n});\n```\n\nThe plugin can be accessed with the key you specify. For example `trakt.images.get()`.\n\n#### Write plugins\nSee the [wiki page](https://github.com/vankasteelj/trakt.tv/wiki/Write-plugins-for-trakt.tv).\n\n#### Notes\n- You can use 'me' as username if the user is authenticated.\n- Timestamps (such as token _expires_ property) are Epoch in milliseconds.\n\n## LICENSE\n\nThe MIT License (MIT) - author: Jean van Kasteel <vankasteelj@gmail.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.","maintainers":[{"name":"dashersw","email":"armagan@amcalar.com"}],"time":{"modified":"2022-06-12T16:52:45.570Z","created":"2016-08-02T00:44:27.616Z","1.4.3":"2016-08-02T00:44:27.616Z","5.0.1":"2017-04-19T22:52:10.169Z"},"homepage":"https://github.com/vankasteelj/trakt.tv#readme","keywords":["trakt","api","wrapper","node"],"repository":{"type":"git","url":"git+https://github.com/vankasteelj/trakt.tv.git"},"bugs":{"url":"https://github.com/vankasteelj/trakt.tv/issues"},"license":"MIT","readmeFilename":"README.md","author":{"name":"Jean van Kasteel"}}