trakt.tv
Advanced tools
Comparing version 7.2.0 to 8.0.0
# Trakt.tv available methods | ||
This help doc was last generated for trakt.tv@7.2.0 on Mon Jul 15 2019 | ||
This help doc was last generated for trakt.tv@8.0.0 on Wed Feb 26 2020 | ||
@@ -118,3 +118,3 @@ ## How to read the table ? | ||
| trakt.shows.progress.watched() | required | id | hidden, specials, count_specials, last_activity | *none* | "full" | GET | api.trakt.tv/shows/**id**/progress/watched | | ||
| trakt.shows.people() | *none* | id | *none* | *none* | "full" | GET | api.trakt.tv/shows/**id**/people | | ||
| trakt.shows.people() | *none* | id | *none* | *none* | "full", "guest_stars" | GET | api.trakt.tv/shows/**id**/people | | ||
| trakt.shows.ratings() | *none* | id | *none* | *none* | *none* | GET | api.trakt.tv/shows/**id**/ratings | | ||
@@ -130,2 +130,3 @@ | trakt.shows.related() | *none* | id | *none* | paginated | "full" | GET | api.trakt.tv/shows/**id**/related | | ||
| trakt.seasons.lists() | *none* | id, season | type, sort | paginated | *none* | GET | api.trakt.tv/shows/**id**/seasons/**season**/lists | | ||
| trakt.seasons.people() | *none* | id, season | *none* | *none* | "guest_stars" | GET | api.trakt.tv/shows/**id**/seasons/**season**/people | | ||
| trakt.seasons.ratings() | *none* | id, season | *none* | *none* | *none* | GET | api.trakt.tv/shows/**id**/seasons/**season**/ratings | | ||
@@ -137,2 +138,3 @@ | trakt.seasons.watching() | *none* | id, season | *none* | *none* | "full" | GET | api.trakt.tv/shows/**id**/seasons/**season**/watching | | ||
| trakt.episodes.lists() | *none* | id, season, episode | type, sort | paginated | *none* | GET | api.trakt.tv/shows/**id**/seasons/**season**/episodes/**episode**/lists | | ||
| trakt.episodes.people() | *none* | id, season, episode | *none* | *none* | "guest_stars" | GET | api.trakt.tv/shows/**id**/seasons/**season**/episodes/**episode**/people | | ||
| trakt.episodes.ratings() | *none* | id, season, episode | *none* | *none* | *none* | GET | api.trakt.tv/shows/**id**/seasons/**season**/episodes/**episode**/ratings | | ||
@@ -149,6 +151,6 @@ | trakt.episodes.stats() | *none* | id, season, episode | *none* | *none* | *none* | GET | api.trakt.tv/shows/**id**/seasons/**season**/episodes/**episode**/stats | | ||
| trakt.sync.history.get() | required | *none* | type, id, start_at, end_at | paginated | "full" | GET | api.trakt.tv/sync/history | | ||
| trakt.sync.history.add() | required | *none* | movies, shows, episodes | *none* | *none* | POST | api.trakt.tv/sync/history | | ||
| trakt.sync.history.add() | required | *none* | movies, shows, seasons, episodes | *none* | *none* | POST | api.trakt.tv/sync/history | | ||
| trakt.sync.history.remove() | required | *none* | movies, shows, episodes, ids | *none* | *none* | POST | api.trakt.tv/sync/history/remove | | ||
| trakt.sync.ratings.get() | required | *none* | rating, type | *none* | "full" | GET | api.trakt.tv/sync/ratings | | ||
| trakt.sync.ratings.add() | required | *none* | movies, shows, episodes | *none* | *none* | POST | api.trakt.tv/sync/ratings | | ||
| trakt.sync.ratings.get() | required | *none* | rating, type | *optional* | "full" | GET | api.trakt.tv/sync/ratings | | ||
| trakt.sync.ratings.add() | required | *none* | movies, shows, seasons, episodes | *none* | *none* | POST | api.trakt.tv/sync/ratings | | ||
| trakt.sync.ratings.remove() | required | *none* | movies, shows, episodes | *none* | *none* | POST | api.trakt.tv/sync/ratings/remove | | ||
@@ -188,3 +190,3 @@ | trakt.sync.watchlist.get() | required | *none* | type | *optional* | "full" | GET | api.trakt.tv/sync/watchlist | | ||
| trakt.users.history() | *optional* | username | type, item_id, start_at, end_at | paginated | "full" | GET | api.trakt.tv/users/**username**/history | | ||
| trakt.users.ratings() | *optional* | username | rating, type | *none* | "full" | GET | api.trakt.tv/users/**username**/ratings | | ||
| trakt.users.ratings() | *optional* | username | rating, type | *optional* | "full" | GET | api.trakt.tv/users/**username**/ratings | | ||
| trakt.users.watchlist() | *optional* | username | type | *optional* | "full" | GET | api.trakt.tv/users/**username**/watchlist | | ||
@@ -191,0 +193,0 @@ | trakt.users.watching() | *optional* | username | *none* | *none* | *none* | GET | api.trakt.tv/users/**username**/watching | |
@@ -681,3 +681,3 @@ { | ||
"opts": { | ||
"extended": ["full"] | ||
"extended": ["full", "guest_stars"] | ||
}, | ||
@@ -765,2 +765,10 @@ "method": "GET", | ||
}, | ||
"/seasons/people": { | ||
"opts": { | ||
"extended": ["guest_stars"] | ||
}, | ||
"method": "GET", | ||
"url": "/shows/:id/seasons/:season/people", | ||
"optional": [] | ||
}, | ||
"/seasons/ratings": { | ||
@@ -810,2 +818,10 @@ "opts": {}, | ||
}, | ||
"/episodes/people": { | ||
"opts": { | ||
"extended": ["guest_stars"] | ||
}, | ||
"method": "GET", | ||
"url": "/shows/:id/seasons/:season/episodes/:episode/people", | ||
"optional": [] | ||
}, | ||
"/episodes/ratings": { | ||
@@ -920,2 +936,3 @@ "opts": {}, | ||
"shows": null, | ||
"seasons": null, | ||
"episodes": null | ||
@@ -942,2 +959,3 @@ }, | ||
"auth": true, | ||
"pagination": "optional", | ||
"extended": ["full"] | ||
@@ -958,2 +976,3 @@ }, | ||
"shows": null, | ||
"seasons": null, | ||
"episodes": null | ||
@@ -1311,2 +1330,3 @@ }, | ||
"auth": "optional", | ||
"pagination": "optional", | ||
"extended": ["full"] | ||
@@ -1313,0 +1333,0 @@ }, |
{ | ||
"name": "trakt.tv", | ||
"version": "7.2.0", | ||
"version": "8.0.0", | ||
"description": "Interact with Trakt.tv API in NodeJS", | ||
@@ -22,3 +22,3 @@ "keywords": [ | ||
"dependencies": { | ||
"got": "^9.6.0", | ||
"got": "^10.6.0", | ||
"sanitizer": "^0.1.3" | ||
@@ -25,0 +25,0 @@ }, |
29
trakt.js
@@ -86,3 +86,3 @@ 'use strict'; | ||
this._debug(req); | ||
return got(req.url, req).then(response => { | ||
return got(req).then(response => { | ||
const body = JSON.parse(response.body); | ||
@@ -107,11 +107,12 @@ | ||
'User-Agent': this._settings.useragent, | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
'Authorization' : `Bearer ${this._authentication.access_token}`, | ||
'trakt-api-version': '2', | ||
'trakt-api-key': this._settings.client_id | ||
'Content-Type': 'application/json' | ||
}, | ||
body: `token=[${this._authentication.access_token}]` | ||
body: JSON.stringify({ | ||
token: this._authentication.access_token, | ||
client_id: this._settings.client_id, | ||
client_secret: this._settings.client_secret | ||
}) | ||
}; | ||
this._debug(req); | ||
got(req.url, req); | ||
got(req); | ||
} | ||
@@ -132,3 +133,3 @@ | ||
this._debug(req); | ||
return got(req.url, req).then(response => this._sanitize(JSON.parse(response.body))).catch(error => { | ||
return got(req).then(response => this._sanitize(JSON.parse(response.body))).catch(error => { | ||
throw (error.response && error.response.statusCode == 401) ? Error(error.response.headers['www-authenticate']) : error; | ||
@@ -151,3 +152,3 @@ }); | ||
const name = queryParams[i].split('=')[0]; | ||
(params[name] || params[name] === 0) && queryParts.push(`${name}=${params[name]}`); | ||
(params[name] || params[name] === 0) && queryParts.push(`${name}=${encodeURIComponent(params[name])}`); | ||
} | ||
@@ -176,3 +177,3 @@ } | ||
for (let p in params) { | ||
filters.indexOf(p) !== -1 && queryParts.indexOf(`${p}=${params[p]}`) === -1 && queryParts.push(`${p}=${params[p]}`); | ||
filters.indexOf(p) !== -1 && queryParts.indexOf(`${p}=${encodeURIComponent(params[p])}`) === -1 && queryParts.push(`${p}=${encodeURIComponent(params[p])}`); | ||
} | ||
@@ -223,6 +224,10 @@ | ||
req.body = JSON.stringify(req.body); | ||
if (method.method === 'GET') { | ||
delete req.body; | ||
} else { | ||
req.body = JSON.stringify(req.body); | ||
} | ||
this._debug(req); | ||
return got(req.url, req).then(response => this._parseResponse(method, params, response)); | ||
return got(req).then(response => this._parseResponse(method, params, response)); | ||
} | ||
@@ -229,0 +234,0 @@ |
84191
1824
+ Added@sindresorhus/is@2.1.1(transitive)
+ Added@szmarczak/http-timer@4.0.6(transitive)
+ Added@types/cacheable-request@6.0.3(transitive)
+ Added@types/http-cache-semantics@4.0.4(transitive)
+ Added@types/keyv@3.1.4(transitive)
+ Added@types/node@20.14.2(transitive)
+ Added@types/responselike@1.0.3(transitive)
+ Addedcacheable-lookup@2.0.1(transitive)
+ Addedcacheable-request@7.0.4(transitive)
+ Addeddecompress-response@5.0.0(transitive)
+ Addeddefer-to-connect@2.0.1(transitive)
+ Addedgot@10.7.0(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedmimic-response@2.1.0(transitive)
+ Addednormalize-url@6.1.0(transitive)
+ Addedp-cancelable@2.1.1(transitive)
+ Addedp-event@4.2.0(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedp-timeout@3.2.0(transitive)
+ Addedresponselike@2.0.1(transitive)
+ Addedto-readable-stream@2.1.0(transitive)
+ Addedtype-fest@0.10.0(transitive)
+ Addedundici-types@5.26.5(transitive)
- Removed@sindresorhus/is@0.14.0(transitive)
- Removed@szmarczak/http-timer@1.1.2(transitive)
- Removedcacheable-request@6.1.0(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removeddefer-to-connect@1.1.3(transitive)
- Removedget-stream@4.1.0(transitive)
- Removedgot@9.6.0(transitive)
- Removedjson-buffer@3.0.0(transitive)
- Removedkeyv@3.1.0(transitive)
- Removedlowercase-keys@1.0.1(transitive)
- Removednormalize-url@4.5.1(transitive)
- Removedp-cancelable@1.1.0(transitive)
- Removedprepend-http@2.0.0(transitive)
- Removedresponselike@1.0.2(transitive)
- Removedto-readable-stream@1.0.0(transitive)
- Removedurl-parse-lax@3.0.0(transitive)
Updatedgot@^10.6.0