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