@api-wrappers/tmdb-wrapper 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +395 -0
- package/dist/index.cjs +2046 -0
- package/dist/index.d.cts +2981 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +2981 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2028 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +72 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2046 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/@types/endpoints/configuration.ts
|
|
3
|
+
let BackdropSizes = /* @__PURE__ */ function(BackdropSizes$1) {
|
|
4
|
+
BackdropSizes$1["W300"] = "w300";
|
|
5
|
+
BackdropSizes$1["W500"] = "w500";
|
|
6
|
+
BackdropSizes$1["W780"] = "w780";
|
|
7
|
+
BackdropSizes$1["W1280"] = "w1280";
|
|
8
|
+
BackdropSizes$1["ORIGINAL"] = "original";
|
|
9
|
+
return BackdropSizes$1;
|
|
10
|
+
}({});
|
|
11
|
+
let LogoSizes = /* @__PURE__ */ function(LogoSizes$1) {
|
|
12
|
+
LogoSizes$1["W45"] = "w45";
|
|
13
|
+
LogoSizes$1["W92"] = "w92";
|
|
14
|
+
LogoSizes$1["W154"] = "w154";
|
|
15
|
+
LogoSizes$1["W185"] = "w185";
|
|
16
|
+
LogoSizes$1["W300"] = "w300";
|
|
17
|
+
LogoSizes$1["W500"] = "w500";
|
|
18
|
+
LogoSizes$1["ORIGINAL"] = "original";
|
|
19
|
+
return LogoSizes$1;
|
|
20
|
+
}({});
|
|
21
|
+
let PosterSizes = /* @__PURE__ */ function(PosterSizes$1) {
|
|
22
|
+
PosterSizes$1["W92"] = "w92";
|
|
23
|
+
PosterSizes$1["W154"] = "w154";
|
|
24
|
+
PosterSizes$1["W185"] = "w185";
|
|
25
|
+
PosterSizes$1["W300"] = "w300";
|
|
26
|
+
PosterSizes$1["W500"] = "w500";
|
|
27
|
+
PosterSizes$1["W780"] = "w780";
|
|
28
|
+
PosterSizes$1["ORIGINAL"] = "original";
|
|
29
|
+
return PosterSizes$1;
|
|
30
|
+
}({});
|
|
31
|
+
let ProfileSizes = /* @__PURE__ */ function(ProfileSizes$1) {
|
|
32
|
+
ProfileSizes$1["W45"] = "w45";
|
|
33
|
+
ProfileSizes$1["W185"] = "w185";
|
|
34
|
+
ProfileSizes$1["W632"] = "w632";
|
|
35
|
+
ProfileSizes$1["ORIGINAL"] = "original";
|
|
36
|
+
return ProfileSizes$1;
|
|
37
|
+
}({});
|
|
38
|
+
let StillSizes = /* @__PURE__ */ function(StillSizes$1) {
|
|
39
|
+
StillSizes$1["W92"] = "w92";
|
|
40
|
+
StillSizes$1["W185"] = "w185";
|
|
41
|
+
StillSizes$1["W300"] = "w300";
|
|
42
|
+
StillSizes$1["ORIGINAL"] = "original";
|
|
43
|
+
return StillSizes$1;
|
|
44
|
+
}({});
|
|
45
|
+
let ChangeKeys = /* @__PURE__ */ function(ChangeKeys$1) {
|
|
46
|
+
ChangeKeys$1["ADULT"] = "adult";
|
|
47
|
+
ChangeKeys$1["AIR_DATE"] = "air_date";
|
|
48
|
+
ChangeKeys$1["ALSO_KNOWN_AS"] = "also_known_as";
|
|
49
|
+
ChangeKeys$1["ALTERNATIVE_TITLES"] = "alternative_titles";
|
|
50
|
+
ChangeKeys$1["BIOGRAPHY"] = "biography";
|
|
51
|
+
ChangeKeys$1["BIRTHDAY"] = "birthday";
|
|
52
|
+
ChangeKeys$1["BUDGET"] = "budget";
|
|
53
|
+
ChangeKeys$1["CAST"] = "cast";
|
|
54
|
+
ChangeKeys$1["CERTIFICATIONS"] = "certifications";
|
|
55
|
+
ChangeKeys$1["CHARACTER_NAMES"] = "character_names";
|
|
56
|
+
ChangeKeys$1["CREATED_BY"] = "created_by";
|
|
57
|
+
ChangeKeys$1["CREW"] = "crew";
|
|
58
|
+
ChangeKeys$1["DEATHDAY"] = "deathday";
|
|
59
|
+
ChangeKeys$1["EPISODE"] = "episode";
|
|
60
|
+
ChangeKeys$1["EPISODE_NUMBER"] = "episode_number";
|
|
61
|
+
ChangeKeys$1["EPISODE_RUN_TIME"] = "episode_run_time";
|
|
62
|
+
ChangeKeys$1["FREEBASE_ID"] = "freebase_id";
|
|
63
|
+
ChangeKeys$1["FREEBASE_MID"] = "freebase_mid";
|
|
64
|
+
ChangeKeys$1["GENERAL"] = "general";
|
|
65
|
+
ChangeKeys$1["GENRES"] = "genres";
|
|
66
|
+
ChangeKeys$1["GUEST_STARS"] = "guest_stars";
|
|
67
|
+
ChangeKeys$1["HOMEPAGE"] = "homepage";
|
|
68
|
+
ChangeKeys$1["IMAGES"] = "images";
|
|
69
|
+
ChangeKeys$1["IMDB_ID"] = "imdb_id";
|
|
70
|
+
ChangeKeys$1["LANGUAGES"] = "languages";
|
|
71
|
+
ChangeKeys$1["NAME"] = "name";
|
|
72
|
+
ChangeKeys$1["NETWORK"] = "network";
|
|
73
|
+
ChangeKeys$1["ORIGIN_COUNTRY"] = "origin_country";
|
|
74
|
+
ChangeKeys$1["ORIGINAL_NAME"] = "original_name";
|
|
75
|
+
ChangeKeys$1["ORIGINAL_TITLE"] = "original_title";
|
|
76
|
+
ChangeKeys$1["OVERVIEW"] = "overview";
|
|
77
|
+
ChangeKeys$1["PARTS"] = "parts";
|
|
78
|
+
ChangeKeys$1["PLACE_OF_BIRTH"] = "place_of_birth";
|
|
79
|
+
ChangeKeys$1["PLOT_KEYWORDS"] = "plot_keywords";
|
|
80
|
+
ChangeKeys$1["PRODUCTION_CODE"] = "production_code";
|
|
81
|
+
ChangeKeys$1["PRODUCTION_COMPANIES"] = "production_companies";
|
|
82
|
+
ChangeKeys$1["PRODUCTION_COUNTRIES"] = "production_countries";
|
|
83
|
+
ChangeKeys$1["RELEASES"] = "releases";
|
|
84
|
+
ChangeKeys$1["REVENUE"] = "revenue";
|
|
85
|
+
ChangeKeys$1["RUNTIME"] = "runtime";
|
|
86
|
+
ChangeKeys$1["SEASON"] = "season";
|
|
87
|
+
ChangeKeys$1["SEASON_NUMBER"] = "season_number";
|
|
88
|
+
ChangeKeys$1["SEASON_REGULAR"] = "season_regular";
|
|
89
|
+
ChangeKeys$1["SPOKEN_LANGUAGES"] = "spoken_languages";
|
|
90
|
+
ChangeKeys$1["STATUS"] = "status";
|
|
91
|
+
ChangeKeys$1["TAGLINE"] = "tagline";
|
|
92
|
+
ChangeKeys$1["TITLE"] = "title";
|
|
93
|
+
ChangeKeys$1["TRANSLATIONS"] = "translations";
|
|
94
|
+
ChangeKeys$1["TVDB_ID"] = "tvdb_id";
|
|
95
|
+
ChangeKeys$1["TVRAGE_ID"] = "tvrage_id";
|
|
96
|
+
ChangeKeys$1["TYPE"] = "type";
|
|
97
|
+
ChangeKeys$1["VIDEO"] = "video";
|
|
98
|
+
ChangeKeys$1["VIDEOS"] = "videos";
|
|
99
|
+
return ChangeKeys$1;
|
|
100
|
+
}({});
|
|
101
|
+
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/@types/endpoints/movies.ts
|
|
104
|
+
let ReleaseDateType = /* @__PURE__ */ function(ReleaseDateType$1) {
|
|
105
|
+
ReleaseDateType$1[ReleaseDateType$1["Premiere"] = 1] = "Premiere";
|
|
106
|
+
ReleaseDateType$1[ReleaseDateType$1["Theatrical (limited)"] = 2] = "Theatrical (limited)";
|
|
107
|
+
ReleaseDateType$1[ReleaseDateType$1["Theatrical"] = 3] = "Theatrical";
|
|
108
|
+
ReleaseDateType$1[ReleaseDateType$1["Digital"] = 4] = "Digital";
|
|
109
|
+
ReleaseDateType$1[ReleaseDateType$1["Physical"] = 5] = "Physical";
|
|
110
|
+
ReleaseDateType$1[ReleaseDateType$1["TV"] = 6] = "TV";
|
|
111
|
+
return ReleaseDateType$1;
|
|
112
|
+
}({});
|
|
113
|
+
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/utils/api.ts
|
|
116
|
+
const BASE_URL_V3 = "https://api.themoviedb.org/3";
|
|
117
|
+
var TMDBError = class extends Error {
|
|
118
|
+
constructor(message, status, url, payload) {
|
|
119
|
+
super(message);
|
|
120
|
+
this.status = status;
|
|
121
|
+
this.url = url;
|
|
122
|
+
this.payload = payload;
|
|
123
|
+
this.name = "TMDBError";
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const parseOptions = (options) => {
|
|
127
|
+
if (!options) return "";
|
|
128
|
+
const entries = [];
|
|
129
|
+
for (const [key, value] of Object.entries(options)) {
|
|
130
|
+
if (value === void 0 || value === null) continue;
|
|
131
|
+
if (Array.isArray(value)) for (const item of value) {
|
|
132
|
+
if (item === void 0 || item === null) continue;
|
|
133
|
+
entries.push([key, String(item)]);
|
|
134
|
+
}
|
|
135
|
+
else entries.push([key, String(value)]);
|
|
136
|
+
}
|
|
137
|
+
return new URLSearchParams(entries).toString();
|
|
138
|
+
};
|
|
139
|
+
const csv = (values) => {
|
|
140
|
+
if (!values) return void 0;
|
|
141
|
+
const normalized = values.filter((value) => value !== void 0 && value !== null).map(String);
|
|
142
|
+
return normalized.length > 0 ? normalized.join(",") : void 0;
|
|
143
|
+
};
|
|
144
|
+
const withQuery = (query, config) => ({
|
|
145
|
+
...config,
|
|
146
|
+
query
|
|
147
|
+
});
|
|
148
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
149
|
+
const shouldRetry = (status) => status === 429 || status === 502 || status === 503 || status === 504;
|
|
150
|
+
const readRetryAfterMs = (res) => {
|
|
151
|
+
const raw = res.headers.get("retry-after");
|
|
152
|
+
if (!raw) return void 0;
|
|
153
|
+
const asSeconds = Number(raw);
|
|
154
|
+
if (Number.isFinite(asSeconds)) return Math.max(0, asSeconds * 1e3);
|
|
155
|
+
const asDate = Date.parse(raw);
|
|
156
|
+
if (!Number.isNaN(asDate)) return Math.max(0, asDate - Date.now());
|
|
157
|
+
return void 0;
|
|
158
|
+
};
|
|
159
|
+
var API = class {
|
|
160
|
+
apiKey;
|
|
161
|
+
accessToken;
|
|
162
|
+
constructor(auth) {
|
|
163
|
+
if (typeof auth === "string") this.accessToken = auth;
|
|
164
|
+
else {
|
|
165
|
+
this.apiKey = auth.apiKey;
|
|
166
|
+
this.accessToken = auth.accessToken;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async get(path, opts = {}) {
|
|
170
|
+
if (!this.apiKey && !this.accessToken) throw new TMDBError("No TMDB authentication provided", 0, `${BASE_URL_V3}${path}`);
|
|
171
|
+
const query = {
|
|
172
|
+
...opts.query ? opts.query : {},
|
|
173
|
+
...this.apiKey ? { api_key: this.apiKey } : {}
|
|
174
|
+
};
|
|
175
|
+
const qs = parseOptions(query);
|
|
176
|
+
const url = `${BASE_URL_V3}${path}${qs ? `?${qs}` : ""}`;
|
|
177
|
+
const retries = opts.retries ?? 2;
|
|
178
|
+
const retryDelayMs = opts.retryDelayMs ?? 300;
|
|
179
|
+
const timeoutMs = opts.timeoutMs ?? 3e4;
|
|
180
|
+
const controller = new AbortController();
|
|
181
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
182
|
+
const abortFromSignal = () => controller.abort();
|
|
183
|
+
if (opts.signal) if (opts.signal.aborted) controller.abort();
|
|
184
|
+
else opts.signal.addEventListener("abort", abortFromSignal, { once: true });
|
|
185
|
+
try {
|
|
186
|
+
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
187
|
+
const res = await fetch(url, {
|
|
188
|
+
method: "GET",
|
|
189
|
+
signal: controller.signal,
|
|
190
|
+
headers: {
|
|
191
|
+
...this.accessToken ? { Authorization: `Bearer ${this.accessToken}` } : {},
|
|
192
|
+
Accept: "application/json"
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
if (res.ok) return await res.json();
|
|
196
|
+
let payload;
|
|
197
|
+
let message = `${res.status} ${res.statusText}`;
|
|
198
|
+
try {
|
|
199
|
+
payload = await res.json();
|
|
200
|
+
if (payload && typeof payload === "object" && "status_message" in payload) message = String(payload.status_message);
|
|
201
|
+
} catch {
|
|
202
|
+
try {
|
|
203
|
+
payload = await res.text();
|
|
204
|
+
} catch {}
|
|
205
|
+
}
|
|
206
|
+
if (attempt < retries && shouldRetry(res.status)) {
|
|
207
|
+
const retryAfter = readRetryAfterMs(res);
|
|
208
|
+
const delay = retryAfter ?? retryDelayMs * 2 ** attempt;
|
|
209
|
+
await sleep(delay);
|
|
210
|
+
continue;
|
|
211
|
+
}
|
|
212
|
+
throw new TMDBError(message, res.status, url, payload);
|
|
213
|
+
}
|
|
214
|
+
throw new TMDBError("Request failed", 0, url);
|
|
215
|
+
} finally {
|
|
216
|
+
clearTimeout(timeout);
|
|
217
|
+
if (opts.signal) opts.signal.removeEventListener("abort", abortFromSignal);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
//#endregion
|
|
223
|
+
//#region src/utils/getimagePath.ts
|
|
224
|
+
const TMDB_IMAGE_BASE_URL = "https://image.tmdb.org/t/p/";
|
|
225
|
+
const ImageSizes = {
|
|
226
|
+
ORIGINAL: "original",
|
|
227
|
+
W500: "w500",
|
|
228
|
+
W300: "w300",
|
|
229
|
+
W185: "w185",
|
|
230
|
+
W92: "w92",
|
|
231
|
+
H632: "h632"
|
|
232
|
+
};
|
|
233
|
+
const ImageFormats = {
|
|
234
|
+
JPG: "jpg",
|
|
235
|
+
PNG: "png",
|
|
236
|
+
SVG: "svg"
|
|
237
|
+
};
|
|
238
|
+
const isAbsoluteUrl = (value) => /^https?:\/\//i.test(value);
|
|
239
|
+
const normalizeBaseUrl = (baseUrl) => baseUrl.endsWith("/") ? baseUrl : `${baseUrl}/`;
|
|
240
|
+
const normalizeSize = (size) => size.replace(/^\/+|\/+$/g, "");
|
|
241
|
+
const normalizePath = (path) => path.startsWith("/") ? path : `/${path}`;
|
|
242
|
+
const setExtension = (path, format) => {
|
|
243
|
+
const lastSlash = path.lastIndexOf("/");
|
|
244
|
+
const lastDot = path.lastIndexOf(".");
|
|
245
|
+
const hasExt = lastDot > lastSlash;
|
|
246
|
+
if (!hasExt) return `${path}.${format}`;
|
|
247
|
+
return `${path.slice(0, lastDot + 1)}${format}`;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* Constructs a TMDB image URL.
|
|
251
|
+
*
|
|
252
|
+
* - Keeps paths as-is unless `format` is provided (then it replaces/appends
|
|
253
|
+
* the extension safely using the last dot after the last slash).
|
|
254
|
+
* - Handles leading/trailing slashes robustly.
|
|
255
|
+
* - If `imagePath` is already an absolute URL, it is returned unchanged.
|
|
256
|
+
*/
|
|
257
|
+
const getFullImagePath = (baseUrl, fileSize, imagePath, format) => {
|
|
258
|
+
if (!imagePath) return "";
|
|
259
|
+
if (isAbsoluteUrl(imagePath)) return imagePath;
|
|
260
|
+
const base = normalizeBaseUrl(baseUrl);
|
|
261
|
+
const size = normalizeSize(fileSize);
|
|
262
|
+
let path = normalizePath(imagePath);
|
|
263
|
+
if (format) path = setExtension(path, format);
|
|
264
|
+
return `${base}${size}${path}`;
|
|
265
|
+
};
|
|
266
|
+
/**
|
|
267
|
+
* Convenience helper for TMDB `Image` objects.
|
|
268
|
+
*/
|
|
269
|
+
const formImage = (image, fileSize, format) => {
|
|
270
|
+
const path = image?.file_path;
|
|
271
|
+
if (!path) return void 0;
|
|
272
|
+
return getFullImagePath(TMDB_IMAGE_BASE_URL, fileSize, path, format);
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/@types/models/baseEndpoint.ts
|
|
277
|
+
/**
|
|
278
|
+
* Base class for all TMDB API endpoints.
|
|
279
|
+
*
|
|
280
|
+
* Provides a configured {@link API} client instance to subclasses.
|
|
281
|
+
*/
|
|
282
|
+
var BaseEndpoint = class {
|
|
283
|
+
/**
|
|
284
|
+
* Low-level HTTP client wrapper used by all endpoints.
|
|
285
|
+
*/
|
|
286
|
+
api;
|
|
287
|
+
/**
|
|
288
|
+
* Create a new endpoint instance.
|
|
289
|
+
*
|
|
290
|
+
* @param {TokenType} auth - Authentication information.
|
|
291
|
+
* - If a string: treated as a v4 API Read Access Token (Bearer token).
|
|
292
|
+
* - If an object: can include an API key and/or access token.
|
|
293
|
+
*/
|
|
294
|
+
constructor(auth) {
|
|
295
|
+
this.auth = auth;
|
|
296
|
+
this.api = new API(auth);
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
//#endregion
|
|
301
|
+
//#region src/endpoints/account.ts
|
|
302
|
+
/**
|
|
303
|
+
* Represents an endpoint for retrieving account details.
|
|
304
|
+
*
|
|
305
|
+
* TMDB v3 reference:
|
|
306
|
+
* - GET /account/{account_id}
|
|
307
|
+
*
|
|
308
|
+
* Note:
|
|
309
|
+
* TMDB does not expose a generic "GET /account" for account details. You must
|
|
310
|
+
* provide an `account_id`. Most apps obtain it from an auth flow and then cache
|
|
311
|
+
* it for subsequent requests.
|
|
312
|
+
*/
|
|
313
|
+
var AccountEndpoint = class extends BaseEndpoint {
|
|
314
|
+
/**
|
|
315
|
+
* Constructs a new AccountEndpoint instance.
|
|
316
|
+
*
|
|
317
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
318
|
+
*/
|
|
319
|
+
constructor(access_token) {
|
|
320
|
+
super(access_token);
|
|
321
|
+
this.access_token = access_token;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Retrieves account details asynchronously.
|
|
325
|
+
*
|
|
326
|
+
* TMDB: GET /account/{account_id}
|
|
327
|
+
*
|
|
328
|
+
* @param {number} accountId - The TMDB account ID.
|
|
329
|
+
* @returns {Promise<AccountDetails>} A Promise that resolves with the account details.
|
|
330
|
+
*/
|
|
331
|
+
details(accountId) {
|
|
332
|
+
return this.api.get(`/account/${accountId}`);
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
//#endregion
|
|
337
|
+
//#region src/endpoints/certification.ts
|
|
338
|
+
/**
|
|
339
|
+
* Represents an endpoint for retrieving certifications for movies and TV shows.
|
|
340
|
+
*
|
|
341
|
+
* TMDB v3 reference:
|
|
342
|
+
* - GET /certification/movie/list
|
|
343
|
+
* - GET /certification/tv/list
|
|
344
|
+
*/
|
|
345
|
+
var CertificationEndpoint = class extends BaseEndpoint {
|
|
346
|
+
/**
|
|
347
|
+
* Constructs a new CertificationEndpoint instance.
|
|
348
|
+
*
|
|
349
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
350
|
+
*/
|
|
351
|
+
constructor(access_token) {
|
|
352
|
+
super(access_token);
|
|
353
|
+
this.access_token = access_token;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Retrieves certifications for movies asynchronously.
|
|
357
|
+
*
|
|
358
|
+
* TMDB: GET /certification/movie/list
|
|
359
|
+
*
|
|
360
|
+
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for movies.
|
|
361
|
+
*/
|
|
362
|
+
movies() {
|
|
363
|
+
return this.api.get("/certification/movie/list");
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Retrieves certifications for TV shows asynchronously.
|
|
367
|
+
*
|
|
368
|
+
* TMDB: GET /certification/tv/list
|
|
369
|
+
*
|
|
370
|
+
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for TV shows.
|
|
371
|
+
*/
|
|
372
|
+
tv() {
|
|
373
|
+
return this.api.get("/certification/tv/list");
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
//#endregion
|
|
378
|
+
//#region src/endpoints/changes.ts
|
|
379
|
+
/**
|
|
380
|
+
* Represents an endpoint for retrieving changes in movies, TV shows, and persons.
|
|
381
|
+
*
|
|
382
|
+
* TMDB v3 reference:
|
|
383
|
+
* - GET /movie/changes
|
|
384
|
+
* - GET /tv/changes
|
|
385
|
+
* - GET /person/changes
|
|
386
|
+
*/
|
|
387
|
+
var ChangeEndpoint = class extends BaseEndpoint {
|
|
388
|
+
/**
|
|
389
|
+
* Constructs a new ChangeEndpoint instance.
|
|
390
|
+
*
|
|
391
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
392
|
+
*/
|
|
393
|
+
constructor(access_token) {
|
|
394
|
+
super(access_token);
|
|
395
|
+
this.access_token = access_token;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Retrieves changes in movies asynchronously.
|
|
399
|
+
*
|
|
400
|
+
* TMDB: GET /movie/changes
|
|
401
|
+
*
|
|
402
|
+
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
403
|
+
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in movies.
|
|
404
|
+
*/
|
|
405
|
+
movies(options) {
|
|
406
|
+
return this.api.get("/movie/changes", { query: options });
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Retrieves changes in TV shows asynchronously.
|
|
410
|
+
*
|
|
411
|
+
* TMDB: GET /tv/changes
|
|
412
|
+
*
|
|
413
|
+
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
414
|
+
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in TV shows.
|
|
415
|
+
*/
|
|
416
|
+
tv(options) {
|
|
417
|
+
return this.api.get("/tv/changes", { query: options });
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Retrieves changes related to persons asynchronously.
|
|
421
|
+
*
|
|
422
|
+
* TMDB: GET /person/changes
|
|
423
|
+
*
|
|
424
|
+
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
425
|
+
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes related to persons.
|
|
426
|
+
*/
|
|
427
|
+
person(options) {
|
|
428
|
+
return this.api.get("/person/changes", { query: options });
|
|
429
|
+
}
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
//#endregion
|
|
433
|
+
//#region src/endpoints/collections.ts
|
|
434
|
+
const BASE_COLLECTION = "/collection";
|
|
435
|
+
/**
|
|
436
|
+
* Represents an endpoint for accessing collections and their details.
|
|
437
|
+
*/
|
|
438
|
+
var CollectionsEndpoint = class extends BaseEndpoint {
|
|
439
|
+
/**
|
|
440
|
+
* Constructs a new CollectionsEndpoint instance.
|
|
441
|
+
*
|
|
442
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
443
|
+
*/
|
|
444
|
+
constructor(auth) {
|
|
445
|
+
super(auth);
|
|
446
|
+
this.auth = auth;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Retrieves details of a specific collection asynchronously.
|
|
450
|
+
*
|
|
451
|
+
* @param {number} id - The ID of the collection.
|
|
452
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
453
|
+
* language.
|
|
454
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
455
|
+
* @returns {Promise<DetailedCollection>} A Promise that resolves with the
|
|
456
|
+
* detailed information of the collection.
|
|
457
|
+
*/
|
|
458
|
+
details(id, options, request) {
|
|
459
|
+
return this.api.get(`${BASE_COLLECTION}/${id}`, withQuery(options, request));
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Retrieves images associated with a specific collection asynchronously.
|
|
463
|
+
*
|
|
464
|
+
* @param {number} id - The ID of the collection.
|
|
465
|
+
* @param {CollectionImageOptions} [options] - Optional parameters for
|
|
466
|
+
* specifying image options.
|
|
467
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
468
|
+
* @returns {Promise<ImageCollection>} A Promise that resolves with the
|
|
469
|
+
* collection images.
|
|
470
|
+
*/
|
|
471
|
+
images(id, options, request) {
|
|
472
|
+
const query = {
|
|
473
|
+
include_image_language: csv(options?.include_image_language),
|
|
474
|
+
language: options?.language
|
|
475
|
+
};
|
|
476
|
+
return this.api.get(`${BASE_COLLECTION}/${id}/images`, withQuery(query, request));
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Retrieves translations for a specific collection asynchronously.
|
|
480
|
+
*
|
|
481
|
+
* @param {number} id - The ID of the collection.
|
|
482
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
483
|
+
* language.
|
|
484
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
485
|
+
* @returns {Promise<Translations>} A Promise that resolves with the
|
|
486
|
+
* translations of the collection.
|
|
487
|
+
*/
|
|
488
|
+
translations(id, options, request) {
|
|
489
|
+
return this.api.get(`${BASE_COLLECTION}/${id}/translations`, withQuery(options, request));
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
493
|
+
//#endregion
|
|
494
|
+
//#region src/endpoints/companies.ts
|
|
495
|
+
/**
|
|
496
|
+
* Represents an endpoint for accessing company details and related information.
|
|
497
|
+
*/
|
|
498
|
+
var CompaniesEndpoint = class extends BaseEndpoint {
|
|
499
|
+
/**
|
|
500
|
+
* Constructs a new CompaniesEndpoint instance.
|
|
501
|
+
*
|
|
502
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
503
|
+
*/
|
|
504
|
+
constructor(auth) {
|
|
505
|
+
super(auth);
|
|
506
|
+
this.auth = auth;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Retrieves details of a specific company asynchronously.
|
|
510
|
+
*
|
|
511
|
+
* @param {number} id - The ID of the company.
|
|
512
|
+
* @returns {Promise<CompanyDetails>} A Promise that resolves with the
|
|
513
|
+
* detailed information of the company.
|
|
514
|
+
*/
|
|
515
|
+
details(id) {
|
|
516
|
+
return this.api.get(`/company/${id}`);
|
|
517
|
+
}
|
|
518
|
+
/**
|
|
519
|
+
* Retrieves alternative names of a specific company asynchronously.
|
|
520
|
+
*
|
|
521
|
+
* @param {number} id - The ID of the company.
|
|
522
|
+
* @returns {Promise<AlternativeNames>} A Promise that resolves with the
|
|
523
|
+
* alternative names of the company.
|
|
524
|
+
*/
|
|
525
|
+
alternativeNames(id) {
|
|
526
|
+
return this.api.get(`/company/${id}/alternative_names`);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Retrieves images associated with a specific company asynchronously.
|
|
530
|
+
*
|
|
531
|
+
* @param {number} id - The ID of the company.
|
|
532
|
+
* @returns {Promise<CompanyImages>} A Promise that resolves with the images
|
|
533
|
+
* of the company.
|
|
534
|
+
*/
|
|
535
|
+
images(id) {
|
|
536
|
+
return this.api.get(`/company/${id}/images`);
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/endpoints/configuration.ts
|
|
542
|
+
/**
|
|
543
|
+
* Represents an endpoint for retrieving current system configuration.
|
|
544
|
+
*/
|
|
545
|
+
var ConfigurationEndpoint = class extends BaseEndpoint {
|
|
546
|
+
/**
|
|
547
|
+
* Constructs a new ConfigurationEndpoint instance.
|
|
548
|
+
*
|
|
549
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
550
|
+
*/
|
|
551
|
+
constructor(auth) {
|
|
552
|
+
super(auth);
|
|
553
|
+
this.auth = auth;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Retrieves the current system configuration asynchronously.
|
|
557
|
+
*
|
|
558
|
+
* @returns {Promise<Configuration>} A Promise that resolves with the current
|
|
559
|
+
* system configuration.
|
|
560
|
+
*/
|
|
561
|
+
getCurrent() {
|
|
562
|
+
return this.api.get("/configuration");
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
//#endregion
|
|
567
|
+
//#region src/endpoints/credits.ts
|
|
568
|
+
/**
|
|
569
|
+
* Represents an endpoint for retrieving credit details.
|
|
570
|
+
*/
|
|
571
|
+
var CreditsEndpoint = class extends BaseEndpoint {
|
|
572
|
+
/**
|
|
573
|
+
* Constructs a new CreditsEndpoint instance.
|
|
574
|
+
*
|
|
575
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
576
|
+
*/
|
|
577
|
+
constructor(auth) {
|
|
578
|
+
super(auth);
|
|
579
|
+
this.auth = auth;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Retrieves credit details by ID asynchronously.
|
|
583
|
+
*
|
|
584
|
+
* @param {string} id - The ID of the credit.
|
|
585
|
+
* @returns {Promise<CreditResponse>} A Promise that resolves with the credit
|
|
586
|
+
* details.
|
|
587
|
+
*/
|
|
588
|
+
getById(id) {
|
|
589
|
+
return this.api.get(`/credit/${id}`);
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
|
|
593
|
+
//#endregion
|
|
594
|
+
//#region src/endpoints/discover.ts
|
|
595
|
+
const BASE_DISCOVER = "/discover";
|
|
596
|
+
/**
|
|
597
|
+
* Represents an endpoint for discovering movies and TV shows based on various
|
|
598
|
+
* criteria.
|
|
599
|
+
*
|
|
600
|
+
* TMDB v3 reference:
|
|
601
|
+
* - GET /discover/movie
|
|
602
|
+
* - GET /discover/tv
|
|
603
|
+
*/
|
|
604
|
+
var DiscoverEndpoint = class extends BaseEndpoint {
|
|
605
|
+
/**
|
|
606
|
+
* Constructs a new DiscoverEndpoint instance.
|
|
607
|
+
*
|
|
608
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
609
|
+
*/
|
|
610
|
+
constructor(access_token) {
|
|
611
|
+
super(access_token);
|
|
612
|
+
this.access_token = access_token;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Retrieves a list of movies based on the provided query options
|
|
616
|
+
* asynchronously.
|
|
617
|
+
*
|
|
618
|
+
* @param {MovieQueryOptions} [options] - Optional parameters for refining the
|
|
619
|
+
* movie discovery.
|
|
620
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
621
|
+
* @returns {Promise<MovieDiscoverResult>} A Promise that resolves with the
|
|
622
|
+
* movie discovery results.
|
|
623
|
+
*/
|
|
624
|
+
movie(options, request) {
|
|
625
|
+
return this.api.get(`${BASE_DISCOVER}/movie`, withQuery(options, request));
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Retrieves a list of TV shows based on the provided query options
|
|
629
|
+
* asynchronously.
|
|
630
|
+
*
|
|
631
|
+
* @param {TvShowQueryOptions} [options] - Optional parameters for refining
|
|
632
|
+
* the TV show discovery.
|
|
633
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
634
|
+
* @returns {Promise<TvShowDiscoverResult>} A Promise that resolves with the
|
|
635
|
+
* TV show discovery results.
|
|
636
|
+
*/
|
|
637
|
+
tvShow(options, request) {
|
|
638
|
+
return this.api.get(`${BASE_DISCOVER}/tv`, withQuery(options, request));
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/endpoints/find.ts
|
|
644
|
+
/**
|
|
645
|
+
* Represents an endpoint for finding media by external ID.
|
|
646
|
+
*/
|
|
647
|
+
var FindEndpoint = class extends BaseEndpoint {
|
|
648
|
+
/**
|
|
649
|
+
* Constructs a new FindEndpoint instance.
|
|
650
|
+
*
|
|
651
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
652
|
+
*/
|
|
653
|
+
constructor(auth) {
|
|
654
|
+
super(auth);
|
|
655
|
+
this.auth = auth;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Retrieves media by external ID asynchronously.
|
|
659
|
+
*
|
|
660
|
+
* @param {string} externalId - The external ID of the media.
|
|
661
|
+
* @param {ExternalIdOptions} options - Options for finding media by external
|
|
662
|
+
* ID.
|
|
663
|
+
* @returns {Promise<FindResult>} A Promise that resolves with the result of
|
|
664
|
+
* the find operation.
|
|
665
|
+
*/
|
|
666
|
+
byId(externalId, options) {
|
|
667
|
+
return this.api.get(`/find/${externalId}`, { query: options });
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
|
|
671
|
+
//#endregion
|
|
672
|
+
//#region src/endpoints/genre.ts
|
|
673
|
+
/**
|
|
674
|
+
* Represents an endpoint for retrieving genre information for movies and TV
|
|
675
|
+
* shows.
|
|
676
|
+
*/
|
|
677
|
+
var GenreEndpoint = class extends BaseEndpoint {
|
|
678
|
+
/**
|
|
679
|
+
* Constructs a new GenreEndpoint instance.
|
|
680
|
+
*
|
|
681
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
682
|
+
*/
|
|
683
|
+
constructor(auth) {
|
|
684
|
+
super(auth);
|
|
685
|
+
this.auth = auth;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Retrieves genre information for movies asynchronously.
|
|
689
|
+
*
|
|
690
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
691
|
+
* language.
|
|
692
|
+
* @returns {Promise<Genres>} A Promise that resolves with the genre
|
|
693
|
+
* information for movies.
|
|
694
|
+
*/
|
|
695
|
+
movies(options) {
|
|
696
|
+
return this.api.get("/genre/movie/list", { query: options });
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Retrieves genre information for TV shows asynchronously.
|
|
700
|
+
*
|
|
701
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
702
|
+
* language.
|
|
703
|
+
* @returns {Promise<Genres>} A Promise that resolves with the genre
|
|
704
|
+
* information for TV shows.
|
|
705
|
+
*/
|
|
706
|
+
tv(options) {
|
|
707
|
+
return this.api.get("/genre/tv/list", { query: options });
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
//#endregion
|
|
712
|
+
//#region src/endpoints/keywords.ts
|
|
713
|
+
const BASE_KEYWORD = "/keyword";
|
|
714
|
+
/**
|
|
715
|
+
* Represents an endpoint for accessing keyword details and related movies.
|
|
716
|
+
*/
|
|
717
|
+
var KeywordsEndpoint = class extends BaseEndpoint {
|
|
718
|
+
/**
|
|
719
|
+
* Constructs a new KeywordsEndpoint instance.
|
|
720
|
+
*
|
|
721
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
722
|
+
*/
|
|
723
|
+
constructor(auth) {
|
|
724
|
+
super(auth);
|
|
725
|
+
this.auth = auth;
|
|
726
|
+
}
|
|
727
|
+
/**
|
|
728
|
+
* Retrieves details of a specific keyword asynchronously.
|
|
729
|
+
*
|
|
730
|
+
* @param {number} keywordId - The ID of the keyword.
|
|
731
|
+
* @returns {Promise<Keyword>} A Promise that resolves with the details of
|
|
732
|
+
* the keyword.
|
|
733
|
+
*/
|
|
734
|
+
details(keywordId) {
|
|
735
|
+
return this.api.get(`${BASE_KEYWORD}/${keywordId}`);
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Retrieves movies belonging to a specific keyword asynchronously.
|
|
739
|
+
*
|
|
740
|
+
* @param {number} keywordId - The ID of the keyword.
|
|
741
|
+
* @param {KeywordsOptions} [options] - Optional parameters for refining the
|
|
742
|
+
* search.
|
|
743
|
+
* @returns {Promise<BelongingMovies>} A Promise that resolves with the
|
|
744
|
+
* movies belonging to the keyword.
|
|
745
|
+
*/
|
|
746
|
+
belongingMovies(keywordId, options) {
|
|
747
|
+
return this.api.get(`${BASE_KEYWORD}/${keywordId}/movies`, { query: options });
|
|
748
|
+
}
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
//#endregion
|
|
752
|
+
//#region src/endpoints/movies.ts
|
|
753
|
+
const BASE_MOVIE = "/movie";
|
|
754
|
+
/**
|
|
755
|
+
* Represents an endpoint for accessing movie-related information.
|
|
756
|
+
*/
|
|
757
|
+
var MoviesEndpoint = class extends BaseEndpoint {
|
|
758
|
+
/**
|
|
759
|
+
* Constructs a new MoviesEndpoint instance.
|
|
760
|
+
*
|
|
761
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
762
|
+
*/
|
|
763
|
+
constructor(auth) {
|
|
764
|
+
super(auth);
|
|
765
|
+
this.auth = auth;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Retrieves details of a specific movie asynchronously.
|
|
769
|
+
*
|
|
770
|
+
* @param {number} id - The ID of the movie.
|
|
771
|
+
* @param {AppendToResponseMovieKey[]} [appendToResponse] - Optional keys to
|
|
772
|
+
* append to the response.
|
|
773
|
+
* @param {string} [language] - Optional parameter for specifying the
|
|
774
|
+
* language.
|
|
775
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
776
|
+
* @returns {Promise<AppendToResponse<MovieDetails, T, "movie">>} A Promise
|
|
777
|
+
* that resolves with the details of the movie.
|
|
778
|
+
*/
|
|
779
|
+
details(id, appendToResponse, language, request) {
|
|
780
|
+
const query = {
|
|
781
|
+
append_to_response: csv(appendToResponse),
|
|
782
|
+
language
|
|
783
|
+
};
|
|
784
|
+
return this.api.get(`${BASE_MOVIE}/${id}`, withQuery(query, request));
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Retrieves alternative titles of a specific movie asynchronously.
|
|
788
|
+
*
|
|
789
|
+
* @param {number} id - The ID of the movie.
|
|
790
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
791
|
+
* @returns {Promise<AlternativeTitles>} A Promise that resolves with the
|
|
792
|
+
* alternative titles of the movie.
|
|
793
|
+
*/
|
|
794
|
+
alternativeTitles(id, request) {
|
|
795
|
+
return this.api.get(`${BASE_MOVIE}/${id}/alternative_titles`, request);
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Retrieves changes made to a specific movie asynchronously.
|
|
799
|
+
*
|
|
800
|
+
* @param {number} id - The ID of the movie.
|
|
801
|
+
* @param {ChangeOption} [options] - Optional parameters for filtering
|
|
802
|
+
* changes.
|
|
803
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
804
|
+
* @returns {Promise<Changes<MovieChangeValue>>} A Promise that resolves with
|
|
805
|
+
* the changes made to the movie.
|
|
806
|
+
*/
|
|
807
|
+
changes(id, options, request) {
|
|
808
|
+
return this.api.get(`${BASE_MOVIE}/${id}/changes`, withQuery(options, request));
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Retrieves credits of a specific movie asynchronously.
|
|
812
|
+
*
|
|
813
|
+
* @param {number} id - The ID of the movie.
|
|
814
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
815
|
+
* language.
|
|
816
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
817
|
+
* @returns {Promise<Credits>} A Promise that resolves with the credits of
|
|
818
|
+
* the movie.
|
|
819
|
+
*/
|
|
820
|
+
credits(id, options, request) {
|
|
821
|
+
return this.api.get(`${BASE_MOVIE}/${id}/credits`, withQuery(options, request));
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Retrieves external IDs of a specific movie asynchronously.
|
|
825
|
+
*
|
|
826
|
+
* @param {number} id - The ID of the movie.
|
|
827
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
828
|
+
* @returns {Promise<ExternalIds>} A Promise that resolves with the external
|
|
829
|
+
* IDs of the movie.
|
|
830
|
+
*/
|
|
831
|
+
externalIds(id, request) {
|
|
832
|
+
return this.api.get(`${BASE_MOVIE}/${id}/external_ids`, request);
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Retrieves images of a specific movie asynchronously.
|
|
836
|
+
*
|
|
837
|
+
* @param {number} id - The ID of the movie.
|
|
838
|
+
* @param {MoviesImageSearchOptions} [options] - Optional parameters for
|
|
839
|
+
* specifying image search options.
|
|
840
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
841
|
+
* @returns {Promise<Images>} A Promise that resolves with the images of the
|
|
842
|
+
* movie.
|
|
843
|
+
*/
|
|
844
|
+
images(id, options, request) {
|
|
845
|
+
const query = {
|
|
846
|
+
include_image_language: csv(options?.include_image_language),
|
|
847
|
+
language: options?.language
|
|
848
|
+
};
|
|
849
|
+
return this.api.get(`${BASE_MOVIE}/${id}/images`, withQuery(query, request));
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* Retrieves keywords of a specific movie asynchronously.
|
|
853
|
+
*
|
|
854
|
+
* @param {number} id - The ID of the movie.
|
|
855
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
856
|
+
* @returns {Promise<Keywords>} A Promise that resolves with the keywords of
|
|
857
|
+
* the movie.
|
|
858
|
+
*/
|
|
859
|
+
keywords(id, request) {
|
|
860
|
+
return this.api.get(`${BASE_MOVIE}/${id}/keywords`, request);
|
|
861
|
+
}
|
|
862
|
+
/**
|
|
863
|
+
* Retrieves lists containing a specific movie asynchronously.
|
|
864
|
+
*
|
|
865
|
+
* @param {number} id - The ID of the movie.
|
|
866
|
+
* @param {LanguageOption & PageOption} [options] - Optional parameters for
|
|
867
|
+
* specifying language and pagination options.
|
|
868
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
869
|
+
* @returns {Promise<MovieLists>} A Promise that resolves with the lists
|
|
870
|
+
* containing the movie.
|
|
871
|
+
*/
|
|
872
|
+
lists(id, options, request) {
|
|
873
|
+
return this.api.get(`${BASE_MOVIE}/${id}/lists`, withQuery(options, request));
|
|
874
|
+
}
|
|
875
|
+
/**
|
|
876
|
+
* Retrieves recommendations for a specific movie asynchronously.
|
|
877
|
+
*
|
|
878
|
+
* @param {number} id - The ID of the movie.
|
|
879
|
+
* @param {LanguageOption & PageOption} [options] - Optional parameters for
|
|
880
|
+
* specifying language and pagination options.
|
|
881
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
882
|
+
* @returns {Promise<Recommendations>} A Promise that resolves with the
|
|
883
|
+
* recommendations for the movie.
|
|
884
|
+
*/
|
|
885
|
+
recommendations(id, options, request) {
|
|
886
|
+
return this.api.get(`${BASE_MOVIE}/${id}/recommendations`, withQuery(options, request));
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Retrieves release dates of a specific movie asynchronously.
|
|
890
|
+
*
|
|
891
|
+
* @param {number} id - The ID of the movie.
|
|
892
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
893
|
+
* @returns {Promise<ReleaseDates>} A Promise that resolves with the release
|
|
894
|
+
* dates of the movie.
|
|
895
|
+
*/
|
|
896
|
+
releaseDates(id, request) {
|
|
897
|
+
return this.api.get(`${BASE_MOVIE}/${id}/release_dates`, request);
|
|
898
|
+
}
|
|
899
|
+
/**
|
|
900
|
+
* Retrieves reviews for a specific movie asynchronously.
|
|
901
|
+
*
|
|
902
|
+
* @param {number} id - The ID of the movie.
|
|
903
|
+
* @param {LanguageOption & PageOption} [options] - Optional parameters for
|
|
904
|
+
* specifying language and pagination options.
|
|
905
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
906
|
+
* @returns {Promise<Reviews>} A Promise that resolves with the reviews for
|
|
907
|
+
* the movie.
|
|
908
|
+
*/
|
|
909
|
+
reviews(id, options, request) {
|
|
910
|
+
return this.api.get(`${BASE_MOVIE}/${id}/reviews`, withQuery(options, request));
|
|
911
|
+
}
|
|
912
|
+
/**
|
|
913
|
+
* Retrieves similar movies for a specific movie asynchronously.
|
|
914
|
+
*
|
|
915
|
+
* @param {number} id - The ID of the movie.
|
|
916
|
+
* @param {LanguageOption & PageOption} [options] - Optional parameters for
|
|
917
|
+
* specifying language and pagination options.
|
|
918
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
919
|
+
* @returns {Promise<SimilarMovies>} A Promise that resolves with the similar
|
|
920
|
+
* movies for the movie.
|
|
921
|
+
*/
|
|
922
|
+
similar(id, options, request) {
|
|
923
|
+
return this.api.get(`${BASE_MOVIE}/${id}/similar`, withQuery(options, request));
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Retrieves translations of a specific movie asynchronously.
|
|
927
|
+
*
|
|
928
|
+
* @param {number} id - The ID of the movie.
|
|
929
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
930
|
+
* @returns {Promise<Translations>} A Promise that resolves with the
|
|
931
|
+
* translations of the movie.
|
|
932
|
+
*/
|
|
933
|
+
translations(id, request) {
|
|
934
|
+
return this.api.get(`${BASE_MOVIE}/${id}/translations`, request);
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Retrieves videos of a specific movie asynchronously.
|
|
938
|
+
*
|
|
939
|
+
* @param {number} id - The ID of the movie.
|
|
940
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
941
|
+
* language.
|
|
942
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
943
|
+
* @returns {Promise<Videos>} A Promise that resolves with the videos of the
|
|
944
|
+
* movie.
|
|
945
|
+
*/
|
|
946
|
+
videos(id, options, request) {
|
|
947
|
+
return this.api.get(`${BASE_MOVIE}/${id}/videos`, withQuery(options, request));
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Retrieves watch providers of a specific movie asynchronously.
|
|
951
|
+
*
|
|
952
|
+
* @param {number} id - The ID of the movie.
|
|
953
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
954
|
+
* @returns {Promise<WatchProviders>} A Promise that resolves with the watch
|
|
955
|
+
* providers of the movie.
|
|
956
|
+
*/
|
|
957
|
+
watchProviders(id, request) {
|
|
958
|
+
return this.api.get(`${BASE_MOVIE}/${id}/watch/providers`, request);
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Retrieves details of the latest movie asynchronously.
|
|
962
|
+
*
|
|
963
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
964
|
+
* @returns {Promise<LatestMovie>} A Promise that resolves with the details
|
|
965
|
+
* of the latest movie.
|
|
966
|
+
*/
|
|
967
|
+
latest(request) {
|
|
968
|
+
return this.api.get(`${BASE_MOVIE}/latest`, request);
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Retrieves movies playing now asynchronously.
|
|
972
|
+
*
|
|
973
|
+
* @param {PageOption & LanguageOption & RegionOption} [options] - Optional
|
|
974
|
+
* parameters for specifying language, region, and pagination options.
|
|
975
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
976
|
+
* @returns {Promise<MoviesPlayingNow>} A Promise that resolves with the
|
|
977
|
+
* movies playing now.
|
|
978
|
+
*/
|
|
979
|
+
nowPlaying(options, request) {
|
|
980
|
+
return this.api.get(`${BASE_MOVIE}/now_playing`, withQuery(options, request));
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Retrieves popular movies asynchronously.
|
|
984
|
+
*
|
|
985
|
+
* @param {LanguageOption & PageOption} [options] - Optional parameters for
|
|
986
|
+
* specifying language and pagination options.
|
|
987
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
988
|
+
* @returns {Promise<PopularMovies>} A Promise that resolves with the popular
|
|
989
|
+
* movies.
|
|
990
|
+
*/
|
|
991
|
+
popular(options, request) {
|
|
992
|
+
return this.api.get(`${BASE_MOVIE}/popular`, withQuery(options, request));
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* Retrieves top rated movies asynchronously.
|
|
996
|
+
*
|
|
997
|
+
* @param {PageOption & LanguageOption & RegionOption} [options] - Optional
|
|
998
|
+
* parameters for specifying language, region, and pagination options.
|
|
999
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1000
|
+
* @returns {Promise<TopRatedMovies>} A Promise that resolves with the top
|
|
1001
|
+
* rated movies.
|
|
1002
|
+
*/
|
|
1003
|
+
topRated(options, request) {
|
|
1004
|
+
return this.api.get(`${BASE_MOVIE}/top_rated`, withQuery(options, request));
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Retrieves upcoming movies asynchronously.
|
|
1008
|
+
*
|
|
1009
|
+
* @param {PageOption & LanguageOption & RegionOption} [options] - Optional
|
|
1010
|
+
* parameters for specifying language, region, and pagination options.
|
|
1011
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1012
|
+
* @returns {Promise<UpcomingMovies>} A Promise that resolves with the
|
|
1013
|
+
* upcoming movies.
|
|
1014
|
+
*/
|
|
1015
|
+
upcoming(options, request) {
|
|
1016
|
+
return this.api.get(`${BASE_MOVIE}/upcoming`, withQuery(options, request));
|
|
1017
|
+
}
|
|
1018
|
+
};
|
|
1019
|
+
|
|
1020
|
+
//#endregion
|
|
1021
|
+
//#region src/endpoints/networks.ts
|
|
1022
|
+
/**
|
|
1023
|
+
* Represents an endpoint for accessing network details.
|
|
1024
|
+
*/
|
|
1025
|
+
var NetworksEndpoint = class extends BaseEndpoint {
|
|
1026
|
+
/**
|
|
1027
|
+
* Constructs a new NetworksEndpoint instance.
|
|
1028
|
+
*
|
|
1029
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
1030
|
+
*/
|
|
1031
|
+
constructor(auth) {
|
|
1032
|
+
super(auth);
|
|
1033
|
+
this.auth = auth;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Retrieves details of a specific network asynchronously.
|
|
1037
|
+
*
|
|
1038
|
+
* @param {number} id - The ID of the network.
|
|
1039
|
+
* @returns {Promise<NetworkDetails>} A Promise that resolves with the
|
|
1040
|
+
* details of the network.
|
|
1041
|
+
*/
|
|
1042
|
+
details(id) {
|
|
1043
|
+
return this.api.get(`/network/${id}`);
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Retrieves alternative names of a specific network asynchronously.
|
|
1047
|
+
*
|
|
1048
|
+
* @param {number} id - The ID of the network.
|
|
1049
|
+
* @returns {Promise<AlternativeNames>} A Promise that resolves with the
|
|
1050
|
+
* alternative names of the network.
|
|
1051
|
+
*/
|
|
1052
|
+
alternativeNames(id) {
|
|
1053
|
+
return this.api.get(`/network/${id}/alternative_names`);
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Retrieves images of a specific network asynchronously.
|
|
1057
|
+
*
|
|
1058
|
+
* @param {number} id - The ID of the network.
|
|
1059
|
+
* @returns {Promise<NetworkImages>} A Promise that resolves with the images
|
|
1060
|
+
* of the network.
|
|
1061
|
+
*/
|
|
1062
|
+
images(id) {
|
|
1063
|
+
return this.api.get(`/network/${id}/images`);
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
//#endregion
|
|
1068
|
+
//#region src/endpoints/people.ts
|
|
1069
|
+
const BASE_PERSON = "/person";
|
|
1070
|
+
/**
|
|
1071
|
+
* Represents an endpoint for accessing information about people.
|
|
1072
|
+
*/
|
|
1073
|
+
var PeopleEndpoint = class extends BaseEndpoint {
|
|
1074
|
+
/**
|
|
1075
|
+
* Constructs a new PeopleEndpoint instance.
|
|
1076
|
+
*
|
|
1077
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
1078
|
+
*/
|
|
1079
|
+
constructor(auth) {
|
|
1080
|
+
super(auth);
|
|
1081
|
+
this.auth = auth;
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Retrieves details of a specific person asynchronously.
|
|
1085
|
+
*
|
|
1086
|
+
* @param {number} id - The ID of the person.
|
|
1087
|
+
* @param {AppendToResponsePersonKey[]} [appendToResponse] - Optional keys to
|
|
1088
|
+
* append to the response.
|
|
1089
|
+
* @param {string} [language] - Optional parameter for specifying the
|
|
1090
|
+
* language.
|
|
1091
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1092
|
+
* @returns {Promise<AppendToResponse<PersonDetails, T, "person">>} A
|
|
1093
|
+
* Promise that resolves with the details of the person.
|
|
1094
|
+
*/
|
|
1095
|
+
details(id, appendToResponse, language, request) {
|
|
1096
|
+
const query = {
|
|
1097
|
+
append_to_response: csv(appendToResponse),
|
|
1098
|
+
language
|
|
1099
|
+
};
|
|
1100
|
+
return this.api.get(`${BASE_PERSON}/${id}`, withQuery(query, request));
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* Retrieves changes made to a specific person asynchronously.
|
|
1104
|
+
*
|
|
1105
|
+
* @param {number} id - The ID of the person.
|
|
1106
|
+
* @param {ChangeOption} [options] - Optional parameters for filtering
|
|
1107
|
+
* changes.
|
|
1108
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1109
|
+
* @returns {Promise<Changes<PersonChangeValue>>} A Promise that resolves
|
|
1110
|
+
* with the changes made to the person.
|
|
1111
|
+
*/
|
|
1112
|
+
changes(id, options, request) {
|
|
1113
|
+
return this.api.get(`${BASE_PERSON}/${id}/changes`, withQuery(options, request));
|
|
1114
|
+
}
|
|
1115
|
+
/**
|
|
1116
|
+
* Retrieves movie credits of a specific person asynchronously.
|
|
1117
|
+
*
|
|
1118
|
+
* @param {number} id - The ID of the person.
|
|
1119
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1120
|
+
* language.
|
|
1121
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1122
|
+
* @returns {Promise<PersonMovieCredit>} A Promise that resolves with the
|
|
1123
|
+
* movie credits of the person.
|
|
1124
|
+
*/
|
|
1125
|
+
movieCredits(id, options, request) {
|
|
1126
|
+
return this.api.get(`${BASE_PERSON}/${id}/movie_credits`, withQuery(options, request));
|
|
1127
|
+
}
|
|
1128
|
+
/**
|
|
1129
|
+
* Retrieves TV show credits of a specific person asynchronously.
|
|
1130
|
+
*
|
|
1131
|
+
* @param {number} id - The ID of the person.
|
|
1132
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1133
|
+
* language.
|
|
1134
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1135
|
+
* @returns {Promise<PersonTvShowCredit>} A Promise that resolves with the
|
|
1136
|
+
* TV show credits of the person.
|
|
1137
|
+
*/
|
|
1138
|
+
tvShowCredits(id, options, request) {
|
|
1139
|
+
return this.api.get(`${BASE_PERSON}/${id}/tv_credits`, withQuery(options, request));
|
|
1140
|
+
}
|
|
1141
|
+
/**
|
|
1142
|
+
* Retrieves combined credits of a specific person asynchronously.
|
|
1143
|
+
*
|
|
1144
|
+
* @param {number} id - The ID of the person.
|
|
1145
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1146
|
+
* language.
|
|
1147
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1148
|
+
* @returns {Promise<PersonCombinedCredits>} A Promise that resolves with the
|
|
1149
|
+
* combined credits of the person.
|
|
1150
|
+
*/
|
|
1151
|
+
combinedCredits(id, options, request) {
|
|
1152
|
+
return this.api.get(`${BASE_PERSON}/${id}/combined_credits`, withQuery(options, request));
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Retrieves external IDs of a specific person asynchronously.
|
|
1156
|
+
*
|
|
1157
|
+
* @param {number} id - The ID of the person.
|
|
1158
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1159
|
+
* @returns {Promise<ExternalIds>} A Promise that resolves with the external
|
|
1160
|
+
* IDs of the person.
|
|
1161
|
+
*/
|
|
1162
|
+
externalId(id, request) {
|
|
1163
|
+
return this.api.get(`${BASE_PERSON}/${id}/external_ids`, request);
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Retrieves images of a specific person asynchronously.
|
|
1167
|
+
*
|
|
1168
|
+
* @param {number} id - The ID of the person.
|
|
1169
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1170
|
+
* @returns {Promise<PeopleImages>} A Promise that resolves with the images
|
|
1171
|
+
* of the person.
|
|
1172
|
+
*/
|
|
1173
|
+
images(id, request) {
|
|
1174
|
+
return this.api.get(`${BASE_PERSON}/${id}/images`, request);
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Retrieves tagged images of a specific person asynchronously.
|
|
1178
|
+
*
|
|
1179
|
+
* @param {number} id - The ID of the person.
|
|
1180
|
+
* @param {PageOption} [options] - Optional parameters for specifying
|
|
1181
|
+
* pagination options.
|
|
1182
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1183
|
+
* @returns {Promise<TaggedImages>} A Promise that resolves with the tagged
|
|
1184
|
+
* images of the person.
|
|
1185
|
+
*/
|
|
1186
|
+
taggedImages(id, options, request) {
|
|
1187
|
+
return this.api.get(`${BASE_PERSON}/${id}/tagged_images`, withQuery(options, request));
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Retrieves translations of a specific person asynchronously.
|
|
1191
|
+
*
|
|
1192
|
+
* @param {number} id - The ID of the person.
|
|
1193
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1194
|
+
* @returns {Promise<PersonTranslations>} A Promise that resolves with the
|
|
1195
|
+
* translations of the person.
|
|
1196
|
+
*/
|
|
1197
|
+
translation(id, request) {
|
|
1198
|
+
return this.api.get(`${BASE_PERSON}/${id}/translations`, request);
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* Retrieves details of the latest person asynchronously.
|
|
1202
|
+
*
|
|
1203
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1204
|
+
* @returns {Promise<PersonDetails>} A Promise that resolves with the details
|
|
1205
|
+
* of the latest person.
|
|
1206
|
+
*/
|
|
1207
|
+
latest(request) {
|
|
1208
|
+
return this.api.get(`${BASE_PERSON}/latest`, request);
|
|
1209
|
+
}
|
|
1210
|
+
/**
|
|
1211
|
+
* Retrieves popular persons asynchronously.
|
|
1212
|
+
*
|
|
1213
|
+
* @param {LanguageOption & PageOption} [options] - Optional parameters for
|
|
1214
|
+
* specifying language and pagination options.
|
|
1215
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1216
|
+
* @returns {Promise<PopularPersons>} A Promise that resolves with the
|
|
1217
|
+
* popular persons.
|
|
1218
|
+
*/
|
|
1219
|
+
popular(options, request) {
|
|
1220
|
+
return this.api.get(`${BASE_PERSON}/popular`, withQuery(options, request));
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
//#endregion
|
|
1225
|
+
//#region src/endpoints/review.ts
|
|
1226
|
+
/**
|
|
1227
|
+
* Represents an endpoint for accessing review details.
|
|
1228
|
+
*/
|
|
1229
|
+
var ReviewEndpoint = class extends BaseEndpoint {
|
|
1230
|
+
/**
|
|
1231
|
+
* Constructs a new ReviewEndpoint instance.
|
|
1232
|
+
*
|
|
1233
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
1234
|
+
*/
|
|
1235
|
+
constructor(auth) {
|
|
1236
|
+
super(auth);
|
|
1237
|
+
this.auth = auth;
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Retrieves details of a specific review asynchronously.
|
|
1241
|
+
*
|
|
1242
|
+
* @param {string} id - The ID of the review.
|
|
1243
|
+
* @returns {Promise<ReviewDetails>} A Promise that resolves with the details
|
|
1244
|
+
* of the review.
|
|
1245
|
+
*/
|
|
1246
|
+
details(id) {
|
|
1247
|
+
return this.api.get(`/review/${id}`);
|
|
1248
|
+
}
|
|
1249
|
+
};
|
|
1250
|
+
|
|
1251
|
+
//#endregion
|
|
1252
|
+
//#region src/endpoints/search.ts
|
|
1253
|
+
const BASE_SEARCH = "/search";
|
|
1254
|
+
/**
|
|
1255
|
+
* Represents an endpoint for performing various search operations.
|
|
1256
|
+
*/
|
|
1257
|
+
var SearchEndpoint = class extends BaseEndpoint {
|
|
1258
|
+
/**
|
|
1259
|
+
* Constructs a new SearchEndpoint instance.
|
|
1260
|
+
*
|
|
1261
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
1262
|
+
*/
|
|
1263
|
+
constructor(access_token) {
|
|
1264
|
+
super(access_token);
|
|
1265
|
+
this.access_token = access_token;
|
|
1266
|
+
}
|
|
1267
|
+
/**
|
|
1268
|
+
* Searches for companies asynchronously.
|
|
1269
|
+
*
|
|
1270
|
+
* @param {SearchOptions} options - The search options.
|
|
1271
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1272
|
+
* @returns {Promise<Search<Company>>} A Promise that resolves with the
|
|
1273
|
+
* search results for companies.
|
|
1274
|
+
*/
|
|
1275
|
+
companies(options, request) {
|
|
1276
|
+
return this.api.get(`${BASE_SEARCH}/company`, withQuery(options, request));
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Searches for collections asynchronously.
|
|
1280
|
+
*
|
|
1281
|
+
* @param {CollectionSearchOptions} options - The search options.
|
|
1282
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1283
|
+
* @returns {Promise<Search<Collection>>} A Promise that resolves with the
|
|
1284
|
+
* search results for collections.
|
|
1285
|
+
*/
|
|
1286
|
+
collections(options, request) {
|
|
1287
|
+
return this.api.get(`${BASE_SEARCH}/collection`, withQuery(options, request));
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Searches for keywords asynchronously.
|
|
1291
|
+
*
|
|
1292
|
+
* @param {SearchOptions} options - The search options.
|
|
1293
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1294
|
+
* @returns {Promise<Search<{ id: string; name: string }>>} A Promise that
|
|
1295
|
+
* resolves with the search results for keywords.
|
|
1296
|
+
*/
|
|
1297
|
+
keywords(options, request) {
|
|
1298
|
+
return this.api.get(`${BASE_SEARCH}/keyword`, withQuery(options, request));
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* Searches for movies asynchronously.
|
|
1302
|
+
*
|
|
1303
|
+
* @param {MovieSearchOptions} options - The search options.
|
|
1304
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1305
|
+
* @returns {Promise<Search<Movie>>} A Promise that resolves with the search
|
|
1306
|
+
* results for movies.
|
|
1307
|
+
*/
|
|
1308
|
+
movies(options, request) {
|
|
1309
|
+
return this.api.get(`${BASE_SEARCH}/movie`, withQuery(options, request));
|
|
1310
|
+
}
|
|
1311
|
+
/**
|
|
1312
|
+
* Searches for people asynchronously.
|
|
1313
|
+
*
|
|
1314
|
+
* @param {PeopleSearchOptions} options - The search options.
|
|
1315
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1316
|
+
* @returns {Promise<Search<Person>>} A Promise that resolves with the search
|
|
1317
|
+
* results for people.
|
|
1318
|
+
*/
|
|
1319
|
+
people(options, request) {
|
|
1320
|
+
return this.api.get(`${BASE_SEARCH}/person`, withQuery(options, request));
|
|
1321
|
+
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Searches for TV shows asynchronously.
|
|
1324
|
+
*
|
|
1325
|
+
* @param {TvSearchOptions} options - The search options.
|
|
1326
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1327
|
+
* @returns {Promise<Search<TV>>} A Promise that resolves with the search
|
|
1328
|
+
* results for TV shows.
|
|
1329
|
+
*/
|
|
1330
|
+
tv(options, request) {
|
|
1331
|
+
return this.api.get(`${BASE_SEARCH}/tv`, withQuery(options, request));
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Performs a multi-search asynchronously.
|
|
1335
|
+
*
|
|
1336
|
+
* @param {MultiSearchOptions} options - The search options.
|
|
1337
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1338
|
+
* @returns {Promise<Search<MultiSearchResult>>} A Promise that resolves with
|
|
1339
|
+
* the multi-search results.
|
|
1340
|
+
*/
|
|
1341
|
+
multi(options, request) {
|
|
1342
|
+
return this.api.get(`${BASE_SEARCH}/multi`, withQuery(options, request));
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
|
|
1346
|
+
//#endregion
|
|
1347
|
+
//#region src/endpoints/trending.ts
|
|
1348
|
+
/**
|
|
1349
|
+
* Represents an endpoint for retrieving trending content.
|
|
1350
|
+
*/
|
|
1351
|
+
var TrendingEndpoint = class extends BaseEndpoint {
|
|
1352
|
+
/**
|
|
1353
|
+
* Constructs a new TrendingEndpoint instance.
|
|
1354
|
+
*
|
|
1355
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
1356
|
+
*/
|
|
1357
|
+
constructor(auth) {
|
|
1358
|
+
super(auth);
|
|
1359
|
+
this.auth = auth;
|
|
1360
|
+
}
|
|
1361
|
+
/**
|
|
1362
|
+
* Retrieves trending content asynchronously based on media type and time
|
|
1363
|
+
* window.
|
|
1364
|
+
*
|
|
1365
|
+
* @param {TrendingMediaType} mediaType - The type of media.
|
|
1366
|
+
* @param {TimeWindow} timeWindow - The time window for trending content.
|
|
1367
|
+
* @param {LanguageOption & PageOption} [options] - Optional parameters for
|
|
1368
|
+
* specifying the language and pagination.
|
|
1369
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1370
|
+
* @returns {Promise<TrendingResults<T>>} A Promise that resolves with the
|
|
1371
|
+
* trending results.
|
|
1372
|
+
* @template T - The type of media being searched for.
|
|
1373
|
+
*/
|
|
1374
|
+
trending(mediaType, timeWindow, options, request) {
|
|
1375
|
+
return this.api.get(`/trending/${mediaType}/${timeWindow}`, withQuery(options, request));
|
|
1376
|
+
}
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
//#endregion
|
|
1380
|
+
//#region src/endpoints/tvEpisodes.ts
|
|
1381
|
+
const BASE_EPISODE = (episodeSelection) => {
|
|
1382
|
+
return `/tv/${episodeSelection.tvShowID}/season/${episodeSelection.seasonNumber}/episode/${episodeSelection.episodeNumber}`;
|
|
1383
|
+
};
|
|
1384
|
+
/**
|
|
1385
|
+
* Represents an endpoint for accessing TV episode-related information.
|
|
1386
|
+
*/
|
|
1387
|
+
var TvEpisodesEndpoint = class extends BaseEndpoint {
|
|
1388
|
+
/**
|
|
1389
|
+
* Constructs a new TvEpisodesEndpoint instance.
|
|
1390
|
+
*
|
|
1391
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
1392
|
+
*/
|
|
1393
|
+
constructor(auth) {
|
|
1394
|
+
super(auth);
|
|
1395
|
+
this.auth = auth;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Retrieves details of a specific TV episode asynchronously.
|
|
1399
|
+
*
|
|
1400
|
+
* @param {EpisodeSelection} episodeSelection - The selection criteria for
|
|
1401
|
+
* the TV episode.
|
|
1402
|
+
* @param {AppendToResponseTvEpisodeKey[]} [appendToResponse] - Additional
|
|
1403
|
+
* data to append to the response.
|
|
1404
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1405
|
+
* language.
|
|
1406
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1407
|
+
* @returns {Promise<AppendToResponse<Omit<Episode, "show_id">, T,
|
|
1408
|
+
* "tvEpisode">>} A Promise that resolves with the details of the TV
|
|
1409
|
+
* episode.
|
|
1410
|
+
*/
|
|
1411
|
+
details(episodeSelection, appendToResponse, options, request) {
|
|
1412
|
+
const query = {
|
|
1413
|
+
append_to_response: csv(appendToResponse),
|
|
1414
|
+
...options
|
|
1415
|
+
};
|
|
1416
|
+
return this.api.get(BASE_EPISODE(episodeSelection), withQuery(query, request));
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Retrieves changes related to a specific TV episode asynchronously.
|
|
1420
|
+
*
|
|
1421
|
+
* @param {number} episodeID - The ID of the TV episode.
|
|
1422
|
+
* @param {ChangeOption} [options] - Optional parameters for specifying
|
|
1423
|
+
* changes.
|
|
1424
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1425
|
+
* @returns {Promise<Changes<TvEpisodeChangeValue>>} A Promise that resolves
|
|
1426
|
+
* with the changes related to the TV episode.
|
|
1427
|
+
*/
|
|
1428
|
+
changes(episodeID, options, request) {
|
|
1429
|
+
return this.api.get(`/tv/episode/${episodeID}/changes`, withQuery(options, request));
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Retrieves credits for a specific TV episode asynchronously.
|
|
1433
|
+
*
|
|
1434
|
+
* @param {EpisodeSelection} episodeSelection - The selection criteria for
|
|
1435
|
+
* the TV episode.
|
|
1436
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1437
|
+
* language.
|
|
1438
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1439
|
+
* @returns {Promise<TvEpisodeCredit>} A Promise that resolves with the
|
|
1440
|
+
* credits for the TV episode.
|
|
1441
|
+
*/
|
|
1442
|
+
credits(episodeSelection, options, request) {
|
|
1443
|
+
return this.api.get(`${BASE_EPISODE(episodeSelection)}/credits`, withQuery(options, request));
|
|
1444
|
+
}
|
|
1445
|
+
/**
|
|
1446
|
+
* Retrieves external IDs for a specific TV episode asynchronously.
|
|
1447
|
+
*
|
|
1448
|
+
* @param {EpisodeSelection} episodeSelection - The selection criteria for
|
|
1449
|
+
* the TV episode.
|
|
1450
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1451
|
+
* @returns {Promise<ExternalIds>} A Promise that resolves with the external
|
|
1452
|
+
* IDs for the TV episode.
|
|
1453
|
+
*/
|
|
1454
|
+
externalIds(episodeSelection, request) {
|
|
1455
|
+
return this.api.get(`${BASE_EPISODE(episodeSelection)}/external_ids`, request);
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Retrieves images for a specific TV episode asynchronously.
|
|
1459
|
+
*
|
|
1460
|
+
* @param {EpisodeSelection} episodeSelection - The selection criteria for
|
|
1461
|
+
* the TV episode.
|
|
1462
|
+
* @param {TvEpisodeImageSearchOptions} [options] - Optional parameters for
|
|
1463
|
+
* specifying image search options.
|
|
1464
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1465
|
+
* @returns {Promise<Images>} A Promise that resolves with the images for the
|
|
1466
|
+
* TV episode.
|
|
1467
|
+
*/
|
|
1468
|
+
images(episodeSelection, options, request) {
|
|
1469
|
+
const query = {
|
|
1470
|
+
include_image_language: csv(options?.include_image_language),
|
|
1471
|
+
language: options?.language
|
|
1472
|
+
};
|
|
1473
|
+
return this.api.get(`${BASE_EPISODE(episodeSelection)}/images`, withQuery(query, request));
|
|
1474
|
+
}
|
|
1475
|
+
/**
|
|
1476
|
+
* Retrieves translations for a specific TV episode asynchronously.
|
|
1477
|
+
*
|
|
1478
|
+
* @param {EpisodeSelection} episodeSelection - The selection criteria for
|
|
1479
|
+
* the TV episode.
|
|
1480
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1481
|
+
* @returns {Promise<TvEpisodeTranslations>} A Promise that resolves with the
|
|
1482
|
+
* translations for the TV episode.
|
|
1483
|
+
*/
|
|
1484
|
+
translations(episodeSelection, request) {
|
|
1485
|
+
return this.api.get(`${BASE_EPISODE(episodeSelection)}/translations`, request);
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* Retrieves videos for a specific TV episode asynchronously.
|
|
1489
|
+
*
|
|
1490
|
+
* @param {EpisodeSelection} episodeSelection - The selection criteria for
|
|
1491
|
+
* the TV episode.
|
|
1492
|
+
* @param {TvEpisodeVideoSearchOptions} [options] - Optional parameters for
|
|
1493
|
+
* specifying video search options.
|
|
1494
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1495
|
+
* @returns {Promise<Videos>} A Promise that resolves with the videos for the
|
|
1496
|
+
* TV episode.
|
|
1497
|
+
*/
|
|
1498
|
+
videos(episodeSelection, options, request) {
|
|
1499
|
+
const query = {
|
|
1500
|
+
include_video_language: csv(options?.include_video_language),
|
|
1501
|
+
language: options?.language
|
|
1502
|
+
};
|
|
1503
|
+
return this.api.get(`${BASE_EPISODE(episodeSelection)}/videos`, withQuery(query, request));
|
|
1504
|
+
}
|
|
1505
|
+
};
|
|
1506
|
+
|
|
1507
|
+
//#endregion
|
|
1508
|
+
//#region src/endpoints/tvSeasons.ts
|
|
1509
|
+
const BASE_SEASON = (seasonSelection) => {
|
|
1510
|
+
return `/tv/${seasonSelection.tvShowID}/season/${seasonSelection.seasonNumber}`;
|
|
1511
|
+
};
|
|
1512
|
+
/**
|
|
1513
|
+
* Represents an endpoint for accessing TV season-related information.
|
|
1514
|
+
*/
|
|
1515
|
+
var TvSeasonsEndpoint = class extends BaseEndpoint {
|
|
1516
|
+
/**
|
|
1517
|
+
* Constructs a new TvSeasonsEndpoint instance.
|
|
1518
|
+
*
|
|
1519
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
1520
|
+
*/
|
|
1521
|
+
constructor(auth) {
|
|
1522
|
+
super(auth);
|
|
1523
|
+
this.auth = auth;
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Retrieves details of a specific TV season asynchronously.
|
|
1527
|
+
*
|
|
1528
|
+
* @param {SeasonSelection} seasonSelection - The selection criteria for the
|
|
1529
|
+
* TV season.
|
|
1530
|
+
* @param {AppendToResponseTvSeasonKey[]} [appendToResponse] - Additional
|
|
1531
|
+
* data to append to the response.
|
|
1532
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1533
|
+
* language.
|
|
1534
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1535
|
+
* @returns {Promise<AppendToResponse<SeasonDetails, T, "tvSeason">>} A
|
|
1536
|
+
* Promise that resolves with the details of the TV season.
|
|
1537
|
+
*/
|
|
1538
|
+
details(seasonSelection, appendToResponse, options, request) {
|
|
1539
|
+
const query = {
|
|
1540
|
+
append_to_response: csv(appendToResponse),
|
|
1541
|
+
...options
|
|
1542
|
+
};
|
|
1543
|
+
return this.api.get(BASE_SEASON(seasonSelection), withQuery(query, request));
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Retrieves aggregate credits for a specific TV season asynchronously.
|
|
1547
|
+
*
|
|
1548
|
+
* @param {SeasonSelection} seasonSelection - The selection criteria for the
|
|
1549
|
+
* TV season.
|
|
1550
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1551
|
+
* language.
|
|
1552
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1553
|
+
* @returns {Promise<AggregateCredits>} A Promise that resolves with the
|
|
1554
|
+
* aggregate credits for the TV season.
|
|
1555
|
+
*/
|
|
1556
|
+
aggregateCredits(seasonSelection, options, request) {
|
|
1557
|
+
return this.api.get(`${BASE_SEASON(seasonSelection)}/aggregate_credits`, withQuery(options, request));
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* Retrieves changes related to a specific TV season asynchronously.
|
|
1561
|
+
*
|
|
1562
|
+
* @param {number} seasonId - The ID of the TV season.
|
|
1563
|
+
* @param {ChangeOption} [options] - Optional parameters for specifying
|
|
1564
|
+
* changes.
|
|
1565
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1566
|
+
* @returns {Promise<Changes<TvSeasonChangeValue>>} A Promise that resolves
|
|
1567
|
+
* with the changes related to the TV season.
|
|
1568
|
+
*/
|
|
1569
|
+
changes(seasonId, options, request) {
|
|
1570
|
+
return this.api.get(`/tv/season/${seasonId}/changes`, withQuery(options, request));
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Retrieves credits for a specific TV season asynchronously.
|
|
1574
|
+
*
|
|
1575
|
+
* @param {SeasonSelection} seasonSelection - The selection criteria for the
|
|
1576
|
+
* TV season.
|
|
1577
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1578
|
+
* language.
|
|
1579
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1580
|
+
* @returns {Promise<Credits>} A Promise that resolves with the credits for
|
|
1581
|
+
* the TV season.
|
|
1582
|
+
*/
|
|
1583
|
+
credits(seasonSelection, options, request) {
|
|
1584
|
+
return this.api.get(`${BASE_SEASON(seasonSelection)}/credits`, withQuery(options, request));
|
|
1585
|
+
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Retrieves external IDs for a specific TV season asynchronously.
|
|
1588
|
+
*
|
|
1589
|
+
* @param {SeasonSelection} seasonSelection - The selection criteria for the
|
|
1590
|
+
* TV season.
|
|
1591
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1592
|
+
* language.
|
|
1593
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1594
|
+
* @returns {Promise<ExternalIds>} A Promise that resolves with the external
|
|
1595
|
+
* IDs for the TV season.
|
|
1596
|
+
*/
|
|
1597
|
+
externalIds(seasonSelection, options, request) {
|
|
1598
|
+
return this.api.get(`${BASE_SEASON(seasonSelection)}/external_ids`, withQuery(options, request));
|
|
1599
|
+
}
|
|
1600
|
+
/**
|
|
1601
|
+
* Retrieves images for a specific TV season asynchronously.
|
|
1602
|
+
*
|
|
1603
|
+
* @param {SeasonSelection} seasonSelection - The selection criteria for the
|
|
1604
|
+
* TV season.
|
|
1605
|
+
* @param {TvSeasonImageSearchOptions} [options] - Optional parameters for
|
|
1606
|
+
* specifying image search options.
|
|
1607
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1608
|
+
* @returns {Promise<Images>} A Promise that resolves with the images for the
|
|
1609
|
+
* TV season.
|
|
1610
|
+
*/
|
|
1611
|
+
images(seasonSelection, options, request) {
|
|
1612
|
+
const query = {
|
|
1613
|
+
include_image_language: csv(options?.include_image_language),
|
|
1614
|
+
language: options?.language
|
|
1615
|
+
};
|
|
1616
|
+
return this.api.get(`${BASE_SEASON(seasonSelection)}/images`, withQuery(query, request));
|
|
1617
|
+
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Retrieves videos for a specific TV season asynchronously.
|
|
1620
|
+
*
|
|
1621
|
+
* @param {SeasonSelection} seasonSelection - The selection criteria for the
|
|
1622
|
+
* TV season.
|
|
1623
|
+
* @param {TvSeasonVideoSearchOptions} [options] - Optional parameters for
|
|
1624
|
+
* specifying video search options.
|
|
1625
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1626
|
+
* @returns {Promise<Videos>} A Promise that resolves with the videos for the
|
|
1627
|
+
* TV season.
|
|
1628
|
+
*/
|
|
1629
|
+
videos(seasonSelection, options, request) {
|
|
1630
|
+
const query = {
|
|
1631
|
+
include_video_language: csv(options?.include_video_language),
|
|
1632
|
+
language: options?.language
|
|
1633
|
+
};
|
|
1634
|
+
return this.api.get(`${BASE_SEASON(seasonSelection)}/videos`, withQuery(query, request));
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Retrieves translations for a specific TV season asynchronously.
|
|
1638
|
+
*
|
|
1639
|
+
* @param {SeasonSelection} seasonSelection - The selection criteria for the
|
|
1640
|
+
* TV season.
|
|
1641
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the
|
|
1642
|
+
* language.
|
|
1643
|
+
* @param {RequestConfig} [request] - Optional request behavior overrides.
|
|
1644
|
+
* @returns {Promise<Translations>} A Promise that resolves with the
|
|
1645
|
+
* translations for the TV season.
|
|
1646
|
+
*/
|
|
1647
|
+
translations(seasonSelection, options, request) {
|
|
1648
|
+
return this.api.get(`${BASE_SEASON(seasonSelection)}/translations`, withQuery(options, request));
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1651
|
+
|
|
1652
|
+
//#endregion
|
|
1653
|
+
//#region src/endpoints/tvShows.ts
|
|
1654
|
+
const BASE_TV = "/tv";
|
|
1655
|
+
/**
|
|
1656
|
+
* Represents an endpoint for accessing TV show-related information.
|
|
1657
|
+
*/
|
|
1658
|
+
var TvShowsEndpoint = class extends BaseEndpoint {
|
|
1659
|
+
/**
|
|
1660
|
+
* Constructs a new TvShowsEndpoint instance.
|
|
1661
|
+
*
|
|
1662
|
+
* @param {TokenType} auth - The authentication configuration.
|
|
1663
|
+
*/
|
|
1664
|
+
constructor(auth) {
|
|
1665
|
+
super(auth);
|
|
1666
|
+
this.auth = auth;
|
|
1667
|
+
}
|
|
1668
|
+
/**
|
|
1669
|
+
* Retrieves details of a specific TV show asynchronously.
|
|
1670
|
+
*
|
|
1671
|
+
* @param {number} id - The ID of the TV show.
|
|
1672
|
+
* @param {AppendToResponseTvKey[]} [appendToResponse] - Additional data to
|
|
1673
|
+
* append to the response.
|
|
1674
|
+
* @param {string} [language] - The language for the response.
|
|
1675
|
+
* @returns {Promise<AppendToResponse<TvShowDetails, T, "tvShow">>} A
|
|
1676
|
+
* Promise that resolves with the details of the TV show.
|
|
1677
|
+
*/
|
|
1678
|
+
details(id, appendToResponse, language) {
|
|
1679
|
+
const options = {
|
|
1680
|
+
append_to_response: csv(appendToResponse),
|
|
1681
|
+
language
|
|
1682
|
+
};
|
|
1683
|
+
return this.api.get(`${BASE_TV}/${id}`, { query: options });
|
|
1684
|
+
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Retrieves alternative titles of a specific TV show asynchronously.
|
|
1687
|
+
*
|
|
1688
|
+
* @param {number} id - The ID of the TV show.
|
|
1689
|
+
* @returns {Promise<AlternativeTitles>} A Promise that resolves with the
|
|
1690
|
+
* alternative titles of the TV show.
|
|
1691
|
+
*/
|
|
1692
|
+
alternativeTitles(id) {
|
|
1693
|
+
return this.api.get(`${BASE_TV}/${id}/alternative_titles`);
|
|
1694
|
+
}
|
|
1695
|
+
/**
|
|
1696
|
+
* Retrieves changes for a specific TV show asynchronously.
|
|
1697
|
+
*
|
|
1698
|
+
* @param {number} id - The ID of the TV show.
|
|
1699
|
+
* @param {ChangeOption} [options] - Additional options for the request.
|
|
1700
|
+
* @returns {Promise<Changes<TvShowChangeValue>>} A Promise that resolves
|
|
1701
|
+
* with the changes for the TV show.
|
|
1702
|
+
*/
|
|
1703
|
+
changes(id, options) {
|
|
1704
|
+
return this.api.get(`${BASE_TV}/${id}/changes`, { query: options });
|
|
1705
|
+
}
|
|
1706
|
+
/**
|
|
1707
|
+
* Retrieves content ratings for a specific TV show asynchronously.
|
|
1708
|
+
*
|
|
1709
|
+
* @param {number} id - The ID of the TV show.
|
|
1710
|
+
* @returns {Promise<ContentRatings>} A Promise that resolves with the
|
|
1711
|
+
* content ratings of the TV show.
|
|
1712
|
+
*/
|
|
1713
|
+
contentRatings(id) {
|
|
1714
|
+
return this.api.get(`${BASE_TV}/${id}/content_ratings`);
|
|
1715
|
+
}
|
|
1716
|
+
/**
|
|
1717
|
+
* Retrieves aggregate credits for a specific TV show asynchronously.
|
|
1718
|
+
*
|
|
1719
|
+
* @param {number} id - The ID of the TV show.
|
|
1720
|
+
* @param {LanguageOption} [options] - Additional options for the request.
|
|
1721
|
+
* @returns {Promise<AggregateCredits>} A Promise that resolves with the
|
|
1722
|
+
* aggregate credits of the TV show.
|
|
1723
|
+
*/
|
|
1724
|
+
aggregateCredits(id, options) {
|
|
1725
|
+
return this.api.get(`${BASE_TV}/${id}/aggregate_credits`, { query: options });
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Retrieves credits for a specific TV show asynchronously.
|
|
1729
|
+
*
|
|
1730
|
+
* @param {number} id - The ID of the TV show.
|
|
1731
|
+
* @param {LanguageOption} [options] - Additional options for the request.
|
|
1732
|
+
* @returns {Promise<Credits>} A Promise that resolves with the credits of
|
|
1733
|
+
* the TV show.
|
|
1734
|
+
*/
|
|
1735
|
+
credits(id, options) {
|
|
1736
|
+
return this.api.get(`${BASE_TV}/${id}/credits`, { query: options });
|
|
1737
|
+
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Retrieves details of a specific season of a TV show asynchronously.
|
|
1740
|
+
*
|
|
1741
|
+
* @param {number} tvId - The ID of the TV show.
|
|
1742
|
+
* @param {number} seasonNumber - The season number.
|
|
1743
|
+
* @returns {Promise<SeasonDetails>} A Promise that resolves with the details
|
|
1744
|
+
* of the season.
|
|
1745
|
+
*/
|
|
1746
|
+
season(tvId, seasonNumber) {
|
|
1747
|
+
return this.api.get(`${BASE_TV}/${tvId}/season/${seasonNumber}`);
|
|
1748
|
+
}
|
|
1749
|
+
/**
|
|
1750
|
+
* Retrieves episode groups for a specific TV show asynchronously.
|
|
1751
|
+
*
|
|
1752
|
+
* @param {number} id - The ID of the TV show.
|
|
1753
|
+
* @returns {Promise<EpisodeGroups>} A Promise that resolves with the episode
|
|
1754
|
+
* groups of the TV show.
|
|
1755
|
+
*/
|
|
1756
|
+
episodeGroups(id) {
|
|
1757
|
+
return this.api.get(`${BASE_TV}/${id}/episode_groups`);
|
|
1758
|
+
}
|
|
1759
|
+
/**
|
|
1760
|
+
* Retrieves external IDs for a specific TV show asynchronously.
|
|
1761
|
+
*
|
|
1762
|
+
* @param {number} id - The ID of the TV show.
|
|
1763
|
+
* @returns {Promise<ExternalIds>} A Promise that resolves with the external
|
|
1764
|
+
* IDs of the TV show.
|
|
1765
|
+
*/
|
|
1766
|
+
externalIds(id) {
|
|
1767
|
+
return this.api.get(`${BASE_TV}/${id}/external_ids`);
|
|
1768
|
+
}
|
|
1769
|
+
/**
|
|
1770
|
+
* Retrieves images for a specific TV show asynchronously.
|
|
1771
|
+
*
|
|
1772
|
+
* @param {number} id - The ID of the TV show.
|
|
1773
|
+
* @param {TvShowImageOptions} [options] - Additional options for the
|
|
1774
|
+
* request.
|
|
1775
|
+
* @returns {Promise<Images>} A Promise that resolves with the images of the
|
|
1776
|
+
* TV show.
|
|
1777
|
+
*/
|
|
1778
|
+
images(id, options) {
|
|
1779
|
+
const computedOptions = {
|
|
1780
|
+
include_image_language: csv(options?.include_image_language),
|
|
1781
|
+
language: options?.language
|
|
1782
|
+
};
|
|
1783
|
+
return this.api.get(`${BASE_TV}/${id}/images`, { query: computedOptions });
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Retrieves keywords for a specific TV show asynchronously.
|
|
1787
|
+
*
|
|
1788
|
+
* @param {number} id - The ID of the TV show.
|
|
1789
|
+
* @returns {Promise<Keywords>} A Promise that resolves with the keywords of
|
|
1790
|
+
* the TV show.
|
|
1791
|
+
*/
|
|
1792
|
+
keywords(id) {
|
|
1793
|
+
return this.api.get(`${BASE_TV}/${id}/keywords`);
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* Retrieves recommendations for a specific TV show asynchronously.
|
|
1797
|
+
*
|
|
1798
|
+
* @param {number} id - The ID of the TV show.
|
|
1799
|
+
* @param {LanguageOption & PageOption} [options] - Additional options for
|
|
1800
|
+
* the request.
|
|
1801
|
+
* @returns {Promise<Recommendations>} A Promise that resolves with the
|
|
1802
|
+
* recommendations for the TV show.
|
|
1803
|
+
*/
|
|
1804
|
+
recommendations(id, options) {
|
|
1805
|
+
return this.api.get(`${BASE_TV}/${id}/recommendations`, { query: options });
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Retrieves reviews for a specific TV show asynchronously.
|
|
1809
|
+
*
|
|
1810
|
+
* @param {number} id - The ID of the TV show.
|
|
1811
|
+
* @param {LanguageOption & PageOption} [options] - Additional options for
|
|
1812
|
+
* the request.
|
|
1813
|
+
* @returns {Promise<Reviews>} A Promise that resolves with the reviews of
|
|
1814
|
+
* the TV show.
|
|
1815
|
+
*/
|
|
1816
|
+
reviews(id, options) {
|
|
1817
|
+
return this.api.get(`${BASE_TV}/${id}/reviews`, { query: options });
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* Retrieves information about whether the TV show was screened theatrically
|
|
1821
|
+
* asynchronously.
|
|
1822
|
+
*
|
|
1823
|
+
* @param {number} id - The ID of the TV show.
|
|
1824
|
+
* @returns {Promise<ScreenedTheatrically>} A Promise that resolves with
|
|
1825
|
+
* information about theatrical screenings.
|
|
1826
|
+
*/
|
|
1827
|
+
screenedTheatrically(id) {
|
|
1828
|
+
return this.api.get(`${BASE_TV}/${id}/screened_theatrically`);
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Retrieves similar TV shows for a specific TV show asynchronously.
|
|
1832
|
+
*
|
|
1833
|
+
* @param {number} id - The ID of the TV show.
|
|
1834
|
+
* @param {LanguageOption & PageOption} [options] - Additional options for
|
|
1835
|
+
* the request.
|
|
1836
|
+
* @returns {Promise<Similartv>} A Promise that resolves with the similar TV
|
|
1837
|
+
* shows.
|
|
1838
|
+
*/
|
|
1839
|
+
similar(id, options) {
|
|
1840
|
+
return this.api.get(`${BASE_TV}/${id}/similar`, { query: options });
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* Retrieves translations for a specific TV show asynchronously.
|
|
1844
|
+
*
|
|
1845
|
+
* @param {number} id - The ID of the TV show.
|
|
1846
|
+
* @returns {Promise<Translations>} A Promise that resolves with the
|
|
1847
|
+
* translations of the TV show.
|
|
1848
|
+
*/
|
|
1849
|
+
translations(id) {
|
|
1850
|
+
return this.api.get(`${BASE_TV}/${id}/translations`);
|
|
1851
|
+
}
|
|
1852
|
+
/**
|
|
1853
|
+
* Retrieves videos for a specific TV show asynchronously.
|
|
1854
|
+
*
|
|
1855
|
+
* @param {number} id - The ID of the TV show.
|
|
1856
|
+
* @param {TvShowVideoOptions} [options] - Additional options for the
|
|
1857
|
+
* request.
|
|
1858
|
+
* @returns {Promise<Videos>} A Promise that resolves with the videos of the
|
|
1859
|
+
* TV show.
|
|
1860
|
+
*/
|
|
1861
|
+
videos(id, options) {
|
|
1862
|
+
const computedOptions = {
|
|
1863
|
+
include_video_language: csv(options?.include_video_language),
|
|
1864
|
+
language: options?.language
|
|
1865
|
+
};
|
|
1866
|
+
return this.api.get(`${BASE_TV}/${id}/videos`, { query: computedOptions });
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Retrieves watch providers for a specific TV show asynchronously.
|
|
1870
|
+
* Powered by JustWatch.
|
|
1871
|
+
*
|
|
1872
|
+
* @param {number} id - The ID of the TV show.
|
|
1873
|
+
* @returns {Promise<WatchProviders>} A Promise that resolves with the watch
|
|
1874
|
+
* providers of the TV show.
|
|
1875
|
+
*/
|
|
1876
|
+
watchProviders(id) {
|
|
1877
|
+
return this.api.get(`${BASE_TV}/${id}/watch/providers`);
|
|
1878
|
+
}
|
|
1879
|
+
/**
|
|
1880
|
+
* Retrieves the latest TV show asynchronously.
|
|
1881
|
+
*
|
|
1882
|
+
* @returns {Promise<Latesttv>} A Promise that resolves with the latest TV
|
|
1883
|
+
* show.
|
|
1884
|
+
*/
|
|
1885
|
+
latest() {
|
|
1886
|
+
return this.api.get(`${BASE_TV}/latest`);
|
|
1887
|
+
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Retrieves TV shows that are currently on the air asynchronously.
|
|
1890
|
+
*
|
|
1891
|
+
* @param {PageOption & LanguageOption & TimezoneOption} [options] -
|
|
1892
|
+
* Additional options for the request.
|
|
1893
|
+
* @returns {Promise<OnTheAir>} A Promise that resolves with TV shows
|
|
1894
|
+
* currently on the air.
|
|
1895
|
+
*/
|
|
1896
|
+
onTheAir(options) {
|
|
1897
|
+
return this.api.get(`${BASE_TV}/on_the_air`, { query: options });
|
|
1898
|
+
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Retrieves TV shows that are airing today asynchronously.
|
|
1901
|
+
*
|
|
1902
|
+
* @param {PageOption & LanguageOption & TimezoneOption} [options] -
|
|
1903
|
+
* Additional options for the request.
|
|
1904
|
+
* @returns {Promise<tvAiringToday>} A Promise that resolves with TV shows
|
|
1905
|
+
* airing today.
|
|
1906
|
+
*/
|
|
1907
|
+
airingToday(options) {
|
|
1908
|
+
return this.api.get(`${BASE_TV}/airing_today`, { query: options });
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* Retrieves popular TV shows asynchronously.
|
|
1912
|
+
*
|
|
1913
|
+
* @param {PageOption & LanguageOption} [options] - Additional options for
|
|
1914
|
+
* the request.
|
|
1915
|
+
* @returns {Promise<Populartv>} A Promise that resolves with popular TV
|
|
1916
|
+
* shows.
|
|
1917
|
+
*/
|
|
1918
|
+
popular(options) {
|
|
1919
|
+
return this.api.get(`${BASE_TV}/popular`, { query: options });
|
|
1920
|
+
}
|
|
1921
|
+
/**
|
|
1922
|
+
* Retrieves top-rated TV shows asynchronously.
|
|
1923
|
+
*
|
|
1924
|
+
* @param {PageOption & LanguageOption} [options] - Additional options for
|
|
1925
|
+
* the request.
|
|
1926
|
+
* @returns {Promise<TopRatedtv>} A Promise that resolves with top-rated TV
|
|
1927
|
+
* shows.
|
|
1928
|
+
*/
|
|
1929
|
+
topRated(options) {
|
|
1930
|
+
return this.api.get(`${BASE_TV}/top_rated`, { query: options });
|
|
1931
|
+
}
|
|
1932
|
+
};
|
|
1933
|
+
|
|
1934
|
+
//#endregion
|
|
1935
|
+
//#region src/endpoints/watchProviders.ts
|
|
1936
|
+
/**
|
|
1937
|
+
* Represents an endpoint for accessing watch provider information.
|
|
1938
|
+
*/
|
|
1939
|
+
var WatchProvidersEndpoint = class extends BaseEndpoint {
|
|
1940
|
+
/**
|
|
1941
|
+
* Constructs a new WatchProvidersEndpoint instance.
|
|
1942
|
+
*
|
|
1943
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
1944
|
+
*/
|
|
1945
|
+
constructor(access_token) {
|
|
1946
|
+
super(access_token);
|
|
1947
|
+
this.access_token = access_token;
|
|
1948
|
+
}
|
|
1949
|
+
/**
|
|
1950
|
+
* Retrieves a list of watch providers for movies.
|
|
1951
|
+
*
|
|
1952
|
+
* @returns {Promise<WatchProviderListResponse>} A Promise that resolves with
|
|
1953
|
+
* the list of movie watch providers.
|
|
1954
|
+
*/
|
|
1955
|
+
movie() {
|
|
1956
|
+
return this.api.get("/watch/providers/movie");
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Retrieves a list of watch providers for TV shows.
|
|
1960
|
+
*
|
|
1961
|
+
* @returns {Promise<WatchProviderListResponse>} A Promise that resolves with
|
|
1962
|
+
* the list of TV watch providers.
|
|
1963
|
+
*/
|
|
1964
|
+
tv() {
|
|
1965
|
+
return this.api.get("/watch/providers/tv");
|
|
1966
|
+
}
|
|
1967
|
+
/**
|
|
1968
|
+
* Retrieves a list of available regions for watch providers.
|
|
1969
|
+
*
|
|
1970
|
+
* @returns {Promise<WatchRegionsResponse>} A Promise that resolves with the
|
|
1971
|
+
* list of available regions.
|
|
1972
|
+
*/
|
|
1973
|
+
regions() {
|
|
1974
|
+
return this.api.get("/watch/providers/regions");
|
|
1975
|
+
}
|
|
1976
|
+
};
|
|
1977
|
+
|
|
1978
|
+
//#endregion
|
|
1979
|
+
//#region src/index.ts
|
|
1980
|
+
var TMDB = class {
|
|
1981
|
+
account;
|
|
1982
|
+
certification;
|
|
1983
|
+
changes;
|
|
1984
|
+
collections;
|
|
1985
|
+
companies;
|
|
1986
|
+
configuration;
|
|
1987
|
+
credits;
|
|
1988
|
+
discover;
|
|
1989
|
+
find;
|
|
1990
|
+
genre;
|
|
1991
|
+
keywords;
|
|
1992
|
+
movies;
|
|
1993
|
+
networks;
|
|
1994
|
+
people;
|
|
1995
|
+
review;
|
|
1996
|
+
search;
|
|
1997
|
+
trending;
|
|
1998
|
+
tvEpisodes;
|
|
1999
|
+
tvSeasons;
|
|
2000
|
+
tvShows;
|
|
2001
|
+
watchProviders;
|
|
2002
|
+
constructor(auth) {
|
|
2003
|
+
this.account = new AccountEndpoint(auth);
|
|
2004
|
+
this.certification = new CertificationEndpoint(auth);
|
|
2005
|
+
this.changes = new ChangeEndpoint(auth);
|
|
2006
|
+
this.collections = new CollectionsEndpoint(auth);
|
|
2007
|
+
this.companies = new CompaniesEndpoint(auth);
|
|
2008
|
+
this.configuration = new ConfigurationEndpoint(auth);
|
|
2009
|
+
this.credits = new CreditsEndpoint(auth);
|
|
2010
|
+
this.discover = new DiscoverEndpoint(auth);
|
|
2011
|
+
this.find = new FindEndpoint(auth);
|
|
2012
|
+
this.genre = new GenreEndpoint(auth);
|
|
2013
|
+
this.keywords = new KeywordsEndpoint(auth);
|
|
2014
|
+
this.movies = new MoviesEndpoint(auth);
|
|
2015
|
+
this.networks = new NetworksEndpoint(auth);
|
|
2016
|
+
this.people = new PeopleEndpoint(auth);
|
|
2017
|
+
this.review = new ReviewEndpoint(auth);
|
|
2018
|
+
this.search = new SearchEndpoint(auth);
|
|
2019
|
+
this.trending = new TrendingEndpoint(auth);
|
|
2020
|
+
this.tvEpisodes = new TvEpisodesEndpoint(auth);
|
|
2021
|
+
this.tvSeasons = new TvSeasonsEndpoint(auth);
|
|
2022
|
+
this.tvShows = new TvShowsEndpoint(auth);
|
|
2023
|
+
this.watchProviders = new WatchProvidersEndpoint(auth);
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
//#endregion
|
|
2028
|
+
exports.API = API;
|
|
2029
|
+
exports.BackdropSizes = BackdropSizes;
|
|
2030
|
+
exports.BaseEndpoint = BaseEndpoint;
|
|
2031
|
+
exports.ChangeKeys = ChangeKeys;
|
|
2032
|
+
exports.ImageFormats = ImageFormats;
|
|
2033
|
+
exports.ImageSizes = ImageSizes;
|
|
2034
|
+
exports.LogoSizes = LogoSizes;
|
|
2035
|
+
exports.PosterSizes = PosterSizes;
|
|
2036
|
+
exports.ProfileSizes = ProfileSizes;
|
|
2037
|
+
exports.ReleaseDateType = ReleaseDateType;
|
|
2038
|
+
exports.StillSizes = StillSizes;
|
|
2039
|
+
exports.TMDB = TMDB;
|
|
2040
|
+
exports.TMDBError = TMDBError;
|
|
2041
|
+
exports.TMDB_IMAGE_BASE_URL = TMDB_IMAGE_BASE_URL;
|
|
2042
|
+
exports.csv = csv;
|
|
2043
|
+
exports.formImage = formImage;
|
|
2044
|
+
exports.getFullImagePath = getFullImagePath;
|
|
2045
|
+
exports.parseOptions = parseOptions;
|
|
2046
|
+
exports.withQuery = withQuery;
|