@lorenzopant/tmdb 1.20.0 → 1.20.1

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/dist/index.mjs CHANGED
@@ -1,4758 +1 @@
1
- //#region src/errors/tmdb.ts
2
- /**
3
- * Represents a generic error or an error specific to the TMDB (The Movie Database) API.
4
- * This error class extends the built-in `Error` class and includes additional
5
- * properties to provide more context about the error.
6
- */
7
- var TMDBError = class extends Error {
8
- /**
9
- * The status code returned by the TMDB API.
10
- * If the value is `-1`, it indicates a library-specific error rather than a TMDB API error.
11
- * @reference https://developer.themoviedb.org/docs/errors - code
12
- */
13
- tmdb_status_code;
14
- /**
15
- * A descriptive message providing details about the error.
16
- * If the error is specific to the TMDB API, this message will be derived from the API response
17
- * @reference https://developer.themoviedb.org/docs/errors - message
18
- */
19
- message;
20
- /**
21
- * The HTTP status code associated with the error.
22
- * If the error is specific to the TMDB API, this code will be derived from the API response.
23
- * @reference https://developer.themoviedb.org/docs/errors - HTTP Status
24
- */
25
- http_status_code;
26
- /**
27
- * Creates an instance of `TMDBError`.
28
- *
29
- * @param message - A descriptive message providing details about the error.
30
- * @param http_status - The HTTP status code associated with the error.
31
- * @param tmdb_status_code - (Optional) The status code returned by the TMDB API. Defaults to `-1` for library-specific errors.
32
- */
33
- constructor(message, http_status, tmdb_status_code) {
34
- super(message);
35
- this.name = "TMDBError";
36
- this.tmdb_status_code = tmdb_status_code || -1;
37
- this.message = message;
38
- this.http_status_code = http_status;
39
- }
40
- };
41
- //#endregion
42
- //#region src/types/config/images.ts
43
- const IMAGE_BASE_URL = "http://image.tmdb.org/t/p/";
44
- const IMAGE_SECURE_BASE_URL = "https://image.tmdb.org/t/p/";
45
- const BACKDROP_SIZES = [
46
- "w300",
47
- "w780",
48
- "w1280",
49
- "original"
50
- ];
51
- const LOGO_SIZES = [
52
- "w45",
53
- "w92",
54
- "w154",
55
- "w185",
56
- "w300",
57
- "w500",
58
- "original"
59
- ];
60
- const POSTER_SIZES = [
61
- "w92",
62
- "w154",
63
- "w185",
64
- "w342",
65
- "w500",
66
- "w780",
67
- "original"
68
- ];
69
- const PROFILE_SIZES = [
70
- "w45",
71
- "w185",
72
- "h632",
73
- "original"
74
- ];
75
- const STILL_SIZES = [
76
- "w92",
77
- "w185",
78
- "w300",
79
- "original"
80
- ];
81
- //#endregion
82
- //#region src/utils/logger.ts
83
- var TMDBLogger = class TMDBLogger {
84
- logger;
85
- constructor(logger) {
86
- this.logger = logger;
87
- }
88
- static from(logger) {
89
- if (!logger) return void 0;
90
- if (logger === true) return new TMDBLogger(TMDBLogger.defaultLogger);
91
- return new TMDBLogger(logger);
92
- }
93
- log(entry) {
94
- if (!this.logger) return;
95
- try {
96
- this.logger(entry);
97
- } catch (error) {
98
- console.warn(`TMDB logger error: ${error}`);
99
- }
100
- }
101
- static defaultLogger(entry) {
102
- const prefix = "🎬 [tmdb]";
103
- const timestamp = (/* @__PURE__ */ new Date()).toISOString();
104
- if (entry.type === "request") {
105
- console.log(`${prefix} ${timestamp} 🛰️ REQUEST ${entry.method} ${entry.endpoint} \n`);
106
- return;
107
- }
108
- if (entry.type === "response") {
109
- console.log(`${prefix} ${timestamp} ✅ RESPONSE ${entry.method} ${entry.status} ${entry.statusText} ${entry.endpoint} (${entry.durationMs}ms)\n`);
110
- return;
111
- }
112
- const statusPart = entry.status != null ? `${entry.status} ${entry.statusText}` : "NETWORK ERROR";
113
- const tmdbPart = entry.tmdbStatusCode != null ? ` (tmdb: ${entry.tmdbStatusCode})` : "";
114
- console.log(`${prefix} ${timestamp} ❌ ${entry.method} ${statusPart} ${entry.endpoint} - ${entry.errorMessage}${tmdbPart}\n`);
115
- }
116
- };
117
- //#endregion
118
- //#region src/utils/jwt.ts
119
- function isBase64Url(str) {
120
- return /^[A-Za-z0-9\-_]+$/.test(str);
121
- }
122
- function decodeBase64Url(str) {
123
- try {
124
- const base64 = str.replace(/-/g, "+").replace(/_/g, "/");
125
- const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
126
- return atob(padded);
127
- } catch {
128
- return null;
129
- }
130
- }
131
- function isObject(value) {
132
- return typeof value === "object" && value !== null;
133
- }
134
- function isJwtHeader(value) {
135
- if (!isObject(value)) return false;
136
- return typeof value.alg === "string";
137
- }
138
- function isJwtPayload(value) {
139
- if (!isObject(value)) return false;
140
- if ("exp" in value && typeof value.exp !== "number") return false;
141
- if ("nbf" in value && typeof value.nbf !== "number") return false;
142
- if ("iat" in value && typeof value.iat !== "number") return false;
143
- return true;
144
- }
145
- function isJwt(token) {
146
- if (typeof token !== "string") return false;
147
- const parts = token.split(".");
148
- if (parts.length !== 3) return false;
149
- const [headerB64, payloadB64, signatureB64] = parts;
150
- if (!isBase64Url(headerB64) || !isBase64Url(payloadB64) || !isBase64Url(signatureB64)) return false;
151
- const headerStr = decodeBase64Url(headerB64);
152
- const payloadStr = decodeBase64Url(payloadB64);
153
- if (!headerStr || !payloadStr) return false;
154
- let parsedHeader;
155
- let parsedPayload;
156
- try {
157
- parsedHeader = JSON.parse(headerStr);
158
- parsedPayload = JSON.parse(payloadStr);
159
- } catch {
160
- return false;
161
- }
162
- if (!isJwtHeader(parsedHeader)) return false;
163
- if (!isJwtPayload(parsedPayload)) return false;
164
- return true;
165
- }
166
- //#endregion
167
- //#region src/utils/types.ts
168
- /**
169
- * Typeguard that checks if a value is a record object.
170
- * @param value - The value to check
171
- * @returns `true` if the value is a non-null object that is not an array, `false` otherwise
172
- */
173
- function isRecord(value) {
174
- return typeof value === "object" && value !== null && !Array.isArray(value);
175
- }
176
- /**
177
- * Typeguard that checks whether a value is a plain object.
178
- * Plain objects are objects whose prototype is `Object.prototype` or `null`.
179
- */
180
- function isPlainObject(value) {
181
- if (!isRecord(value)) return false;
182
- const prototype = Object.getPrototypeOf(value);
183
- return prototype === Object.prototype || prototype === null;
184
- }
185
- /** Utility type guard to check if an object has a poster_path property */
186
- function hasPosterPath(data) {
187
- return typeof data === "object" && data !== null && "poster_path" in data && typeof data.poster_path === "string";
188
- }
189
- /** Utility type guard to check if an object has a backdrop_path property */
190
- function hasBackdropPath(data) {
191
- return typeof data === "object" && data !== null && "backdrop_path" in data && typeof data.backdrop_path === "string";
192
- }
193
- /** Utility type guard to check if an object has a profile_path property */
194
- function hasProfilePath(data) {
195
- return typeof data === "object" && data !== null && "profile_path" in data && typeof data.profile_path === "string";
196
- }
197
- /** Utility type guard to check if an object has a still_path property */
198
- function hasStillPath(data) {
199
- return typeof data === "object" && data !== null && "still_path" in data && typeof data.still_path === "string";
200
- }
201
- /** Utility type guard to check if an object has a logo_path property */
202
- function hasLogoPath(data) {
203
- return typeof data === "object" && data !== null && "logo_path" in data && typeof data.logo_path === "string";
204
- }
205
- //#endregion
206
- //#region src/images/images.ts
207
- const IMAGE_PATH_BUILDERS = {
208
- backdrop_path: "backdrop",
209
- logo_path: "logo",
210
- poster_path: "poster",
211
- profile_path: "profile",
212
- still_path: "still"
213
- };
214
- const IMAGE_COLLECTION_BUILDERS = {
215
- backdrops: "backdrop_path",
216
- logos: "logo_path",
217
- posters: "poster_path",
218
- profiles: "profile_path",
219
- stills: "still_path"
220
- };
221
- var ImageAPI = class {
222
- options;
223
- constructor(options = {}) {
224
- this.options = {
225
- secure_images_url: true,
226
- ...options
227
- };
228
- }
229
- buildUrl(path, size) {
230
- return `${this.options.secure_images_url ? IMAGE_SECURE_BASE_URL : IMAGE_BASE_URL}${size}${path}`;
231
- }
232
- backdrop(path, size = this.options.default_image_sizes?.backdrops || "w780") {
233
- return this.buildUrl(path, size);
234
- }
235
- logo(path, size = this.options.default_image_sizes?.logos || "w185") {
236
- return this.buildUrl(path, size);
237
- }
238
- poster(path, size = this.options.default_image_sizes?.posters || "w500") {
239
- return this.buildUrl(path, size);
240
- }
241
- profile(path, size = this.options.default_image_sizes?.profiles || "w185") {
242
- return this.buildUrl(path, size);
243
- }
244
- still(path, size = this.options.default_image_sizes?.still || "w300") {
245
- return this.buildUrl(path, size);
246
- }
247
- /**
248
- * Recursively processes an object or array to autocomplete image paths by transforming string values
249
- * and tracking the current image collection context.
250
- *
251
- * @template T - The type of the value being processed
252
- * @param value - The value to process (can be an object, array, string, or primitive)
253
- * @param collectionKey - Optional image collection key to maintain context during recursion
254
- * @returns The processed value with autocompleted image paths, maintaining the original type
255
- *
256
- * @remarks
257
- * - Arrays are recursively mapped over each entry
258
- * - String values are transformed using {@link transformPathValue}
259
- * - Object keys that match image collection keys update the collection context
260
- * - Non-plain objects (e.g. Date/class instances) are returned unchanged
261
- */
262
- autocompleteImagePaths(value, collectionKey) {
263
- if (Array.isArray(value)) return value.map((entry) => this.autocompleteImagePaths(entry, collectionKey));
264
- if (!isPlainObject(value)) return value;
265
- const transformed = Object.create(null);
266
- for (const [key, entry] of Object.entries(value)) {
267
- if (key === "__proto__" || key === "constructor" || key === "prototype") {
268
- transformed[key] = entry;
269
- continue;
270
- }
271
- if (typeof entry === "string") {
272
- transformed[key] = this.transformPathValue(key, entry, collectionKey);
273
- continue;
274
- }
275
- const nextCollectionKey = this.isImageCollectionKey(key) ? key : collectionKey;
276
- transformed[key] = this.autocompleteImagePaths(entry, nextCollectionKey);
277
- }
278
- return transformed;
279
- }
280
- isImageCollectionKey(value) {
281
- return Object.hasOwn(IMAGE_COLLECTION_BUILDERS, value);
282
- }
283
- isFullUrl(path) {
284
- return /^https?:\/\//.test(path);
285
- }
286
- buildImageUrl(key, path) {
287
- const method = IMAGE_PATH_BUILDERS[key];
288
- if (Object.hasOwn(this, method) || typeof this[method] !== "function") {}
289
- return this[method](path);
290
- }
291
- transformPathValue(key, value, collectionKey) {
292
- if (!value.startsWith("/") || this.isFullUrl(value)) return value;
293
- if (Object.hasOwn(IMAGE_PATH_BUILDERS, key)) return this.buildImageUrl(key, value);
294
- if (key === "file_path" && collectionKey) return this.buildImageUrl(IMAGE_COLLECTION_BUILDERS[collectionKey], value);
295
- return value;
296
- }
297
- };
298
- //#endregion
299
- //#region src/utils/rate-limiter.ts
300
- /**
301
- * A sliding-window rate limiter that queues callers when the request budget is exhausted.
302
- *
303
- * Callers `await acquire()` before dispatching a fetch. If the number of requests made
304
- * within the last `per_ms` milliseconds is below `max_requests`, the caller is released
305
- * immediately. Otherwise it waits until enough time has passed for older timestamps to
306
- * leave the window, then proceeds.
307
- *
308
- * The internal queue is processed serially by a single `process()` loop so there are no
309
- * race conditions between concurrent callers.
310
- */
311
- var RateLimiter = class {
312
- maxRequests;
313
- windowMs;
314
- timestamps = [];
315
- queue = [];
316
- processing = false;
317
- constructor(options = {}) {
318
- const maxRequests = options.max_requests ?? 40;
319
- const perMs = options.per_ms ?? 1e3;
320
- if (!Number.isFinite(maxRequests) || !Number.isInteger(maxRequests) || maxRequests < 1) throw new RangeError(`rate_limit.max_requests must be a finite integer >= 1 (got ${maxRequests})`);
321
- if (!Number.isFinite(perMs) || !Number.isInteger(perMs) || perMs < 1) throw new RangeError(`rate_limit.per_ms must be a finite integer >= 1 (got ${perMs})`);
322
- this.maxRequests = maxRequests;
323
- this.windowMs = perMs;
324
- }
325
- /**
326
- * Resolves when a request slot is available within the current window.
327
- * Requests that cannot be dispatched immediately are queued in FIFO order.
328
- */
329
- acquire() {
330
- return new Promise((resolve) => {
331
- this.queue.push(resolve);
332
- if (!this.processing) this.process();
333
- });
334
- }
335
- async process() {
336
- this.processing = true;
337
- while (this.queue.length > 0) {
338
- const now = Date.now();
339
- this.timestamps = this.timestamps.filter((t) => now - t < this.windowMs);
340
- if (this.timestamps.length < this.maxRequests) {
341
- this.timestamps.push(Date.now());
342
- this.queue.shift()();
343
- } else {
344
- const oldest = this.timestamps[0];
345
- const waitMs = this.windowMs - (Date.now() - oldest) + 1;
346
- await new Promise((r) => setTimeout(r, waitMs));
347
- }
348
- }
349
- this.processing = false;
350
- }
351
- };
352
- //#endregion
353
- //#region src/client.ts
354
- var ApiClient = class {
355
- accessToken;
356
- baseUrl;
357
- logger;
358
- /**
359
- * Tracks in-flight requests keyed by a deterministic string derived from the endpoint
360
- * and its parameters. When two identical requests are fired concurrently, the second
361
- * caller receives the same Promise as the first — only one fetch is made.
362
- * Entries are removed via `.finally()` so the map never holds settled promises.
363
- */
364
- inflightRequests = /* @__PURE__ */ new Map();
365
- deduplication;
366
- rateLimiter;
367
- requestInterceptors;
368
- onSuccessInterceptor;
369
- onErrorInterceptor;
370
- imageApi;
371
- constructor(accessToken, options = {}) {
372
- this.accessToken = accessToken;
373
- this.baseUrl = `https://api.themoviedb.org/${options.version ?? 3}`;
374
- this.logger = TMDBLogger.from(options.logger);
375
- this.deduplication = options.deduplication !== false;
376
- if (options.rate_limit) this.rateLimiter = new RateLimiter(options.rate_limit === true ? {} : options.rate_limit);
377
- const raw = options.interceptors?.request;
378
- this.requestInterceptors = raw == null ? [] : Array.isArray(raw) ? raw : [raw];
379
- this.onSuccessInterceptor = options.interceptors?.response?.onSuccess;
380
- this.onErrorInterceptor = options.interceptors?.response?.onError;
381
- this.imageApi = options.images?.autocomplete_paths ? new ImageAPI(options.images) : void 0;
382
- }
383
- /**
384
- * Builds a stable, order-independent cache key for a request.
385
- *
386
- * `undefined` values are excluded (they are never serialised into the URL),
387
- * and the remaining entries are sorted alphabetically before joining so that
388
- * `{ language, page }` and `{ page, language }` produce the same key.
389
- */
390
- buildRequestKey(endpoint, params) {
391
- const definedEntries = this.serializeParams(params).sort(([a], [b]) => a.localeCompare(b)).map(([key, value]) => `${key}=${value}`);
392
- return definedEntries.length > 0 ? `${endpoint}?${definedEntries.join("&")}` : endpoint;
393
- }
394
- /**
395
- * Serializes request params once so URL construction and deduplication keys stay aligned.
396
- * `undefined` values are intentionally skipped because they are not sent to TMDB.
397
- */
398
- serializeParams(params) {
399
- return Object.entries(params).flatMap(([key, value]) => {
400
- if (value === void 0) return [];
401
- return [[key, String(value)]];
402
- });
403
- }
404
- /**
405
- * Makes an authenticated GET request to the TMDB API, returning the parsed and
406
- * null-sanitised response.
407
- *
408
- * **Deduplication:** when enabled (the default), concurrent calls with the same
409
- * `endpoint` + `params` share a single in-flight fetch. The second (and any
410
- * subsequent) caller receives the same `Promise` — no extra network request is made.
411
- * Once the promise settles (success or error) it is evicted from the map so the next
412
- * call triggers a fresh fetch. Deduplication can be disabled globally via
413
- * `TMDBOptions.deduplication = false`.
414
- */
415
- async request(endpoint, params = {}) {
416
- if (!this.deduplication) return this.execute("GET", endpoint, params);
417
- const key = this.buildRequestKey(endpoint, params);
418
- const existing = this.inflightRequests.get(key);
419
- if (existing) return existing;
420
- const promise = this.execute("GET", endpoint, params).finally(() => {
421
- this.inflightRequests.delete(key);
422
- });
423
- this.inflightRequests.set(key, promise);
424
- return promise;
425
- }
426
- /**
427
- * Runs all registered request interceptors in order, threading the context through each one.
428
- * If an interceptor returns a new context, it replaces the current context for the next interceptor.
429
- */
430
- async runRequestInterceptors(context) {
431
- let current = context;
432
- for (const interceptor of this.requestInterceptors) {
433
- const result = await interceptor(current);
434
- if (result != null) current = result;
435
- }
436
- return current;
437
- }
438
- /**
439
- * Recursively converts null values to undefined in API responses.
440
- * This allows optional properties to model fields that TMDB returns as nullable.
441
- * Response types for nullable fields should account for possible undefined values.
442
- */
443
- sanitizeNulls(value) {
444
- if (value === null) return;
445
- if (typeof value !== "object") return value;
446
- if (Array.isArray(value)) return value.map((v) => this.sanitizeNulls(v));
447
- const sanitized = {};
448
- for (const [key, val] of Object.entries(value)) sanitized[key] = this.sanitizeNulls(val);
449
- return sanitized;
450
- }
451
- async handleError(res, endpoint, method) {
452
- let errorMessage = res.statusText;
453
- let tmdbStatusCode = -1;
454
- try {
455
- const errorBody = await res.json();
456
- if (errorBody && typeof errorBody === "object") {
457
- const err = errorBody;
458
- errorMessage = err.status_message || errorMessage;
459
- tmdbStatusCode = err.status_code || -1;
460
- }
461
- } catch (error) {
462
- console.error(`Unknown error: ${error}`);
463
- }
464
- this.logger?.log({
465
- type: "error",
466
- method,
467
- endpoint,
468
- status: res.status,
469
- statusText: res.statusText,
470
- tmdbStatusCode,
471
- errorMessage
472
- });
473
- const error = new TMDBError(errorMessage, res.status, tmdbStatusCode);
474
- if (this.onErrorInterceptor) await this.onErrorInterceptor(error);
475
- throw error;
476
- }
477
- /**
478
- * Makes an authenticated mutation request to the TMDB API.
479
- * Unlike `request()`, mutations are **never deduplicated** since they change server state.
480
- *
481
- * Accepts `"GET"` in addition to the standard mutation verbs for the rare TMDB endpoints
482
- * (e.g. `GET /4/list/{id}/clear`) that are specified as GET but carry side effects and
483
- * must therefore not be collapsed by the deduplication layer.
484
- *
485
- * @param method - HTTP method to use
486
- * @param endpoint - API path (e.g. "/account/123/favorite")
487
- * @param body - JSON body to send (omit for DELETE/GET requests without a body)
488
- * @param params - Optional query string parameters (e.g. session_id)
489
- */
490
- async mutate(method, endpoint, body, params = {}) {
491
- return this.execute(method, endpoint, params, body);
492
- }
493
- /**
494
- * Shared fetch + response-parsing pipeline used by both `request` and `mutate`.
495
- * Handles URL construction, auth, logging, error mapping, and null sanitisation.
496
- */
497
- async execute(method, endpoint, params, body) {
498
- const bodyJson = body !== void 0 ? JSON.stringify(body) : void 0;
499
- const ctx = await this.runRequestInterceptors({
500
- endpoint,
501
- params,
502
- method
503
- });
504
- const effectiveEndpoint = ctx.endpoint;
505
- const effectiveParams = ctx.params;
506
- const url = new URL(`${this.baseUrl}${effectiveEndpoint}`);
507
- const jwt = isJwt(this.accessToken);
508
- for (const [key, value] of this.serializeParams(effectiveParams)) url.searchParams.append(key, value);
509
- if (!jwt) url.searchParams.append("api_key", this.accessToken);
510
- const startedAt = Date.now();
511
- this.logger?.log({
512
- type: "request",
513
- method,
514
- endpoint: effectiveEndpoint
515
- });
516
- if (this.rateLimiter) await this.rateLimiter.acquire();
517
- let res;
518
- try {
519
- res = await fetch(url.toString(), {
520
- method,
521
- headers: jwt ? {
522
- Authorization: `Bearer ${this.accessToken}`,
523
- "Content-Type": "application/json;charset=utf-8"
524
- } : { "Content-Type": "application/json;charset=utf-8" },
525
- ...bodyJson !== void 0 ? { body: bodyJson } : {}
526
- });
527
- } catch (error) {
528
- this.logger?.log({
529
- type: "error",
530
- method,
531
- endpoint: effectiveEndpoint,
532
- errorMessage: error instanceof Error ? error.message : String(error),
533
- durationMs: Date.now() - startedAt
534
- });
535
- throw error;
536
- }
537
- if (!res.ok) await this.handleError(res, effectiveEndpoint, method);
538
- this.logger?.log({
539
- type: "response",
540
- method,
541
- endpoint: effectiveEndpoint,
542
- status: res.status,
543
- statusText: res.statusText,
544
- durationMs: Date.now() - startedAt
545
- });
546
- const data = await res.json();
547
- const sanitized = this.sanitizeNulls(data);
548
- const transformed = this.imageApi ? this.imageApi.autocompleteImagePaths(sanitized) : sanitized;
549
- if (this.onSuccessInterceptor) {
550
- const result = await this.onSuccessInterceptor(transformed);
551
- return result !== void 0 ? result : transformed;
552
- }
553
- return transformed;
554
- }
555
- };
556
- //#endregion
557
- //#region src/routes.ts
558
- const ENDPOINTS = {
559
- AUTHENTICATION: {
560
- VALIDATE: "/authentication",
561
- GUEST_SESSION: "/authentication/guest_session/new",
562
- REQUEST_TOKEN: "/authentication/token/new",
563
- CREATE_SESSION: "/authentication/session/new",
564
- CREATE_SESSION_WITH_LOGIN: "/authentication/token/validate_with_login",
565
- DELETE_SESSION: "/authentication/session"
566
- },
567
- ACCOUNT: {
568
- DETAILS: "/account",
569
- ADD_FAVORITE: "/favorite",
570
- ADD_TO_WATCHLIST: "/watchlist",
571
- FAVORITE_MOVIES: "/favorite/movies",
572
- FAVORITE_TV: "/favorite/tv",
573
- WATCHLIST_MOVIES: "/watchlist/movies",
574
- WATCHLIST_TV: "/watchlist/tv",
575
- RATED_MOVIES: "/rated/movies",
576
- RATED_TV: "/rated/tv",
577
- RATED_TV_EPISODES: "/rated/tv/episodes",
578
- LISTS: "/lists"
579
- },
580
- CONFIGURATION: {
581
- DETAILS: "/configuration",
582
- COUNTRIES: "/configuration/countries",
583
- JOBS: "/configuration/jobs",
584
- LANGUAGES: "/configuration/languages",
585
- TIMEZONES: "/configuration/timezones",
586
- PRIMARY_TRANSLATIONS: "/configuration/primary_translations"
587
- },
588
- CERTIFICATIONS: {
589
- MOVIE_CERTIFICATIONS: "/certification/movie/list",
590
- TV_CERTIFICATIONS: "/certification/tv/list"
591
- },
592
- CHANGES: {
593
- MOVIE_LIST: "/movie/changes",
594
- PEOPLE_LIST: "/person/changes",
595
- TV_LIST: "/tv/changes"
596
- },
597
- DISCOVER: {
598
- MOVIE: "/discover/movie",
599
- TV: "/discover/tv"
600
- },
601
- FIND: "/find",
602
- CREDITS: { DETAILS: "/credit" },
603
- COMPANIES: {
604
- DETAILS: "/company",
605
- ALTERNATIVE_NAMES: "/alternative_names",
606
- IMAGES: "/images"
607
- },
608
- COLLECTIONS: {
609
- DETAILS: "/collection",
610
- IMAGES: "/images",
611
- TRANSLATIONS: "/translations"
612
- },
613
- GENRES: {
614
- MOVIE_LIST: "/genre/movie/list",
615
- TV_LIST: "/genre/tv/list"
616
- },
617
- KEYWORDS: {
618
- DETAILS: "/keyword",
619
- MOVIES: "/movies"
620
- },
621
- MOVIES: {
622
- DETAILS: "/movie",
623
- ALTERNATIVE_TITLES: "/alternative_titles",
624
- CREDITS: "/credits",
625
- EXTERNAL_IDS: "/external_ids",
626
- KEYWORDS: "/keywords",
627
- CHANGES: "/changes",
628
- IMAGES: "/images",
629
- LATEST: "/latest",
630
- NOW_PLAYING: "/now_playing",
631
- POPULAR: "/popular",
632
- RECOMMENDATIONS: "/recommendations",
633
- RELEASE_DATES: "/release_dates",
634
- REVIEWS: "/reviews",
635
- SIMILAR: "/similar",
636
- TOP_RATED: "/top_rated",
637
- TRANSLATIONS: "/translations",
638
- UPCOMING: "/upcoming",
639
- VIDEOS: "/videos",
640
- WATCH_PROVIDERS: "/watch/providers"
641
- },
642
- NETWORKS: {
643
- DETAILS: "/network",
644
- ALTERNATIVE_NAMES: "/alternative_names",
645
- IMAGES: "/images"
646
- },
647
- PEOPLE: {
648
- DETAILS: "/person",
649
- CHANGES: "/changes",
650
- COMBINED_CREDITS: "/combined_credits",
651
- EXTERNAL_IDS: "/external_ids",
652
- IMAGES: "/images",
653
- LATEST: "/latest",
654
- MOVIE_CREDITS: "/movie_credits",
655
- TAGGED_IMAGES: "/tagged_images",
656
- TRANSLATIONS: "/translations",
657
- TV_CREDITS: "/tv_credits"
658
- },
659
- SEARCH: {
660
- MOVIE: "/search/movie",
661
- COLLECTION: "/search/collection",
662
- COMPANY: "/search/company",
663
- KEYWORD: "/search/keyword",
664
- MULTI: "/search/multi",
665
- PERSON: "/search/person",
666
- TV: "/search/tv"
667
- },
668
- TV_SERIES: {
669
- DETAILS: "/tv",
670
- AGGREGATE_CREDITS: "/aggregate_credits",
671
- AIRING_TODAY: "/airing_today",
672
- ALTERNATIVE_TITLES: "/alternative_titles",
673
- CHANGES: "/changes",
674
- CONTENT_RATINGS: "/content_ratings",
675
- CREDITS: "/credits",
676
- EPISODE_GROUPS: "/episode_groups",
677
- EXTERNAL_IDS: "/external_ids",
678
- IMAGES: "/images",
679
- KEYWORDS: "/keywords",
680
- LATEST: "/latest",
681
- LISTS: "/lists",
682
- ON_THE_AIR: "/on_the_air",
683
- POPULAR: "/popular",
684
- RECOMMENDATIONS: "/recommendations",
685
- REVIEWS: "/reviews",
686
- SCREENED_THEATRICALLY: "/screened_theatrically",
687
- SIMILAR: "/similar",
688
- TOP_RATED: "/top_rated",
689
- TRANSLATIONS: "/translations",
690
- VIDEOS: "/videos",
691
- WATCH_PROVIDERS: "/watch/providers"
692
- },
693
- TV_SEASONS: {
694
- DETAILS: "/season",
695
- AGGREGATE_CREDITS: "/aggregate_credits",
696
- CHANGES: "/changes",
697
- CREDITS: "/credits",
698
- EXTERNAL_IDS: "/external_ids",
699
- IMAGES: "/images",
700
- TRANSLATIONS: "/translations",
701
- VIDEOS: "/videos",
702
- WATCH_PROVIDERS: "/watch/providers"
703
- },
704
- TV_EPISODES: {
705
- DETAILS: "/episode",
706
- CHANGES: "/changes",
707
- CREDITS: "/credits",
708
- EXTERNAL_IDS: "/external_ids",
709
- IMAGES: "/images",
710
- TRANSLATIONS: "/translations",
711
- VIDEOS: "/videos"
712
- },
713
- TV_EPISODE_GROUPS: { DETAILS: "/tv/episode_group" },
714
- WATCH_PROVIDERS: {
715
- MOVIE: "/watch/providers/movie",
716
- TV: "/watch/providers/tv",
717
- REGIONS: "/watch/providers/regions"
718
- },
719
- TRENDING: {
720
- ALL: "/trending/all",
721
- MOVIE: "/trending/movie",
722
- TV: "/trending/tv",
723
- PERSON: "/trending/person"
724
- },
725
- REVIEWS: { DETAILS: "/review" },
726
- PEOPLE_LISTS: { POPULAR: "/person/popular" },
727
- LISTS: {
728
- DETAILS: "/list",
729
- ADD_ITEM: "/add_item",
730
- ITEM_STATUS: "/item_status",
731
- CLEAR: "/clear",
732
- REMOVE_ITEM: "/remove_item"
733
- },
734
- GUEST_SESSIONS: {
735
- DETAILS: "/guest_session",
736
- RATED_MOVIES: "/rated/movies",
737
- RATED_TV: "/rated/tv",
738
- RATED_TV_EPISODES: "/rated/tv/episodes"
739
- }
740
- };
741
- /**
742
- * TMDB API v4 endpoint fragments.
743
- * These are combined with `https://api.themoviedb.org/4` by the v4 ApiClient.
744
- */
745
- const ENDPOINTS_V4 = {
746
- AUTH: {
747
- REQUEST_TOKEN: "/auth/request_token",
748
- ACCESS_TOKEN: "/auth/access_token"
749
- },
750
- ACCOUNT: {
751
- DETAILS: "/account",
752
- LISTS: "/lists",
753
- FAVORITE_MOVIES: "/favorite/movies",
754
- FAVORITE_TV: "/favorite/tv",
755
- WATCHLIST_MOVIES: "/watchlist/movies",
756
- WATCHLIST_TV: "/watchlist/tv",
757
- RATED_MOVIES: "/rated/movies",
758
- RATED_TV: "/rated/tv"
759
- },
760
- LISTS: {
761
- DETAILS: "/list",
762
- ITEMS: "/items",
763
- ITEM_STATUS: "/item_status",
764
- CLEAR: "/clear"
765
- }
766
- };
767
- //#endregion
768
- //#region src/errors/messages.ts
769
- /**
770
- * A collection of error messages used throughout the application.
771
- * For library-specific errors (-1 status code) only.
772
- */
773
- const Errors = {
774
- NO_ACCESS_TOKEN: "TMDB requires a valid access token, please provide one.",
775
- INVALID_CLIENT: "TMDB received an invalid ApiClient instance. Pass a valid ApiClient or an access token string.",
776
- V4_REQUIRES_JWT: "TMDB v4 requires a Bearer (JWT) access token. API key strings are not supported for v4 endpoints."
777
- };
778
- //#endregion
779
- //#region src/endpoints/base.ts
780
- var TMDBAPIBase = class {
781
- client;
782
- defaultOptions;
783
- constructor(accessTokenOrClient, defaultOptions = {}) {
784
- if (typeof accessTokenOrClient === "string") {
785
- if (!accessTokenOrClient) throw new Error(Errors.NO_ACCESS_TOKEN);
786
- this.client = new ApiClient(accessTokenOrClient, {
787
- logger: defaultOptions.logger,
788
- deduplication: defaultOptions.deduplication,
789
- rate_limit: defaultOptions.rate_limit,
790
- interceptors: defaultOptions.interceptors
791
- });
792
- } else if (accessTokenOrClient instanceof ApiClient) this.client = accessTokenOrClient;
793
- else throw new Error(accessTokenOrClient == null ? Errors.NO_ACCESS_TOKEN : Errors.INVALID_CLIENT);
794
- this.defaultOptions = defaultOptions;
795
- }
796
- /**
797
- * Merges the endpoint's params with TMDB-wide defaults (language, region).
798
- * Works only for param types that include optional `language` and `region` fields.
799
- * Only request-safe defaults are merged — config-only options (logger, images, etc.) are excluded.
800
- */
801
- applyDefaults(params) {
802
- const { language, region } = this.defaultOptions;
803
- return {
804
- ...language !== void 0 && { language },
805
- ...region !== void 0 && { region },
806
- ...params
807
- };
808
- }
809
- /**
810
- * Ensures params contains a language: prefer explicit param, fallback to defaultOptions.language.
811
- * If neither is present, returns the original params unmodified.
812
- * When params is undefined but a default language is set, returns { language: defaultLang }.
813
- */
814
- withLanguage(params) {
815
- const defaultLang = this.defaultOptions?.language;
816
- if (!params) return defaultLang !== void 0 ? { language: defaultLang } : void 0;
817
- if (params.language !== void 0) return params;
818
- if (defaultLang === void 0) return params;
819
- return {
820
- ...params,
821
- language: defaultLang
822
- };
823
- }
824
- };
825
- //#endregion
826
- //#region src/endpoints/certifications.ts
827
- var CertificationsAPI = class extends TMDBAPIBase {
828
- /**
829
- * Movie Certifications
830
- * GET - https://api.themoviedb.org/3/certification/movie/list
831
- *
832
- * Get an up to date list of the officially supported movie certifications on TMDB.
833
- * @reference https://developer.themoviedb.org/reference/certification-movie-list
834
- */
835
- async movie_certifications() {
836
- return this.client.request(ENDPOINTS.CERTIFICATIONS.MOVIE_CERTIFICATIONS);
837
- }
838
- /**
839
- * TV Certifications
840
- * GET - https://api.themoviedb.org/3/certification/tv/list
841
- *
842
- * Get an up to date list of the officially supported tv certifications on TMDB.
843
- * @reference https://developer.themoviedb.org/reference/certification-tv-list
844
- */
845
- async tv_certifications() {
846
- return this.client.request(ENDPOINTS.CERTIFICATIONS.TV_CERTIFICATIONS);
847
- }
848
- };
849
- //#endregion
850
- //#region src/endpoints/changes.ts
851
- var ChangesAPI = class extends TMDBAPIBase {
852
- /**
853
- * Movie List
854
- * GET - https://api.themoviedb.org/3/movie/changes
855
- *
856
- * Get a list of all of the movie ids that have been changed in the past 24 hours.
857
- *
858
- * @param page Page number
859
- * @param start_date Start date for change items
860
- * @param end_date End date for change items
861
- * @reference https://developer.themoviedb.org/reference/changes-movie-list
862
- */
863
- async movie_list(params) {
864
- return this.client.request(ENDPOINTS.CHANGES.MOVIE_LIST, params);
865
- }
866
- /**
867
- * People List
868
- * GET - https://api.themoviedb.org/3/person/changes
869
- *
870
- * Get a list of all of the person ids that have been changed in the past 24 hours.
871
- *
872
- * @param page Page number
873
- * @param start_date Start date for change items
874
- * @param end_date End date for change items
875
- * @reference https://developer.themoviedb.org/reference/changes-people-list
876
- */
877
- async people_list(params) {
878
- return this.client.request(ENDPOINTS.CHANGES.PEOPLE_LIST, params);
879
- }
880
- /**
881
- * TV List
882
- * GET - https://api.themoviedb.org/3/tv/changes
883
- *
884
- * Get a list of all of the tv show ids that have been changed in the past 24 hours.
885
- *
886
- * @param page Page number
887
- * @param start_date Start date for change items
888
- * @param end_date End date for change items
889
- * @reference https://developer.themoviedb.org/reference/changes-tv-list
890
- */
891
- async tv_list(params) {
892
- return this.client.request(ENDPOINTS.CHANGES.TV_LIST, params);
893
- }
894
- };
895
- //#endregion
896
- //#region src/endpoints/companies.ts
897
- var CompaniesAPI = class extends TMDBAPIBase {
898
- companyPath(company_id) {
899
- return `${ENDPOINTS.COMPANIES.DETAILS}/${company_id}`;
900
- }
901
- /**
902
- * Details
903
- * GET - https://api.themoviedb.org/3/company/{company_id}
904
- *
905
- * Get the company details by ID.
906
- *
907
- * @param company_id Unique identifier for the company
908
- * @reference https://developer.themoviedb.org/reference/company-details
909
- */
910
- async details(params) {
911
- const endpoint = this.companyPath(params.company_id);
912
- return this.client.request(endpoint);
913
- }
914
- /**
915
- * Alternative names
916
- * GET - https://api.themoviedb.org/3/company/{company_id}/alternative_names
917
- *
918
- * Get the list of alternative names for a company.
919
- *
920
- * @param company_id Unique identifier for the company
921
- * @reference https://developer.themoviedb.org/reference/company-alternative-names
922
- */
923
- async alternative_names(params) {
924
- const endpoint = `${this.companyPath(params.company_id)}${ENDPOINTS.COMPANIES.ALTERNATIVE_NAMES}`;
925
- return this.client.request(endpoint);
926
- }
927
- /**
928
- * Images
929
- * GET - https://api.themoviedb.org/3/company/{company_id}/images
930
- *
931
- * Get the logos for a company by ID.
932
- *
933
- * @param company_id Unique identifier for the company
934
- * @param language Language for the response
935
- * @param include_image_language Additional language for images
936
- * @reference https://developer.themoviedb.org/reference/company-images
937
- */
938
- async images(params) {
939
- const { company_id, ...rest } = params;
940
- const endpoint = `${this.companyPath(company_id)}${ENDPOINTS.COMPANIES.IMAGES}`;
941
- return this.client.request(endpoint, this.withLanguage(rest));
942
- }
943
- };
944
- //#endregion
945
- //#region src/endpoints/credits.ts
946
- var CreditsAPI = class extends TMDBAPIBase {
947
- creditPath(credit_id) {
948
- return `${ENDPOINTS.CREDITS.DETAILS}/${credit_id}`;
949
- }
950
- /**
951
- * Details
952
- * GET - https://api.themoviedb.org/3/credit/{credit_id}
953
- *
954
- * Get the detailed information for a movie or TV credit.
955
- *
956
- * @param credit_id Unique identifier for the credit
957
- * @param language Language for the response
958
- * @reference https://developer.themoviedb.org/reference/credit-details
959
- */
960
- async details(params) {
961
- const { credit_id, ...rest } = params;
962
- const endpoint = this.creditPath(credit_id);
963
- return this.client.request(endpoint, this.withLanguage(rest));
964
- }
965
- };
966
- //#endregion
967
- //#region src/endpoints/collections.ts
968
- var CollectionsAPI = class extends TMDBAPIBase {
969
- collectionPath(collection_id) {
970
- return `${ENDPOINTS.COLLECTIONS.DETAILS}/${collection_id}`;
971
- }
972
- /**
973
- * Details
974
- * GET - https://api.themoviedb.org/3/collection/{collection_id}
975
- *
976
- * Get collection details by ID.
977
- *
978
- * @param collection_id Unique identifier for the collection
979
- * @param language Language for the response
980
- * @reference https://developer.themoviedb.org/reference/collection-details
981
- */
982
- async details(params) {
983
- const { language = this.defaultOptions.language, collection_id } = params;
984
- const endpoint = this.collectionPath(collection_id);
985
- return this.client.request(endpoint, { language });
986
- }
987
- /**
988
- * Images
989
- * GET - https://api.themoviedb.org/3/collection/{collection_id}/images
990
- *
991
- * Get the images that belong to a collection.
992
- * This method will return the backdrops and posters that have been added to a collection.
993
- *
994
- * @param collection_id Unique identifier for the collection
995
- * @param language Language for the response
996
- * @param include_image_language Additional language for images
997
- * @reference https://developer.themoviedb.org/reference/collection-images
998
- */
999
- async images(params) {
1000
- const { collection_id, ...rest } = params;
1001
- const endpoint = `${this.collectionPath(collection_id)}${ENDPOINTS.COLLECTIONS.IMAGES}`;
1002
- return this.client.request(endpoint, this.withLanguage(rest));
1003
- }
1004
- /**
1005
- * Translations
1006
- * GET - https://api.themoviedb.org/3/collection/{collection_id}/translations
1007
- *
1008
- * Get collection translations by ID.
1009
- *
1010
- * @param collection_id Unique identifier for the collection
1011
- * @reference https://developer.themoviedb.org/reference/collection-translations
1012
- */
1013
- async translations(params) {
1014
- const endpoint = `${this.collectionPath(params.collection_id)}${ENDPOINTS.COLLECTIONS.TRANSLATIONS}`;
1015
- return this.client.request(endpoint);
1016
- }
1017
- };
1018
- //#endregion
1019
- //#region src/endpoints/configuration.ts
1020
- var ConfigurationAPI = class extends TMDBAPIBase {
1021
- /**
1022
- * Details
1023
- * GET - https://api.themoviedb.org/3/configuration
1024
- *
1025
- * Query the API configuration details.
1026
- * The data returned here in the configuration endpoint is designed to provide some of
1027
- * the required information you'll need as you integrate our API.
1028
- * For example, you can get a list of valid image sizes and the valid image address.
1029
- * @reference https://developer.themoviedb.org/reference/configuration-details
1030
- */
1031
- async details() {
1032
- return this.client.request(ENDPOINTS.CONFIGURATION.DETAILS);
1033
- }
1034
- /**
1035
- * Countries
1036
- * GET - https://api.themoviedb.org/3/configuration/countries
1037
- *
1038
- * Get the list of countries (ISO 3166-1 tags) used throughout TMDB.
1039
- * @param language Language (Defaults to en-US)
1040
- * @reference https://developer.themoviedb.org/reference/configuration-countries
1041
- */
1042
- async countries(params) {
1043
- return this.client.request(ENDPOINTS.CONFIGURATION.COUNTRIES, this.withLanguage(params));
1044
- }
1045
- /**
1046
- * Jobs
1047
- * GET - https://api.themoviedb.org/3/configuration/jobs
1048
- *
1049
- * Get the list of the jobs and departments used throughout TMDB.
1050
- * @reference https://developer.themoviedb.org/reference/configuration-jobs
1051
- */
1052
- async jobs() {
1053
- return this.client.request(ENDPOINTS.CONFIGURATION.JOBS);
1054
- }
1055
- /**
1056
- * Languages
1057
- * GET - https://api.themoviedb.org/3/configuration/languages
1058
- *
1059
- * Get the list of the languages (ISO 639-1 tags) used throughout TMDB.
1060
- * @reference https://developer.themoviedb.org/reference/configuration-languages
1061
- */
1062
- async languages() {
1063
- return this.client.request(ENDPOINTS.CONFIGURATION.LANGUAGES);
1064
- }
1065
- /**
1066
- * Primary Translations
1067
- * GET - https://api.themoviedb.org/3/configuration/primary_translations
1068
- *
1069
- * Get a list of the officially supported translations on TMDB.
1070
- *
1071
- * While it's technically possible to add a translation in any one of the languages we have added to TMDB
1072
- * (we don't restrict content), the ones listed in this method are the ones
1073
- * we also support for localizing the website with which means they are "primary" translations.
1074
- *
1075
- * These are all specified as IETF tags to identify the languages we use on TMDB. There is one exception which is image languages.
1076
- * They are currently only designated by a ISO-639-1 tag.
1077
- * This is a planned upgrade for the future.
1078
- *
1079
- * We're always open to adding more if you think one should be added.
1080
- * You can ask about getting a new primary translation added by posting on the forums.
1081
- *
1082
- * One more thing to mention, these are the translations that map to our website translation project.
1083
- * You can view and contribute to that project here.
1084
- *
1085
- * @reference https://developer.themoviedb.org/reference/configuration-primary-translations
1086
- */
1087
- async primary_translations() {
1088
- return this.client.request(ENDPOINTS.CONFIGURATION.PRIMARY_TRANSLATIONS);
1089
- }
1090
- /**
1091
- * Timezones
1092
- * GET - https://api.themoviedb.org/3/configuration/timezones
1093
- *
1094
- * Get the list of timezones used throughout TMDB.
1095
- * @reference https://developer.themoviedb.org/reference/configuration-timezones
1096
- */
1097
- async timezones() {
1098
- return this.client.request(ENDPOINTS.CONFIGURATION.TIMEZONES);
1099
- }
1100
- };
1101
- //#endregion
1102
- //#region src/endpoints/discover.ts
1103
- var DiscoverAPI = class extends TMDBAPIBase {
1104
- /**
1105
- * TMDB discover filtering notes:
1106
- *
1107
- * - If `region` is provided on movie discover, TMDB uses the regional release date
1108
- * instead of the primary release date. When `with_release_type` is also provided,
1109
- * the returned release date follows the order of the specified release types.
1110
- * - Filters that accept comma-separated or pipe-separated values are forwarded as-is:
1111
- * commas mean AND, pipes mean OR.
1112
- *
1113
- * @reference https://developer.themoviedb.org/reference/discover-movie
1114
- * @reference https://developer.themoviedb.org/reference/discover-tv
1115
- */
1116
- withMovieDefaults(params) {
1117
- if (!params && !this.defaultOptions.language && !this.defaultOptions.region) return void 0;
1118
- const language = params?.language ?? this.defaultOptions.language;
1119
- const region = params?.region ?? this.defaultOptions.region;
1120
- return {
1121
- ...params,
1122
- language,
1123
- region
1124
- };
1125
- }
1126
- withTVDefaults(params) {
1127
- if (!params && !this.defaultOptions.language && !this.defaultOptions.timezone) return;
1128
- const language = params?.language ?? this.defaultOptions.language;
1129
- const timezone = params?.timezone ?? this.defaultOptions.timezone;
1130
- return {
1131
- ...params,
1132
- language,
1133
- timezone
1134
- };
1135
- }
1136
- /**
1137
- * Movie
1138
- * GET - https://api.themoviedb.org/3/discover/movie
1139
- *
1140
- * Discover movies by applying filters and sort options.
1141
- *
1142
- * @reference https://developer.themoviedb.org/reference/discover-movie
1143
- */
1144
- async movie(params = {}) {
1145
- return this.client.request(ENDPOINTS.DISCOVER.MOVIE, this.withMovieDefaults(params));
1146
- }
1147
- /**
1148
- * TV
1149
- * GET - https://api.themoviedb.org/3/discover/tv
1150
- *
1151
- * Discover TV series by applying filters and sort options.
1152
- *
1153
- * @reference https://developer.themoviedb.org/reference/discover-tv
1154
- */
1155
- async tv(params = {}) {
1156
- return this.client.request(ENDPOINTS.DISCOVER.TV, this.withTVDefaults(params));
1157
- }
1158
- };
1159
- //#endregion
1160
- //#region src/endpoints/find.ts
1161
- var FindAPI = class extends TMDBAPIBase {
1162
- /**
1163
- * By ID
1164
- * GET - https://api.themoviedb.org/3/find/{external_id}
1165
- *
1166
- * Find movies, TV series, seasons, episodes, or people by an external ID.
1167
- *
1168
- * @param external_id External identifier to look up
1169
- * @param external_source Source namespace for the external ID
1170
- * @param language Language for localized results
1171
- * @reference https://developer.themoviedb.org/reference/find-by-id
1172
- */
1173
- async by_id(params) {
1174
- const { external_id, ...rest } = params;
1175
- const endpoint = `${ENDPOINTS.FIND}/${encodeURIComponent(external_id)}`;
1176
- const requestParams = this.withLanguage(rest);
1177
- return this.client.request(endpoint, requestParams);
1178
- }
1179
- };
1180
- //#endregion
1181
- //#region src/endpoints/genres.ts
1182
- var GenresAPI = class extends TMDBAPIBase {
1183
- /**
1184
- * Movie List
1185
- * GET - https://api.themoviedb.org/3/genre/movie/list
1186
- *
1187
- * Get the list of official genres for movies.
1188
- * @param language The language to use for the response.
1189
- * @returns A promise that resolves to the genres list.
1190
- * @reference https://developer.themoviedb.org/reference/genre-movie-list
1191
- */
1192
- async movie_list(params) {
1193
- return this.client.request(ENDPOINTS.GENRES.MOVIE_LIST, this.withLanguage(params));
1194
- }
1195
- /**
1196
- * TV List
1197
- * GET - https://api.themoviedb.org/3/genre/tv/list
1198
- *
1199
- * Get the list of official genres for TV shows.
1200
- * @param language The language to use for the response.
1201
- * @returns A promise that resolves to the genres list.
1202
- * @reference https://developer.themoviedb.org/reference/genre-tv-list
1203
- */
1204
- async tv_list(params) {
1205
- return this.client.request(ENDPOINTS.GENRES.TV_LIST, this.withLanguage(params));
1206
- }
1207
- };
1208
- //#endregion
1209
- //#region src/endpoints/keywords.ts
1210
- var KeywordsAPI = class extends TMDBAPIBase {
1211
- keywordPath(keyword_id) {
1212
- return `${ENDPOINTS.KEYWORDS.DETAILS}/${keyword_id}`;
1213
- }
1214
- /**
1215
- * Details
1216
- * GET - https://api.themoviedb.org/3/keyword/{keyword_id}
1217
- *
1218
- * Get the details of a keyword by ID.
1219
- *
1220
- * @param keyword_id Unique identifier for the keyword
1221
- * @reference https://developer.themoviedb.org/reference/keyword-details
1222
- */
1223
- async details(params) {
1224
- const endpoint = this.keywordPath(params.keyword_id);
1225
- return this.client.request(endpoint);
1226
- }
1227
- /**
1228
- * Movies
1229
- * GET - https://api.themoviedb.org/3/keyword/{keyword_id}/movies
1230
- *
1231
- * Get the movies associated with a keyword.
1232
- *
1233
- * @deprecated TMDB marks this endpoint as deprecated. Use discover/movie with_keywords instead.
1234
- * @param keyword_id Unique identifier for the keyword
1235
- * @param language Language for localized results
1236
- * @param page Page number for paginated results
1237
- * @param include_adult Include adult titles in results
1238
- * @reference https://developer.themoviedb.org/reference/keyword-movies
1239
- */
1240
- async movies(params) {
1241
- const { keyword_id, ...rest } = params;
1242
- const endpoint = `${this.keywordPath(keyword_id)}${ENDPOINTS.KEYWORDS.MOVIES}`;
1243
- const requestParams = this.withLanguage(rest);
1244
- return this.client.request(endpoint, requestParams);
1245
- }
1246
- };
1247
- //#endregion
1248
- //#region src/endpoints/movie_lists.ts
1249
- var MovieListsAPI = class extends TMDBAPIBase {
1250
- withDefaults(params) {
1251
- const { language = this.defaultOptions.language, region = this.defaultOptions.region, ...rest } = params;
1252
- return {
1253
- language,
1254
- region,
1255
- ...rest
1256
- };
1257
- }
1258
- /**
1259
- * Fetch Movie List Wrapper
1260
- * @param endpoint Endpoint to call
1261
- * @param params Params for the request (language, page, region, etc)
1262
- * @returns Specific to endpoint (MovieListResult)
1263
- */
1264
- fetch_movie_list(endpoint, params = {}) {
1265
- return this.client.request(ENDPOINTS.MOVIES.DETAILS + endpoint, this.withDefaults(params));
1266
- }
1267
- /**
1268
- * Now Playing
1269
- * GET - https://api.themoviedb.org/3/movie/now_playing
1270
- *
1271
- * Get a list of movies that are currently in theatres.
1272
- * @param language Language (Defaults to en-US or TMDB default)
1273
- * @param page Page (Defaults to 1)
1274
- * @param region ISO-3166-1 code
1275
- */
1276
- async now_playing(params = {}) {
1277
- return this.fetch_movie_list(ENDPOINTS.MOVIES.NOW_PLAYING, params);
1278
- }
1279
- /**
1280
- * Popular
1281
- * GET - https://api.themoviedb.org/3/movie/popular
1282
- *
1283
- * Get a list of movies ordered by popularity.
1284
- * @param language Language (Defaults to en-US or TMDB default)
1285
- * @param page Page (Defaults to 1)
1286
- * @param region ISO-3166-1 code
1287
- */
1288
- async popular(params = {}) {
1289
- return this.fetch_movie_list(ENDPOINTS.MOVIES.POPULAR, params);
1290
- }
1291
- /**
1292
- * Top Rated
1293
- * GET - https://api.themoviedb.org/3/movie/top_rated
1294
- *
1295
- * Get a list of movies ordered by rating.
1296
- * @param language Language (Defaults to en-US or TMDB default)
1297
- * @param page Page (Defaults to 1)
1298
- * @param region ISO-3166-1 code
1299
- */
1300
- async top_rated(params = {}) {
1301
- return this.fetch_movie_list(ENDPOINTS.MOVIES.TOP_RATED, params);
1302
- }
1303
- /**
1304
- * Upcoming
1305
- * GET - https://api.themoviedb.org/3/movie/upcoming
1306
- *
1307
- * Get a list of movies that are being released soon.
1308
- * @param language Language (Defaults to en-US or TMDB default)
1309
- * @param page Page (Defaults to 1)
1310
- * @param region ISO-3166-1 code
1311
- */
1312
- async upcoming(params = {}) {
1313
- return this.fetch_movie_list(ENDPOINTS.MOVIES.UPCOMING, params);
1314
- }
1315
- };
1316
- //#endregion
1317
- //#region src/endpoints/movies.ts
1318
- var MoviesAPI = class extends TMDBAPIBase {
1319
- moviePath(movie_id) {
1320
- return `${ENDPOINTS.MOVIES.DETAILS}/${movie_id}`;
1321
- }
1322
- movieSubPath(movie_id, route) {
1323
- return `${this.moviePath(movie_id)}${route}`;
1324
- }
1325
- /**
1326
- * Details
1327
- * GET - https://api.themoviedb.org/3/movie/{movie_id}
1328
- *
1329
- * Get the top level details of a movie by ID.
1330
- * @param movie_id The ID of the movie.
1331
- * @param append_to_response A comma-separated list of the fields to include in the response.
1332
- * @param language The language to use for the response.
1333
- * @returns A promise that resolves to the movie details.
1334
- * @reference https://developer.themoviedb.org/reference/movie-details
1335
- */
1336
- async details(params) {
1337
- const { language = this.defaultOptions.language, movie_id, append_to_response } = params;
1338
- const endpoint = this.moviePath(movie_id);
1339
- return this.client.request(endpoint, {
1340
- language,
1341
- append_to_response
1342
- });
1343
- }
1344
- /**
1345
- * Alternative Titles
1346
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/alternative_titles
1347
- *
1348
- * Get the alternative titles for a movie (ex. Russian name, Indian names etc..).
1349
- * @param movie_id The ID of the movie.
1350
- * @param country The ISO 3166-1 code of the country to get alternative titles for.
1351
- * @returns A promise that resolves to the movie alternative titles.
1352
- * @reference https://developer.themoviedb.org/reference/movie-alternative-titles
1353
- */
1354
- async alternative_titles(params) {
1355
- const { movie_id, ...rest } = params;
1356
- const endpoint = this.movieSubPath(movie_id, ENDPOINTS.MOVIES.ALTERNATIVE_TITLES);
1357
- return this.client.request(endpoint, rest);
1358
- }
1359
- /**
1360
- * Credits
1361
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/credits
1362
- *
1363
- * Get the cast and crew members details for a movie.
1364
- * @param movie_id The ID of the movie.
1365
- * @param language The ISO 639-1 code of the language to use for the response. Default is "en-US".
1366
- * @returns A promise that resolves to the movie credits.
1367
- * @reference https://developer.themoviedb.org/reference/movie-credits
1368
- */
1369
- async credits(params) {
1370
- const { movie_id, language = this.defaultOptions.language, ...rest } = params;
1371
- const endpoint = this.movieSubPath(movie_id, ENDPOINTS.MOVIES.CREDITS);
1372
- return this.client.request(endpoint, {
1373
- language,
1374
- ...rest
1375
- });
1376
- }
1377
- /**
1378
- * External IDs
1379
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/external_ids
1380
- *
1381
- * Get the external IDs for a movie (ex. IMDB, Facebook, Instagram etc..).
1382
- * Supported external IDs are: IMDB, Facebook, Instagram, Twitter, and Wikidata.
1383
- *
1384
- * @param movie_id The ID of the movie.
1385
- * @returns A promise that resolves to the movie external IDs.
1386
- * @reference https://developer.themoviedb.org/reference/movie-external-ids
1387
- */
1388
- async external_ids(params) {
1389
- const endpoint = this.movieSubPath(params.movie_id, ENDPOINTS.MOVIES.EXTERNAL_IDS);
1390
- return this.client.request(endpoint);
1391
- }
1392
- /**
1393
- * Keywords
1394
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/keywords
1395
- *
1396
- * Get the keywords that have been added to a movie.
1397
- * This is a list of keywords that have been added to the movie.
1398
- * @param movie_id The ID of the movie.
1399
- * @returns A promise that resolves to the movie keywords.
1400
- * @reference https://developer.themoviedb.org/reference/movie-keywords
1401
- */
1402
- async keywords(params) {
1403
- const endpoint = this.movieSubPath(params.movie_id, ENDPOINTS.MOVIES.KEYWORDS);
1404
- return this.client.request(endpoint);
1405
- }
1406
- /**
1407
- * Changes
1408
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/changes
1409
- *
1410
- * Get the changes for a movie. This is a list of all the changes that have been made to a movie.
1411
- * By default, only the last 24 hours are returned.
1412
- * You can query up to 14 days in a single query by using the start_date and end_date query parameters.
1413
- * @param movie_id The ID of the movie.
1414
- * @param page Page number of the results to return. Defaults to 1.
1415
- * @param start_date Optional start date for the changes. Format: YYYY-MM-DD.
1416
- * @param end_date Optional end date for the changes. Format: YYYY-MM-DD.
1417
- * @returns A promise that resolves to the changes made to the movie.
1418
- * @reference https://developer.themoviedb.org/reference/movie-changes
1419
- */
1420
- async changes(params) {
1421
- const { movie_id, ...rest } = params;
1422
- const endpoint = this.movieSubPath(movie_id, ENDPOINTS.MOVIES.CHANGES);
1423
- return this.client.request(endpoint, rest);
1424
- }
1425
- /**
1426
- * Images
1427
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/images
1428
- *
1429
- * Fetches images related to a specific movie, such as posters and backdrops.
1430
- * The images are returned in various sizes and formats.
1431
- *
1432
- * If you have a language specified, it will act as a filter on the returned items. You can use the include_image_language param to query additional languages.
1433
- *
1434
- * @param movie_id - The unique identifier of the movie.
1435
- * @param language - (Optional) The language code to filter the images by language.
1436
- * @param include_image_language - (Optional) A comma-separated list of language codes to include images for.
1437
- * @returns A promise that resolves to a `MovieImages` object containing the movie's images.
1438
- * @reference https://developer.themoviedb.org/reference/movie-images
1439
- */
1440
- async images(params) {
1441
- const { movie_id, language = this.defaultOptions.language, ...rest } = params;
1442
- const endpoint = this.movieSubPath(movie_id, ENDPOINTS.MOVIES.IMAGES);
1443
- return this.client.request(endpoint, {
1444
- language,
1445
- ...rest
1446
- });
1447
- }
1448
- /**
1449
- * Latest
1450
- * GET - https://api.themoviedb.org/3/movie/latest
1451
- *
1452
- * Get the newest movie ID.
1453
- * This is the most recent movie that has been added to TMDB. This is a live response will continuously change as new movies are added.
1454
- * @returns A promise that resolves to the latest movie details.
1455
- * @reference https://developer.themoviedb.org/reference/movie-latest-id
1456
- */
1457
- async latest() {
1458
- const endpoint = `${ENDPOINTS.MOVIES.DETAILS}${ENDPOINTS.MOVIES.LATEST}`;
1459
- return this.client.request(endpoint);
1460
- }
1461
- /**
1462
- * Recommendations
1463
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/recommendations
1464
- *
1465
- * Get a list of recommended movies for a specific movie.
1466
- * This is based on the movie's popularity and user ratings.
1467
- * @param movie_id The ID of the movie.
1468
- * @param page Page number of the results to return. Defaults to 1.
1469
- * @param language Language code to filter the results. Default is "en-US".
1470
- * @returns A promise that resolves to a paginated response of similar movies.
1471
- * @reference https://developer.themoviedb.org/reference/movie-recommendations
1472
- */
1473
- async recommendations(params) {
1474
- const { movie_id, language = this.defaultOptions.language, ...rest } = params;
1475
- const endpoint = this.movieSubPath(movie_id, ENDPOINTS.MOVIES.RECOMMENDATIONS);
1476
- return this.client.request(endpoint, {
1477
- language,
1478
- ...rest
1479
- });
1480
- }
1481
- /**
1482
- * Release Dates
1483
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/release_dates
1484
- *
1485
- * Get the release dates and certifications for a movie. For different countries and release types.
1486
- * The release types and statuses used on TMDB are the following:
1487
- * - 1: Premiere
1488
- * - 2: Theatrical (Limited)
1489
- * - 3: Theatrical
1490
- * - 4: Digital
1491
- * - 5: Physical
1492
- * - 6: TV
1493
- * @param movie_id The ID of the movie.
1494
- * @returns A promise that resolves to the release dates for the movie.
1495
- * @reference https://developer.themoviedb.org/reference/movie-release-dates
1496
- */
1497
- async release_dates(params) {
1498
- const endpoint = this.movieSubPath(params.movie_id, ENDPOINTS.MOVIES.RELEASE_DATES);
1499
- return this.client.request(endpoint);
1500
- }
1501
- /**
1502
- * Reviews
1503
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/reviews
1504
- *
1505
- * Get the user reviews for a movie.
1506
- * @param movie_id The ID of the movie.
1507
- * @param page Page number of the results to return. Defaults to 1.
1508
- * @param language Language code to filter the results. Default is "en-US".
1509
- * @returns A promise that resolves to a paginated response of movies reviews.
1510
- * @reference https://developer.themoviedb.org/reference/movie-reviews
1511
- */
1512
- async reviews(params) {
1513
- const { movie_id, language = this.defaultOptions.language, ...rest } = params;
1514
- const endpoint = this.movieSubPath(movie_id, ENDPOINTS.MOVIES.REVIEWS);
1515
- return this.client.request(endpoint, {
1516
- language,
1517
- ...rest
1518
- });
1519
- }
1520
- /**
1521
- * Similar
1522
- * GET -https://api.themoviedb.org/3/movie/{movie_id}/similar
1523
- *
1524
- * Get the similar movies based on genres and keywords.
1525
- * This method only looks for other items based on genres and plot keywords.
1526
- * As such, the results found here are not always going to be 💯. Use it with that in mind.
1527
- * @param movie_id The ID of the movie
1528
- * @param page Page number of the results to return. Defaults to 1.
1529
- * @param language Language code to filter the results. Default is "en-US".
1530
- * @returns A promise that resolves to a paginated response of similar movies.
1531
- * @reference https://developer.themoviedb.org/reference/movie-similar
1532
- */
1533
- async similar(params) {
1534
- const { movie_id, language = this.defaultOptions.language, ...rest } = params;
1535
- const endpoint = this.movieSubPath(movie_id, ENDPOINTS.MOVIES.SIMILAR);
1536
- return this.client.request(endpoint, {
1537
- language,
1538
- ...rest
1539
- });
1540
- }
1541
- /**
1542
- * Translations
1543
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/translations
1544
- *
1545
- * Get the translations for a movie.
1546
- * Take a read through our language documentation for more information about languages on TMDB.
1547
- * https://developer.themoviedb.org/docs/languages
1548
- * @param movie_id The ID of the movie
1549
- * @returns A promise that resolves to the translations of the movie.
1550
- * @reference https://developer.themoviedb.org/reference/movie-translations
1551
- */
1552
- async translations(params) {
1553
- const endpoint = this.movieSubPath(params.movie_id, ENDPOINTS.MOVIES.TRANSLATIONS);
1554
- return this.client.request(endpoint);
1555
- }
1556
- /**
1557
- * Videos
1558
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/videos
1559
- *
1560
- * Get the available videos for a movie.
1561
- * @param movie_id The ID of the movie
1562
- * @returns A promise that resolves to a list of videos for the movie.
1563
- * @reference https://developer.themoviedb.org/reference/movie-videos
1564
- */
1565
- async videos(params) {
1566
- const { movie_id, language = this.defaultOptions.language, ...rest } = params;
1567
- const endpoint = this.movieSubPath(movie_id, ENDPOINTS.MOVIES.VIDEOS);
1568
- return this.client.request(endpoint, {
1569
- language,
1570
- ...rest
1571
- });
1572
- }
1573
- /**
1574
- * Watch Providers
1575
- * GET - https://api.themoviedb.org/3/movie/{movie_id}/watch/providers
1576
- *
1577
- * Get the list of streaming providers we have for a movie.
1578
- * Powered by our partnership with JustWatch, you can query this method to get a list of the streaming/rental/purchase availabilities per country by provider.
1579
- * This is not going to return full deep links, but rather, it's just enough information to display what's available where.
1580
- * You can link to the provided TMDB URL to help support TMDB and provide the actual deep links to the content.
1581
- *
1582
- * JustWatch ATTRIBUTION REQUIRED
1583
- * In order to use this data you must attribute the source of the data as JustWatch.
1584
- * If we find any usage not complying with these terms we will revoke access to the API.
1585
- * @param movie_id The ID of the movie
1586
- * @returns A promise that resolves to a list of videos for the movie.
1587
- * @reference https://developer.themoviedb.org/reference/movie-videos
1588
- */
1589
- async watch_providers(params) {
1590
- const endpoint = this.movieSubPath(params.movie_id, ENDPOINTS.MOVIES.WATCH_PROVIDERS);
1591
- return this.client.request(endpoint);
1592
- }
1593
- };
1594
- //#endregion
1595
- //#region src/endpoints/search.ts
1596
- var SearchAPI = class extends TMDBAPIBase {
1597
- /**
1598
- * Search Collection
1599
- * GET - https://api.themoviedb.org/3/search/collection
1600
- *
1601
- * Search for collections by their original, translated and alternative names.
1602
- * @param query Search query (required)
1603
- * @param include_adult Include Adult (Defaults to false)
1604
- * @param language Language (Defaults to en-US)
1605
- * @param page Page (Defaults to 1)
1606
- * @param region Region
1607
- * @reference https://developer.themoviedb.org/reference/search-collection
1608
- */
1609
- async collections(params) {
1610
- return this.client.request(ENDPOINTS.SEARCH.COLLECTION, this.applyDefaults(params));
1611
- }
1612
- /**
1613
- * Search Movies
1614
- * GET - https://api.themoviedb.org/3/search/movie
1615
- *
1616
- * Search for movies by their original, translated and alternative titles.
1617
- * @param query Search query (required)
1618
- * @param include_adult Include Adult (Defaults to false)
1619
- * @param language Language (Defaults to en-US)
1620
- * @param primary_release_year: string
1621
- * @param page Page (Defaults to 1)
1622
- * @param region Region
1623
- * @param year Year
1624
- * @reference https://developer.themoviedb.org/reference/search-movie
1625
- */
1626
- async movies(params) {
1627
- return this.client.request(ENDPOINTS.SEARCH.MOVIE, this.applyDefaults(params));
1628
- }
1629
- /**
1630
- * Search Company
1631
- * GET - https://api.themoviedb.org/3/search/company
1632
- *
1633
- * Search for companies by their original and alternative names.
1634
- * @param query Search query (required)
1635
- * @param page Page (Defaults to 1)
1636
- * @reference https://developer.themoviedb.org/reference/search-company
1637
- */
1638
- async company(params) {
1639
- return this.client.request(ENDPOINTS.SEARCH.COMPANY, this.applyDefaults(params));
1640
- }
1641
- /**
1642
- * Search Keyword
1643
- * GET - https://api.themoviedb.org/3/search/keyword
1644
- *
1645
- * Search for keywords by their name.
1646
- * @param query Search query (required)
1647
- * @param page Page (Defaults to 1)
1648
- * @reference https://developer.themoviedb.org/reference/search-keyword
1649
- */
1650
- async keyword(params) {
1651
- return this.client.request(ENDPOINTS.SEARCH.KEYWORD, this.applyDefaults(params));
1652
- }
1653
- /**
1654
- * Search Person
1655
- * GET - https://api.themoviedb.org/3/search/person
1656
- *
1657
- * Search for people by their name and also known as names.
1658
- * @param query Search query (required)
1659
- * @param page Page (Defaults to 1)
1660
- * @reference https://developer.themoviedb.org/reference/search-person
1661
- */
1662
- async person(params) {
1663
- return this.client.request(ENDPOINTS.SEARCH.PERSON, this.applyDefaults(params));
1664
- }
1665
- /**
1666
- * Search TV Series
1667
- * GET - https://api.themoviedb.org/3/search/tv
1668
- *
1669
- * Search for TV shows by their original, translated and also known as names.
1670
- * @param query Search query (required)
1671
- * @param include_adult Include Adult (Defaults to false)
1672
- * @param language Language (Defaults to en-US)
1673
- * @param page Page (Defaults to 1)
1674
- * @param first_air_date_year Filter by first air date year
1675
- * @param year Filter by any air date year (including episodes)
1676
- * @reference https://developer.themoviedb.org/reference/search-tv
1677
- */
1678
- async tv_series(params) {
1679
- return this.client.request(ENDPOINTS.SEARCH.TV, this.applyDefaults(params));
1680
- }
1681
- /**
1682
- * Search Multi
1683
- * GET - https://api.themoviedb.org/3/search/multi
1684
- *
1685
- * Search for movies, TV shows, and people in a single request.
1686
- * @param query Search query (required)
1687
- * @param include_adult Include Adult (Defaults to false)
1688
- * @param language Language (Defaults to en-US)
1689
- * @param page Page (Defaults to 1)
1690
- * @reference https://developer.themoviedb.org/reference/search-multi
1691
- */
1692
- async multi(params) {
1693
- return this.client.request(ENDPOINTS.SEARCH.MULTI, this.applyDefaults(params));
1694
- }
1695
- };
1696
- //#endregion
1697
- //#region src/endpoints/tv_series.ts
1698
- var TVSeriesAPI = class extends TMDBAPIBase {
1699
- seriesPath(series_id) {
1700
- return `${ENDPOINTS.TV_SERIES.DETAILS}/${series_id}`;
1701
- }
1702
- seriesSubPath(series_id, route) {
1703
- return `${this.seriesPath(series_id)}${route}`;
1704
- }
1705
- /**
1706
- * Details
1707
- * GET - https://api.themoviedb.org/3/tv/{series_id}
1708
- *
1709
- * Get the top level details of a TV series by ID.
1710
- * @param series_id The ID of the TV series.
1711
- * @param append_to_response A comma-separated list of the fields to include in the response.
1712
- * @param language The language to use for the response.
1713
- * @returns A promise that resolves to the TV series details.
1714
- * @reference https://developer.themoviedb.org/reference/tv-series-details
1715
- */
1716
- async details(params) {
1717
- const { language = this.defaultOptions.language, series_id, ...rest } = params;
1718
- const endpoint = this.seriesPath(series_id);
1719
- return this.client.request(endpoint, {
1720
- language,
1721
- ...rest
1722
- });
1723
- }
1724
- /**
1725
- * Aggregate Credits
1726
- * GET - https://api.themoviedb.org/3/tv/{series_id}/aggregate_credits
1727
- *
1728
- * Get the aggregate credits (cast and crew) that have been added to a TV show.
1729
- *
1730
- * NOTE: This call differs from the main credits call in that it does not return the newest season.
1731
- * Instead, it is a view of all the entire cast & crew for all episodes belonging to a TV show.
1732
- * @param series_id The ID of the TV series.
1733
- * @param language The language to use for the response.
1734
- * @returns A promise that resolves to the TV series aggregate credits.
1735
- * @reference https://developer.themoviedb.org/reference/tv-series-aggregate-credits
1736
- */
1737
- async aggregate_credits(params) {
1738
- const { language = this.defaultOptions.language, series_id, ...rest } = params;
1739
- const endpoint = this.seriesSubPath(series_id, ENDPOINTS.TV_SERIES.AGGREGATE_CREDITS);
1740
- return this.client.request(endpoint, {
1741
- language,
1742
- ...rest
1743
- });
1744
- }
1745
- /**
1746
- * Alternative Titles
1747
- * GET - https://api.themoviedb.org/3/tv/{series_id}/alternative_tiles
1748
- *
1749
- * Get the alternative titles that have been added to a TV show.
1750
- * @param series_id The ID of the TV series.
1751
- * @returns A promise that resolves to the TV series alternative tiles.
1752
- * @reference https://developer.themoviedb.org/reference/tv-series-alternative-titles
1753
- */
1754
- async alternative_titles(params) {
1755
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.ALTERNATIVE_TITLES);
1756
- return this.client.request(endpoint);
1757
- }
1758
- /**
1759
- * Changes
1760
- * GET - https://api.themoviedb.org/3/tv/{series_id}/changes
1761
- *
1762
- * Get the changes for a TV show. By default only the last 24 hours are returned.
1763
- * You can query up to 14 days in a single query by using the start_date and end_date query parameters.
1764
- *
1765
- * NOTE: TV show changes are a little different than movie changes in that there are some edits
1766
- * on seasons and episodes that will create a top level change entry at the show level.
1767
- * These can be found under the season and episode keys.
1768
- * These keys will contain a series_id and episode_id.
1769
- * You can use the season changes and episode changes methods to look these up individually.
1770
- *
1771
- * @param series_id The ID of the TV series.
1772
- * @returns A promise that resolves to the TV series changes history.
1773
- * @reference https://developer.themoviedb.org/reference/tv-series-changes
1774
- */
1775
- async changes(params) {
1776
- const { series_id, ...rest } = params;
1777
- const endpoint = this.seriesSubPath(series_id, ENDPOINTS.TV_SERIES.CHANGES);
1778
- return this.client.request(endpoint, { ...rest });
1779
- }
1780
- /**
1781
- * Content Ratings
1782
- * GET - https://api.themoviedb.org/3/tv/{series_id}/content_ratings
1783
- *
1784
- * Get the content ratings that have been added to a TV show.
1785
- * @param series_id The ID of the TV series.
1786
- * @returns A promise that resolves to the TV series content ratings.
1787
- * @reference https://developer.themoviedb.org/reference/tv-series-content-ratings
1788
- */
1789
- async content_ratings(params) {
1790
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.CONTENT_RATINGS);
1791
- return this.client.request(endpoint);
1792
- }
1793
- /**
1794
- * Credits
1795
- * GET - https://api.themoviedb.org/3/tv/{series_id}/credits
1796
- *
1797
- * Get the latest season credits of a TV show.
1798
- *
1799
- * This is the original TV credits method which returns the latest season credit data.
1800
- * If you would like to request the aggregate view (which is what you see on our website)
1801
- * you should use the /aggregate_credits method.
1802
- * @param series_id The ID of the TV series.
1803
- * @param language The Language for the credits
1804
- * @returns A promise that resolves to the TV series credits.
1805
- * @reference https://developer.themoviedb.org/reference/tv-series-credits
1806
- */
1807
- async credits(params) {
1808
- const { language = this.defaultOptions.language, series_id, ...rest } = params;
1809
- const endpoint = this.seriesSubPath(series_id, ENDPOINTS.TV_SERIES.CREDITS);
1810
- return this.client.request(endpoint, {
1811
- language,
1812
- ...rest
1813
- });
1814
- }
1815
- /**
1816
- * Episode Groups
1817
- * GET - https://api.themoviedb.org/3/tv/{series_id}/episode_groups
1818
- *
1819
- * Get the episode groups that have been added to a TV show.
1820
- * With a group ID you can call the get TV episode group details method.
1821
- * @param series_id The ID of the TV series.
1822
- * @returns A promise that resolves to the TV series episode groups.
1823
- * @reference https://developer.themoviedb.org/reference/tv-series-episode-groups
1824
- */
1825
- async episode_groups(params) {
1826
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.EPISODE_GROUPS);
1827
- return this.client.request(endpoint);
1828
- }
1829
- /**
1830
- * External IDs
1831
- * GET - https://api.themoviedb.org/3/tv/{series_id}/external_ids
1832
- *
1833
- * Get a list of external IDs that have been added to a TV show.
1834
- * @param series_id The ID of the TV series.
1835
- * @returns A promise that resolves to the TV series external ids.
1836
- * @reference https://developer.themoviedb.org/reference/tv-series-external-ids
1837
- */
1838
- async external_ids(params) {
1839
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.EXTERNAL_IDS);
1840
- return this.client.request(endpoint);
1841
- }
1842
- /**
1843
- * Images
1844
- * GET - https://api.themoviedb.org/3/tv/{series_id}/images
1845
- *
1846
- * Fetches images related to a specific tv show, such as posters and backdrops.
1847
- * The images are returned in various sizes and formats.
1848
- *
1849
- * NOTE: If you have a language specified, it will act as a filter on the returned items. You can use the include_image_language param to query additional languages.
1850
- *
1851
- * @param series_id - The unique identifier of the tv show.
1852
- * @param language - (Optional) The language code to filter the images by language.
1853
- * @param include_image_language - (Optional) A comma-separated list of language codes to include images for.
1854
- * @returns A promise that resolves to a `TVImages` object containing the tv show's images.
1855
- * @reference https://developer.themoviedb.org/reference/tv-series-images
1856
- */
1857
- async images(params) {
1858
- const { language = this.defaultOptions.language, series_id, ...rest } = params;
1859
- const endpoint = this.seriesSubPath(series_id, ENDPOINTS.TV_SERIES.IMAGES);
1860
- return this.client.request(endpoint, {
1861
- language,
1862
- ...rest
1863
- });
1864
- }
1865
- /**
1866
- * Keywords
1867
- * GET - https://api.themoviedb.org/3/tv/{series_id}/keywords
1868
- *
1869
- * Get a list of keywords that have been added to a TV show.
1870
- * @param series_id The ID of the TV series.
1871
- * @returns A promise that resolves to the TV series keywords.
1872
- * @reference https://developer.themoviedb.org/reference/tv-series-keywords
1873
- */
1874
- async keywords(params) {
1875
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.KEYWORDS);
1876
- return this.client.request(endpoint);
1877
- }
1878
- /**
1879
- * Latest
1880
- * GET - https://api.themoviedb.org/3/tv/latest
1881
- *
1882
- * Get the newest tv show.
1883
- * This is a live response and will continuosly change.
1884
- * @returns A promise that resolves to the lastest TV series.
1885
- * @reference https://developer.themoviedb.org/reference/tv-series-latest-id
1886
- */
1887
- async latest() {
1888
- const endpoint = `${ENDPOINTS.TV_SERIES.DETAILS}${ENDPOINTS.TV_SERIES.LATEST}`;
1889
- return this.client.request(endpoint);
1890
- }
1891
- /**
1892
- * Lists
1893
- * GET - https://api.themoviedb.org/3/tv/{series_id}/lists
1894
- *
1895
- * Get the lists that a TV series has been added to.
1896
- * @param series_id The ID of the TV series.
1897
- * @param language The Language for the lists
1898
- * @param page Page number - Defaults to 1
1899
- * @returns A promise that resolves to the TV series lists.
1900
- * @reference https://developer.themoviedb.org/reference/lists-copy (TODO: Check this url for updates, it's like this on TMDB docs (??))
1901
- */
1902
- async lists(params) {
1903
- const { language = this.defaultOptions.language, series_id, ...rest } = params;
1904
- const endpoint = this.seriesSubPath(series_id, ENDPOINTS.TV_SERIES.LISTS);
1905
- return this.client.request(endpoint, {
1906
- language,
1907
- ...rest
1908
- });
1909
- }
1910
- /**
1911
- * Recomendations
1912
- * GET - https://api.themoviedb.org/3/tv/{series_id}/recommendations
1913
- *
1914
- * Get the recommendations shows for a TV series.
1915
- * @param series_id The ID of the TV series.
1916
- * @param language The Language for the lists
1917
- * @param page Page number - Defaults to 1
1918
- * @returns A promise that resolves to TV series recommended shows.
1919
- * @reference https://developer.themoviedb.org/reference/tv-series-recommendations
1920
- */
1921
- async recommendations(params) {
1922
- const { language = this.defaultOptions.language, series_id, ...rest } = params;
1923
- const endpoint = this.seriesSubPath(series_id, ENDPOINTS.TV_SERIES.RECOMMENDATIONS);
1924
- return this.client.request(endpoint, {
1925
- language,
1926
- ...rest
1927
- });
1928
- }
1929
- /**
1930
- * Reviews
1931
- * GET - https://api.themoviedb.org/3/tv/{series_id}/reviews
1932
- *
1933
- * Get the reviews that have been added to a TV show.
1934
- * @param series_id The ID of the TV series.
1935
- * @param language The Language for the lists
1936
- * @param page Page number - Defaults to 1
1937
- * @returns A promise that resolves to TV series recommended shows.
1938
- * @reference https://developer.themoviedb.org/reference/tv-series-recommendations
1939
- */
1940
- async reviews(params) {
1941
- const { language = this.defaultOptions.language, series_id, ...rest } = params;
1942
- const endpoint = this.seriesSubPath(series_id, ENDPOINTS.TV_SERIES.REVIEWS);
1943
- return this.client.request(endpoint, {
1944
- language,
1945
- ...rest
1946
- });
1947
- }
1948
- /**
1949
- * Sreened Theatrically
1950
- * GET - https://api.themoviedb.org/3/tv/{series_id}/screened_theatrically
1951
- *
1952
- * Get the seasons and episodes that have screened theatrically.
1953
- * @param series_id The ID of the TV series.
1954
- * @returns A promise that resolves to the TV episodes that have been screened thatrically.
1955
- * @reference https://developer.themoviedb.org/reference/tv-series-screened-theatrically
1956
- */
1957
- async screened_theatrically(params) {
1958
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.SCREENED_THEATRICALLY);
1959
- return this.client.request(endpoint);
1960
- }
1961
- /**
1962
- * Similar
1963
- * GET - https://api.themoviedb.org/3/tv/{series_id}/similar
1964
- *
1965
- * Get the similar shows for a TV series.
1966
- * @param series_id The ID of the TV series.
1967
- * @param language The Language for the lists
1968
- * @param page Page number - Defaults to 1
1969
- * @returns A promise that resolves to TV series similar shows.
1970
- * @reference https://developer.themoviedb.org/reference/tv-series-similar
1971
- */
1972
- async similar(params) {
1973
- const { language = this.defaultOptions.language, series_id, ...rest } = params;
1974
- const endpoint = this.seriesSubPath(series_id, ENDPOINTS.TV_SERIES.SIMILAR);
1975
- return this.client.request(endpoint, {
1976
- language,
1977
- ...rest
1978
- });
1979
- }
1980
- /**
1981
- * Translations
1982
- * GET - https://api.themoviedb.org/3/movie/{series_id}/translations
1983
- *
1984
- * Get the translations that have been added to a tv show.
1985
- * Take a read through our language documentation for more information about languages on TMDB.
1986
- * https://developer.themoviedb.org/docs/languages
1987
- * @param series_id The ID of the TV Series
1988
- * @returns A promise that resolves to the translations of the tv show.
1989
- * @reference https://developer.themoviedb.org/reference/tv-series-translations
1990
- */
1991
- async translations(params) {
1992
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.TRANSLATIONS);
1993
- return this.client.request(endpoint);
1994
- }
1995
- /**
1996
- * Videos
1997
- * GET - https://api.themoviedb.org/3/movie/{series_id}/videos
1998
- *
1999
- * Get the videos that belong to a TV show.
2000
- * @param series_id The ID of the TV Series
2001
- * @returns A promise that resolves to the videos for the tv show.
2002
- * @reference https://developer.themoviedb.org/reference/tv-series-videos
2003
- */
2004
- async videos(params) {
2005
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.VIDEOS);
2006
- return this.client.request(endpoint);
2007
- }
2008
- /**
2009
- * Watch Providers
2010
- * GET - https://api.themoviedb.org/3/movie/{series_id}/watch/providers
2011
- *
2012
- * Get the list of streaming providers we have for a TV show.
2013
- *
2014
- * Powered by our partnership with JustWatch, you can query this method to get a list of the streaming/rental/purchase availabilities per country by provider.
2015
- * This is not going to return full deep links, but rather, it's just enough information to display what's available where.
2016
- * You can link to the provided TMDB URL to help support TMDB and provide the actual deep links to the content.
2017
- *
2018
- * WARNING: JustWatch Attribution Required
2019
- * In order to use this data you must attribute the source of the data as JustWatch.
2020
- * If we find any usage not complying with these terms we will revoke access to the API.
2021
- *
2022
- * @param series_id The ID of the TV Series
2023
- * @returns A promise that resolves to the watch providers for the tv show.
2024
- * @reference https://developer.themoviedb.org/reference/tv-series-watch-providers
2025
- */
2026
- async watch_providers(params) {
2027
- const endpoint = this.seriesSubPath(params.series_id, ENDPOINTS.TV_SERIES.WATCH_PROVIDERS);
2028
- return this.client.request(endpoint);
2029
- }
2030
- };
2031
- //#endregion
2032
- //#region src/endpoints/tv_series_lists.ts
2033
- var TVSeriesListsAPI = class extends TMDBAPIBase {
2034
- withDefaults(params) {
2035
- const { language = this.defaultOptions.language, timezone = this.defaultOptions.timezone, ...rest } = params;
2036
- return {
2037
- language,
2038
- timezone,
2039
- ...rest
2040
- };
2041
- }
2042
- /**
2043
- * Fetch TVSeries List Wrapper
2044
- * @param endpoint Endpoint to call
2045
- * @param params Params for the request
2046
- * @returns PaginatedResponse of TVSeriesResultItem
2047
- */
2048
- fetch_tv_series_list(endpoint, params = {}) {
2049
- return this.client.request(ENDPOINTS.TV_SERIES.DETAILS + endpoint, this.withDefaults(params));
2050
- }
2051
- /**
2052
- * Airing Today
2053
- * GET - https://api.themoviedb.org/3/tv/airing_today
2054
- *
2055
- * Get a list of TV shows airing today.
2056
- * @param language Language (Defaults to en-US or TMDB default)
2057
- * @param page Page (Defaults to 1)
2058
- * @param timezone Timezone for the "today"
2059
- */
2060
- async airing_today(params = {}) {
2061
- return this.fetch_tv_series_list(ENDPOINTS.TV_SERIES.AIRING_TODAY, params);
2062
- }
2063
- /**
2064
- * On The Air
2065
- * GET - https://api.themoviedb.org/3/tv/on_the_air
2066
- *
2067
- * Get a list of TV shows that air in the next 7 days.
2068
- * @param language Language (Defaults to en-US or TMDB default)
2069
- * @param page Page (Defaults to 1)
2070
- * @param timezone Timezone for the "today"
2071
- */
2072
- async on_the_air(params = {}) {
2073
- return this.fetch_tv_series_list(ENDPOINTS.TV_SERIES.ON_THE_AIR, params);
2074
- }
2075
- /**
2076
- * Popular
2077
- * GET - https://api.themoviedb.org/3/tv/popular
2078
- *
2079
- * Get a list of TV shows ordered by popularity.
2080
- * @param language Language (Defaults to en-US or TMDB default)
2081
- * @param page Page (Defaults to 1)
2082
- */
2083
- async popular(params = {}) {
2084
- return this.fetch_tv_series_list(ENDPOINTS.TV_SERIES.POPULAR, params);
2085
- }
2086
- /**
2087
- * Top Rated
2088
- * GET - https://api.themoviedb.org/3/tv/top_rated
2089
- *
2090
- * Get a list of movies ordered by rating.
2091
- * @param language Language (Defaults to en-US or TMDB default)
2092
- * @param page Page (Defaults to 1)
2093
- */
2094
- async top_rated(params = {}) {
2095
- return this.fetch_tv_series_list(ENDPOINTS.TV_SERIES.TOP_RATED, params);
2096
- }
2097
- };
2098
- //#endregion
2099
- //#region src/endpoints/watch_providers.ts
2100
- var WatchProvidersAPI = class extends TMDBAPIBase {
2101
- /**
2102
- * Movie Providers
2103
- * GET - https://api.themoviedb.org/3/watch/providers/movie
2104
- *
2105
- * Get the list of movie watch providers supported by TMDB.
2106
- *
2107
- * @param language Language used for localized provider names
2108
- * @reference https://developer.themoviedb.org/reference/watch-provider-movie-list
2109
- */
2110
- async movie_providers(params) {
2111
- const language = params?.language ?? this.defaultOptions.language;
2112
- const requestParams = language === void 0 ? params : {
2113
- ...params,
2114
- language
2115
- };
2116
- return this.client.request(ENDPOINTS.WATCH_PROVIDERS.MOVIE, requestParams);
2117
- }
2118
- /**
2119
- * TV Providers
2120
- * GET - https://api.themoviedb.org/3/watch/providers/tv
2121
- *
2122
- * Get the list of TV watch providers supported by TMDB.
2123
- *
2124
- * @param language Language used for localized provider names
2125
- * @reference https://developer.themoviedb.org/reference/watch-provider-tv-list
2126
- */
2127
- async tv_providers(params) {
2128
- const language = params?.language ?? this.defaultOptions.language;
2129
- const requestParams = language === void 0 ? params : {
2130
- ...params,
2131
- language
2132
- };
2133
- return this.client.request(ENDPOINTS.WATCH_PROVIDERS.TV, requestParams);
2134
- }
2135
- /**
2136
- * Available Regions
2137
- * GET - https://api.themoviedb.org/3/watch/providers/regions
2138
- *
2139
- * Get the list of regions with watch provider support.
2140
- *
2141
- * @param language Language used for localized region names
2142
- * @reference https://developer.themoviedb.org/reference/watch-providers-available-regions
2143
- */
2144
- async available_regions(params) {
2145
- const language = params?.language ?? this.defaultOptions.language;
2146
- const requestParams = language === void 0 ? params : {
2147
- ...params,
2148
- language
2149
- };
2150
- return this.client.request(ENDPOINTS.WATCH_PROVIDERS.REGIONS, requestParams);
2151
- }
2152
- };
2153
- //#endregion
2154
- //#region src/endpoints/networks.ts
2155
- var NetworksAPI = class extends TMDBAPIBase {
2156
- networkPath(network_id) {
2157
- return `${ENDPOINTS.NETWORKS.DETAILS}/${network_id}`;
2158
- }
2159
- /**
2160
- * Details
2161
- * GET - https://api.themoviedb.org/3/network/{network_id}
2162
- *
2163
- * Get the network details by ID.
2164
- *
2165
- * @param network_id Unique identifier for the network
2166
- * @reference https://developer.themoviedb.org/reference/network-details
2167
- */
2168
- async details(params) {
2169
- const endpoint = this.networkPath(params.network_id);
2170
- return this.client.request(endpoint);
2171
- }
2172
- /**
2173
- * Alternative names
2174
- * GET - https://api.themoviedb.org/3/network/{network_id}/alternative_names
2175
- *
2176
- * Get the list of alternative names for a network.
2177
- *
2178
- * @param network_id Unique identifier for the network
2179
- * @reference https://developer.themoviedb.org/reference/network-alternative-names
2180
- */
2181
- async alternative_names(params) {
2182
- const endpoint = `${this.networkPath(params.network_id)}${ENDPOINTS.NETWORKS.ALTERNATIVE_NAMES}`;
2183
- return this.client.request(endpoint);
2184
- }
2185
- /**
2186
- * Images
2187
- * GET - https://api.themoviedb.org/3/network/{network_id}/images
2188
- *
2189
- * Get the logos for a network by ID.
2190
- *
2191
- * @param network_id Unique identifier for the network
2192
- * @reference https://developer.themoviedb.org/reference/network-images
2193
- */
2194
- async images(params) {
2195
- const endpoint = `${this.networkPath(params.network_id)}${ENDPOINTS.NETWORKS.IMAGES}`;
2196
- return this.client.request(endpoint);
2197
- }
2198
- };
2199
- //#endregion
2200
- //#region src/endpoints/tv_episodes.ts
2201
- var TVEpisodesAPI = class extends TMDBAPIBase {
2202
- episodePath(params) {
2203
- return `${ENDPOINTS.TV_SERIES.DETAILS}/${params.series_id}${ENDPOINTS.TV_SEASONS.DETAILS}/${params.season_number}${ENDPOINTS.TV_EPISODES.DETAILS}/${params.episode_number}`;
2204
- }
2205
- episodeSubPath(params, route) {
2206
- return `${this.episodePath(params)}${route}`;
2207
- }
2208
- /**
2209
- * Details
2210
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/episode/{episode_number}
2211
- *
2212
- * Query the details of a TV episode.
2213
- * @param series_id The ID of the TV series.
2214
- * @param season_number The number of the season within the TV show
2215
- * @param episode_number The number of the episode within the season
2216
- * @param append_to_response A comma-separated list of the fields to include in the response.
2217
- * @param language The language to use for the response.
2218
- * @returns A promise that resolves to the TV episode .
2219
- * @reference https://developer.themoviedb.org/reference/tv-episode-details
2220
- */
2221
- async details(params) {
2222
- const { language = this.defaultOptions.language, append_to_response, ...rest } = params;
2223
- const endpoint = this.episodePath(rest);
2224
- return this.client.request(endpoint, {
2225
- language,
2226
- append_to_response
2227
- });
2228
- }
2229
- /**
2230
- * Changes
2231
- * GET - https://api.themoviedb.org/3/tv/episode/{episode_id}/changes
2232
- *
2233
- * Get the changes for a TV episode. By default only the last 24 hours are returned.
2234
- * ACCORDING TO TMDB DOCS:
2235
- * You can query up to 14 days in a single query by using the start_date and end_date query parameters.
2236
- * BUT NO start_date or end_date query params are specified in the documentation
2237
- *
2238
- * NOTE: TV show changes are a little different than movie changes in that there are some edits
2239
- * on seasons and episodes that will create a top level change entry at the show level.
2240
- * These can be found under the season and episode keys.
2241
- * These keys will contain a series_id and episode_id.
2242
- * You can use the season changes and episode changes methods to look these up individually.
2243
- *
2244
- * @param episode_id The ID of the TV episode.
2245
- * @returns A promise that resolves to the TV episode changes history.
2246
- * @reference https://developer.themoviedb.org/reference/tv-episode-changes-by-id
2247
- */
2248
- async changes(params) {
2249
- const endpoint = `${ENDPOINTS.TV_SERIES.DETAILS}${ENDPOINTS.TV_EPISODES.DETAILS}/${params.episode_id}${ENDPOINTS.TV_EPISODES.CHANGES}`;
2250
- return this.client.request(endpoint);
2251
- }
2252
- /**
2253
- * Credits
2254
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/episode/{episode_number}/credits
2255
- *
2256
- * Get the credits for a TV episode.
2257
- * @param series_id The ID of the TV series.
2258
- * @param season_number The number of the season within the TV show
2259
- * @param episode_number The number of the episode within the season
2260
- * @param language The language to use for the response.
2261
- * @reference https://developer.themoviedb.org/reference/tv-episode-credits
2262
- */
2263
- async credits(params) {
2264
- const { language = this.defaultOptions.language, ...rest } = params;
2265
- const endpoint = this.episodeSubPath(rest, ENDPOINTS.TV_EPISODES.CREDITS);
2266
- return this.client.request(endpoint, { language });
2267
- }
2268
- /**
2269
- * External IDs
2270
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/episode/{episode_number}/external_ids
2271
- *
2272
- * Get a list of external IDs that have been added to a TV episode.
2273
- * @param series_id The ID of the TV series.
2274
- * @param season_number The number of the season within the TV show
2275
- * @param episode_number The number of the episode within the season
2276
- * @returns A promise that resolves to the TV episode external ids.
2277
- * @reference https://developer.themoviedb.org/reference/tv-episode-external-ids
2278
- */
2279
- async external_ids(params) {
2280
- const endpoint = this.episodeSubPath(params, ENDPOINTS.TV_EPISODES.EXTERNAL_IDS);
2281
- return this.client.request(endpoint);
2282
- }
2283
- /**
2284
- * Images
2285
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/episode/{episode_number}/images
2286
- *
2287
- * Fetches still images related to a specific tv episode
2288
- * The images are returned in various sizes and formats.
2289
- *
2290
- * NOTE: If you have a language specified, it will act as a filter on the returned items. You can use the include_image_language param to query additional languages.
2291
- *
2292
- * @param series_id The ID of the TV series.
2293
- * @param season_number The number of the season within the TV show
2294
- * @param episode_number The number of the episode within the season
2295
- * @param language - (Optional) The language code to filter the images by language.
2296
- * @param include_image_language - (Optional) A comma-separated list of language codes to include images for.
2297
- * @returns A promise that resolves to a `TVEpisodeImages` object containing the tv episode's images.
2298
- * @reference https://developer.themoviedb.org/reference/tv-episode-images
2299
- */
2300
- async images(params) {
2301
- const { language = this.defaultOptions.language, include_image_language, ...rest } = params;
2302
- const endpoint = this.episodeSubPath(rest, ENDPOINTS.TV_EPISODES.IMAGES);
2303
- return this.client.request(endpoint, {
2304
- language,
2305
- include_image_language
2306
- });
2307
- }
2308
- /**
2309
- * Translations
2310
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/episode/{episode_number}/translations
2311
- *
2312
- * Get the translations that have been added to a TV episode.
2313
- * Take a read through our language documentation for more information about languages on TMDB.
2314
- * https://developer.themoviedb.org/docs/languages
2315
- * @param series_id The ID of the TV series.
2316
- * @param season_number The number of the season within the TV show
2317
- * @param episode_number The number of the episode within the season
2318
- * @returns A promise that resolves to the translations of the tv episode.
2319
- * @reference https://developer.themoviedb.org/reference/tv-episode-translations
2320
- */
2321
- async translations(params) {
2322
- const endpoint = this.episodeSubPath(params, ENDPOINTS.TV_EPISODES.TRANSLATIONS);
2323
- return this.client.request(endpoint);
2324
- }
2325
- /**
2326
- * Videos
2327
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/episode/{episode_number}/videos
2328
- *
2329
- * Get the videos that belong to a TV episode.
2330
- * @param series_id The ID of the TV series.
2331
- * @param season_number The number of the season within the TV show
2332
- * @param episode_number The number of the episode within the season
2333
- * @returns A promise that resolves to the videos for the tv episode.
2334
- * @reference https://developer.themoviedb.org/reference/tv-episode-videos
2335
- */
2336
- async videos(params) {
2337
- const endpoint = this.episodeSubPath(params, ENDPOINTS.TV_EPISODES.VIDEOS);
2338
- return this.client.request(endpoint);
2339
- }
2340
- };
2341
- //#endregion
2342
- //#region src/endpoints/tv_episode_groups.ts
2343
- var TVEpisodeGroupsAPI = class extends TMDBAPIBase {
2344
- /**
2345
- * Details
2346
- * GET - https://api.themoviedb.org/3/tv/episode_group/{episode_group_id}
2347
- *
2348
- * Get the details of a TV episode group by ID.
2349
- * @param episode_group_id The ID of the episode group.
2350
- * @reference https://developer.themoviedb.org/reference/tv-episode-group-details
2351
- */
2352
- async details(params) {
2353
- const endpoint = `${ENDPOINTS.TV_EPISODE_GROUPS.DETAILS}/${params.episode_group_id}`;
2354
- return this.client.request(endpoint);
2355
- }
2356
- };
2357
- //#endregion
2358
- //#region src/endpoints/tv_seasons.ts
2359
- var TVSeasonsAPI = class extends TMDBAPIBase {
2360
- seasonPath(params) {
2361
- return `${ENDPOINTS.TV_SERIES.DETAILS}/${params.series_id}${ENDPOINTS.TV_SEASONS.DETAILS}/${params.season_number}`;
2362
- }
2363
- seasonSubPath(params, route) {
2364
- return `${this.seasonPath(params)}${route}`;
2365
- }
2366
- /**
2367
- * Details
2368
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}
2369
- *
2370
- * Query the details of a TV season.
2371
- * @param series_id The ID of the TV series.
2372
- * @param season_number The season number within the TV show.
2373
- * @param append_to_response A comma-separated list of the fields to include in the response.
2374
- * @param language The language to use for the response.
2375
- * @returns A promise that resolves to the TV season details.
2376
- * @reference https://developer.themoviedb.org/reference/tv-season-details
2377
- */
2378
- async details(params) {
2379
- const { language = this.defaultOptions.language, append_to_response, ...rest } = params;
2380
- const endpoint = this.seasonPath(rest);
2381
- return this.client.request(endpoint, {
2382
- language,
2383
- append_to_response
2384
- });
2385
- }
2386
- /**
2387
- * Aggregate Credits
2388
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/aggregate_credits
2389
- *
2390
- * Get the aggregate credits for a TV season.
2391
- * This returns the full cast and crew across all episodes of the season.
2392
- * @param series_id The ID of the TV series.
2393
- * @param season_number The season number within the TV show.
2394
- * @param language The language to use for the response.
2395
- * @returns A promise that resolves to the TV season aggregate credits.
2396
- * @reference https://developer.themoviedb.org/reference/tv-season-aggregate-credits
2397
- */
2398
- async aggregate_credits(params) {
2399
- const { language = this.defaultOptions.language, ...rest } = params;
2400
- const endpoint = this.seasonSubPath(rest, ENDPOINTS.TV_SEASONS.AGGREGATE_CREDITS);
2401
- return this.client.request(endpoint, { language });
2402
- }
2403
- /**
2404
- * Changes
2405
- * GET - https://api.themoviedb.org/3/tv/season/{season_id}/changes
2406
- *
2407
- * Get the changes for a TV season by season ID. By default only the last 24 hours are returned.
2408
- * You can query up to 14 days in a single query by using the start_date and end_date query parameters.
2409
- * @param season_id The ID of the TV season.
2410
- * @param start_date Filter changes by start date (ISO 8601 format, e.g. "2024-01-01").
2411
- * @param end_date Filter changes by end date (ISO 8601 format, e.g. "2024-01-14").
2412
- * @param page The page of results to return.
2413
- * @returns A promise that resolves to the TV season changes history.
2414
- * @reference https://developer.themoviedb.org/reference/tv-season-changes-by-id
2415
- */
2416
- async changes(params) {
2417
- const { season_id, ...rest } = params;
2418
- const endpoint = `${ENDPOINTS.TV_SERIES.DETAILS}${ENDPOINTS.TV_SEASONS.DETAILS}/${season_id}${ENDPOINTS.TV_SEASONS.CHANGES}`;
2419
- return this.client.request(endpoint, { ...rest });
2420
- }
2421
- /**
2422
- * Credits
2423
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/credits
2424
- *
2425
- * Get the credits for a TV season.
2426
- * @param series_id The ID of the TV series.
2427
- * @param season_number The season number within the TV show.
2428
- * @param language The language to use for the response.
2429
- * @returns A promise that resolves to the TV season credits.
2430
- * @reference https://developer.themoviedb.org/reference/tv-season-credits
2431
- */
2432
- async credits(params) {
2433
- const { language = this.defaultOptions.language, ...rest } = params;
2434
- const endpoint = this.seasonSubPath(rest, ENDPOINTS.TV_SEASONS.CREDITS);
2435
- return this.client.request(endpoint, { language });
2436
- }
2437
- /**
2438
- * External IDs
2439
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/external_ids
2440
- *
2441
- * Get a list of external IDs that have been added to a TV season.
2442
- * @param series_id The ID of the TV series.
2443
- * @param season_number The season number within the TV show.
2444
- * @returns A promise that resolves to the TV season external IDs.
2445
- * @reference https://developer.themoviedb.org/reference/tv-season-external-ids
2446
- */
2447
- async external_ids(params) {
2448
- const endpoint = this.seasonSubPath(params, ENDPOINTS.TV_SEASONS.EXTERNAL_IDS);
2449
- return this.client.request(endpoint);
2450
- }
2451
- /**
2452
- * Images
2453
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/images
2454
- *
2455
- * Get the images that belong to a TV season. Returns season posters.
2456
- *
2457
- * NOTE: If you have a language specified, it will act as a filter on the returned items.
2458
- * You can use the include_image_language param to query additional languages.
2459
- *
2460
- * @param series_id The ID of the TV series.
2461
- * @param season_number The season number within the TV show.
2462
- * @param language The language code to filter images by language.
2463
- * @param include_image_language A comma-separated list of language codes to include images for.
2464
- * @returns A promise that resolves to the TV season images.
2465
- * @reference https://developer.themoviedb.org/reference/tv-season-images
2466
- */
2467
- async images(params) {
2468
- const { language = this.defaultOptions.language, include_image_language, ...rest } = params;
2469
- const endpoint = this.seasonSubPath(rest, ENDPOINTS.TV_SEASONS.IMAGES);
2470
- return this.client.request(endpoint, {
2471
- language,
2472
- include_image_language
2473
- });
2474
- }
2475
- /**
2476
- * Translations
2477
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/translations
2478
- *
2479
- * Get the translations that have been added to a TV season.
2480
- * Take a read through our language documentation for more information about languages on TMDB.
2481
- * https://developer.themoviedb.org/docs/languages
2482
- * @param series_id The ID of the TV series.
2483
- * @param season_number The season number within the TV show.
2484
- * @returns A promise that resolves to the TV season translations.
2485
- * @reference https://developer.themoviedb.org/reference/tv-season-translations
2486
- */
2487
- async translations(params) {
2488
- const endpoint = this.seasonSubPath(params, ENDPOINTS.TV_SEASONS.TRANSLATIONS);
2489
- return this.client.request(endpoint);
2490
- }
2491
- /**
2492
- * Videos
2493
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/videos
2494
- *
2495
- * Get the videos that belong to a TV season.
2496
- * @param series_id The ID of the TV series.
2497
- * @param season_number The season number within the TV show.
2498
- * @param language The language to use for the response.
2499
- * @param include_video_language A comma-separated list of language codes to include videos for.
2500
- * @returns A promise that resolves to the TV season videos.
2501
- * @reference https://developer.themoviedb.org/reference/tv-season-videos
2502
- */
2503
- async videos(params) {
2504
- const { language = this.defaultOptions.language, include_video_language, ...rest } = params;
2505
- const endpoint = this.seasonSubPath(rest, ENDPOINTS.TV_SEASONS.VIDEOS);
2506
- return this.client.request(endpoint, {
2507
- language,
2508
- include_video_language
2509
- });
2510
- }
2511
- /**
2512
- * Watch Providers
2513
- * GET - https://api.themoviedb.org/3/tv/{series_id}/season/{season_number}/watch/providers
2514
- *
2515
- * Get the watch providers for a specific TV season.
2516
- * Powered by our partnership with JustWatch, you can query which streaming services
2517
- * have the season available.
2518
- * @param series_id The ID of the TV series.
2519
- * @param season_number The season number within the TV show.
2520
- * @param language The language to use for the response.
2521
- * @returns A promise that resolves to the TV season watch providers.
2522
- * @reference https://developer.themoviedb.org/reference/tv-season-watch-providers
2523
- */
2524
- async watch_providers(params) {
2525
- const { language = this.defaultOptions.language, ...rest } = params;
2526
- const endpoint = this.seasonSubPath(rest, ENDPOINTS.TV_SEASONS.WATCH_PROVIDERS);
2527
- return this.client.request(endpoint, { language });
2528
- }
2529
- };
2530
- //#endregion
2531
- //#region src/endpoints/trending.ts
2532
- var TrendingAPI = class extends TMDBAPIBase {
2533
- /**
2534
- * Trending All
2535
- * GET - https://api.themoviedb.org/3/trending/all/{time_window}
2536
- *
2537
- * Get the trending movies, TV shows and people on TMDB.
2538
- * @reference https://developer.themoviedb.org/reference/trending-all
2539
- */
2540
- async all(params) {
2541
- const { time_window, language = this.defaultOptions.language } = params;
2542
- return this.client.request(`${ENDPOINTS.TRENDING.ALL}/${time_window}`, { language });
2543
- }
2544
- /**
2545
- * Trending Movies
2546
- * GET - https://api.themoviedb.org/3/trending/movie/{time_window}
2547
- *
2548
- * Get the trending movies on TMDB.
2549
- * @reference https://developer.themoviedb.org/reference/trending-movies
2550
- */
2551
- async movies(params) {
2552
- const { time_window, language = this.defaultOptions.language } = params;
2553
- return this.client.request(`${ENDPOINTS.TRENDING.MOVIE}/${time_window}`, { language });
2554
- }
2555
- /**
2556
- * Trending TV
2557
- * GET - https://api.themoviedb.org/3/trending/tv/{time_window}
2558
- *
2559
- * Get the trending TV shows on TMDB.
2560
- * @reference https://developer.themoviedb.org/reference/trending-tv
2561
- */
2562
- async tv(params) {
2563
- const { time_window, language = this.defaultOptions.language } = params;
2564
- return this.client.request(`${ENDPOINTS.TRENDING.TV}/${time_window}`, { language });
2565
- }
2566
- /**
2567
- * Trending People
2568
- * GET - https://api.themoviedb.org/3/trending/person/{time_window}
2569
- *
2570
- * Get the trending people on TMDB.
2571
- * @reference https://developer.themoviedb.org/reference/trending-people
2572
- */
2573
- async people(params) {
2574
- const { time_window, language = this.defaultOptions.language } = params;
2575
- return this.client.request(`${ENDPOINTS.TRENDING.PERSON}/${time_window}`, { language });
2576
- }
2577
- };
2578
- //#endregion
2579
- //#region src/endpoints/reviews.ts
2580
- var ReviewsAPI = class extends TMDBAPIBase {
2581
- /**
2582
- * Details
2583
- * GET - https://api.themoviedb.org/3/review/{review_id}
2584
- *
2585
- * Retrieve the details of a single review by its TMDB review ID.
2586
- * @param review_id The TMDB review identifier.
2587
- * @returns A promise that resolves to the full review details.
2588
- * @reference https://developer.themoviedb.org/reference/review-details
2589
- */
2590
- async details(params) {
2591
- return this.client.request(`${ENDPOINTS.REVIEWS.DETAILS}/${params.review_id}`);
2592
- }
2593
- };
2594
- //#endregion
2595
- //#region src/endpoints/people_lists.ts
2596
- var PeopleListsAPI = class extends TMDBAPIBase {
2597
- /**
2598
- * Popular
2599
- * GET - https://api.themoviedb.org/3/person/popular
2600
- *
2601
- * Get a list of people ordered by popularity.
2602
- * @param language Language for localised results (Defaults to en-US or TMDB default)
2603
- * @param page Page number (Defaults to 1)
2604
- * @reference https://developer.themoviedb.org/reference/person-popular-list
2605
- */
2606
- async popular(params = {}) {
2607
- return this.client.request(ENDPOINTS.PEOPLE_LISTS.POPULAR, this.withLanguage(params));
2608
- }
2609
- };
2610
- //#endregion
2611
- //#region src/endpoints/people.ts
2612
- var PeopleAPI = class extends TMDBAPIBase {
2613
- personPath(person_id) {
2614
- return `${ENDPOINTS.PEOPLE.DETAILS}/${person_id}`;
2615
- }
2616
- personSubPath(person_id, route) {
2617
- return `${this.personPath(person_id)}${route}`;
2618
- }
2619
- /**
2620
- * Details
2621
- * GET - https://api.themoviedb.org/3/person/{person_id}
2622
- *
2623
- * Get the primary person details by TMDB person id.
2624
- * @param person_id The TMDB person id.
2625
- * @param append_to_response Additional person subresources to append.
2626
- * @param language Language for localized results.
2627
- * @reference https://developer.themoviedb.org/reference/person-details
2628
- */
2629
- async details(params) {
2630
- const { language = this.defaultOptions.language, person_id, ...rest } = params;
2631
- return this.client.request(this.personPath(person_id), {
2632
- language,
2633
- ...rest
2634
- });
2635
- }
2636
- /**
2637
- * Changes
2638
- * GET - https://api.themoviedb.org/3/person/{person_id}/changes
2639
- *
2640
- * Get the change history for a person.
2641
- * @reference https://developer.themoviedb.org/reference/person-changes
2642
- */
2643
- async changes(params) {
2644
- const { person_id, ...rest } = params;
2645
- return this.client.request(this.personSubPath(person_id, ENDPOINTS.PEOPLE.CHANGES), rest);
2646
- }
2647
- /**
2648
- * Combined Credits
2649
- * GET - https://api.themoviedb.org/3/person/{person_id}/combined_credits
2650
- *
2651
- * Get movie and TV credits in a single response.
2652
- * @reference https://developer.themoviedb.org/reference/person-combined-credits
2653
- */
2654
- async combined_credits(params) {
2655
- const { language = this.defaultOptions.language, person_id, ...rest } = params;
2656
- return this.client.request(this.personSubPath(person_id, ENDPOINTS.PEOPLE.COMBINED_CREDITS), {
2657
- language,
2658
- ...rest
2659
- });
2660
- }
2661
- /**
2662
- * External IDs
2663
- * GET - https://api.themoviedb.org/3/person/{person_id}/external_ids
2664
- *
2665
- * Get external platform identifiers for a person.
2666
- * @reference https://developer.themoviedb.org/reference/person-external-ids
2667
- */
2668
- async external_ids(params) {
2669
- return this.client.request(this.personSubPath(params.person_id, ENDPOINTS.PEOPLE.EXTERNAL_IDS));
2670
- }
2671
- /**
2672
- * Images
2673
- * GET - https://api.themoviedb.org/3/person/{person_id}/images
2674
- *
2675
- * Get profile images for a person.
2676
- * @reference https://developer.themoviedb.org/reference/person-images
2677
- */
2678
- async images(params) {
2679
- return this.client.request(this.personSubPath(params.person_id, ENDPOINTS.PEOPLE.IMAGES));
2680
- }
2681
- /**
2682
- * Latest
2683
- * GET - https://api.themoviedb.org/3/person/latest
2684
- *
2685
- * Get the newest person id added to TMDB.
2686
- * @reference https://developer.themoviedb.org/reference/person-latest-id
2687
- */
2688
- async latest() {
2689
- return this.client.request(`${ENDPOINTS.PEOPLE.DETAILS}${ENDPOINTS.PEOPLE.LATEST}`);
2690
- }
2691
- /**
2692
- * Movie Credits
2693
- * GET - https://api.themoviedb.org/3/person/{person_id}/movie_credits
2694
- *
2695
- * Get a person's movie cast and crew credits.
2696
- * @reference https://developer.themoviedb.org/reference/person-movie-credits
2697
- */
2698
- async movie_credits(params) {
2699
- const { language = this.defaultOptions.language, person_id, ...rest } = params;
2700
- return this.client.request(this.personSubPath(person_id, ENDPOINTS.PEOPLE.MOVIE_CREDITS), {
2701
- language,
2702
- ...rest
2703
- });
2704
- }
2705
- /**
2706
- * Tagged Images
2707
- * GET - https://api.themoviedb.org/3/person/{person_id}/tagged_images
2708
- *
2709
- * Get images where the person has been tagged.
2710
- * @reference https://developer.themoviedb.org/reference/person-tagged-images
2711
- */
2712
- async tagged_images(params) {
2713
- const { person_id, ...rest } = params;
2714
- return this.client.request(this.personSubPath(person_id, ENDPOINTS.PEOPLE.TAGGED_IMAGES), rest);
2715
- }
2716
- /**
2717
- * Translations
2718
- * GET - https://api.themoviedb.org/3/person/{person_id}/translations
2719
- *
2720
- * Get the translations available for a person biography and name.
2721
- * @reference https://developer.themoviedb.org/reference/person-translations
2722
- */
2723
- async translations(params) {
2724
- return this.client.request(this.personSubPath(params.person_id, ENDPOINTS.PEOPLE.TRANSLATIONS));
2725
- }
2726
- /**
2727
- * TV Credits
2728
- * GET - https://api.themoviedb.org/3/person/{person_id}/tv_credits
2729
- *
2730
- * Get a person's TV cast and crew credits.
2731
- * @reference https://developer.themoviedb.org/reference/person-tv-credits
2732
- */
2733
- async tv_credits(params) {
2734
- const { language = this.defaultOptions.language, person_id, ...rest } = params;
2735
- return this.client.request(this.personSubPath(person_id, ENDPOINTS.PEOPLE.TV_CREDITS), {
2736
- language,
2737
- ...rest
2738
- });
2739
- }
2740
- };
2741
- //#endregion
2742
- //#region src/endpoints/account.ts
2743
- var AccountAPI = class extends TMDBAPIBase {
2744
- accountPath(account_id) {
2745
- return `${ENDPOINTS.ACCOUNT.DETAILS}/${account_id}`;
2746
- }
2747
- accountSubPath(account_id, route) {
2748
- return `${this.accountPath(account_id)}${route}`;
2749
- }
2750
- /**
2751
- * Account Details
2752
- * GET - https://api.themoviedb.org/3/account/{account_id}
2753
- *
2754
- * Get the details of an account.
2755
- * @param account_id The TMDB account ID.
2756
- * @param session_id Session ID required for v3 session-based auth.
2757
- * @reference https://developer.themoviedb.org/reference/account-details
2758
- */
2759
- async details(params) {
2760
- const { account_id, ...rest } = params;
2761
- return this.client.request(this.accountPath(account_id), rest);
2762
- }
2763
- /**
2764
- * Add Favorite
2765
- * POST - https://api.themoviedb.org/3/account/{account_id}/favorite
2766
- *
2767
- * Mark a movie or TV show as a favourite. Pass `favorite: false` to remove it.
2768
- * @param params Account ID and optional session_id.
2769
- * @param body media_type, media_id, and favorite flag.
2770
- * @reference https://developer.themoviedb.org/reference/account-add-favorite
2771
- */
2772
- async add_favorite(params, body) {
2773
- const { account_id, ...queryParams } = params;
2774
- return this.client.mutate("POST", this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.ADD_FAVORITE), body, queryParams);
2775
- }
2776
- /**
2777
- * Add to Watchlist
2778
- * POST - https://api.themoviedb.org/3/account/{account_id}/watchlist
2779
- *
2780
- * Add a movie or TV show to your watchlist. Pass `watchlist: false` to remove it.
2781
- * @param params Account ID and optional session_id.
2782
- * @param body media_type, media_id, and watchlist flag.
2783
- * @reference https://developer.themoviedb.org/reference/account-add-to-watchlist
2784
- */
2785
- async add_to_watchlist(params, body) {
2786
- const { account_id, ...queryParams } = params;
2787
- return this.client.mutate("POST", this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.ADD_TO_WATCHLIST), body, queryParams);
2788
- }
2789
- /**
2790
- * Favorite Movies
2791
- * GET - https://api.themoviedb.org/3/account/{account_id}/favorite/movies
2792
- *
2793
- * Get the list of movies you have marked as a favourite.
2794
- * @param account_id The TMDB account ID.
2795
- * @reference https://developer.themoviedb.org/reference/account-get-favorites
2796
- */
2797
- async favorite_movies(params) {
2798
- const { account_id, language = this.defaultOptions.language, ...rest } = params;
2799
- return this.client.request(this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.FAVORITE_MOVIES), {
2800
- language,
2801
- ...rest
2802
- });
2803
- }
2804
- /**
2805
- * Favorite TV Shows
2806
- * GET - https://api.themoviedb.org/3/account/{account_id}/favorite/tv
2807
- *
2808
- * Get the list of TV shows you have marked as a favourite.
2809
- * @param account_id The TMDB account ID.
2810
- * @reference https://developer.themoviedb.org/reference/account-get-favorites
2811
- */
2812
- async favorite_tv(params) {
2813
- const { account_id, language = this.defaultOptions.language, ...rest } = params;
2814
- return this.client.request(this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.FAVORITE_TV), {
2815
- language,
2816
- ...rest
2817
- });
2818
- }
2819
- /**
2820
- * Watchlist Movies
2821
- * GET - https://api.themoviedb.org/3/account/{account_id}/watchlist/movies
2822
- *
2823
- * Get the list of movies you have added to your watchlist.
2824
- * @param account_id The TMDB account ID.
2825
- * @reference https://developer.themoviedb.org/reference/account-watchlist-movies
2826
- */
2827
- async watchlist_movies(params) {
2828
- const { account_id, language = this.defaultOptions.language, ...rest } = params;
2829
- return this.client.request(this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.WATCHLIST_MOVIES), {
2830
- language,
2831
- ...rest
2832
- });
2833
- }
2834
- /**
2835
- * Watchlist TV Shows
2836
- * GET - https://api.themoviedb.org/3/account/{account_id}/watchlist/tv
2837
- *
2838
- * Get the list of TV shows you have added to your watchlist.
2839
- * @param account_id The TMDB account ID.
2840
- * @reference https://developer.themoviedb.org/reference/account-watchlist-tv
2841
- */
2842
- async watchlist_tv(params) {
2843
- const { account_id, language = this.defaultOptions.language, ...rest } = params;
2844
- return this.client.request(this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.WATCHLIST_TV), {
2845
- language,
2846
- ...rest
2847
- });
2848
- }
2849
- /**
2850
- * Rated Movies
2851
- * GET - https://api.themoviedb.org/3/account/{account_id}/rated/movies
2852
- *
2853
- * Get the list of movies you have rated.
2854
- * @param account_id The TMDB account ID.
2855
- * @reference https://developer.themoviedb.org/reference/account-rated-movies
2856
- */
2857
- async rated_movies(params) {
2858
- const { account_id, language = this.defaultOptions.language, ...rest } = params;
2859
- return this.client.request(this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.RATED_MOVIES), {
2860
- language,
2861
- ...rest
2862
- });
2863
- }
2864
- /**
2865
- * Rated TV Shows
2866
- * GET - https://api.themoviedb.org/3/account/{account_id}/rated/tv
2867
- *
2868
- * Get the list of TV shows you have rated.
2869
- * @param account_id The TMDB account ID.
2870
- * @reference https://developer.themoviedb.org/reference/account-rated-tv
2871
- */
2872
- async rated_tv(params) {
2873
- const { account_id, language = this.defaultOptions.language, ...rest } = params;
2874
- return this.client.request(this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.RATED_TV), {
2875
- language,
2876
- ...rest
2877
- });
2878
- }
2879
- /**
2880
- * Rated TV Episodes
2881
- * GET - https://api.themoviedb.org/3/account/{account_id}/rated/tv/episodes
2882
- *
2883
- * Get the list of TV episodes you have rated.
2884
- * @param account_id The TMDB account ID.
2885
- * @reference https://developer.themoviedb.org/reference/account-rated-tv-episodes
2886
- */
2887
- async rated_tv_episodes(params) {
2888
- const { account_id, language = this.defaultOptions.language, ...rest } = params;
2889
- return this.client.request(this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.RATED_TV_EPISODES), {
2890
- language,
2891
- ...rest
2892
- });
2893
- }
2894
- /**
2895
- * Lists
2896
- * GET - https://api.themoviedb.org/3/account/{account_id}/lists
2897
- *
2898
- * Get all of the lists you have created.
2899
- * @param account_id The TMDB account ID.
2900
- * @reference https://developer.themoviedb.org/reference/account-lists
2901
- */
2902
- async lists(params) {
2903
- const { account_id, ...rest } = params;
2904
- return this.client.request(this.accountSubPath(account_id, ENDPOINTS.ACCOUNT.LISTS), rest);
2905
- }
2906
- };
2907
- //#endregion
2908
- //#region src/endpoints/authentication.ts
2909
- var AuthenticationAPI = class extends TMDBAPIBase {
2910
- /**
2911
- * Validate Key
2912
- * GET - https://api.themoviedb.org/3/authentication
2913
- *
2914
- * Test your API key or Bearer token to confirm it is valid.
2915
- * Returns a success flag along with a TMDB status code and message.
2916
- * @reference https://developer.themoviedb.org/reference/authentication-validate-key
2917
- */
2918
- async validate_key() {
2919
- return this.client.request(ENDPOINTS.AUTHENTICATION.VALIDATE);
2920
- }
2921
- /**
2922
- * Create Guest Session
2923
- * GET - https://api.themoviedb.org/3/authentication/guest_session/new
2924
- *
2925
- * Create a temporary guest session that allows limited account actions
2926
- * (rating movies, TV shows and episodes) without a registered TMDB account.
2927
- * Guest sessions automatically expire after 60 minutes of inactivity.
2928
- * @reference https://developer.themoviedb.org/reference/authentication-create-guest-session
2929
- */
2930
- async create_guest_session() {
2931
- return this.client.request(ENDPOINTS.AUTHENTICATION.GUEST_SESSION);
2932
- }
2933
- /**
2934
- * Create Request Token
2935
- * GET - https://api.themoviedb.org/3/authentication/token/new
2936
- *
2937
- * Generate a short-lived request token (step 1 of the v3 session flow).
2938
- * The token expires after 60 minutes if not used. Direct the user to:
2939
- * `https://www.themoviedb.org/authenticate/{request_token}`
2940
- * to approve it, then exchange it for a session via `create_session`.
2941
- * @reference https://developer.themoviedb.org/reference/authentication-create-request-token
2942
- */
2943
- async create_request_token() {
2944
- return this.client.request(ENDPOINTS.AUTHENTICATION.REQUEST_TOKEN);
2945
- }
2946
- /**
2947
- * Create Session
2948
- * POST - https://api.themoviedb.org/3/authentication/session/new
2949
- *
2950
- * Exchange a user-approved request token for a permanent session ID (step 3 of the v3 session flow).
2951
- * The request token must have been approved by the user either via the TMDB website
2952
- * or via `create_session_with_login`. The returned `session_id` is valid indefinitely
2953
- * until explicitly deleted with `delete_session`.
2954
- * @param body An object containing the approved `request_token`.
2955
- * @reference https://developer.themoviedb.org/reference/authentication-create-session
2956
- */
2957
- async create_session(body) {
2958
- return this.client.mutate("POST", ENDPOINTS.AUTHENTICATION.CREATE_SESSION, body);
2959
- }
2960
- /**
2961
- * Create Session With Login
2962
- * POST - https://api.themoviedb.org/3/authentication/token/validate_with_login
2963
- *
2964
- * Validate a request token using TMDB username and password credentials directly,
2965
- * as an alternative to the browser-redirect flow (step 2 of the v3 session flow).
2966
- * Use this for server-side apps or environments without web view access.
2967
- * The returned (validated) `request_token` must then be passed to `create_session`.
2968
- *
2969
- * **Important:** Only use this over HTTPS. Prefer the browser-redirect flow when possible.
2970
- * @param body Username, password, and the request token to validate.
2971
- * @reference https://developer.themoviedb.org/reference/authentication-create-session-from-login
2972
- */
2973
- async create_session_with_login(body) {
2974
- return this.client.mutate("POST", ENDPOINTS.AUTHENTICATION.CREATE_SESSION_WITH_LOGIN, body);
2975
- }
2976
- /**
2977
- * Delete Session
2978
- * DELETE - https://api.themoviedb.org/3/authentication/session
2979
- *
2980
- * Invalidate an existing session ID. Use this to log a user out of your application.
2981
- * @param body An object containing the `session_id` to delete.
2982
- * @reference https://developer.themoviedb.org/reference/authentication-delete-session
2983
- */
2984
- async delete_session(body) {
2985
- return this.client.mutate("DELETE", ENDPOINTS.AUTHENTICATION.DELETE_SESSION, body);
2986
- }
2987
- };
2988
- //#endregion
2989
- //#region src/endpoints/guest_sessions.ts
2990
- var GuestSessionsAPI = class extends TMDBAPIBase {
2991
- guestSessionPath(guest_session_id) {
2992
- return `${ENDPOINTS.GUEST_SESSIONS.DETAILS}/${guest_session_id}`;
2993
- }
2994
- guestSessionSubPath(guest_session_id, route) {
2995
- return `${this.guestSessionPath(guest_session_id)}${route}`;
2996
- }
2997
- /**
2998
- * Rated Movies
2999
- * GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/movies
3000
- *
3001
- * Get the rated movies for a guest session.
3002
- * @param params Guest session ID, optional language, page, and sort_by.
3003
- * @reference https://developer.themoviedb.org/reference/guest-session-rated-movies
3004
- */
3005
- async rated_movies(params) {
3006
- const { guest_session_id, language = this.defaultOptions.language, ...rest } = params;
3007
- return this.client.request(this.guestSessionSubPath(guest_session_id, ENDPOINTS.GUEST_SESSIONS.RATED_MOVIES), {
3008
- language,
3009
- ...rest
3010
- });
3011
- }
3012
- /**
3013
- * Rated TV
3014
- * GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/tv
3015
- *
3016
- * Get the rated TV shows for a guest session.
3017
- * @param params Guest session ID, optional language, page, and sort_by.
3018
- * @reference https://developer.themoviedb.org/reference/guest-session-rated-tv
3019
- */
3020
- async rated_tv(params) {
3021
- const { guest_session_id, language = this.defaultOptions.language, ...rest } = params;
3022
- return this.client.request(this.guestSessionSubPath(guest_session_id, ENDPOINTS.GUEST_SESSIONS.RATED_TV), {
3023
- language,
3024
- ...rest
3025
- });
3026
- }
3027
- /**
3028
- * Rated TV Episodes
3029
- * GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/tv/episodes
3030
- *
3031
- * Get the rated TV episodes for a guest session.
3032
- * @param params Guest session ID, optional language, page, and sort_by.
3033
- * @reference https://developer.themoviedb.org/reference/guest-session-rated-tv-episodes
3034
- */
3035
- async rated_tv_episodes(params) {
3036
- const { guest_session_id, language = this.defaultOptions.language, ...rest } = params;
3037
- return this.client.request(this.guestSessionSubPath(guest_session_id, ENDPOINTS.GUEST_SESSIONS.RATED_TV_EPISODES), {
3038
- language,
3039
- ...rest
3040
- });
3041
- }
3042
- };
3043
- //#endregion
3044
- //#region src/endpoints/lists.ts
3045
- var ListsAPI = class extends TMDBAPIBase {
3046
- listPath(list_id) {
3047
- return `${ENDPOINTS.LISTS.DETAILS}/${list_id}`;
3048
- }
3049
- listSubPath(list_id, route) {
3050
- return `${this.listPath(list_id)}${route}`;
3051
- }
3052
- /**
3053
- * Details
3054
- * GET - https://api.themoviedb.org/3/list/{list_id}
3055
- *
3056
- * Get the details of a list.
3057
- * @param params List ID and optional language and page.
3058
- * @reference https://developer.themoviedb.org/reference/list-details
3059
- */
3060
- async details(params) {
3061
- const { list_id, language = this.defaultOptions.language, ...rest } = params;
3062
- return this.client.request(this.listPath(list_id), {
3063
- language,
3064
- ...rest
3065
- });
3066
- }
3067
- /**
3068
- * Create
3069
- * POST - https://api.themoviedb.org/3/list
3070
- *
3071
- * Create a new list.
3072
- * @param params session_id query param (required).
3073
- * @param body name, description, and language for the new list.
3074
- * @reference https://developer.themoviedb.org/reference/list-create
3075
- */
3076
- async create(params, body) {
3077
- return this.client.mutate("POST", ENDPOINTS.LISTS.DETAILS, body, params);
3078
- }
3079
- /**
3080
- * Delete
3081
- * DELETE - https://api.themoviedb.org/3/list/{list_id}
3082
- *
3083
- * Delete a list.
3084
- * @param params List ID and session_id (required).
3085
- * @reference https://developer.themoviedb.org/reference/list-delete
3086
- */
3087
- async delete(params) {
3088
- const { list_id, ...queryParams } = params;
3089
- return this.client.mutate("DELETE", this.listPath(list_id), void 0, queryParams);
3090
- }
3091
- /**
3092
- * Add Movie
3093
- * POST - https://api.themoviedb.org/3/list/{list_id}/add_item
3094
- *
3095
- * Add a movie to a list.
3096
- * @param params List ID and session_id (required).
3097
- * @param body media_id of the movie to add.
3098
- * @reference https://developer.themoviedb.org/reference/list-add-movie
3099
- */
3100
- async add_movie(params, body) {
3101
- const { list_id, ...queryParams } = params;
3102
- return this.client.mutate("POST", this.listSubPath(list_id, ENDPOINTS.LISTS.ADD_ITEM), body, queryParams);
3103
- }
3104
- /**
3105
- * Remove Movie
3106
- * POST - https://api.themoviedb.org/3/list/{list_id}/remove_item
3107
- *
3108
- * Remove a movie from a list.
3109
- * @param params List ID and session_id (required).
3110
- * @param body media_id of the movie to remove.
3111
- * @reference https://developer.themoviedb.org/reference/list-remove-movie
3112
- */
3113
- async remove_movie(params, body) {
3114
- const { list_id, ...queryParams } = params;
3115
- return this.client.mutate("POST", this.listSubPath(list_id, ENDPOINTS.LISTS.REMOVE_ITEM), body, queryParams);
3116
- }
3117
- /**
3118
- * Check Item Status
3119
- * GET - https://api.themoviedb.org/3/list/{list_id}/item_status
3120
- *
3121
- * Check if a movie has already been added to a list.
3122
- * @param params List ID and optional movie_id and language.
3123
- * @reference https://developer.themoviedb.org/reference/list-check-item-status
3124
- */
3125
- async check_item_status(params) {
3126
- const { list_id, language = this.defaultOptions.language, ...rest } = params;
3127
- return this.client.request(this.listSubPath(list_id, ENDPOINTS.LISTS.ITEM_STATUS), {
3128
- language,
3129
- ...rest
3130
- });
3131
- }
3132
- /**
3133
- * Clear
3134
- * POST - https://api.themoviedb.org/3/list/{list_id}/clear
3135
- *
3136
- * Clear all items from a list. Pass `confirm: true` to confirm the operation.
3137
- * @param params List ID, session_id, and confirm flag (required).
3138
- * @reference https://developer.themoviedb.org/reference/list-clear
3139
- */
3140
- async clear(params) {
3141
- const { list_id, ...queryParams } = params;
3142
- return this.client.mutate("POST", this.listSubPath(list_id, ENDPOINTS.LISTS.CLEAR), void 0, queryParams);
3143
- }
3144
- };
3145
- //#endregion
3146
- //#region src/endpoints/v4/auth.ts
3147
- var V4AuthAPI = class extends TMDBAPIBase {
3148
- /**
3149
- * Create Request Token
3150
- * POST - https://api.themoviedb.org/4/auth/request_token
3151
- *
3152
- * Generate a request token that the user must approve at the TMDB website to begin
3153
- * the v4 OAuth-style flow. Redirect the user to:
3154
- * `https://www.themoviedb.org/auth/access?request_token={request_token}`
3155
- *
3156
- * Once approved, exchange the token for an access token using `create_access_token`.
3157
- * @param body Optional body with a `redirect_to` URL for post-approval redirect.
3158
- * @reference https://developer.themoviedb.org/reference/create-request-token
3159
- */
3160
- async create_request_token(body) {
3161
- return this.client.mutate("POST", ENDPOINTS_V4.AUTH.REQUEST_TOKEN, body ?? {});
3162
- }
3163
- /**
3164
- * Create Access Token
3165
- * POST - https://api.themoviedb.org/4/auth/access_token
3166
- *
3167
- * Exchange a user-approved request token for a permanent user access token and
3168
- * TMDB account ID. Store the returned `access_token` securely — it is valid
3169
- * indefinitely until explicitly deleted with `delete_access_token`.
3170
- * @param body An object containing the approved `request_token`.
3171
- * @reference https://developer.themoviedb.org/reference/create-access-token
3172
- */
3173
- async create_access_token(body) {
3174
- return this.client.mutate("POST", ENDPOINTS_V4.AUTH.ACCESS_TOKEN, body);
3175
- }
3176
- /**
3177
- * Delete Access Token (Logout)
3178
- * DELETE - https://api.themoviedb.org/4/auth/access_token
3179
- *
3180
- * Invalidate a user access token. Use this to log a user out of your application.
3181
- * @param body An object containing the `access_token` to delete.
3182
- * @reference https://developer.themoviedb.org/reference/delete-access-token
3183
- */
3184
- async delete_access_token(body) {
3185
- return this.client.mutate("DELETE", ENDPOINTS_V4.AUTH.ACCESS_TOKEN, body);
3186
- }
3187
- };
3188
- //#endregion
3189
- //#region src/endpoints/v4/account.ts
3190
- var V4AccountAPI = class extends TMDBAPIBase {};
3191
- //#endregion
3192
- //#region src/endpoints/v4/lists.ts
3193
- var V4ListsAPI = class extends TMDBAPIBase {
3194
- listPath(list_id) {
3195
- return `${ENDPOINTS_V4.LISTS.DETAILS}/${list_id}`;
3196
- }
3197
- /**
3198
- * Create List
3199
- * POST - https://api.themoviedb.org/4/list
3200
- *
3201
- * Create a new v4 list. The authenticated user becomes the owner.
3202
- * @param body List name and ISO 639-1 language code are required.
3203
- * @reference https://developer.themoviedb.org/reference/list-create
3204
- */
3205
- async create(body) {
3206
- return this.client.mutate("POST", ENDPOINTS_V4.LISTS.DETAILS, body);
3207
- }
3208
- /**
3209
- * List Details
3210
- * GET - https://api.themoviedb.org/4/list/{list_id}
3211
- *
3212
- * Retrieve the details and paginated items of a specific list.
3213
- * @param params `list_id` is required. Optionally pass `language` and `page`.
3214
- * @reference https://developer.themoviedb.org/reference/list-details
3215
- */
3216
- async details({ list_id, ...params }) {
3217
- return this.client.request(this.listPath(list_id), this.withLanguage(params));
3218
- }
3219
- /**
3220
- * Update List
3221
- * PUT - https://api.themoviedb.org/4/list/{list_id}
3222
- *
3223
- * Update the metadata (name, description, visibility, sort order) of an existing list.
3224
- * @param body `list_id` plus any fields to change.
3225
- * @reference https://developer.themoviedb.org/reference/list-update
3226
- */
3227
- async update({ list_id, ...body }) {
3228
- return this.client.mutate("PUT", this.listPath(list_id), body);
3229
- }
3230
- /**
3231
- * Delete List
3232
- * DELETE - https://api.themoviedb.org/4/list/{list_id}
3233
- *
3234
- * Permanently delete a list. This action cannot be undone.
3235
- * @param params.list_id The TMDB list ID to delete.
3236
- * @reference https://developer.themoviedb.org/reference/list-delete
3237
- */
3238
- async delete({ list_id }) {
3239
- return this.client.mutate("DELETE", this.listPath(list_id), {});
3240
- }
3241
- /**
3242
- * Add Items
3243
- * POST - https://api.themoviedb.org/4/list/{list_id}/items
3244
- *
3245
- * Add one or more movies or TV shows to a list. For each item the response
3246
- * includes whether it was added successfully.
3247
- * @param list_id The TMDB list ID.
3248
- * @param body Array of `{ media_type, media_id }` objects to add.
3249
- * @reference https://developer.themoviedb.org/reference/list-add-items
3250
- */
3251
- async add_items(list_id, body) {
3252
- return this.client.mutate("POST", `${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.ITEMS}`, body);
3253
- }
3254
- /**
3255
- * Update Items
3256
- * PUT - https://api.themoviedb.org/4/list/{list_id}/items
3257
- *
3258
- * Update per-item comments for items already in the list.
3259
- * @param list_id The TMDB list ID.
3260
- * @param body Array of `{ media_type, media_id, comment }` objects.
3261
- * @reference https://developer.themoviedb.org/reference/list-update-items
3262
- */
3263
- async update_items(list_id, body) {
3264
- return this.client.mutate("PUT", `${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.ITEMS}`, body);
3265
- }
3266
- /**
3267
- * Remove Items
3268
- * DELETE - https://api.themoviedb.org/4/list/{list_id}/items
3269
- *
3270
- * Remove one or more items from the list.
3271
- * @param list_id The TMDB list ID.
3272
- * @param body Array of `{ media_type, media_id }` objects to remove.
3273
- * @reference https://developer.themoviedb.org/reference/list-remove-items
3274
- */
3275
- async remove_items(list_id, body) {
3276
- return this.client.mutate("DELETE", `${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.ITEMS}`, body);
3277
- }
3278
- /**
3279
- * Check Item Status
3280
- * GET - https://api.themoviedb.org/4/list/{list_id}/item_status
3281
- *
3282
- * Check whether a specific movie or TV show is already present in the list.
3283
- * @param params `list_id`, `media_type`, and `media_id` are all required.
3284
- * @reference https://developer.themoviedb.org/reference/list-item-status
3285
- */
3286
- async item_status({ list_id, ...params }) {
3287
- return this.client.request(`${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.ITEM_STATUS}`, params);
3288
- }
3289
- /**
3290
- * Clear List
3291
- * GET - https://api.themoviedb.org/4/list/{list_id}/clear
3292
- *
3293
- * Remove all items from the list without deleting the list itself.
3294
- * @param list_id The TMDB list ID to clear.
3295
- * @reference https://developer.themoviedb.org/reference/list-clear
3296
- */
3297
- async clear(list_id) {
3298
- return this.client.mutate("GET", `${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.CLEAR}`);
3299
- }
3300
- };
3301
- //#endregion
3302
- //#region src/tmdb.v4.ts
3303
- /**
3304
- * Aggregator for all TMDB API v4 namespaces.
3305
- *
3306
- * Access via `tmdb.v4` — the v4 client is backed by `https://api.themoviedb.org/4`
3307
- * and inherits the same access token and options as the parent TMDB instance.
3308
- *
3309
- * @example
3310
- * ```ts
3311
- * const tmdb = new TMDB(accessToken);
3312
- *
3313
- * // v4 auth flow
3314
- * const { request_token } = await tmdb.v4.auth.create_request_token();
3315
- * // ... user approves at https://www.themoviedb.org/auth/access?request_token=...
3316
- * const { access_token, account_id } = await tmdb.v4.auth.create_access_token({ request_token });
3317
- *
3318
- * // v4 account (account_id is a string from the access token response)
3319
- * const profile = await tmdb.v4.account.details(account_id);
3320
- * const favorites = await tmdb.v4.account.favorite_movies({ account_id, page: 1 });
3321
- *
3322
- * // v4 lists (full CRUD)
3323
- * const list = await tmdb.v4.lists.create({ name: "My list", iso_639_1: "en" });
3324
- * await tmdb.v4.lists.add_items(list.id, { items: [{ media_type: "movie", media_id: 550 }] });
3325
- * ```
3326
- */
3327
- var TMDBv4 = class {
3328
- client;
3329
- /** v4 authentication — request token → access token → logout. */
3330
- auth;
3331
- /** v4 account — details, lists, favorites, watchlist, rated. */
3332
- account;
3333
- /** v4 lists — full CRUD for user-created lists. */
3334
- lists;
3335
- constructor(accessToken, options = {}) {
3336
- if (!accessToken) throw new Error(Errors.NO_ACCESS_TOKEN);
3337
- this.client = new ApiClient(accessToken, {
3338
- version: 4,
3339
- logger: options.logger,
3340
- deduplication: options.deduplication,
3341
- images: options.images,
3342
- rate_limit: options.rate_limit,
3343
- interceptors: options.interceptors
3344
- });
3345
- this.auth = new V4AuthAPI(this.client, options);
3346
- this.account = new V4AccountAPI(this.client, options);
3347
- this.lists = new V4ListsAPI(this.client, options);
3348
- }
3349
- };
3350
- //#endregion
3351
- //#region src/tmdb.ts
3352
- var TMDB = class {
3353
- client;
3354
- accessToken;
3355
- options;
3356
- movies;
3357
- movie_lists;
3358
- search;
3359
- images;
3360
- configuration;
3361
- genres;
3362
- keywords;
3363
- tv_lists;
3364
- tv_series;
3365
- watch_providers;
3366
- certifications;
3367
- changes;
3368
- companies;
3369
- credits;
3370
- collections;
3371
- discover;
3372
- find;
3373
- networks;
3374
- tv_episodes;
3375
- tv_episode_groups;
3376
- tv_seasons;
3377
- trending;
3378
- reviews;
3379
- people_lists;
3380
- people;
3381
- account;
3382
- authentication;
3383
- guest_sessions;
3384
- lists;
3385
- /**
3386
- * TMDB API v4 namespaces. Access via `tmdb.v4.auth`, `tmdb.v4.account`, `tmdb.v4.lists`.
3387
- * Requires a Bearer (JWT) access token — throws if the instance was created with an API key.
3388
- */
3389
- get v4() {
3390
- if (!isJwt(this.accessToken)) throw new Error(Errors.V4_REQUIRES_JWT);
3391
- if (!this._v4) this._v4 = new TMDBv4(this.accessToken, this.options);
3392
- return this._v4;
3393
- }
3394
- _v4;
3395
- /**
3396
- * Creates a new TMDB instance.
3397
- * @param accessToken The TMDB API access token.
3398
- * @param options Optional default options (e.g., language) for all requests.
3399
- */
3400
- constructor(accessToken, options = {}) {
3401
- if (!accessToken) throw new Error(Errors.NO_ACCESS_TOKEN);
3402
- this.accessToken = accessToken;
3403
- this.options = options;
3404
- this.client = new ApiClient(accessToken, {
3405
- logger: options.logger,
3406
- deduplication: options.deduplication,
3407
- images: options.images,
3408
- rate_limit: options.rate_limit,
3409
- interceptors: options.interceptors
3410
- });
3411
- this.movies = new MoviesAPI(this.client, this.options);
3412
- this.movie_lists = new MovieListsAPI(this.client, this.options);
3413
- this.search = new SearchAPI(this.client, this.options);
3414
- this.images = new ImageAPI(this.options.images);
3415
- this.configuration = new ConfigurationAPI(this.client, this.options);
3416
- this.genres = new GenresAPI(this.client, this.options);
3417
- this.keywords = new KeywordsAPI(this.client, this.options);
3418
- this.tv_lists = new TVSeriesListsAPI(this.client, this.options);
3419
- this.tv_series = new TVSeriesAPI(this.client, this.options);
3420
- this.watch_providers = new WatchProvidersAPI(this.client, this.options);
3421
- this.certifications = new CertificationsAPI(this.client, this.options);
3422
- this.changes = new ChangesAPI(this.client, this.options);
3423
- this.companies = new CompaniesAPI(this.client, this.options);
3424
- this.credits = new CreditsAPI(this.client, this.options);
3425
- this.collections = new CollectionsAPI(this.client, this.options);
3426
- this.discover = new DiscoverAPI(this.client, this.options);
3427
- this.find = new FindAPI(this.client, this.options);
3428
- this.networks = new NetworksAPI(this.client, this.options);
3429
- this.tv_episodes = new TVEpisodesAPI(this.client, this.options);
3430
- this.tv_episode_groups = new TVEpisodeGroupsAPI(this.client, this.options);
3431
- this.tv_seasons = new TVSeasonsAPI(this.client, this.options);
3432
- this.trending = new TrendingAPI(this.client, this.options);
3433
- this.reviews = new ReviewsAPI(this.client, this.options);
3434
- this.people_lists = new PeopleListsAPI(this.client, this.options);
3435
- this.people = new PeopleAPI(this.client, this.options);
3436
- this.account = new AccountAPI(this.client, this.options);
3437
- this.authentication = new AuthenticationAPI(this.client, this.options);
3438
- this.guest_sessions = new GuestSessionsAPI(this.client, this.options);
3439
- this.lists = new ListsAPI(this.client, this.options);
3440
- }
3441
- };
3442
- //#endregion
3443
- //#region src/types/config/countries.ts
3444
- const TMDBCountries = [
3445
- {
3446
- iso_3166_1: "AD",
3447
- english_name: "Andorra",
3448
- native_name: "Andorra"
3449
- },
3450
- {
3451
- iso_3166_1: "AE",
3452
- english_name: "United Arab Emirates",
3453
- native_name: "United Arab Emirates"
3454
- },
3455
- {
3456
- iso_3166_1: "AF",
3457
- english_name: "Afghanistan",
3458
- native_name: "Afghanistan"
3459
- },
3460
- {
3461
- iso_3166_1: "AG",
3462
- english_name: "Antigua and Barbuda",
3463
- native_name: "Antigua & Barbuda"
3464
- },
3465
- {
3466
- iso_3166_1: "AI",
3467
- english_name: "Anguilla",
3468
- native_name: "Anguilla"
3469
- },
3470
- {
3471
- iso_3166_1: "AL",
3472
- english_name: "Albania",
3473
- native_name: "Albania"
3474
- },
3475
- {
3476
- iso_3166_1: "AM",
3477
- english_name: "Armenia",
3478
- native_name: "Armenia"
3479
- },
3480
- {
3481
- iso_3166_1: "AN",
3482
- english_name: "Netherlands Antilles",
3483
- native_name: "Netherlands Antilles"
3484
- },
3485
- {
3486
- iso_3166_1: "AO",
3487
- english_name: "Angola",
3488
- native_name: "Angola"
3489
- },
3490
- {
3491
- iso_3166_1: "AQ",
3492
- english_name: "Antarctica",
3493
- native_name: "Antarctica"
3494
- },
3495
- {
3496
- iso_3166_1: "AR",
3497
- english_name: "Argentina",
3498
- native_name: "Argentina"
3499
- },
3500
- {
3501
- iso_3166_1: "AS",
3502
- english_name: "American Samoa",
3503
- native_name: "American Samoa"
3504
- },
3505
- {
3506
- iso_3166_1: "AT",
3507
- english_name: "Austria",
3508
- native_name: "Austria"
3509
- },
3510
- {
3511
- iso_3166_1: "AU",
3512
- english_name: "Australia",
3513
- native_name: "Australia"
3514
- },
3515
- {
3516
- iso_3166_1: "AW",
3517
- english_name: "Aruba",
3518
- native_name: "Aruba"
3519
- },
3520
- {
3521
- iso_3166_1: "AZ",
3522
- english_name: "Azerbaijan",
3523
- native_name: "Azerbaijan"
3524
- },
3525
- {
3526
- iso_3166_1: "BA",
3527
- english_name: "Bosnia and Herzegovina",
3528
- native_name: "Bosnia & Herzegovina"
3529
- },
3530
- {
3531
- iso_3166_1: "BB",
3532
- english_name: "Barbados",
3533
- native_name: "Barbados"
3534
- },
3535
- {
3536
- iso_3166_1: "BD",
3537
- english_name: "Bangladesh",
3538
- native_name: "Bangladesh"
3539
- },
3540
- {
3541
- iso_3166_1: "BE",
3542
- english_name: "Belgium",
3543
- native_name: "Belgium"
3544
- },
3545
- {
3546
- iso_3166_1: "BF",
3547
- english_name: "Burkina Faso",
3548
- native_name: "Burkina Faso"
3549
- },
3550
- {
3551
- iso_3166_1: "BG",
3552
- english_name: "Bulgaria",
3553
- native_name: "Bulgaria"
3554
- },
3555
- {
3556
- iso_3166_1: "BH",
3557
- english_name: "Bahrain",
3558
- native_name: "Bahrain"
3559
- },
3560
- {
3561
- iso_3166_1: "BI",
3562
- english_name: "Burundi",
3563
- native_name: "Burundi"
3564
- },
3565
- {
3566
- iso_3166_1: "BJ",
3567
- english_name: "Benin",
3568
- native_name: "Benin"
3569
- },
3570
- {
3571
- iso_3166_1: "BM",
3572
- english_name: "Bermuda",
3573
- native_name: "Bermuda"
3574
- },
3575
- {
3576
- iso_3166_1: "BN",
3577
- english_name: "Brunei Darussalam",
3578
- native_name: "Brunei"
3579
- },
3580
- {
3581
- iso_3166_1: "BO",
3582
- english_name: "Bolivia",
3583
- native_name: "Bolivia"
3584
- },
3585
- {
3586
- iso_3166_1: "BR",
3587
- english_name: "Brazil",
3588
- native_name: "Brazil"
3589
- },
3590
- {
3591
- iso_3166_1: "BS",
3592
- english_name: "Bahamas",
3593
- native_name: "Bahamas"
3594
- },
3595
- {
3596
- iso_3166_1: "BT",
3597
- english_name: "Bhutan",
3598
- native_name: "Bhutan"
3599
- },
3600
- {
3601
- iso_3166_1: "BU",
3602
- english_name: "Burma",
3603
- native_name: "Burma"
3604
- },
3605
- {
3606
- iso_3166_1: "BV",
3607
- english_name: "Bouvet Island",
3608
- native_name: "Bouvet Island"
3609
- },
3610
- {
3611
- iso_3166_1: "BW",
3612
- english_name: "Botswana",
3613
- native_name: "Botswana"
3614
- },
3615
- {
3616
- iso_3166_1: "BY",
3617
- english_name: "Belarus",
3618
- native_name: "Belarus"
3619
- },
3620
- {
3621
- iso_3166_1: "BZ",
3622
- english_name: "Belize",
3623
- native_name: "Belize"
3624
- },
3625
- {
3626
- iso_3166_1: "CA",
3627
- english_name: "Canada",
3628
- native_name: "Canada"
3629
- },
3630
- {
3631
- iso_3166_1: "CC",
3632
- english_name: "Cocos Islands",
3633
- native_name: "Cocos (Keeling) Islands"
3634
- },
3635
- {
3636
- iso_3166_1: "CD",
3637
- english_name: "Congo",
3638
- native_name: "Democratic Republic of the Congo (Kinshasa)"
3639
- },
3640
- {
3641
- iso_3166_1: "CF",
3642
- english_name: "Central African Republic",
3643
- native_name: "Central African Republic"
3644
- },
3645
- {
3646
- iso_3166_1: "CG",
3647
- english_name: "Congo",
3648
- native_name: "Republic of the Congo (Brazzaville)"
3649
- },
3650
- {
3651
- iso_3166_1: "CH",
3652
- english_name: "Switzerland",
3653
- native_name: "Switzerland"
3654
- },
3655
- {
3656
- iso_3166_1: "CI",
3657
- english_name: "Cote D'Ivoire",
3658
- native_name: "Côte d’Ivoire"
3659
- },
3660
- {
3661
- iso_3166_1: "CK",
3662
- english_name: "Cook Islands",
3663
- native_name: "Cook Islands"
3664
- },
3665
- {
3666
- iso_3166_1: "CL",
3667
- english_name: "Chile",
3668
- native_name: "Chile"
3669
- },
3670
- {
3671
- iso_3166_1: "CM",
3672
- english_name: "Cameroon",
3673
- native_name: "Cameroon"
3674
- },
3675
- {
3676
- iso_3166_1: "CN",
3677
- english_name: "China",
3678
- native_name: "China"
3679
- },
3680
- {
3681
- iso_3166_1: "CO",
3682
- english_name: "Colombia",
3683
- native_name: "Colombia"
3684
- },
3685
- {
3686
- iso_3166_1: "CR",
3687
- english_name: "Costa Rica",
3688
- native_name: "Costa Rica"
3689
- },
3690
- {
3691
- iso_3166_1: "CS",
3692
- english_name: "Serbia and Montenegro",
3693
- native_name: "Serbia and Montenegro"
3694
- },
3695
- {
3696
- iso_3166_1: "CU",
3697
- english_name: "Cuba",
3698
- native_name: "Cuba"
3699
- },
3700
- {
3701
- iso_3166_1: "CV",
3702
- english_name: "Cape Verde",
3703
- native_name: "Cape Verde"
3704
- },
3705
- {
3706
- iso_3166_1: "CX",
3707
- english_name: "Christmas Island",
3708
- native_name: "Christmas Island"
3709
- },
3710
- {
3711
- iso_3166_1: "CY",
3712
- english_name: "Cyprus",
3713
- native_name: "Cyprus"
3714
- },
3715
- {
3716
- iso_3166_1: "CZ",
3717
- english_name: "Czech Republic",
3718
- native_name: "Czech Republic"
3719
- },
3720
- {
3721
- iso_3166_1: "DE",
3722
- english_name: "Germany",
3723
- native_name: "Germany"
3724
- },
3725
- {
3726
- iso_3166_1: "DJ",
3727
- english_name: "Djibouti",
3728
- native_name: "Djibouti"
3729
- },
3730
- {
3731
- iso_3166_1: "DK",
3732
- english_name: "Denmark",
3733
- native_name: "Denmark"
3734
- },
3735
- {
3736
- iso_3166_1: "DM",
3737
- english_name: "Dominica",
3738
- native_name: "Dominica"
3739
- },
3740
- {
3741
- iso_3166_1: "DO",
3742
- english_name: "Dominican Republic",
3743
- native_name: "Dominican Republic"
3744
- },
3745
- {
3746
- iso_3166_1: "DZ",
3747
- english_name: "Algeria",
3748
- native_name: "Algeria"
3749
- },
3750
- {
3751
- iso_3166_1: "EC",
3752
- english_name: "Ecuador",
3753
- native_name: "Ecuador"
3754
- },
3755
- {
3756
- iso_3166_1: "EE",
3757
- english_name: "Estonia",
3758
- native_name: "Estonia"
3759
- },
3760
- {
3761
- iso_3166_1: "EG",
3762
- english_name: "Egypt",
3763
- native_name: "Egypt"
3764
- },
3765
- {
3766
- iso_3166_1: "EH",
3767
- english_name: "Western Sahara",
3768
- native_name: "Western Sahara"
3769
- },
3770
- {
3771
- iso_3166_1: "ER",
3772
- english_name: "Eritrea",
3773
- native_name: "Eritrea"
3774
- },
3775
- {
3776
- iso_3166_1: "ES",
3777
- english_name: "Spain",
3778
- native_name: "Spain"
3779
- },
3780
- {
3781
- iso_3166_1: "ET",
3782
- english_name: "Ethiopia",
3783
- native_name: "Ethiopia"
3784
- },
3785
- {
3786
- iso_3166_1: "FI",
3787
- english_name: "Finland",
3788
- native_name: "Finland"
3789
- },
3790
- {
3791
- iso_3166_1: "FJ",
3792
- english_name: "Fiji",
3793
- native_name: "Fiji"
3794
- },
3795
- {
3796
- iso_3166_1: "FK",
3797
- english_name: "Falkland Islands",
3798
- native_name: "Falkland Islands"
3799
- },
3800
- {
3801
- iso_3166_1: "FM",
3802
- english_name: "Micronesia",
3803
- native_name: "Micronesia"
3804
- },
3805
- {
3806
- iso_3166_1: "FO",
3807
- english_name: "Faeroe Islands",
3808
- native_name: "Faroe Islands"
3809
- },
3810
- {
3811
- iso_3166_1: "FR",
3812
- english_name: "France",
3813
- native_name: "France"
3814
- },
3815
- {
3816
- iso_3166_1: "GA",
3817
- english_name: "Gabon",
3818
- native_name: "Gabon"
3819
- },
3820
- {
3821
- iso_3166_1: "GB",
3822
- english_name: "United Kingdom",
3823
- native_name: "United Kingdom"
3824
- },
3825
- {
3826
- iso_3166_1: "GD",
3827
- english_name: "Grenada",
3828
- native_name: "Grenada"
3829
- },
3830
- {
3831
- iso_3166_1: "GE",
3832
- english_name: "Georgia",
3833
- native_name: "Georgia"
3834
- },
3835
- {
3836
- iso_3166_1: "GF",
3837
- english_name: "French Guiana",
3838
- native_name: "French Guiana"
3839
- },
3840
- {
3841
- iso_3166_1: "GH",
3842
- english_name: "Ghana",
3843
- native_name: "Ghana"
3844
- },
3845
- {
3846
- iso_3166_1: "GI",
3847
- english_name: "Gibraltar",
3848
- native_name: "Gibraltar"
3849
- },
3850
- {
3851
- iso_3166_1: "GL",
3852
- english_name: "Greenland",
3853
- native_name: "Greenland"
3854
- },
3855
- {
3856
- iso_3166_1: "GM",
3857
- english_name: "Gambia",
3858
- native_name: "Gambia"
3859
- },
3860
- {
3861
- iso_3166_1: "GN",
3862
- english_name: "Guinea",
3863
- native_name: "Guinea"
3864
- },
3865
- {
3866
- iso_3166_1: "GP",
3867
- english_name: "Guadaloupe",
3868
- native_name: "Guadeloupe"
3869
- },
3870
- {
3871
- iso_3166_1: "GQ",
3872
- english_name: "Equatorial Guinea",
3873
- native_name: "Equatorial Guinea"
3874
- },
3875
- {
3876
- iso_3166_1: "GR",
3877
- english_name: "Greece",
3878
- native_name: "Greece"
3879
- },
3880
- {
3881
- iso_3166_1: "GS",
3882
- english_name: "South Georgia and the South Sandwich Islands",
3883
- native_name: "South Georgia & South Sandwich Islands"
3884
- },
3885
- {
3886
- iso_3166_1: "GT",
3887
- english_name: "Guatemala",
3888
- native_name: "Guatemala"
3889
- },
3890
- {
3891
- iso_3166_1: "GU",
3892
- english_name: "Guam",
3893
- native_name: "Guam"
3894
- },
3895
- {
3896
- iso_3166_1: "GW",
3897
- english_name: "Guinea-Bissau",
3898
- native_name: "Guinea-Bissau"
3899
- },
3900
- {
3901
- iso_3166_1: "GY",
3902
- english_name: "Guyana",
3903
- native_name: "Guyana"
3904
- },
3905
- {
3906
- iso_3166_1: "HK",
3907
- english_name: "Hong Kong",
3908
- native_name: "Hong Kong SAR China"
3909
- },
3910
- {
3911
- iso_3166_1: "HM",
3912
- english_name: "Heard and McDonald Islands",
3913
- native_name: "Heard & McDonald Islands"
3914
- },
3915
- {
3916
- iso_3166_1: "HN",
3917
- english_name: "Honduras",
3918
- native_name: "Honduras"
3919
- },
3920
- {
3921
- iso_3166_1: "HR",
3922
- english_name: "Croatia",
3923
- native_name: "Croatia"
3924
- },
3925
- {
3926
- iso_3166_1: "HT",
3927
- english_name: "Haiti",
3928
- native_name: "Haiti"
3929
- },
3930
- {
3931
- iso_3166_1: "HU",
3932
- english_name: "Hungary",
3933
- native_name: "Hungary"
3934
- },
3935
- {
3936
- iso_3166_1: "ID",
3937
- english_name: "Indonesia",
3938
- native_name: "Indonesia"
3939
- },
3940
- {
3941
- iso_3166_1: "IE",
3942
- english_name: "Ireland",
3943
- native_name: "Ireland"
3944
- },
3945
- {
3946
- iso_3166_1: "IL",
3947
- english_name: "Israel",
3948
- native_name: "Israel"
3949
- },
3950
- {
3951
- iso_3166_1: "IN",
3952
- english_name: "India",
3953
- native_name: "India"
3954
- },
3955
- {
3956
- iso_3166_1: "IO",
3957
- english_name: "British Indian Ocean Territory",
3958
- native_name: "British Indian Ocean Territory"
3959
- },
3960
- {
3961
- iso_3166_1: "IQ",
3962
- english_name: "Iraq",
3963
- native_name: "Iraq"
3964
- },
3965
- {
3966
- iso_3166_1: "IR",
3967
- english_name: "Iran",
3968
- native_name: "Iran"
3969
- },
3970
- {
3971
- iso_3166_1: "IS",
3972
- english_name: "Iceland",
3973
- native_name: "Iceland"
3974
- },
3975
- {
3976
- iso_3166_1: "IT",
3977
- english_name: "Italy",
3978
- native_name: "Italy"
3979
- },
3980
- {
3981
- iso_3166_1: "JM",
3982
- english_name: "Jamaica",
3983
- native_name: "Jamaica"
3984
- },
3985
- {
3986
- iso_3166_1: "JO",
3987
- english_name: "Jordan",
3988
- native_name: "Jordan"
3989
- },
3990
- {
3991
- iso_3166_1: "JP",
3992
- english_name: "Japan",
3993
- native_name: "Japan"
3994
- },
3995
- {
3996
- iso_3166_1: "KE",
3997
- english_name: "Kenya",
3998
- native_name: "Kenya"
3999
- },
4000
- {
4001
- iso_3166_1: "KG",
4002
- english_name: "Kyrgyz Republic",
4003
- native_name: "Kyrgyzstan"
4004
- },
4005
- {
4006
- iso_3166_1: "KH",
4007
- english_name: "Cambodia",
4008
- native_name: "Cambodia"
4009
- },
4010
- {
4011
- iso_3166_1: "KI",
4012
- english_name: "Kiribati",
4013
- native_name: "Kiribati"
4014
- },
4015
- {
4016
- iso_3166_1: "KM",
4017
- english_name: "Comoros",
4018
- native_name: "Comoros"
4019
- },
4020
- {
4021
- iso_3166_1: "KN",
4022
- english_name: "St. Kitts and Nevis",
4023
- native_name: "St. Kitts & Nevis"
4024
- },
4025
- {
4026
- iso_3166_1: "KP",
4027
- english_name: "North Korea",
4028
- native_name: "North Korea"
4029
- },
4030
- {
4031
- iso_3166_1: "KR",
4032
- english_name: "South Korea",
4033
- native_name: "South Korea"
4034
- },
4035
- {
4036
- iso_3166_1: "KW",
4037
- english_name: "Kuwait",
4038
- native_name: "Kuwait"
4039
- },
4040
- {
4041
- iso_3166_1: "KY",
4042
- english_name: "Cayman Islands",
4043
- native_name: "Cayman Islands"
4044
- },
4045
- {
4046
- iso_3166_1: "KZ",
4047
- english_name: "Kazakhstan",
4048
- native_name: "Kazakhstan"
4049
- },
4050
- {
4051
- iso_3166_1: "LA",
4052
- english_name: "Lao People's Democratic Republic",
4053
- native_name: "Laos"
4054
- },
4055
- {
4056
- iso_3166_1: "LB",
4057
- english_name: "Lebanon",
4058
- native_name: "Lebanon"
4059
- },
4060
- {
4061
- iso_3166_1: "LC",
4062
- english_name: "St. Lucia",
4063
- native_name: "St. Lucia"
4064
- },
4065
- {
4066
- iso_3166_1: "LI",
4067
- english_name: "Liechtenstein",
4068
- native_name: "Liechtenstein"
4069
- },
4070
- {
4071
- iso_3166_1: "LK",
4072
- english_name: "Sri Lanka",
4073
- native_name: "Sri Lanka"
4074
- },
4075
- {
4076
- iso_3166_1: "LR",
4077
- english_name: "Liberia",
4078
- native_name: "Liberia"
4079
- },
4080
- {
4081
- iso_3166_1: "LS",
4082
- english_name: "Lesotho",
4083
- native_name: "Lesotho"
4084
- },
4085
- {
4086
- iso_3166_1: "LT",
4087
- english_name: "Lithuania",
4088
- native_name: "Lithuania"
4089
- },
4090
- {
4091
- iso_3166_1: "LU",
4092
- english_name: "Luxembourg",
4093
- native_name: "Luxembourg"
4094
- },
4095
- {
4096
- iso_3166_1: "LV",
4097
- english_name: "Latvia",
4098
- native_name: "Latvia"
4099
- },
4100
- {
4101
- iso_3166_1: "LY",
4102
- english_name: "Libyan Arab Jamahiriya",
4103
- native_name: "Libya"
4104
- },
4105
- {
4106
- iso_3166_1: "MA",
4107
- english_name: "Morocco",
4108
- native_name: "Morocco"
4109
- },
4110
- {
4111
- iso_3166_1: "MC",
4112
- english_name: "Monaco",
4113
- native_name: "Monaco"
4114
- },
4115
- {
4116
- iso_3166_1: "MD",
4117
- english_name: "Moldova",
4118
- native_name: "Moldova"
4119
- },
4120
- {
4121
- iso_3166_1: "ME",
4122
- english_name: "Montenegro",
4123
- native_name: "Montenegro"
4124
- },
4125
- {
4126
- iso_3166_1: "MG",
4127
- english_name: "Madagascar",
4128
- native_name: "Madagascar"
4129
- },
4130
- {
4131
- iso_3166_1: "MH",
4132
- english_name: "Marshall Islands",
4133
- native_name: "Marshall Islands"
4134
- },
4135
- {
4136
- iso_3166_1: "MK",
4137
- english_name: "Macedonia",
4138
- native_name: "Macedonia"
4139
- },
4140
- {
4141
- iso_3166_1: "ML",
4142
- english_name: "Mali",
4143
- native_name: "Mali"
4144
- },
4145
- {
4146
- iso_3166_1: "MM",
4147
- english_name: "Myanmar",
4148
- native_name: "Myanmar (Burma)"
4149
- },
4150
- {
4151
- iso_3166_1: "MN",
4152
- english_name: "Mongolia",
4153
- native_name: "Mongolia"
4154
- },
4155
- {
4156
- iso_3166_1: "MO",
4157
- english_name: "Macao",
4158
- native_name: "Macau SAR China"
4159
- },
4160
- {
4161
- iso_3166_1: "MP",
4162
- english_name: "Northern Mariana Islands",
4163
- native_name: "Northern Mariana Islands"
4164
- },
4165
- {
4166
- iso_3166_1: "MQ",
4167
- english_name: "Martinique",
4168
- native_name: "Martinique"
4169
- },
4170
- {
4171
- iso_3166_1: "MR",
4172
- english_name: "Mauritania",
4173
- native_name: "Mauritania"
4174
- },
4175
- {
4176
- iso_3166_1: "MS",
4177
- english_name: "Montserrat",
4178
- native_name: "Montserrat"
4179
- },
4180
- {
4181
- iso_3166_1: "MT",
4182
- english_name: "Malta",
4183
- native_name: "Malta"
4184
- },
4185
- {
4186
- iso_3166_1: "MU",
4187
- english_name: "Mauritius",
4188
- native_name: "Mauritius"
4189
- },
4190
- {
4191
- iso_3166_1: "MV",
4192
- english_name: "Maldives",
4193
- native_name: "Maldives"
4194
- },
4195
- {
4196
- iso_3166_1: "MW",
4197
- english_name: "Malawi",
4198
- native_name: "Malawi"
4199
- },
4200
- {
4201
- iso_3166_1: "MX",
4202
- english_name: "Mexico",
4203
- native_name: "Mexico"
4204
- },
4205
- {
4206
- iso_3166_1: "MY",
4207
- english_name: "Malaysia",
4208
- native_name: "Malaysia"
4209
- },
4210
- {
4211
- iso_3166_1: "MZ",
4212
- english_name: "Mozambique",
4213
- native_name: "Mozambique"
4214
- },
4215
- {
4216
- iso_3166_1: "NA",
4217
- english_name: "Namibia",
4218
- native_name: "Namibia"
4219
- },
4220
- {
4221
- iso_3166_1: "NC",
4222
- english_name: "New Caledonia",
4223
- native_name: "New Caledonia"
4224
- },
4225
- {
4226
- iso_3166_1: "NE",
4227
- english_name: "Niger",
4228
- native_name: "Niger"
4229
- },
4230
- {
4231
- iso_3166_1: "NF",
4232
- english_name: "Norfolk Island",
4233
- native_name: "Norfolk Island"
4234
- },
4235
- {
4236
- iso_3166_1: "NG",
4237
- english_name: "Nigeria",
4238
- native_name: "Nigeria"
4239
- },
4240
- {
4241
- iso_3166_1: "NI",
4242
- english_name: "Nicaragua",
4243
- native_name: "Nicaragua"
4244
- },
4245
- {
4246
- iso_3166_1: "NL",
4247
- english_name: "Netherlands",
4248
- native_name: "Netherlands"
4249
- },
4250
- {
4251
- iso_3166_1: "NO",
4252
- english_name: "Norway",
4253
- native_name: "Norway"
4254
- },
4255
- {
4256
- iso_3166_1: "NP",
4257
- english_name: "Nepal",
4258
- native_name: "Nepal"
4259
- },
4260
- {
4261
- iso_3166_1: "NR",
4262
- english_name: "Nauru",
4263
- native_name: "Nauru"
4264
- },
4265
- {
4266
- iso_3166_1: "NU",
4267
- english_name: "Niue",
4268
- native_name: "Niue"
4269
- },
4270
- {
4271
- iso_3166_1: "NZ",
4272
- english_name: "New Zealand",
4273
- native_name: "New Zealand"
4274
- },
4275
- {
4276
- iso_3166_1: "OM",
4277
- english_name: "Oman",
4278
- native_name: "Oman"
4279
- },
4280
- {
4281
- iso_3166_1: "PA",
4282
- english_name: "Panama",
4283
- native_name: "Panama"
4284
- },
4285
- {
4286
- iso_3166_1: "PE",
4287
- english_name: "Peru",
4288
- native_name: "Peru"
4289
- },
4290
- {
4291
- iso_3166_1: "PF",
4292
- english_name: "French Polynesia",
4293
- native_name: "French Polynesia"
4294
- },
4295
- {
4296
- iso_3166_1: "PG",
4297
- english_name: "Papua New Guinea",
4298
- native_name: "Papua New Guinea"
4299
- },
4300
- {
4301
- iso_3166_1: "PH",
4302
- english_name: "Philippines",
4303
- native_name: "Philippines"
4304
- },
4305
- {
4306
- iso_3166_1: "PK",
4307
- english_name: "Pakistan",
4308
- native_name: "Pakistan"
4309
- },
4310
- {
4311
- iso_3166_1: "PL",
4312
- english_name: "Poland",
4313
- native_name: "Poland"
4314
- },
4315
- {
4316
- iso_3166_1: "PM",
4317
- english_name: "St. Pierre and Miquelon",
4318
- native_name: "St. Pierre & Miquelon"
4319
- },
4320
- {
4321
- iso_3166_1: "PN",
4322
- english_name: "Pitcairn Island",
4323
- native_name: "Pitcairn Islands"
4324
- },
4325
- {
4326
- iso_3166_1: "PR",
4327
- english_name: "Puerto Rico",
4328
- native_name: "Puerto Rico"
4329
- },
4330
- {
4331
- iso_3166_1: "PS",
4332
- english_name: "Palestinian Territory",
4333
- native_name: "Palestinian Territories"
4334
- },
4335
- {
4336
- iso_3166_1: "PT",
4337
- english_name: "Portugal",
4338
- native_name: "Portugal"
4339
- },
4340
- {
4341
- iso_3166_1: "PW",
4342
- english_name: "Palau",
4343
- native_name: "Palau"
4344
- },
4345
- {
4346
- iso_3166_1: "PY",
4347
- english_name: "Paraguay",
4348
- native_name: "Paraguay"
4349
- },
4350
- {
4351
- iso_3166_1: "QA",
4352
- english_name: "Qatar",
4353
- native_name: "Qatar"
4354
- },
4355
- {
4356
- iso_3166_1: "RE",
4357
- english_name: "Reunion",
4358
- native_name: "Réunion"
4359
- },
4360
- {
4361
- iso_3166_1: "RO",
4362
- english_name: "Romania",
4363
- native_name: "Romania"
4364
- },
4365
- {
4366
- iso_3166_1: "RS",
4367
- english_name: "Serbia",
4368
- native_name: "Serbia"
4369
- },
4370
- {
4371
- iso_3166_1: "RU",
4372
- english_name: "Russia",
4373
- native_name: "Russia"
4374
- },
4375
- {
4376
- iso_3166_1: "RW",
4377
- english_name: "Rwanda",
4378
- native_name: "Rwanda"
4379
- },
4380
- {
4381
- iso_3166_1: "SA",
4382
- english_name: "Saudi Arabia",
4383
- native_name: "Saudi Arabia"
4384
- },
4385
- {
4386
- iso_3166_1: "SB",
4387
- english_name: "Solomon Islands",
4388
- native_name: "Solomon Islands"
4389
- },
4390
- {
4391
- iso_3166_1: "SC",
4392
- english_name: "Seychelles",
4393
- native_name: "Seychelles"
4394
- },
4395
- {
4396
- iso_3166_1: "SD",
4397
- english_name: "Sudan",
4398
- native_name: "Sudan"
4399
- },
4400
- {
4401
- iso_3166_1: "SE",
4402
- english_name: "Sweden",
4403
- native_name: "Sweden"
4404
- },
4405
- {
4406
- iso_3166_1: "SG",
4407
- english_name: "Singapore",
4408
- native_name: "Singapore"
4409
- },
4410
- {
4411
- iso_3166_1: "SH",
4412
- english_name: "St. Helena",
4413
- native_name: "St. Helena"
4414
- },
4415
- {
4416
- iso_3166_1: "SI",
4417
- english_name: "Slovenia",
4418
- native_name: "Slovenia"
4419
- },
4420
- {
4421
- iso_3166_1: "SJ",
4422
- english_name: "Svalbard & Jan Mayen Islands",
4423
- native_name: "Svalbard & Jan Mayen"
4424
- },
4425
- {
4426
- iso_3166_1: "SK",
4427
- english_name: "Slovakia",
4428
- native_name: "Slovakia"
4429
- },
4430
- {
4431
- iso_3166_1: "SL",
4432
- english_name: "Sierra Leone",
4433
- native_name: "Sierra Leone"
4434
- },
4435
- {
4436
- iso_3166_1: "SM",
4437
- english_name: "San Marino",
4438
- native_name: "San Marino"
4439
- },
4440
- {
4441
- iso_3166_1: "SN",
4442
- english_name: "Senegal",
4443
- native_name: "Senegal"
4444
- },
4445
- {
4446
- iso_3166_1: "SO",
4447
- english_name: "Somalia",
4448
- native_name: "Somalia"
4449
- },
4450
- {
4451
- iso_3166_1: "SR",
4452
- english_name: "Suriname",
4453
- native_name: "Suriname"
4454
- },
4455
- {
4456
- iso_3166_1: "SS",
4457
- english_name: "South Sudan",
4458
- native_name: "South Sudan"
4459
- },
4460
- {
4461
- iso_3166_1: "ST",
4462
- english_name: "Sao Tome and Principe",
4463
- native_name: "São Tomé & Príncipe"
4464
- },
4465
- {
4466
- iso_3166_1: "SU",
4467
- english_name: "Soviet Union",
4468
- native_name: "Soviet Union"
4469
- },
4470
- {
4471
- iso_3166_1: "SV",
4472
- english_name: "El Salvador",
4473
- native_name: "El Salvador"
4474
- },
4475
- {
4476
- iso_3166_1: "SY",
4477
- english_name: "Syrian Arab Republic",
4478
- native_name: "Syria"
4479
- },
4480
- {
4481
- iso_3166_1: "SZ",
4482
- english_name: "Swaziland",
4483
- native_name: "Eswatini (Swaziland)"
4484
- },
4485
- {
4486
- iso_3166_1: "TC",
4487
- english_name: "Turks and Caicos Islands",
4488
- native_name: "Turks & Caicos Islands"
4489
- },
4490
- {
4491
- iso_3166_1: "TD",
4492
- english_name: "Chad",
4493
- native_name: "Chad"
4494
- },
4495
- {
4496
- iso_3166_1: "TF",
4497
- english_name: "French Southern Territories",
4498
- native_name: "French Southern Territories"
4499
- },
4500
- {
4501
- iso_3166_1: "TG",
4502
- english_name: "Togo",
4503
- native_name: "Togo"
4504
- },
4505
- {
4506
- iso_3166_1: "TH",
4507
- english_name: "Thailand",
4508
- native_name: "Thailand"
4509
- },
4510
- {
4511
- iso_3166_1: "TJ",
4512
- english_name: "Tajikistan",
4513
- native_name: "Tajikistan"
4514
- },
4515
- {
4516
- iso_3166_1: "TK",
4517
- english_name: "Tokelau",
4518
- native_name: "Tokelau"
4519
- },
4520
- {
4521
- iso_3166_1: "TL",
4522
- english_name: "Timor-Leste",
4523
- native_name: "Timor-Leste"
4524
- },
4525
- {
4526
- iso_3166_1: "TM",
4527
- english_name: "Turkmenistan",
4528
- native_name: "Turkmenistan"
4529
- },
4530
- {
4531
- iso_3166_1: "TN",
4532
- english_name: "Tunisia",
4533
- native_name: "Tunisia"
4534
- },
4535
- {
4536
- iso_3166_1: "TO",
4537
- english_name: "Tonga",
4538
- native_name: "Tonga"
4539
- },
4540
- {
4541
- iso_3166_1: "TP",
4542
- english_name: "East Timor",
4543
- native_name: "East Timor"
4544
- },
4545
- {
4546
- iso_3166_1: "TR",
4547
- english_name: "Turkey",
4548
- native_name: "Turkey"
4549
- },
4550
- {
4551
- iso_3166_1: "TT",
4552
- english_name: "Trinidad and Tobago",
4553
- native_name: "Trinidad & Tobago"
4554
- },
4555
- {
4556
- iso_3166_1: "TV",
4557
- english_name: "Tuvalu",
4558
- native_name: "Tuvalu"
4559
- },
4560
- {
4561
- iso_3166_1: "TW",
4562
- english_name: "Taiwan",
4563
- native_name: "Taiwan"
4564
- },
4565
- {
4566
- iso_3166_1: "TZ",
4567
- english_name: "Tanzania",
4568
- native_name: "Tanzania"
4569
- },
4570
- {
4571
- iso_3166_1: "UA",
4572
- english_name: "Ukraine",
4573
- native_name: "Ukraine"
4574
- },
4575
- {
4576
- iso_3166_1: "UG",
4577
- english_name: "Uganda",
4578
- native_name: "Uganda"
4579
- },
4580
- {
4581
- iso_3166_1: "UM",
4582
- english_name: "United States Minor Outlying Islands",
4583
- native_name: "U.S. Outlying Islands"
4584
- },
4585
- {
4586
- iso_3166_1: "US",
4587
- english_name: "United States of America",
4588
- native_name: "United States"
4589
- },
4590
- {
4591
- iso_3166_1: "UY",
4592
- english_name: "Uruguay",
4593
- native_name: "Uruguay"
4594
- },
4595
- {
4596
- iso_3166_1: "UZ",
4597
- english_name: "Uzbekistan",
4598
- native_name: "Uzbekistan"
4599
- },
4600
- {
4601
- iso_3166_1: "VA",
4602
- english_name: "Holy See",
4603
- native_name: "Vatican City"
4604
- },
4605
- {
4606
- iso_3166_1: "VC",
4607
- english_name: "St. Vincent and the Grenadines",
4608
- native_name: "St. Vincent & Grenadines"
4609
- },
4610
- {
4611
- iso_3166_1: "VE",
4612
- english_name: "Venezuela",
4613
- native_name: "Venezuela"
4614
- },
4615
- {
4616
- iso_3166_1: "VG",
4617
- english_name: "British Virgin Islands",
4618
- native_name: "British Virgin Islands"
4619
- },
4620
- {
4621
- iso_3166_1: "VI",
4622
- english_name: "US Virgin Islands",
4623
- native_name: "U.S. Virgin Islands"
4624
- },
4625
- {
4626
- iso_3166_1: "VN",
4627
- english_name: "Vietnam",
4628
- native_name: "Vietnam"
4629
- },
4630
- {
4631
- iso_3166_1: "VU",
4632
- english_name: "Vanuatu",
4633
- native_name: "Vanuatu"
4634
- },
4635
- {
4636
- iso_3166_1: "WF",
4637
- english_name: "Wallis and Futuna Islands",
4638
- native_name: "Wallis & Futuna"
4639
- },
4640
- {
4641
- iso_3166_1: "WS",
4642
- english_name: "Samoa",
4643
- native_name: "Samoa"
4644
- },
4645
- {
4646
- iso_3166_1: "XC",
4647
- english_name: "Czechoslovakia",
4648
- native_name: "Czechoslovakia"
4649
- },
4650
- {
4651
- iso_3166_1: "XG",
4652
- english_name: "East Germany",
4653
- native_name: "East Germany"
4654
- },
4655
- {
4656
- iso_3166_1: "XI",
4657
- english_name: "Northern Ireland",
4658
- native_name: "Northern Ireland"
4659
- },
4660
- {
4661
- iso_3166_1: "XK",
4662
- english_name: "Kosovo",
4663
- native_name: "Kosovo"
4664
- },
4665
- {
4666
- iso_3166_1: "YE",
4667
- english_name: "Yemen",
4668
- native_name: "Yemen"
4669
- },
4670
- {
4671
- iso_3166_1: "YT",
4672
- english_name: "Mayotte",
4673
- native_name: "Mayotte"
4674
- },
4675
- {
4676
- iso_3166_1: "YU",
4677
- english_name: "Yugoslavia",
4678
- native_name: "Yugoslavia"
4679
- },
4680
- {
4681
- iso_3166_1: "ZA",
4682
- english_name: "South Africa",
4683
- native_name: "South Africa"
4684
- },
4685
- {
4686
- iso_3166_1: "ZM",
4687
- english_name: "Zambia",
4688
- native_name: "Zambia"
4689
- },
4690
- {
4691
- iso_3166_1: "ZR",
4692
- english_name: "Zaire",
4693
- native_name: "Zaire"
4694
- },
4695
- {
4696
- iso_3166_1: "ZW",
4697
- english_name: "Zimbabwe",
4698
- native_name: "Zimbabwe"
4699
- }
4700
- ];
4701
- //#endregion
4702
- //#region src/types/discover.ts
4703
- /**
4704
- * TV status values accepted by TMDB discover filters.
4705
- * @reference https://developer.themoviedb.org/reference/discover-tv
4706
- */
4707
- let DiscoverTVStatus = /* @__PURE__ */ function(DiscoverTVStatus) {
4708
- DiscoverTVStatus[DiscoverTVStatus["ReturningSeries"] = 0] = "ReturningSeries";
4709
- DiscoverTVStatus[DiscoverTVStatus["Planned"] = 1] = "Planned";
4710
- DiscoverTVStatus[DiscoverTVStatus["InProduction"] = 2] = "InProduction";
4711
- DiscoverTVStatus[DiscoverTVStatus["Ended"] = 3] = "Ended";
4712
- DiscoverTVStatus[DiscoverTVStatus["Canceled"] = 4] = "Canceled";
4713
- DiscoverTVStatus[DiscoverTVStatus["Pilot"] = 5] = "Pilot";
4714
- return DiscoverTVStatus;
4715
- }({});
4716
- /**
4717
- * TV type values accepted by TMDB discover filters.
4718
- * @reference https://developer.themoviedb.org/reference/discover-tv
4719
- */
4720
- let DiscoverTVType = /* @__PURE__ */ function(DiscoverTVType) {
4721
- DiscoverTVType[DiscoverTVType["Documentary"] = 0] = "Documentary";
4722
- DiscoverTVType[DiscoverTVType["News"] = 1] = "News";
4723
- DiscoverTVType[DiscoverTVType["Miniseries"] = 2] = "Miniseries";
4724
- DiscoverTVType[DiscoverTVType["Reality"] = 3] = "Reality";
4725
- DiscoverTVType[DiscoverTVType["Scripted"] = 4] = "Scripted";
4726
- DiscoverTVType[DiscoverTVType["TalkShow"] = 5] = "TalkShow";
4727
- DiscoverTVType[DiscoverTVType["Video"] = 6] = "Video";
4728
- return DiscoverTVType;
4729
- }({});
4730
- //#endregion
4731
- //#region src/types/utility.ts
4732
- /**
4733
- * Type guard checks for KnowForItems (tv or movie)
4734
- * @returns
4735
- */
4736
- function isKnownForMovie(item) {
4737
- return item.media_type === "movie";
4738
- }
4739
- function isKnownForTV(item) {
4740
- return item.media_type === "tv";
4741
- }
4742
- //#endregion
4743
- //#region src/types/tv-episode-groups.ts
4744
- /**
4745
- * Supported episode group type identifiers.
4746
- */
4747
- let TVEpisodeGroupType = /* @__PURE__ */ function(TVEpisodeGroupType) {
4748
- TVEpisodeGroupType[TVEpisodeGroupType["OriginalAirDate"] = 1] = "OriginalAirDate";
4749
- TVEpisodeGroupType[TVEpisodeGroupType["Absolute"] = 2] = "Absolute";
4750
- TVEpisodeGroupType[TVEpisodeGroupType["Dvd"] = 3] = "Dvd";
4751
- TVEpisodeGroupType[TVEpisodeGroupType["Digital"] = 4] = "Digital";
4752
- TVEpisodeGroupType[TVEpisodeGroupType["StoryArc"] = 5] = "StoryArc";
4753
- TVEpisodeGroupType[TVEpisodeGroupType["Production"] = 6] = "Production";
4754
- TVEpisodeGroupType[TVEpisodeGroupType["TV"] = 7] = "TV";
4755
- return TVEpisodeGroupType;
4756
- }({});
4757
- //#endregion
4758
- export { AccountAPI, AuthenticationAPI, BACKDROP_SIZES, CertificationsAPI, ChangesAPI, CollectionsAPI, CompaniesAPI, ConfigurationAPI, CreditsAPI, DiscoverAPI, DiscoverTVStatus, DiscoverTVType, FindAPI, GenresAPI, GuestSessionsAPI, IMAGE_BASE_URL, IMAGE_SECURE_BASE_URL, KeywordsAPI, LOGO_SIZES, ListsAPI, MovieListsAPI, MoviesAPI, NetworksAPI, POSTER_SIZES, PROFILE_SIZES, PeopleAPI, PeopleListsAPI, ReviewsAPI, STILL_SIZES, SearchAPI, TMDB, TMDBCountries, TMDBError, TMDBLogger, TMDBv4, TVEpisodeGroupType, TVEpisodeGroupsAPI, TVEpisodesAPI, TVSeasonsAPI, TVSeriesAPI, TVSeriesListsAPI, TrendingAPI, V4AccountAPI, V4AuthAPI, V4ListsAPI, WatchProvidersAPI, hasBackdropPath, hasLogoPath, hasPosterPath, hasProfilePath, hasStillPath, isJwt, isKnownForMovie, isKnownForTV, isPlainObject, isRecord };
1
+ var e=class extends Error{tmdb_status_code;message;http_status_code;constructor(e,t,n){super(e),this.name=`TMDBError`,this.tmdb_status_code=n||-1,this.message=e,this.http_status_code=t}};const t=`http://image.tmdb.org/t/p/`,n=`https://image.tmdb.org/t/p/`,r=[`w300`,`w780`,`w1280`,`original`],i=[`w45`,`w92`,`w154`,`w185`,`w300`,`w500`,`original`],a=[`w92`,`w154`,`w185`,`w342`,`w500`,`w780`,`original`],o=[`w45`,`w185`,`h632`,`original`],s=[`w92`,`w185`,`w300`,`original`];var c=class e{logger;constructor(e){this.logger=e}static from(t){if(t)return t===!0?new e(e.defaultLogger):new e(t)}log(e){if(this.logger)try{this.logger(e)}catch(e){console.warn(`TMDB logger error: ${e}`)}}static defaultLogger(e){let t=`🎬 [tmdb]`,n=new Date().toISOString();if(e.type===`request`){console.log(`${t} ${n} 🛰️ REQUEST ${e.method} ${e.endpoint} \n`);return}if(e.type===`response`){console.log(`${t} ${n} ✅ RESPONSE ${e.method} ${e.status} ${e.statusText} ${e.endpoint} (${e.durationMs}ms)\n`);return}let r=e.status==null?`NETWORK ERROR`:`${e.status} ${e.statusText}`,i=e.tmdbStatusCode==null?``:` (tmdb: ${e.tmdbStatusCode})`;console.log(`${t} ${n} ❌ ${e.method} ${r} ${e.endpoint} - ${e.errorMessage}${i}\n`)}};function l(e){return/^[A-Za-z0-9\-_]+$/.test(e)}function u(e){try{let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.padEnd(t.length+(4-t.length%4)%4,`=`);return atob(n)}catch{return null}}function d(e){return typeof e==`object`&&!!e}function f(e){return d(e)?typeof e.alg==`string`:!1}function p(e){return!(!d(e)||`exp`in e&&typeof e.exp!=`number`||`nbf`in e&&typeof e.nbf!=`number`||`iat`in e&&typeof e.iat!=`number`)}function m(e){if(typeof e!=`string`)return!1;let t=e.split(`.`);if(t.length!==3)return!1;let[n,r,i]=t;if(!l(n)||!l(r)||!l(i))return!1;let a=u(n),o=u(r);if(!a||!o)return!1;let s,c;try{s=JSON.parse(a),c=JSON.parse(o)}catch{return!1}return!(!f(s)||!p(c))}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(e){if(!h(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ee(e){return typeof e==`object`&&!!e&&`poster_path`in e&&typeof e.poster_path==`string`}function te(e){return typeof e==`object`&&!!e&&`backdrop_path`in e&&typeof e.backdrop_path==`string`}function ne(e){return typeof e==`object`&&!!e&&`profile_path`in e&&typeof e.profile_path==`string`}function re(e){return typeof e==`object`&&!!e&&`still_path`in e&&typeof e.still_path==`string`}function ie(e){return typeof e==`object`&&!!e&&`logo_path`in e&&typeof e.logo_path==`string`}const _={backdrop_path:`backdrop`,logo_path:`logo`,poster_path:`poster`,profile_path:`profile`,still_path:`still`},v={backdrops:`backdrop_path`,logos:`logo_path`,posters:`poster_path`,profiles:`profile_path`,stills:`still_path`};var y=class{options;constructor(e={}){this.options={secure_images_url:!0,...e}}buildUrl(e,r){return`${this.options.secure_images_url?n:t}${r}${e}`}backdrop(e,t=this.options.default_image_sizes?.backdrops||`w780`){return this.buildUrl(e,t)}logo(e,t=this.options.default_image_sizes?.logos||`w185`){return this.buildUrl(e,t)}poster(e,t=this.options.default_image_sizes?.posters||`w500`){return this.buildUrl(e,t)}profile(e,t=this.options.default_image_sizes?.profiles||`w185`){return this.buildUrl(e,t)}still(e,t=this.options.default_image_sizes?.still||`w300`){return this.buildUrl(e,t)}autocompleteImagePaths(e,t){if(Array.isArray(e))return e.map(e=>this.autocompleteImagePaths(e,t));if(!g(e))return e;let n=Object.create(null);for(let[r,i]of Object.entries(e)){if(r===`__proto__`||r===`constructor`||r===`prototype`){n[r]=i;continue}if(typeof i==`string`){n[r]=this.transformPathValue(r,i,t);continue}let e=this.isImageCollectionKey(r)?r:t;n[r]=this.autocompleteImagePaths(i,e)}return n}isImageCollectionKey(e){return Object.hasOwn(v,e)}isFullUrl(e){return/^https?:\/\//.test(e)}buildImageUrl(e,t){let n=_[e];return Object.hasOwn(this,n)||this[n],this[n](t)}transformPathValue(e,t,n){return!t.startsWith(`/`)||this.isFullUrl(t)?t:Object.hasOwn(_,e)?this.buildImageUrl(e,t):e===`file_path`&&n?this.buildImageUrl(v[n],t):t}},ae=class{ttl;maxSize;excludedEndpoints;store=new Map;constructor(e={}){let t=e.ttl??3e5;if(!Number.isFinite(t)||!Number.isInteger(t)||t<1)throw RangeError(`cache.ttl must be a finite integer >= 1 (got ${t})`);if(e.max_size!==void 0&&(!Number.isFinite(e.max_size)||!Number.isInteger(e.max_size)||e.max_size<1))throw RangeError(`cache.max_size must be a finite integer >= 1 (got ${e.max_size})`);this.ttl=t,this.maxSize=e.max_size,this.excludedEndpoints=(e.excluded_endpoints??[]).map(e=>typeof e!=`string`&&/[gy]/.test(e.flags)?new RegExp(e.source,e.flags.replace(/[gy]/g,``)):e)}shouldCache(e){return!this.excludedEndpoints.some(t=>typeof t==`string`?e.startsWith(t):t.test(e))}get(e){let t=this.store.get(e);if(t){if(Date.now()>t.expiresAt){this.store.delete(e);return}return t.value}}has(e){let t=this.store.get(e);return t?Date.now()>t.expiresAt?(this.store.delete(e),!1):!0:!1}set(e,t){this.maxSize!==void 0&&!this.store.has(e)&&this.store.size>=this.maxSize&&this.store.delete(this.store.keys().next().value),this.store.set(e,{value:t,expiresAt:Date.now()+this.ttl})}delete(e){return this.store.delete(e)}clear(){this.store.clear()}get size(){return this.store.size}},oe=class{maxRequests;windowMs;timestamps=[];queue=[];processing=!1;constructor(e={}){let t=e.max_requests??40,n=e.per_ms??1e3;if(!Number.isFinite(t)||!Number.isInteger(t)||t<1)throw RangeError(`rate_limit.max_requests must be a finite integer >= 1 (got ${t})`);if(!Number.isFinite(n)||!Number.isInteger(n)||n<1)throw RangeError(`rate_limit.per_ms must be a finite integer >= 1 (got ${n})`);this.maxRequests=t,this.windowMs=n}acquire(){return new Promise(e=>{this.queue.push(e),this.processing||this.process()})}async process(){for(this.processing=!0;this.queue.length>0;){let e=Date.now();if(this.timestamps=this.timestamps.filter(t=>e-t<this.windowMs),this.timestamps.length<this.maxRequests)this.timestamps.push(Date.now()),this.queue.shift()();else{let e=this.timestamps[0],t=this.windowMs-(Date.now()-e)+1;await new Promise(e=>setTimeout(e,t))}}this.processing=!1}},b=class{accessToken;baseUrl;logger;inflightRequests=new Map;deduplication;rateLimiter;requestInterceptors;onSuccessInterceptor;onErrorInterceptor;imageApi;responseCache;constructor(e,t={}){this.accessToken=e,this.baseUrl=`https://api.themoviedb.org/${t.version??3}`,this.logger=c.from(t.logger),this.deduplication=t.deduplication!==!1,t.rate_limit&&(this.rateLimiter=new oe(t.rate_limit===!0?{}:t.rate_limit)),t.cache&&(this.responseCache=new ae(t.cache===!0?{}:t.cache));let n=t.interceptors?.request;this.requestInterceptors=n==null?[]:Array.isArray(n)?n:[n],this.onSuccessInterceptor=t.interceptors?.response?.onSuccess,this.onErrorInterceptor=t.interceptors?.response?.onError,this.imageApi=t.images?.autocomplete_paths?new y(t.images):void 0}buildRequestKey(e,t){let n=this.serializeParams(t).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>`${e}=${t}`);return n.length>0?`${e}?${n.join(`&`)}`:e}serializeParams(e){return Object.entries(e).flatMap(([e,t])=>t===void 0?[]:[[e,String(t)]])}async request(e,t={}){let n=await this.runRequestInterceptors({endpoint:e,params:t,method:`GET`}),r=n.endpoint,i=n.params,a=this.buildRequestKey(r,i),o=!!this.responseCache?.shouldCache(a);if(o&&this.responseCache.has(a))return this.responseCache.get(a);if(!this.deduplication){let e=await this.execute(`GET`,r,i,void 0,!0);return o&&this.responseCache.set(a,e),e}let s=this.inflightRequests.get(a);if(s)return s;let c=o?this.responseCache:void 0,l=this.execute(`GET`,r,i,void 0,!0).then(e=>(c?.set(a,e),e)).finally(()=>{this.inflightRequests.delete(a)});return this.inflightRequests.set(a,l),l}invalidateCache(e,t={}){return this.responseCache?this.responseCache.delete(this.buildRequestKey(e,t)):!1}clearCache(){this.responseCache?.clear()}get cacheSize(){return this.responseCache?.size??0}async runRequestInterceptors(e){let t=e;for(let e of this.requestInterceptors){let n=await e(t);n!=null&&(t=n)}return t}sanitizeNulls(e){if(e===null)return;if(typeof e!=`object`)return e;if(Array.isArray(e))return e.map(e=>this.sanitizeNulls(e));let t={};for(let[n,r]of Object.entries(e))t[n]=this.sanitizeNulls(r);return t}async handleError(t,n,r){let i=t.statusText,a=-1;try{let e=await t.json();if(e&&typeof e==`object`){let t=e;i=t.status_message||i,a=t.status_code||-1}}catch(e){console.error(`Unknown error: ${e}`)}this.logger?.log({type:`error`,method:r,endpoint:n,status:t.status,statusText:t.statusText,tmdbStatusCode:a,errorMessage:i});let o=new e(i,t.status,a);throw this.onErrorInterceptor&&await this.onErrorInterceptor(o),o}async mutate(e,t,n,r={}){return this.execute(e,t,r,n)}async execute(e,t,n,r,i=!1){let a=r===void 0?void 0:JSON.stringify(r),o,s;if(i)o=t,s=n;else{let r=await this.runRequestInterceptors({endpoint:t,params:n,method:e});o=r.endpoint,s=r.params}let c=new URL(`${this.baseUrl}${o}`),l=m(this.accessToken);for(let[e,t]of this.serializeParams(s))c.searchParams.append(e,t);l||c.searchParams.append(`api_key`,this.accessToken);let u=Date.now();this.logger?.log({type:`request`,method:e,endpoint:o}),this.rateLimiter&&await this.rateLimiter.acquire();let d;try{d=await fetch(c.toString(),{method:e,headers:l?{Authorization:`Bearer ${this.accessToken}`,"Content-Type":`application/json;charset=utf-8`}:{"Content-Type":`application/json;charset=utf-8`},...a===void 0?{}:{body:a}})}catch(t){throw this.logger?.log({type:`error`,method:e,endpoint:o,errorMessage:t instanceof Error?t.message:String(t),durationMs:Date.now()-u}),t}d.ok||await this.handleError(d,o,e),this.logger?.log({type:`response`,method:e,endpoint:o,status:d.status,statusText:d.statusText,durationMs:Date.now()-u});let f=await d.json(),p=this.sanitizeNulls(f),h=this.imageApi?this.imageApi.autocompleteImagePaths(p):p;if(this.onSuccessInterceptor){let e=await this.onSuccessInterceptor(h);return e===void 0?h:e}return h}};const x={AUTHENTICATION:{VALIDATE:`/authentication`,GUEST_SESSION:`/authentication/guest_session/new`,REQUEST_TOKEN:`/authentication/token/new`,CREATE_SESSION:`/authentication/session/new`,CREATE_SESSION_WITH_LOGIN:`/authentication/token/validate_with_login`,DELETE_SESSION:`/authentication/session`},ACCOUNT:{DETAILS:`/account`,ADD_FAVORITE:`/favorite`,ADD_TO_WATCHLIST:`/watchlist`,FAVORITE_MOVIES:`/favorite/movies`,FAVORITE_TV:`/favorite/tv`,WATCHLIST_MOVIES:`/watchlist/movies`,WATCHLIST_TV:`/watchlist/tv`,RATED_MOVIES:`/rated/movies`,RATED_TV:`/rated/tv`,RATED_TV_EPISODES:`/rated/tv/episodes`,LISTS:`/lists`},CONFIGURATION:{DETAILS:`/configuration`,COUNTRIES:`/configuration/countries`,JOBS:`/configuration/jobs`,LANGUAGES:`/configuration/languages`,TIMEZONES:`/configuration/timezones`,PRIMARY_TRANSLATIONS:`/configuration/primary_translations`},CERTIFICATIONS:{MOVIE_CERTIFICATIONS:`/certification/movie/list`,TV_CERTIFICATIONS:`/certification/tv/list`},CHANGES:{MOVIE_LIST:`/movie/changes`,PEOPLE_LIST:`/person/changes`,TV_LIST:`/tv/changes`},DISCOVER:{MOVIE:`/discover/movie`,TV:`/discover/tv`},FIND:`/find`,CREDITS:{DETAILS:`/credit`},COMPANIES:{DETAILS:`/company`,ALTERNATIVE_NAMES:`/alternative_names`,IMAGES:`/images`},COLLECTIONS:{DETAILS:`/collection`,IMAGES:`/images`,TRANSLATIONS:`/translations`},GENRES:{MOVIE_LIST:`/genre/movie/list`,TV_LIST:`/genre/tv/list`},KEYWORDS:{DETAILS:`/keyword`,MOVIES:`/movies`},MOVIES:{DETAILS:`/movie`,ALTERNATIVE_TITLES:`/alternative_titles`,CREDITS:`/credits`,EXTERNAL_IDS:`/external_ids`,KEYWORDS:`/keywords`,CHANGES:`/changes`,IMAGES:`/images`,LATEST:`/latest`,NOW_PLAYING:`/now_playing`,POPULAR:`/popular`,RECOMMENDATIONS:`/recommendations`,RELEASE_DATES:`/release_dates`,REVIEWS:`/reviews`,SIMILAR:`/similar`,TOP_RATED:`/top_rated`,TRANSLATIONS:`/translations`,UPCOMING:`/upcoming`,VIDEOS:`/videos`,WATCH_PROVIDERS:`/watch/providers`},NETWORKS:{DETAILS:`/network`,ALTERNATIVE_NAMES:`/alternative_names`,IMAGES:`/images`},PEOPLE:{DETAILS:`/person`,CHANGES:`/changes`,COMBINED_CREDITS:`/combined_credits`,EXTERNAL_IDS:`/external_ids`,IMAGES:`/images`,LATEST:`/latest`,MOVIE_CREDITS:`/movie_credits`,TAGGED_IMAGES:`/tagged_images`,TRANSLATIONS:`/translations`,TV_CREDITS:`/tv_credits`},SEARCH:{MOVIE:`/search/movie`,COLLECTION:`/search/collection`,COMPANY:`/search/company`,KEYWORD:`/search/keyword`,MULTI:`/search/multi`,PERSON:`/search/person`,TV:`/search/tv`},TV_SERIES:{DETAILS:`/tv`,AGGREGATE_CREDITS:`/aggregate_credits`,AIRING_TODAY:`/airing_today`,ALTERNATIVE_TITLES:`/alternative_titles`,CHANGES:`/changes`,CONTENT_RATINGS:`/content_ratings`,CREDITS:`/credits`,EPISODE_GROUPS:`/episode_groups`,EXTERNAL_IDS:`/external_ids`,IMAGES:`/images`,KEYWORDS:`/keywords`,LATEST:`/latest`,LISTS:`/lists`,ON_THE_AIR:`/on_the_air`,POPULAR:`/popular`,RECOMMENDATIONS:`/recommendations`,REVIEWS:`/reviews`,SCREENED_THEATRICALLY:`/screened_theatrically`,SIMILAR:`/similar`,TOP_RATED:`/top_rated`,TRANSLATIONS:`/translations`,VIDEOS:`/videos`,WATCH_PROVIDERS:`/watch/providers`},TV_SEASONS:{DETAILS:`/season`,AGGREGATE_CREDITS:`/aggregate_credits`,CHANGES:`/changes`,CREDITS:`/credits`,EXTERNAL_IDS:`/external_ids`,IMAGES:`/images`,TRANSLATIONS:`/translations`,VIDEOS:`/videos`,WATCH_PROVIDERS:`/watch/providers`},TV_EPISODES:{DETAILS:`/episode`,CHANGES:`/changes`,CREDITS:`/credits`,EXTERNAL_IDS:`/external_ids`,IMAGES:`/images`,TRANSLATIONS:`/translations`,VIDEOS:`/videos`},TV_EPISODE_GROUPS:{DETAILS:`/tv/episode_group`},WATCH_PROVIDERS:{MOVIE:`/watch/providers/movie`,TV:`/watch/providers/tv`,REGIONS:`/watch/providers/regions`},TRENDING:{ALL:`/trending/all`,MOVIE:`/trending/movie`,TV:`/trending/tv`,PERSON:`/trending/person`},REVIEWS:{DETAILS:`/review`},PEOPLE_LISTS:{POPULAR:`/person/popular`},LISTS:{DETAILS:`/list`,ADD_ITEM:`/add_item`,ITEM_STATUS:`/item_status`,CLEAR:`/clear`,REMOVE_ITEM:`/remove_item`},GUEST_SESSIONS:{DETAILS:`/guest_session`,RATED_MOVIES:`/rated/movies`,RATED_TV:`/rated/tv`,RATED_TV_EPISODES:`/rated/tv/episodes`}},S={AUTH:{REQUEST_TOKEN:`/auth/request_token`,ACCESS_TOKEN:`/auth/access_token`},ACCOUNT:{DETAILS:`/account`,LISTS:`/lists`,FAVORITE_MOVIES:`/favorite/movies`,FAVORITE_TV:`/favorite/tv`,WATCHLIST_MOVIES:`/watchlist/movies`,WATCHLIST_TV:`/watchlist/tv`,RATED_MOVIES:`/rated/movies`,RATED_TV:`/rated/tv`},LISTS:{DETAILS:`/list`,ITEMS:`/items`,ITEM_STATUS:`/item_status`,CLEAR:`/clear`}},C={NO_ACCESS_TOKEN:`TMDB requires a valid access token, please provide one.`,INVALID_CLIENT:`TMDB received an invalid ApiClient instance. Pass a valid ApiClient or an access token string.`,V4_REQUIRES_JWT:`TMDB v4 requires a Bearer (JWT) access token. API key strings are not supported for v4 endpoints.`};var w=class{client;defaultOptions;constructor(e,t={}){if(typeof e==`string`){if(!e)throw Error(C.NO_ACCESS_TOKEN);this.client=new b(e,{logger:t.logger,deduplication:t.deduplication,rate_limit:t.rate_limit,interceptors:t.interceptors})}else if(e instanceof b)this.client=e;else throw Error(e==null?C.NO_ACCESS_TOKEN:C.INVALID_CLIENT);this.defaultOptions=t}applyDefaults(e){let{language:t,region:n}=this.defaultOptions;return{...t!==void 0&&{language:t},...n!==void 0&&{region:n},...e}}withLanguage(e){let t=this.defaultOptions?.language;return e?e.language!==void 0||t===void 0?e:{...e,language:t}:t===void 0?void 0:{language:t}}},T=class extends w{async movie_certifications(){return this.client.request(x.CERTIFICATIONS.MOVIE_CERTIFICATIONS)}async tv_certifications(){return this.client.request(x.CERTIFICATIONS.TV_CERTIFICATIONS)}},E=class extends w{async movie_list(e){return this.client.request(x.CHANGES.MOVIE_LIST,e)}async people_list(e){return this.client.request(x.CHANGES.PEOPLE_LIST,e)}async tv_list(e){return this.client.request(x.CHANGES.TV_LIST,e)}},D=class extends w{companyPath(e){return`${x.COMPANIES.DETAILS}/${e}`}async details(e){let t=this.companyPath(e.company_id);return this.client.request(t)}async alternative_names(e){let t=`${this.companyPath(e.company_id)}${x.COMPANIES.ALTERNATIVE_NAMES}`;return this.client.request(t)}async images(e){let{company_id:t,...n}=e,r=`${this.companyPath(t)}${x.COMPANIES.IMAGES}`;return this.client.request(r,this.withLanguage(n))}},O=class extends w{creditPath(e){return`${x.CREDITS.DETAILS}/${e}`}async details(e){let{credit_id:t,...n}=e,r=this.creditPath(t);return this.client.request(r,this.withLanguage(n))}},k=class extends w{collectionPath(e){return`${x.COLLECTIONS.DETAILS}/${e}`}async details(e){let{language:t=this.defaultOptions.language,collection_id:n}=e,r=this.collectionPath(n);return this.client.request(r,{language:t})}async images(e){let{collection_id:t,...n}=e,r=`${this.collectionPath(t)}${x.COLLECTIONS.IMAGES}`;return this.client.request(r,this.withLanguage(n))}async translations(e){let t=`${this.collectionPath(e.collection_id)}${x.COLLECTIONS.TRANSLATIONS}`;return this.client.request(t)}},A=class extends w{async details(){return this.client.request(x.CONFIGURATION.DETAILS)}async countries(e){return this.client.request(x.CONFIGURATION.COUNTRIES,this.withLanguage(e))}async jobs(){return this.client.request(x.CONFIGURATION.JOBS)}async languages(){return this.client.request(x.CONFIGURATION.LANGUAGES)}async primary_translations(){return this.client.request(x.CONFIGURATION.PRIMARY_TRANSLATIONS)}async timezones(){return this.client.request(x.CONFIGURATION.TIMEZONES)}},j=class extends w{withMovieDefaults(e){if(!e&&!this.defaultOptions.language&&!this.defaultOptions.region)return;let t=e?.language??this.defaultOptions.language,n=e?.region??this.defaultOptions.region;return{...e,language:t,region:n}}withTVDefaults(e){if(!e&&!this.defaultOptions.language&&!this.defaultOptions.timezone)return;let t=e?.language??this.defaultOptions.language,n=e?.timezone??this.defaultOptions.timezone;return{...e,language:t,timezone:n}}async movie(e={}){return this.client.request(x.DISCOVER.MOVIE,this.withMovieDefaults(e))}async tv(e={}){return this.client.request(x.DISCOVER.TV,this.withTVDefaults(e))}},M=class extends w{async by_id(e){let{external_id:t,...n}=e,r=`${x.FIND}/${encodeURIComponent(t)}`,i=this.withLanguage(n);return this.client.request(r,i)}},N=class extends w{async movie_list(e){return this.client.request(x.GENRES.MOVIE_LIST,this.withLanguage(e))}async tv_list(e){return this.client.request(x.GENRES.TV_LIST,this.withLanguage(e))}},P=class extends w{keywordPath(e){return`${x.KEYWORDS.DETAILS}/${e}`}async details(e){let t=this.keywordPath(e.keyword_id);return this.client.request(t)}async movies(e){let{keyword_id:t,...n}=e,r=`${this.keywordPath(t)}${x.KEYWORDS.MOVIES}`,i=this.withLanguage(n);return this.client.request(r,i)}},F=class extends w{withDefaults(e){let{language:t=this.defaultOptions.language,region:n=this.defaultOptions.region,...r}=e;return{language:t,region:n,...r}}fetch_movie_list(e,t={}){return this.client.request(x.MOVIES.DETAILS+e,this.withDefaults(t))}async now_playing(e={}){return this.fetch_movie_list(x.MOVIES.NOW_PLAYING,e)}async popular(e={}){return this.fetch_movie_list(x.MOVIES.POPULAR,e)}async top_rated(e={}){return this.fetch_movie_list(x.MOVIES.TOP_RATED,e)}async upcoming(e={}){return this.fetch_movie_list(x.MOVIES.UPCOMING,e)}},I=class extends w{moviePath(e){return`${x.MOVIES.DETAILS}/${e}`}movieSubPath(e,t){return`${this.moviePath(e)}${t}`}async details(e){let{language:t=this.defaultOptions.language,movie_id:n,append_to_response:r}=e,i=this.moviePath(n);return this.client.request(i,{language:t,append_to_response:r})}async alternative_titles(e){let{movie_id:t,...n}=e,r=this.movieSubPath(t,x.MOVIES.ALTERNATIVE_TITLES);return this.client.request(r,n)}async credits(e){let{movie_id:t,language:n=this.defaultOptions.language,...r}=e,i=this.movieSubPath(t,x.MOVIES.CREDITS);return this.client.request(i,{language:n,...r})}async external_ids(e){let t=this.movieSubPath(e.movie_id,x.MOVIES.EXTERNAL_IDS);return this.client.request(t)}async keywords(e){let t=this.movieSubPath(e.movie_id,x.MOVIES.KEYWORDS);return this.client.request(t)}async changes(e){let{movie_id:t,...n}=e,r=this.movieSubPath(t,x.MOVIES.CHANGES);return this.client.request(r,n)}async images(e){let{movie_id:t,language:n=this.defaultOptions.language,...r}=e,i=this.movieSubPath(t,x.MOVIES.IMAGES);return this.client.request(i,{language:n,...r})}async latest(){let e=`${x.MOVIES.DETAILS}${x.MOVIES.LATEST}`;return this.client.request(e)}async recommendations(e){let{movie_id:t,language:n=this.defaultOptions.language,...r}=e,i=this.movieSubPath(t,x.MOVIES.RECOMMENDATIONS);return this.client.request(i,{language:n,...r})}async release_dates(e){let t=this.movieSubPath(e.movie_id,x.MOVIES.RELEASE_DATES);return this.client.request(t)}async reviews(e){let{movie_id:t,language:n=this.defaultOptions.language,...r}=e,i=this.movieSubPath(t,x.MOVIES.REVIEWS);return this.client.request(i,{language:n,...r})}async similar(e){let{movie_id:t,language:n=this.defaultOptions.language,...r}=e,i=this.movieSubPath(t,x.MOVIES.SIMILAR);return this.client.request(i,{language:n,...r})}async translations(e){let t=this.movieSubPath(e.movie_id,x.MOVIES.TRANSLATIONS);return this.client.request(t)}async videos(e){let{movie_id:t,language:n=this.defaultOptions.language,...r}=e,i=this.movieSubPath(t,x.MOVIES.VIDEOS);return this.client.request(i,{language:n,...r})}async watch_providers(e){let t=this.movieSubPath(e.movie_id,x.MOVIES.WATCH_PROVIDERS);return this.client.request(t)}},L=class extends w{async collections(e){return this.client.request(x.SEARCH.COLLECTION,this.applyDefaults(e))}async movies(e){return this.client.request(x.SEARCH.MOVIE,this.applyDefaults(e))}async company(e){return this.client.request(x.SEARCH.COMPANY,this.applyDefaults(e))}async keyword(e){return this.client.request(x.SEARCH.KEYWORD,this.applyDefaults(e))}async person(e){return this.client.request(x.SEARCH.PERSON,this.applyDefaults(e))}async tv_series(e){return this.client.request(x.SEARCH.TV,this.applyDefaults(e))}async multi(e){return this.client.request(x.SEARCH.MULTI,this.applyDefaults(e))}},se=class extends w{seriesPath(e){return`${x.TV_SERIES.DETAILS}/${e}`}seriesSubPath(e,t){return`${this.seriesPath(e)}${t}`}async details(e){let{language:t=this.defaultOptions.language,series_id:n,...r}=e,i=this.seriesPath(n);return this.client.request(i,{language:t,...r})}async aggregate_credits(e){let{language:t=this.defaultOptions.language,series_id:n,...r}=e,i=this.seriesSubPath(n,x.TV_SERIES.AGGREGATE_CREDITS);return this.client.request(i,{language:t,...r})}async alternative_titles(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.ALTERNATIVE_TITLES);return this.client.request(t)}async changes(e){let{series_id:t,...n}=e,r=this.seriesSubPath(t,x.TV_SERIES.CHANGES);return this.client.request(r,{...n})}async content_ratings(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.CONTENT_RATINGS);return this.client.request(t)}async credits(e){let{language:t=this.defaultOptions.language,series_id:n,...r}=e,i=this.seriesSubPath(n,x.TV_SERIES.CREDITS);return this.client.request(i,{language:t,...r})}async episode_groups(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.EPISODE_GROUPS);return this.client.request(t)}async external_ids(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.EXTERNAL_IDS);return this.client.request(t)}async images(e){let{language:t=this.defaultOptions.language,series_id:n,...r}=e,i=this.seriesSubPath(n,x.TV_SERIES.IMAGES);return this.client.request(i,{language:t,...r})}async keywords(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.KEYWORDS);return this.client.request(t)}async latest(){let e=`${x.TV_SERIES.DETAILS}${x.TV_SERIES.LATEST}`;return this.client.request(e)}async lists(e){let{language:t=this.defaultOptions.language,series_id:n,...r}=e,i=this.seriesSubPath(n,x.TV_SERIES.LISTS);return this.client.request(i,{language:t,...r})}async recommendations(e){let{language:t=this.defaultOptions.language,series_id:n,...r}=e,i=this.seriesSubPath(n,x.TV_SERIES.RECOMMENDATIONS);return this.client.request(i,{language:t,...r})}async reviews(e){let{language:t=this.defaultOptions.language,series_id:n,...r}=e,i=this.seriesSubPath(n,x.TV_SERIES.REVIEWS);return this.client.request(i,{language:t,...r})}async screened_theatrically(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.SCREENED_THEATRICALLY);return this.client.request(t)}async similar(e){let{language:t=this.defaultOptions.language,series_id:n,...r}=e,i=this.seriesSubPath(n,x.TV_SERIES.SIMILAR);return this.client.request(i,{language:t,...r})}async translations(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.TRANSLATIONS);return this.client.request(t)}async videos(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.VIDEOS);return this.client.request(t)}async watch_providers(e){let t=this.seriesSubPath(e.series_id,x.TV_SERIES.WATCH_PROVIDERS);return this.client.request(t)}},R=class extends w{withDefaults(e){let{language:t=this.defaultOptions.language,timezone:n=this.defaultOptions.timezone,...r}=e;return{language:t,timezone:n,...r}}fetch_tv_series_list(e,t={}){return this.client.request(x.TV_SERIES.DETAILS+e,this.withDefaults(t))}async airing_today(e={}){return this.fetch_tv_series_list(x.TV_SERIES.AIRING_TODAY,e)}async on_the_air(e={}){return this.fetch_tv_series_list(x.TV_SERIES.ON_THE_AIR,e)}async popular(e={}){return this.fetch_tv_series_list(x.TV_SERIES.POPULAR,e)}async top_rated(e={}){return this.fetch_tv_series_list(x.TV_SERIES.TOP_RATED,e)}},z=class extends w{async movie_providers(e){let t=e?.language??this.defaultOptions.language,n=t===void 0?e:{...e,language:t};return this.client.request(x.WATCH_PROVIDERS.MOVIE,n)}async tv_providers(e){let t=e?.language??this.defaultOptions.language,n=t===void 0?e:{...e,language:t};return this.client.request(x.WATCH_PROVIDERS.TV,n)}async available_regions(e){let t=e?.language??this.defaultOptions.language,n=t===void 0?e:{...e,language:t};return this.client.request(x.WATCH_PROVIDERS.REGIONS,n)}},B=class extends w{networkPath(e){return`${x.NETWORKS.DETAILS}/${e}`}async details(e){let t=this.networkPath(e.network_id);return this.client.request(t)}async alternative_names(e){let t=`${this.networkPath(e.network_id)}${x.NETWORKS.ALTERNATIVE_NAMES}`;return this.client.request(t)}async images(e){let t=`${this.networkPath(e.network_id)}${x.NETWORKS.IMAGES}`;return this.client.request(t)}},V=class extends w{episodePath(e){return`${x.TV_SERIES.DETAILS}/${e.series_id}${x.TV_SEASONS.DETAILS}/${e.season_number}${x.TV_EPISODES.DETAILS}/${e.episode_number}`}episodeSubPath(e,t){return`${this.episodePath(e)}${t}`}async details(e){let{language:t=this.defaultOptions.language,append_to_response:n,...r}=e,i=this.episodePath(r);return this.client.request(i,{language:t,append_to_response:n})}async changes(e){let t=`${x.TV_SERIES.DETAILS}${x.TV_EPISODES.DETAILS}/${e.episode_id}${x.TV_EPISODES.CHANGES}`;return this.client.request(t)}async credits(e){let{language:t=this.defaultOptions.language,...n}=e,r=this.episodeSubPath(n,x.TV_EPISODES.CREDITS);return this.client.request(r,{language:t})}async external_ids(e){let t=this.episodeSubPath(e,x.TV_EPISODES.EXTERNAL_IDS);return this.client.request(t)}async images(e){let{language:t=this.defaultOptions.language,include_image_language:n,...r}=e,i=this.episodeSubPath(r,x.TV_EPISODES.IMAGES);return this.client.request(i,{language:t,include_image_language:n})}async translations(e){let t=this.episodeSubPath(e,x.TV_EPISODES.TRANSLATIONS);return this.client.request(t)}async videos(e){let t=this.episodeSubPath(e,x.TV_EPISODES.VIDEOS);return this.client.request(t)}},H=class extends w{async details(e){let t=`${x.TV_EPISODE_GROUPS.DETAILS}/${e.episode_group_id}`;return this.client.request(t)}},U=class extends w{seasonPath(e){return`${x.TV_SERIES.DETAILS}/${e.series_id}${x.TV_SEASONS.DETAILS}/${e.season_number}`}seasonSubPath(e,t){return`${this.seasonPath(e)}${t}`}async details(e){let{language:t=this.defaultOptions.language,append_to_response:n,...r}=e,i=this.seasonPath(r);return this.client.request(i,{language:t,append_to_response:n})}async aggregate_credits(e){let{language:t=this.defaultOptions.language,...n}=e,r=this.seasonSubPath(n,x.TV_SEASONS.AGGREGATE_CREDITS);return this.client.request(r,{language:t})}async changes(e){let{season_id:t,...n}=e,r=`${x.TV_SERIES.DETAILS}${x.TV_SEASONS.DETAILS}/${t}${x.TV_SEASONS.CHANGES}`;return this.client.request(r,{...n})}async credits(e){let{language:t=this.defaultOptions.language,...n}=e,r=this.seasonSubPath(n,x.TV_SEASONS.CREDITS);return this.client.request(r,{language:t})}async external_ids(e){let t=this.seasonSubPath(e,x.TV_SEASONS.EXTERNAL_IDS);return this.client.request(t)}async images(e){let{language:t=this.defaultOptions.language,include_image_language:n,...r}=e,i=this.seasonSubPath(r,x.TV_SEASONS.IMAGES);return this.client.request(i,{language:t,include_image_language:n})}async translations(e){let t=this.seasonSubPath(e,x.TV_SEASONS.TRANSLATIONS);return this.client.request(t)}async videos(e){let{language:t=this.defaultOptions.language,include_video_language:n,...r}=e,i=this.seasonSubPath(r,x.TV_SEASONS.VIDEOS);return this.client.request(i,{language:t,include_video_language:n})}async watch_providers(e){let{language:t=this.defaultOptions.language,...n}=e,r=this.seasonSubPath(n,x.TV_SEASONS.WATCH_PROVIDERS);return this.client.request(r,{language:t})}},W=class extends w{async all(e){let{time_window:t,language:n=this.defaultOptions.language}=e;return this.client.request(`${x.TRENDING.ALL}/${t}`,{language:n})}async movies(e){let{time_window:t,language:n=this.defaultOptions.language}=e;return this.client.request(`${x.TRENDING.MOVIE}/${t}`,{language:n})}async tv(e){let{time_window:t,language:n=this.defaultOptions.language}=e;return this.client.request(`${x.TRENDING.TV}/${t}`,{language:n})}async people(e){let{time_window:t,language:n=this.defaultOptions.language}=e;return this.client.request(`${x.TRENDING.PERSON}/${t}`,{language:n})}},G=class extends w{async details(e){return this.client.request(`${x.REVIEWS.DETAILS}/${e.review_id}`)}},K=class extends w{async popular(e={}){return this.client.request(x.PEOPLE_LISTS.POPULAR,this.withLanguage(e))}},q=class extends w{personPath(e){return`${x.PEOPLE.DETAILS}/${e}`}personSubPath(e,t){return`${this.personPath(e)}${t}`}async details(e){let{language:t=this.defaultOptions.language,person_id:n,...r}=e;return this.client.request(this.personPath(n),{language:t,...r})}async changes(e){let{person_id:t,...n}=e;return this.client.request(this.personSubPath(t,x.PEOPLE.CHANGES),n)}async combined_credits(e){let{language:t=this.defaultOptions.language,person_id:n,...r}=e;return this.client.request(this.personSubPath(n,x.PEOPLE.COMBINED_CREDITS),{language:t,...r})}async external_ids(e){return this.client.request(this.personSubPath(e.person_id,x.PEOPLE.EXTERNAL_IDS))}async images(e){return this.client.request(this.personSubPath(e.person_id,x.PEOPLE.IMAGES))}async latest(){return this.client.request(`${x.PEOPLE.DETAILS}${x.PEOPLE.LATEST}`)}async movie_credits(e){let{language:t=this.defaultOptions.language,person_id:n,...r}=e;return this.client.request(this.personSubPath(n,x.PEOPLE.MOVIE_CREDITS),{language:t,...r})}async tagged_images(e){let{person_id:t,...n}=e;return this.client.request(this.personSubPath(t,x.PEOPLE.TAGGED_IMAGES),n)}async translations(e){return this.client.request(this.personSubPath(e.person_id,x.PEOPLE.TRANSLATIONS))}async tv_credits(e){let{language:t=this.defaultOptions.language,person_id:n,...r}=e;return this.client.request(this.personSubPath(n,x.PEOPLE.TV_CREDITS),{language:t,...r})}},J=class extends w{accountPath(e){return`${x.ACCOUNT.DETAILS}/${e}`}accountSubPath(e,t){return`${this.accountPath(e)}${t}`}async details(e){let{account_id:t,...n}=e;return this.client.request(this.accountPath(t),n)}async add_favorite(e,t){let{account_id:n,...r}=e;return this.client.mutate(`POST`,this.accountSubPath(n,x.ACCOUNT.ADD_FAVORITE),t,r)}async add_to_watchlist(e,t){let{account_id:n,...r}=e;return this.client.mutate(`POST`,this.accountSubPath(n,x.ACCOUNT.ADD_TO_WATCHLIST),t,r)}async favorite_movies(e){let{account_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.accountSubPath(t,x.ACCOUNT.FAVORITE_MOVIES),{language:n,...r})}async favorite_tv(e){let{account_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.accountSubPath(t,x.ACCOUNT.FAVORITE_TV),{language:n,...r})}async watchlist_movies(e){let{account_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.accountSubPath(t,x.ACCOUNT.WATCHLIST_MOVIES),{language:n,...r})}async watchlist_tv(e){let{account_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.accountSubPath(t,x.ACCOUNT.WATCHLIST_TV),{language:n,...r})}async rated_movies(e){let{account_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.accountSubPath(t,x.ACCOUNT.RATED_MOVIES),{language:n,...r})}async rated_tv(e){let{account_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.accountSubPath(t,x.ACCOUNT.RATED_TV),{language:n,...r})}async rated_tv_episodes(e){let{account_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.accountSubPath(t,x.ACCOUNT.RATED_TV_EPISODES),{language:n,...r})}async lists(e){let{account_id:t,...n}=e;return this.client.request(this.accountSubPath(t,x.ACCOUNT.LISTS),n)}},Y=class extends w{async validate_key(){return this.client.request(x.AUTHENTICATION.VALIDATE)}async create_guest_session(){return this.client.request(x.AUTHENTICATION.GUEST_SESSION)}async create_request_token(){return this.client.request(x.AUTHENTICATION.REQUEST_TOKEN)}async create_session(e){return this.client.mutate(`POST`,x.AUTHENTICATION.CREATE_SESSION,e)}async create_session_with_login(e){return this.client.mutate(`POST`,x.AUTHENTICATION.CREATE_SESSION_WITH_LOGIN,e)}async delete_session(e){return this.client.mutate(`DELETE`,x.AUTHENTICATION.DELETE_SESSION,e)}},X=class extends w{guestSessionPath(e){return`${x.GUEST_SESSIONS.DETAILS}/${e}`}guestSessionSubPath(e,t){return`${this.guestSessionPath(e)}${t}`}async rated_movies(e){let{guest_session_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.guestSessionSubPath(t,x.GUEST_SESSIONS.RATED_MOVIES),{language:n,...r})}async rated_tv(e){let{guest_session_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.guestSessionSubPath(t,x.GUEST_SESSIONS.RATED_TV),{language:n,...r})}async rated_tv_episodes(e){let{guest_session_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.guestSessionSubPath(t,x.GUEST_SESSIONS.RATED_TV_EPISODES),{language:n,...r})}},Z=class extends w{listPath(e){return`${x.LISTS.DETAILS}/${e}`}listSubPath(e,t){return`${this.listPath(e)}${t}`}async details(e){let{list_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.listPath(t),{language:n,...r})}async create(e,t){return this.client.mutate(`POST`,x.LISTS.DETAILS,t,e)}async delete(e){let{list_id:t,...n}=e;return this.client.mutate(`DELETE`,this.listPath(t),void 0,n)}async add_movie(e,t){let{list_id:n,...r}=e;return this.client.mutate(`POST`,this.listSubPath(n,x.LISTS.ADD_ITEM),t,r)}async remove_movie(e,t){let{list_id:n,...r}=e;return this.client.mutate(`POST`,this.listSubPath(n,x.LISTS.REMOVE_ITEM),t,r)}async check_item_status(e){let{list_id:t,language:n=this.defaultOptions.language,...r}=e;return this.client.request(this.listSubPath(t,x.LISTS.ITEM_STATUS),{language:n,...r})}async clear(e){let{list_id:t,...n}=e;return this.client.mutate(`POST`,this.listSubPath(t,x.LISTS.CLEAR),void 0,n)}},Q=class extends w{async create_request_token(e){return this.client.mutate(`POST`,S.AUTH.REQUEST_TOKEN,e??{})}async create_access_token(e){return this.client.mutate(`POST`,S.AUTH.ACCESS_TOKEN,e)}async delete_access_token(e){return this.client.mutate(`DELETE`,S.AUTH.ACCESS_TOKEN,e)}},$=class extends w{},ce=class extends w{listPath(e){return`${S.LISTS.DETAILS}/${e}`}async create(e){return this.client.mutate(`POST`,S.LISTS.DETAILS,e)}async details({list_id:e,...t}){return this.client.request(this.listPath(e),this.withLanguage(t))}async update({list_id:e,...t}){return this.client.mutate(`PUT`,this.listPath(e),t)}async delete({list_id:e}){return this.client.mutate(`DELETE`,this.listPath(e),{})}async add_items(e,t){return this.client.mutate(`POST`,`${this.listPath(e)}${S.LISTS.ITEMS}`,t)}async update_items(e,t){return this.client.mutate(`PUT`,`${this.listPath(e)}${S.LISTS.ITEMS}`,t)}async remove_items(e,t){return this.client.mutate(`DELETE`,`${this.listPath(e)}${S.LISTS.ITEMS}`,t)}async item_status({list_id:e,...t}){return this.client.request(`${this.listPath(e)}${S.LISTS.ITEM_STATUS}`,t)}async clear(e){return this.client.mutate(`GET`,`${this.listPath(e)}${S.LISTS.CLEAR}`)}},le=class{client;auth;account;lists;constructor(e,t={}){if(!e)throw Error(C.NO_ACCESS_TOKEN);this.client=new b(e,{...t,version:4}),this.auth=new Q(this.client,t),this.account=new $(this.client,t),this.lists=new ce(this.client,t)}},ue=class{client;accessToken;options;movies;movie_lists;search;images;configuration;genres;keywords;tv_lists;tv_series;watch_providers;certifications;changes;companies;credits;collections;discover;find;networks;tv_episodes;tv_episode_groups;tv_seasons;trending;reviews;people_lists;people;account;authentication;guest_sessions;lists;get v4(){if(!m(this.accessToken))throw Error(C.V4_REQUIRES_JWT);return this._v4||=new le(this.accessToken,this.options),this._v4}_v4;get cache(){if(!this.options.cache)return;let e=this.client;return{clear(){e.clearCache()},invalidate(t,n){return e.invalidateCache(t,n)},get size(){return e.cacheSize}}}constructor(e,t={}){if(!e)throw Error(C.NO_ACCESS_TOKEN);this.accessToken=e,this.options=t,this.client=new b(e,{logger:t.logger,deduplication:t.deduplication,images:t.images,rate_limit:t.rate_limit,cache:t.cache,interceptors:t.interceptors}),this.movies=new I(this.client,this.options),this.movie_lists=new F(this.client,this.options),this.search=new L(this.client,this.options),this.images=new y(this.options.images),this.configuration=new A(this.client,this.options),this.genres=new N(this.client,this.options),this.keywords=new P(this.client,this.options),this.tv_lists=new R(this.client,this.options),this.tv_series=new se(this.client,this.options),this.watch_providers=new z(this.client,this.options),this.certifications=new T(this.client,this.options),this.changes=new E(this.client,this.options),this.companies=new D(this.client,this.options),this.credits=new O(this.client,this.options),this.collections=new k(this.client,this.options),this.discover=new j(this.client,this.options),this.find=new M(this.client,this.options),this.networks=new B(this.client,this.options),this.tv_episodes=new V(this.client,this.options),this.tv_episode_groups=new H(this.client,this.options),this.tv_seasons=new U(this.client,this.options),this.trending=new W(this.client,this.options),this.reviews=new G(this.client,this.options),this.people_lists=new K(this.client,this.options),this.people=new q(this.client,this.options),this.account=new J(this.client,this.options),this.authentication=new Y(this.client,this.options),this.guest_sessions=new X(this.client,this.options),this.lists=new Z(this.client,this.options)}};const de=[{iso_3166_1:`AD`,english_name:`Andorra`,native_name:`Andorra`},{iso_3166_1:`AE`,english_name:`United Arab Emirates`,native_name:`United Arab Emirates`},{iso_3166_1:`AF`,english_name:`Afghanistan`,native_name:`Afghanistan`},{iso_3166_1:`AG`,english_name:`Antigua and Barbuda`,native_name:`Antigua & Barbuda`},{iso_3166_1:`AI`,english_name:`Anguilla`,native_name:`Anguilla`},{iso_3166_1:`AL`,english_name:`Albania`,native_name:`Albania`},{iso_3166_1:`AM`,english_name:`Armenia`,native_name:`Armenia`},{iso_3166_1:`AN`,english_name:`Netherlands Antilles`,native_name:`Netherlands Antilles`},{iso_3166_1:`AO`,english_name:`Angola`,native_name:`Angola`},{iso_3166_1:`AQ`,english_name:`Antarctica`,native_name:`Antarctica`},{iso_3166_1:`AR`,english_name:`Argentina`,native_name:`Argentina`},{iso_3166_1:`AS`,english_name:`American Samoa`,native_name:`American Samoa`},{iso_3166_1:`AT`,english_name:`Austria`,native_name:`Austria`},{iso_3166_1:`AU`,english_name:`Australia`,native_name:`Australia`},{iso_3166_1:`AW`,english_name:`Aruba`,native_name:`Aruba`},{iso_3166_1:`AZ`,english_name:`Azerbaijan`,native_name:`Azerbaijan`},{iso_3166_1:`BA`,english_name:`Bosnia and Herzegovina`,native_name:`Bosnia & Herzegovina`},{iso_3166_1:`BB`,english_name:`Barbados`,native_name:`Barbados`},{iso_3166_1:`BD`,english_name:`Bangladesh`,native_name:`Bangladesh`},{iso_3166_1:`BE`,english_name:`Belgium`,native_name:`Belgium`},{iso_3166_1:`BF`,english_name:`Burkina Faso`,native_name:`Burkina Faso`},{iso_3166_1:`BG`,english_name:`Bulgaria`,native_name:`Bulgaria`},{iso_3166_1:`BH`,english_name:`Bahrain`,native_name:`Bahrain`},{iso_3166_1:`BI`,english_name:`Burundi`,native_name:`Burundi`},{iso_3166_1:`BJ`,english_name:`Benin`,native_name:`Benin`},{iso_3166_1:`BM`,english_name:`Bermuda`,native_name:`Bermuda`},{iso_3166_1:`BN`,english_name:`Brunei Darussalam`,native_name:`Brunei`},{iso_3166_1:`BO`,english_name:`Bolivia`,native_name:`Bolivia`},{iso_3166_1:`BR`,english_name:`Brazil`,native_name:`Brazil`},{iso_3166_1:`BS`,english_name:`Bahamas`,native_name:`Bahamas`},{iso_3166_1:`BT`,english_name:`Bhutan`,native_name:`Bhutan`},{iso_3166_1:`BU`,english_name:`Burma`,native_name:`Burma`},{iso_3166_1:`BV`,english_name:`Bouvet Island`,native_name:`Bouvet Island`},{iso_3166_1:`BW`,english_name:`Botswana`,native_name:`Botswana`},{iso_3166_1:`BY`,english_name:`Belarus`,native_name:`Belarus`},{iso_3166_1:`BZ`,english_name:`Belize`,native_name:`Belize`},{iso_3166_1:`CA`,english_name:`Canada`,native_name:`Canada`},{iso_3166_1:`CC`,english_name:`Cocos Islands`,native_name:`Cocos (Keeling) Islands`},{iso_3166_1:`CD`,english_name:`Congo`,native_name:`Democratic Republic of the Congo (Kinshasa)`},{iso_3166_1:`CF`,english_name:`Central African Republic`,native_name:`Central African Republic`},{iso_3166_1:`CG`,english_name:`Congo`,native_name:`Republic of the Congo (Brazzaville)`},{iso_3166_1:`CH`,english_name:`Switzerland`,native_name:`Switzerland`},{iso_3166_1:`CI`,english_name:`Cote D'Ivoire`,native_name:`Côte d’Ivoire`},{iso_3166_1:`CK`,english_name:`Cook Islands`,native_name:`Cook Islands`},{iso_3166_1:`CL`,english_name:`Chile`,native_name:`Chile`},{iso_3166_1:`CM`,english_name:`Cameroon`,native_name:`Cameroon`},{iso_3166_1:`CN`,english_name:`China`,native_name:`China`},{iso_3166_1:`CO`,english_name:`Colombia`,native_name:`Colombia`},{iso_3166_1:`CR`,english_name:`Costa Rica`,native_name:`Costa Rica`},{iso_3166_1:`CS`,english_name:`Serbia and Montenegro`,native_name:`Serbia and Montenegro`},{iso_3166_1:`CU`,english_name:`Cuba`,native_name:`Cuba`},{iso_3166_1:`CV`,english_name:`Cape Verde`,native_name:`Cape Verde`},{iso_3166_1:`CX`,english_name:`Christmas Island`,native_name:`Christmas Island`},{iso_3166_1:`CY`,english_name:`Cyprus`,native_name:`Cyprus`},{iso_3166_1:`CZ`,english_name:`Czech Republic`,native_name:`Czech Republic`},{iso_3166_1:`DE`,english_name:`Germany`,native_name:`Germany`},{iso_3166_1:`DJ`,english_name:`Djibouti`,native_name:`Djibouti`},{iso_3166_1:`DK`,english_name:`Denmark`,native_name:`Denmark`},{iso_3166_1:`DM`,english_name:`Dominica`,native_name:`Dominica`},{iso_3166_1:`DO`,english_name:`Dominican Republic`,native_name:`Dominican Republic`},{iso_3166_1:`DZ`,english_name:`Algeria`,native_name:`Algeria`},{iso_3166_1:`EC`,english_name:`Ecuador`,native_name:`Ecuador`},{iso_3166_1:`EE`,english_name:`Estonia`,native_name:`Estonia`},{iso_3166_1:`EG`,english_name:`Egypt`,native_name:`Egypt`},{iso_3166_1:`EH`,english_name:`Western Sahara`,native_name:`Western Sahara`},{iso_3166_1:`ER`,english_name:`Eritrea`,native_name:`Eritrea`},{iso_3166_1:`ES`,english_name:`Spain`,native_name:`Spain`},{iso_3166_1:`ET`,english_name:`Ethiopia`,native_name:`Ethiopia`},{iso_3166_1:`FI`,english_name:`Finland`,native_name:`Finland`},{iso_3166_1:`FJ`,english_name:`Fiji`,native_name:`Fiji`},{iso_3166_1:`FK`,english_name:`Falkland Islands`,native_name:`Falkland Islands`},{iso_3166_1:`FM`,english_name:`Micronesia`,native_name:`Micronesia`},{iso_3166_1:`FO`,english_name:`Faeroe Islands`,native_name:`Faroe Islands`},{iso_3166_1:`FR`,english_name:`France`,native_name:`France`},{iso_3166_1:`GA`,english_name:`Gabon`,native_name:`Gabon`},{iso_3166_1:`GB`,english_name:`United Kingdom`,native_name:`United Kingdom`},{iso_3166_1:`GD`,english_name:`Grenada`,native_name:`Grenada`},{iso_3166_1:`GE`,english_name:`Georgia`,native_name:`Georgia`},{iso_3166_1:`GF`,english_name:`French Guiana`,native_name:`French Guiana`},{iso_3166_1:`GH`,english_name:`Ghana`,native_name:`Ghana`},{iso_3166_1:`GI`,english_name:`Gibraltar`,native_name:`Gibraltar`},{iso_3166_1:`GL`,english_name:`Greenland`,native_name:`Greenland`},{iso_3166_1:`GM`,english_name:`Gambia`,native_name:`Gambia`},{iso_3166_1:`GN`,english_name:`Guinea`,native_name:`Guinea`},{iso_3166_1:`GP`,english_name:`Guadaloupe`,native_name:`Guadeloupe`},{iso_3166_1:`GQ`,english_name:`Equatorial Guinea`,native_name:`Equatorial Guinea`},{iso_3166_1:`GR`,english_name:`Greece`,native_name:`Greece`},{iso_3166_1:`GS`,english_name:`South Georgia and the South Sandwich Islands`,native_name:`South Georgia & South Sandwich Islands`},{iso_3166_1:`GT`,english_name:`Guatemala`,native_name:`Guatemala`},{iso_3166_1:`GU`,english_name:`Guam`,native_name:`Guam`},{iso_3166_1:`GW`,english_name:`Guinea-Bissau`,native_name:`Guinea-Bissau`},{iso_3166_1:`GY`,english_name:`Guyana`,native_name:`Guyana`},{iso_3166_1:`HK`,english_name:`Hong Kong`,native_name:`Hong Kong SAR China`},{iso_3166_1:`HM`,english_name:`Heard and McDonald Islands`,native_name:`Heard & McDonald Islands`},{iso_3166_1:`HN`,english_name:`Honduras`,native_name:`Honduras`},{iso_3166_1:`HR`,english_name:`Croatia`,native_name:`Croatia`},{iso_3166_1:`HT`,english_name:`Haiti`,native_name:`Haiti`},{iso_3166_1:`HU`,english_name:`Hungary`,native_name:`Hungary`},{iso_3166_1:`ID`,english_name:`Indonesia`,native_name:`Indonesia`},{iso_3166_1:`IE`,english_name:`Ireland`,native_name:`Ireland`},{iso_3166_1:`IL`,english_name:`Israel`,native_name:`Israel`},{iso_3166_1:`IN`,english_name:`India`,native_name:`India`},{iso_3166_1:`IO`,english_name:`British Indian Ocean Territory`,native_name:`British Indian Ocean Territory`},{iso_3166_1:`IQ`,english_name:`Iraq`,native_name:`Iraq`},{iso_3166_1:`IR`,english_name:`Iran`,native_name:`Iran`},{iso_3166_1:`IS`,english_name:`Iceland`,native_name:`Iceland`},{iso_3166_1:`IT`,english_name:`Italy`,native_name:`Italy`},{iso_3166_1:`JM`,english_name:`Jamaica`,native_name:`Jamaica`},{iso_3166_1:`JO`,english_name:`Jordan`,native_name:`Jordan`},{iso_3166_1:`JP`,english_name:`Japan`,native_name:`Japan`},{iso_3166_1:`KE`,english_name:`Kenya`,native_name:`Kenya`},{iso_3166_1:`KG`,english_name:`Kyrgyz Republic`,native_name:`Kyrgyzstan`},{iso_3166_1:`KH`,english_name:`Cambodia`,native_name:`Cambodia`},{iso_3166_1:`KI`,english_name:`Kiribati`,native_name:`Kiribati`},{iso_3166_1:`KM`,english_name:`Comoros`,native_name:`Comoros`},{iso_3166_1:`KN`,english_name:`St. Kitts and Nevis`,native_name:`St. Kitts & Nevis`},{iso_3166_1:`KP`,english_name:`North Korea`,native_name:`North Korea`},{iso_3166_1:`KR`,english_name:`South Korea`,native_name:`South Korea`},{iso_3166_1:`KW`,english_name:`Kuwait`,native_name:`Kuwait`},{iso_3166_1:`KY`,english_name:`Cayman Islands`,native_name:`Cayman Islands`},{iso_3166_1:`KZ`,english_name:`Kazakhstan`,native_name:`Kazakhstan`},{iso_3166_1:`LA`,english_name:`Lao People's Democratic Republic`,native_name:`Laos`},{iso_3166_1:`LB`,english_name:`Lebanon`,native_name:`Lebanon`},{iso_3166_1:`LC`,english_name:`St. Lucia`,native_name:`St. Lucia`},{iso_3166_1:`LI`,english_name:`Liechtenstein`,native_name:`Liechtenstein`},{iso_3166_1:`LK`,english_name:`Sri Lanka`,native_name:`Sri Lanka`},{iso_3166_1:`LR`,english_name:`Liberia`,native_name:`Liberia`},{iso_3166_1:`LS`,english_name:`Lesotho`,native_name:`Lesotho`},{iso_3166_1:`LT`,english_name:`Lithuania`,native_name:`Lithuania`},{iso_3166_1:`LU`,english_name:`Luxembourg`,native_name:`Luxembourg`},{iso_3166_1:`LV`,english_name:`Latvia`,native_name:`Latvia`},{iso_3166_1:`LY`,english_name:`Libyan Arab Jamahiriya`,native_name:`Libya`},{iso_3166_1:`MA`,english_name:`Morocco`,native_name:`Morocco`},{iso_3166_1:`MC`,english_name:`Monaco`,native_name:`Monaco`},{iso_3166_1:`MD`,english_name:`Moldova`,native_name:`Moldova`},{iso_3166_1:`ME`,english_name:`Montenegro`,native_name:`Montenegro`},{iso_3166_1:`MG`,english_name:`Madagascar`,native_name:`Madagascar`},{iso_3166_1:`MH`,english_name:`Marshall Islands`,native_name:`Marshall Islands`},{iso_3166_1:`MK`,english_name:`Macedonia`,native_name:`Macedonia`},{iso_3166_1:`ML`,english_name:`Mali`,native_name:`Mali`},{iso_3166_1:`MM`,english_name:`Myanmar`,native_name:`Myanmar (Burma)`},{iso_3166_1:`MN`,english_name:`Mongolia`,native_name:`Mongolia`},{iso_3166_1:`MO`,english_name:`Macao`,native_name:`Macau SAR China`},{iso_3166_1:`MP`,english_name:`Northern Mariana Islands`,native_name:`Northern Mariana Islands`},{iso_3166_1:`MQ`,english_name:`Martinique`,native_name:`Martinique`},{iso_3166_1:`MR`,english_name:`Mauritania`,native_name:`Mauritania`},{iso_3166_1:`MS`,english_name:`Montserrat`,native_name:`Montserrat`},{iso_3166_1:`MT`,english_name:`Malta`,native_name:`Malta`},{iso_3166_1:`MU`,english_name:`Mauritius`,native_name:`Mauritius`},{iso_3166_1:`MV`,english_name:`Maldives`,native_name:`Maldives`},{iso_3166_1:`MW`,english_name:`Malawi`,native_name:`Malawi`},{iso_3166_1:`MX`,english_name:`Mexico`,native_name:`Mexico`},{iso_3166_1:`MY`,english_name:`Malaysia`,native_name:`Malaysia`},{iso_3166_1:`MZ`,english_name:`Mozambique`,native_name:`Mozambique`},{iso_3166_1:`NA`,english_name:`Namibia`,native_name:`Namibia`},{iso_3166_1:`NC`,english_name:`New Caledonia`,native_name:`New Caledonia`},{iso_3166_1:`NE`,english_name:`Niger`,native_name:`Niger`},{iso_3166_1:`NF`,english_name:`Norfolk Island`,native_name:`Norfolk Island`},{iso_3166_1:`NG`,english_name:`Nigeria`,native_name:`Nigeria`},{iso_3166_1:`NI`,english_name:`Nicaragua`,native_name:`Nicaragua`},{iso_3166_1:`NL`,english_name:`Netherlands`,native_name:`Netherlands`},{iso_3166_1:`NO`,english_name:`Norway`,native_name:`Norway`},{iso_3166_1:`NP`,english_name:`Nepal`,native_name:`Nepal`},{iso_3166_1:`NR`,english_name:`Nauru`,native_name:`Nauru`},{iso_3166_1:`NU`,english_name:`Niue`,native_name:`Niue`},{iso_3166_1:`NZ`,english_name:`New Zealand`,native_name:`New Zealand`},{iso_3166_1:`OM`,english_name:`Oman`,native_name:`Oman`},{iso_3166_1:`PA`,english_name:`Panama`,native_name:`Panama`},{iso_3166_1:`PE`,english_name:`Peru`,native_name:`Peru`},{iso_3166_1:`PF`,english_name:`French Polynesia`,native_name:`French Polynesia`},{iso_3166_1:`PG`,english_name:`Papua New Guinea`,native_name:`Papua New Guinea`},{iso_3166_1:`PH`,english_name:`Philippines`,native_name:`Philippines`},{iso_3166_1:`PK`,english_name:`Pakistan`,native_name:`Pakistan`},{iso_3166_1:`PL`,english_name:`Poland`,native_name:`Poland`},{iso_3166_1:`PM`,english_name:`St. Pierre and Miquelon`,native_name:`St. Pierre & Miquelon`},{iso_3166_1:`PN`,english_name:`Pitcairn Island`,native_name:`Pitcairn Islands`},{iso_3166_1:`PR`,english_name:`Puerto Rico`,native_name:`Puerto Rico`},{iso_3166_1:`PS`,english_name:`Palestinian Territory`,native_name:`Palestinian Territories`},{iso_3166_1:`PT`,english_name:`Portugal`,native_name:`Portugal`},{iso_3166_1:`PW`,english_name:`Palau`,native_name:`Palau`},{iso_3166_1:`PY`,english_name:`Paraguay`,native_name:`Paraguay`},{iso_3166_1:`QA`,english_name:`Qatar`,native_name:`Qatar`},{iso_3166_1:`RE`,english_name:`Reunion`,native_name:`Réunion`},{iso_3166_1:`RO`,english_name:`Romania`,native_name:`Romania`},{iso_3166_1:`RS`,english_name:`Serbia`,native_name:`Serbia`},{iso_3166_1:`RU`,english_name:`Russia`,native_name:`Russia`},{iso_3166_1:`RW`,english_name:`Rwanda`,native_name:`Rwanda`},{iso_3166_1:`SA`,english_name:`Saudi Arabia`,native_name:`Saudi Arabia`},{iso_3166_1:`SB`,english_name:`Solomon Islands`,native_name:`Solomon Islands`},{iso_3166_1:`SC`,english_name:`Seychelles`,native_name:`Seychelles`},{iso_3166_1:`SD`,english_name:`Sudan`,native_name:`Sudan`},{iso_3166_1:`SE`,english_name:`Sweden`,native_name:`Sweden`},{iso_3166_1:`SG`,english_name:`Singapore`,native_name:`Singapore`},{iso_3166_1:`SH`,english_name:`St. Helena`,native_name:`St. Helena`},{iso_3166_1:`SI`,english_name:`Slovenia`,native_name:`Slovenia`},{iso_3166_1:`SJ`,english_name:`Svalbard & Jan Mayen Islands`,native_name:`Svalbard & Jan Mayen`},{iso_3166_1:`SK`,english_name:`Slovakia`,native_name:`Slovakia`},{iso_3166_1:`SL`,english_name:`Sierra Leone`,native_name:`Sierra Leone`},{iso_3166_1:`SM`,english_name:`San Marino`,native_name:`San Marino`},{iso_3166_1:`SN`,english_name:`Senegal`,native_name:`Senegal`},{iso_3166_1:`SO`,english_name:`Somalia`,native_name:`Somalia`},{iso_3166_1:`SR`,english_name:`Suriname`,native_name:`Suriname`},{iso_3166_1:`SS`,english_name:`South Sudan`,native_name:`South Sudan`},{iso_3166_1:`ST`,english_name:`Sao Tome and Principe`,native_name:`São Tomé & Príncipe`},{iso_3166_1:`SU`,english_name:`Soviet Union`,native_name:`Soviet Union`},{iso_3166_1:`SV`,english_name:`El Salvador`,native_name:`El Salvador`},{iso_3166_1:`SY`,english_name:`Syrian Arab Republic`,native_name:`Syria`},{iso_3166_1:`SZ`,english_name:`Swaziland`,native_name:`Eswatini (Swaziland)`},{iso_3166_1:`TC`,english_name:`Turks and Caicos Islands`,native_name:`Turks & Caicos Islands`},{iso_3166_1:`TD`,english_name:`Chad`,native_name:`Chad`},{iso_3166_1:`TF`,english_name:`French Southern Territories`,native_name:`French Southern Territories`},{iso_3166_1:`TG`,english_name:`Togo`,native_name:`Togo`},{iso_3166_1:`TH`,english_name:`Thailand`,native_name:`Thailand`},{iso_3166_1:`TJ`,english_name:`Tajikistan`,native_name:`Tajikistan`},{iso_3166_1:`TK`,english_name:`Tokelau`,native_name:`Tokelau`},{iso_3166_1:`TL`,english_name:`Timor-Leste`,native_name:`Timor-Leste`},{iso_3166_1:`TM`,english_name:`Turkmenistan`,native_name:`Turkmenistan`},{iso_3166_1:`TN`,english_name:`Tunisia`,native_name:`Tunisia`},{iso_3166_1:`TO`,english_name:`Tonga`,native_name:`Tonga`},{iso_3166_1:`TP`,english_name:`East Timor`,native_name:`East Timor`},{iso_3166_1:`TR`,english_name:`Turkey`,native_name:`Turkey`},{iso_3166_1:`TT`,english_name:`Trinidad and Tobago`,native_name:`Trinidad & Tobago`},{iso_3166_1:`TV`,english_name:`Tuvalu`,native_name:`Tuvalu`},{iso_3166_1:`TW`,english_name:`Taiwan`,native_name:`Taiwan`},{iso_3166_1:`TZ`,english_name:`Tanzania`,native_name:`Tanzania`},{iso_3166_1:`UA`,english_name:`Ukraine`,native_name:`Ukraine`},{iso_3166_1:`UG`,english_name:`Uganda`,native_name:`Uganda`},{iso_3166_1:`UM`,english_name:`United States Minor Outlying Islands`,native_name:`U.S. Outlying Islands`},{iso_3166_1:`US`,english_name:`United States of America`,native_name:`United States`},{iso_3166_1:`UY`,english_name:`Uruguay`,native_name:`Uruguay`},{iso_3166_1:`UZ`,english_name:`Uzbekistan`,native_name:`Uzbekistan`},{iso_3166_1:`VA`,english_name:`Holy See`,native_name:`Vatican City`},{iso_3166_1:`VC`,english_name:`St. Vincent and the Grenadines`,native_name:`St. Vincent & Grenadines`},{iso_3166_1:`VE`,english_name:`Venezuela`,native_name:`Venezuela`},{iso_3166_1:`VG`,english_name:`British Virgin Islands`,native_name:`British Virgin Islands`},{iso_3166_1:`VI`,english_name:`US Virgin Islands`,native_name:`U.S. Virgin Islands`},{iso_3166_1:`VN`,english_name:`Vietnam`,native_name:`Vietnam`},{iso_3166_1:`VU`,english_name:`Vanuatu`,native_name:`Vanuatu`},{iso_3166_1:`WF`,english_name:`Wallis and Futuna Islands`,native_name:`Wallis & Futuna`},{iso_3166_1:`WS`,english_name:`Samoa`,native_name:`Samoa`},{iso_3166_1:`XC`,english_name:`Czechoslovakia`,native_name:`Czechoslovakia`},{iso_3166_1:`XG`,english_name:`East Germany`,native_name:`East Germany`},{iso_3166_1:`XI`,english_name:`Northern Ireland`,native_name:`Northern Ireland`},{iso_3166_1:`XK`,english_name:`Kosovo`,native_name:`Kosovo`},{iso_3166_1:`YE`,english_name:`Yemen`,native_name:`Yemen`},{iso_3166_1:`YT`,english_name:`Mayotte`,native_name:`Mayotte`},{iso_3166_1:`YU`,english_name:`Yugoslavia`,native_name:`Yugoslavia`},{iso_3166_1:`ZA`,english_name:`South Africa`,native_name:`South Africa`},{iso_3166_1:`ZM`,english_name:`Zambia`,native_name:`Zambia`},{iso_3166_1:`ZR`,english_name:`Zaire`,native_name:`Zaire`},{iso_3166_1:`ZW`,english_name:`Zimbabwe`,native_name:`Zimbabwe`}];let fe=function(e){return e[e.ReturningSeries=0]=`ReturningSeries`,e[e.Planned=1]=`Planned`,e[e.InProduction=2]=`InProduction`,e[e.Ended=3]=`Ended`,e[e.Canceled=4]=`Canceled`,e[e.Pilot=5]=`Pilot`,e}({}),pe=function(e){return e[e.Documentary=0]=`Documentary`,e[e.News=1]=`News`,e[e.Miniseries=2]=`Miniseries`,e[e.Reality=3]=`Reality`,e[e.Scripted=4]=`Scripted`,e[e.TalkShow=5]=`TalkShow`,e[e.Video=6]=`Video`,e}({});function me(e){return e.media_type===`movie`}function he(e){return e.media_type===`tv`}let ge=function(e){return e[e.OriginalAirDate=1]=`OriginalAirDate`,e[e.Absolute=2]=`Absolute`,e[e.Dvd=3]=`Dvd`,e[e.Digital=4]=`Digital`,e[e.StoryArc=5]=`StoryArc`,e[e.Production=6]=`Production`,e[e.TV=7]=`TV`,e}({});export{J as AccountAPI,Y as AuthenticationAPI,r as BACKDROP_SIZES,T as CertificationsAPI,E as ChangesAPI,k as CollectionsAPI,D as CompaniesAPI,A as ConfigurationAPI,O as CreditsAPI,j as DiscoverAPI,fe as DiscoverTVStatus,pe as DiscoverTVType,M as FindAPI,N as GenresAPI,X as GuestSessionsAPI,t as IMAGE_BASE_URL,n as IMAGE_SECURE_BASE_URL,P as KeywordsAPI,i as LOGO_SIZES,Z as ListsAPI,F as MovieListsAPI,I as MoviesAPI,B as NetworksAPI,a as POSTER_SIZES,o as PROFILE_SIZES,q as PeopleAPI,K as PeopleListsAPI,G as ReviewsAPI,s as STILL_SIZES,L as SearchAPI,ue as TMDB,de as TMDBCountries,e as TMDBError,c as TMDBLogger,le as TMDBv4,ge as TVEpisodeGroupType,H as TVEpisodeGroupsAPI,V as TVEpisodesAPI,U as TVSeasonsAPI,se as TVSeriesAPI,R as TVSeriesListsAPI,W as TrendingAPI,$ as V4AccountAPI,Q as V4AuthAPI,ce as V4ListsAPI,z as WatchProvidersAPI,te as hasBackdropPath,ie as hasLogoPath,ee as hasPosterPath,ne as hasProfilePath,re as hasStillPath,m as isJwt,me as isKnownForMovie,he as isKnownForTV,g as isPlainObject,h as isRecord};