@api-wrappers/tmdb-wrapper 2.0.0

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