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