@tdanks2000/tmdb-wrapper 1.4.0 → 1.5.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/README.md +7 -7
- package/dist/index.cjs +128 -23
- package/dist/index.d.cts +131 -20
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +131 -20
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +128 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -196,7 +196,7 @@ The wrapper also provides access to these additional endpoints:
|
|
|
196
196
|
|
|
197
197
|
The wrapper includes utilities to reliably construct TMDB image URLs, plus a convenience helper for TMDB `Image` objects.
|
|
198
198
|
|
|
199
|
-
```
|
|
199
|
+
```typescript
|
|
200
200
|
import {
|
|
201
201
|
formImage,
|
|
202
202
|
getFullImagePath,
|
|
@@ -207,7 +207,7 @@ import {
|
|
|
207
207
|
|
|
208
208
|
### `getFullImagePath(...)`
|
|
209
209
|
|
|
210
|
-
```
|
|
210
|
+
```typescript
|
|
211
211
|
getFullImagePath(
|
|
212
212
|
baseUrl: string, // e.g. "https://image.tmdb.org/t/p/"
|
|
213
213
|
fileSize: string, // e.g. ImageSizes.W500 or "w780"
|
|
@@ -226,7 +226,7 @@ Notes:
|
|
|
226
226
|
|
|
227
227
|
`formImage` is a small helper that reads `file_path` from a TMDB `Image` object and returns a ready-to-use URL. If the image object doesn’t include a `file_path`, it returns `undefined`.
|
|
228
228
|
|
|
229
|
-
```
|
|
229
|
+
```typescript
|
|
230
230
|
formImage(
|
|
231
231
|
image: Image,
|
|
232
232
|
fileSize: ImageSizes,
|
|
@@ -238,7 +238,7 @@ formImage(
|
|
|
238
238
|
|
|
239
239
|
Poster path without extension (add one via `format`):
|
|
240
240
|
|
|
241
|
-
```
|
|
241
|
+
```typescript
|
|
242
242
|
const posterUrl = getFullImagePath(
|
|
243
243
|
"https://image.tmdb.org/t/p/",
|
|
244
244
|
ImageSizes.W500,
|
|
@@ -250,7 +250,7 @@ const posterUrl = getFullImagePath(
|
|
|
250
250
|
|
|
251
251
|
Profile path that already includes an extension (no need to pass `format`):
|
|
252
252
|
|
|
253
|
-
```
|
|
253
|
+
```typescript
|
|
254
254
|
const profileUrl = getFullImagePath(
|
|
255
255
|
"https://image.tmdb.org/t/p/",
|
|
256
256
|
ImageSizes.W185,
|
|
@@ -261,7 +261,7 @@ const profileUrl = getFullImagePath(
|
|
|
261
261
|
|
|
262
262
|
Using `formImage` with a TMDB response image object:
|
|
263
263
|
|
|
264
|
-
```
|
|
264
|
+
```typescript
|
|
265
265
|
const images = await tmdb.movies.getImages(550);
|
|
266
266
|
const poster = images.posters[0];
|
|
267
267
|
|
|
@@ -271,7 +271,7 @@ const posterUrl = formImage(poster, ImageSizes.W500);
|
|
|
271
271
|
|
|
272
272
|
Override the output extension (append/replace) with `format`:
|
|
273
273
|
|
|
274
|
-
```
|
|
274
|
+
```typescript
|
|
275
275
|
const posterPngUrl = formImage(poster, ImageSizes.W500, ImageFormats.PNG);
|
|
276
276
|
```
|
|
277
277
|
|
package/dist/index.cjs
CHANGED
|
@@ -114,9 +114,32 @@ 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
|
+
* Lightweight TMDB v3 API client.
|
|
119
|
+
*
|
|
120
|
+
* - Sends requests to `https://api.themoviedb.org/3`.
|
|
121
|
+
* - Supports authentication via:
|
|
122
|
+
* - v4 API Read Access Token (Bearer), and/or
|
|
123
|
+
* - v3 API key via `api_key` query parameter.
|
|
124
|
+
*
|
|
125
|
+
* Notes:
|
|
126
|
+
* - Many endpoints accept either method depending on your TMDB settings.
|
|
127
|
+
* - When an API key is present, it is appended as `api_key` in the query string.
|
|
128
|
+
*/
|
|
117
129
|
var API = class {
|
|
130
|
+
/**
|
|
131
|
+
* Optional v3 API key (sent as `api_key` query param).
|
|
132
|
+
*/
|
|
118
133
|
apiKey;
|
|
134
|
+
/**
|
|
135
|
+
* Optional v4 read access token (sent as `Authorization: Bearer ...`).
|
|
136
|
+
*/
|
|
119
137
|
accessToken;
|
|
138
|
+
/**
|
|
139
|
+
* Create a new API client.
|
|
140
|
+
*
|
|
141
|
+
* @param {TokenType} auth - Authentication information.
|
|
142
|
+
*/
|
|
120
143
|
constructor(auth) {
|
|
121
144
|
if (typeof auth === "string") this.accessToken = auth;
|
|
122
145
|
else {
|
|
@@ -125,9 +148,16 @@ var API = class {
|
|
|
125
148
|
}
|
|
126
149
|
}
|
|
127
150
|
/**
|
|
128
|
-
* Generic GET
|
|
129
|
-
*
|
|
130
|
-
* @template
|
|
151
|
+
* Generic HTTP GET request.
|
|
152
|
+
*
|
|
153
|
+
* @template T - Response JSON type.
|
|
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.
|
|
131
161
|
*/
|
|
132
162
|
async get(path, options) {
|
|
133
163
|
const rawOptions = {
|
|
@@ -149,6 +179,16 @@ var API = class {
|
|
|
149
179
|
return await response.json();
|
|
150
180
|
}
|
|
151
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
|
+
*/
|
|
152
192
|
const parseOptions = (options) => {
|
|
153
193
|
if (!options) return "";
|
|
154
194
|
const entries = [];
|
|
@@ -215,8 +255,23 @@ const formImage = (image, fileSize, format) => {
|
|
|
215
255
|
|
|
216
256
|
//#endregion
|
|
217
257
|
//#region src/@types/models/baseEndpoint.ts
|
|
258
|
+
/**
|
|
259
|
+
* Base class for all TMDB API endpoints.
|
|
260
|
+
*
|
|
261
|
+
* Provides a configured {@link API} client instance to subclasses.
|
|
262
|
+
*/
|
|
218
263
|
var BaseEndpoint = class {
|
|
264
|
+
/**
|
|
265
|
+
* Low-level HTTP client wrapper used by all endpoints.
|
|
266
|
+
*/
|
|
219
267
|
api;
|
|
268
|
+
/**
|
|
269
|
+
* Create a new endpoint instance.
|
|
270
|
+
*
|
|
271
|
+
* @param {TokenType} auth - Authentication information.
|
|
272
|
+
* - 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, depending on your {@link TokenType}.
|
|
274
|
+
*/
|
|
220
275
|
constructor(auth) {
|
|
221
276
|
this.auth = auth;
|
|
222
277
|
this.api = new API(auth);
|
|
@@ -227,11 +282,20 @@ var BaseEndpoint = class {
|
|
|
227
282
|
//#region src/endpoints/account.ts
|
|
228
283
|
/**
|
|
229
284
|
* Represents an endpoint for retrieving account details.
|
|
285
|
+
*
|
|
286
|
+
* TMDB v3 reference:
|
|
287
|
+
* - GET /account/{account_id}
|
|
288
|
+
*
|
|
289
|
+
* Note:
|
|
290
|
+
* TMDB does not expose a generic "GET /account" for account details. You must
|
|
291
|
+
* provide an `account_id`. Most apps obtain it from an auth flow and then cache
|
|
292
|
+
* it for subsequent requests.
|
|
230
293
|
*/
|
|
231
294
|
var AccountEndpoint = class extends BaseEndpoint {
|
|
232
295
|
/**
|
|
233
296
|
* Constructs a new AccountEndpoint instance.
|
|
234
|
-
*
|
|
297
|
+
*
|
|
298
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
235
299
|
*/
|
|
236
300
|
constructor(access_token) {
|
|
237
301
|
super(access_token);
|
|
@@ -239,10 +303,14 @@ var AccountEndpoint = class extends BaseEndpoint {
|
|
|
239
303
|
}
|
|
240
304
|
/**
|
|
241
305
|
* Retrieves account details asynchronously.
|
|
306
|
+
*
|
|
307
|
+
* TMDB: GET /account/{account_id}
|
|
308
|
+
*
|
|
309
|
+
* @param {number} accountId - The TMDB account ID.
|
|
242
310
|
* @returns {Promise<AccountDetails>} A Promise that resolves with the account details.
|
|
243
311
|
*/
|
|
244
|
-
|
|
245
|
-
return
|
|
312
|
+
details(accountId) {
|
|
313
|
+
return this.api.get(`/account/${accountId}`);
|
|
246
314
|
}
|
|
247
315
|
};
|
|
248
316
|
|
|
@@ -250,11 +318,16 @@ var AccountEndpoint = class extends BaseEndpoint {
|
|
|
250
318
|
//#region src/endpoints/certification.ts
|
|
251
319
|
/**
|
|
252
320
|
* Represents an endpoint for retrieving certifications for movies and TV shows.
|
|
321
|
+
*
|
|
322
|
+
* TMDB v3 reference:
|
|
323
|
+
* - GET /certification/movie/list
|
|
324
|
+
* - GET /certification/tv/list
|
|
253
325
|
*/
|
|
254
326
|
var CertificationEndpoint = class extends BaseEndpoint {
|
|
255
327
|
/**
|
|
256
328
|
* Constructs a new CertificationEndpoint instance.
|
|
257
|
-
*
|
|
329
|
+
*
|
|
330
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
258
331
|
*/
|
|
259
332
|
constructor(access_token) {
|
|
260
333
|
super(access_token);
|
|
@@ -262,17 +335,23 @@ var CertificationEndpoint = class extends BaseEndpoint {
|
|
|
262
335
|
}
|
|
263
336
|
/**
|
|
264
337
|
* Retrieves certifications for movies asynchronously.
|
|
338
|
+
*
|
|
339
|
+
* TMDB: GET /certification/movie/list
|
|
340
|
+
*
|
|
265
341
|
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for movies.
|
|
266
342
|
*/
|
|
267
|
-
|
|
268
|
-
return
|
|
343
|
+
movies() {
|
|
344
|
+
return this.api.get("/certification/movie/list");
|
|
269
345
|
}
|
|
270
346
|
/**
|
|
271
347
|
* Retrieves certifications for TV shows asynchronously.
|
|
348
|
+
*
|
|
349
|
+
* TMDB: GET /certification/tv/list
|
|
350
|
+
*
|
|
272
351
|
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for TV shows.
|
|
273
352
|
*/
|
|
274
|
-
|
|
275
|
-
return
|
|
353
|
+
tv() {
|
|
354
|
+
return this.api.get("/certification/tv/list");
|
|
276
355
|
}
|
|
277
356
|
};
|
|
278
357
|
|
|
@@ -280,11 +359,17 @@ var CertificationEndpoint = class extends BaseEndpoint {
|
|
|
280
359
|
//#region src/endpoints/changes.ts
|
|
281
360
|
/**
|
|
282
361
|
* Represents an endpoint for retrieving changes in movies, TV shows, and persons.
|
|
362
|
+
*
|
|
363
|
+
* TMDB v3 reference:
|
|
364
|
+
* - GET /movie/changes
|
|
365
|
+
* - GET /tv/changes
|
|
366
|
+
* - GET /person/changes
|
|
283
367
|
*/
|
|
284
368
|
var ChangeEndpoint = class extends BaseEndpoint {
|
|
285
369
|
/**
|
|
286
370
|
* Constructs a new ChangeEndpoint instance.
|
|
287
|
-
*
|
|
371
|
+
*
|
|
372
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
288
373
|
*/
|
|
289
374
|
constructor(access_token) {
|
|
290
375
|
super(access_token);
|
|
@@ -292,27 +377,36 @@ var ChangeEndpoint = class extends BaseEndpoint {
|
|
|
292
377
|
}
|
|
293
378
|
/**
|
|
294
379
|
* Retrieves changes in movies asynchronously.
|
|
380
|
+
*
|
|
381
|
+
* TMDB: GET /movie/changes
|
|
382
|
+
*
|
|
295
383
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
296
384
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in movies.
|
|
297
385
|
*/
|
|
298
|
-
|
|
299
|
-
return
|
|
386
|
+
movies(options) {
|
|
387
|
+
return this.api.get("/movie/changes", options);
|
|
300
388
|
}
|
|
301
389
|
/**
|
|
302
390
|
* Retrieves changes in TV shows asynchronously.
|
|
391
|
+
*
|
|
392
|
+
* TMDB: GET /tv/changes
|
|
393
|
+
*
|
|
303
394
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
304
395
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in TV shows.
|
|
305
396
|
*/
|
|
306
|
-
|
|
307
|
-
return
|
|
397
|
+
tv(options) {
|
|
398
|
+
return this.api.get("/tv/changes", options);
|
|
308
399
|
}
|
|
309
400
|
/**
|
|
310
401
|
* Retrieves changes related to persons asynchronously.
|
|
402
|
+
*
|
|
403
|
+
* TMDB: GET /person/changes
|
|
404
|
+
*
|
|
311
405
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
312
406
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes related to persons.
|
|
313
407
|
*/
|
|
314
|
-
|
|
315
|
-
return
|
|
408
|
+
person(options) {
|
|
409
|
+
return this.api.get("/person/changes", options);
|
|
316
410
|
}
|
|
317
411
|
};
|
|
318
412
|
|
|
@@ -456,11 +550,16 @@ var CreditsEndpoint = class extends BaseEndpoint {
|
|
|
456
550
|
const BASE_DISCOVER = "/discover";
|
|
457
551
|
/**
|
|
458
552
|
* Represents an endpoint for discovering movies and TV shows based on various criteria.
|
|
553
|
+
*
|
|
554
|
+
* TMDB v3 reference:
|
|
555
|
+
* - GET /discover/movie
|
|
556
|
+
* - GET /discover/tv
|
|
459
557
|
*/
|
|
460
558
|
var DiscoverEndpoint = class extends BaseEndpoint {
|
|
461
559
|
/**
|
|
462
560
|
* Constructs a new DiscoverEndpoint instance.
|
|
463
|
-
*
|
|
561
|
+
*
|
|
562
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
464
563
|
*/
|
|
465
564
|
constructor(access_token) {
|
|
466
565
|
super(access_token);
|
|
@@ -468,19 +567,25 @@ var DiscoverEndpoint = class extends BaseEndpoint {
|
|
|
468
567
|
}
|
|
469
568
|
/**
|
|
470
569
|
* Retrieves a list of movies based on the provided query options asynchronously.
|
|
570
|
+
*
|
|
571
|
+
* TMDB: GET /discover/movie
|
|
572
|
+
*
|
|
471
573
|
* @param {MovieQueryOptions} [options] - Optional parameters for refining the movie discovery.
|
|
472
574
|
* @returns {Promise<MovieDiscoverResult>} A Promise that resolves with the movie discovery results.
|
|
473
575
|
*/
|
|
474
|
-
|
|
475
|
-
return
|
|
576
|
+
movie(options) {
|
|
577
|
+
return this.api.get(`${BASE_DISCOVER}/movie`, options);
|
|
476
578
|
}
|
|
477
579
|
/**
|
|
478
580
|
* Retrieves a list of TV shows based on the provided query options asynchronously.
|
|
581
|
+
*
|
|
582
|
+
* TMDB: GET /discover/tv
|
|
583
|
+
*
|
|
479
584
|
* @param {TvShowQueryOptions} [options] - Optional parameters for refining the TV show discovery.
|
|
480
585
|
* @returns {Promise<TvShowDiscoverResult>} A Promise that resolves with the TV show discovery results.
|
|
481
586
|
*/
|
|
482
|
-
|
|
483
|
-
return
|
|
587
|
+
tvShow(options) {
|
|
588
|
+
return this.api.get(`${BASE_DISCOVER}/tv`, options);
|
|
484
589
|
}
|
|
485
590
|
};
|
|
486
591
|
|
package/dist/index.d.cts
CHANGED
|
@@ -362,7 +362,8 @@ interface AggregateCrew {
|
|
|
362
362
|
//# sourceMappingURL=credits.d.ts.map
|
|
363
363
|
//#endregion
|
|
364
364
|
//#region src/@types/endpoints/discover.d.ts
|
|
365
|
-
type
|
|
365
|
+
type MovieSortOption = "original_title.asc" | "original_title.desc" | "popularity.asc" | "popularity.desc" | "revenue.asc" | "revenue.desc" | "primary_release_date.asc" | "primary_release_date.desc" | "title.asc" | "title.desc" | "vote_average.asc" | "vote_average.desc" | "vote_count.asc" | "vote_count.desc";
|
|
366
|
+
type TvSortOption = "first_air_date.asc" | "first_air_date.desc" | "name.asc" | "name.desc" | "original_name.asc" | "original_name.desc" | "popularity.asc" | "popularity.desc" | "vote_average.asc" | "vote_average.desc" | "vote_count.asc" | "vote_count.desc";
|
|
366
367
|
interface MovieDiscoverResult {
|
|
367
368
|
page: number;
|
|
368
369
|
results: Movie[];
|
|
@@ -375,29 +376,31 @@ interface TvShowDiscoverResult {
|
|
|
375
376
|
total_results: number;
|
|
376
377
|
total_pages: number;
|
|
377
378
|
}
|
|
379
|
+
type WatchMonetizationType = "flatrate" | "free" | "ads" | "rent" | "buy";
|
|
378
380
|
interface DiscoverQueryOptions {
|
|
379
381
|
language?: string;
|
|
380
|
-
sort_by?: SortOption;
|
|
381
382
|
page?: number;
|
|
382
383
|
"vote_average.gte"?: number;
|
|
384
|
+
"vote_average.lte"?: number;
|
|
383
385
|
"vote_count.gte"?: number;
|
|
384
386
|
"vote_count.lte"?: number;
|
|
385
|
-
"vote_average.lte"?: number;
|
|
386
387
|
with_watch_providers?: string;
|
|
388
|
+
without_watch_providers?: string;
|
|
387
389
|
watch_region?: string;
|
|
388
|
-
|
|
389
|
-
with_watch_monetization_types?: "flatrate" | "free" | "ads" | "rent" | "buy";
|
|
390
|
+
with_watch_monetization_types?: WatchMonetizationType | string;
|
|
390
391
|
"with_runtime.gte"?: number;
|
|
391
392
|
"with_runtime.lte"?: number;
|
|
392
393
|
with_genres?: string;
|
|
393
394
|
without_genres?: string;
|
|
394
|
-
with_original_language?: string;
|
|
395
|
-
without_keywords?: string;
|
|
396
395
|
with_keywords?: string;
|
|
396
|
+
without_keywords?: string;
|
|
397
397
|
with_companies?: string;
|
|
398
|
+
without_companies?: string;
|
|
399
|
+
with_original_language?: string;
|
|
398
400
|
with_text_query?: string;
|
|
399
401
|
}
|
|
400
|
-
interface MovieQueryOptions extends DiscoverQueryOptions {
|
|
402
|
+
interface MovieQueryOptions extends Omit<DiscoverQueryOptions, "with_text_query"> {
|
|
403
|
+
sort_by?: MovieSortOption;
|
|
401
404
|
region?: string;
|
|
402
405
|
certification_country?: string;
|
|
403
406
|
certification?: string;
|
|
@@ -410,22 +413,25 @@ interface MovieQueryOptions extends DiscoverQueryOptions {
|
|
|
410
413
|
"primary_release_date.lte"?: string;
|
|
411
414
|
"release_date.gte"?: string;
|
|
412
415
|
"release_date.lte"?: string;
|
|
413
|
-
with_release_type?: string;
|
|
416
|
+
with_release_type?: number | string;
|
|
414
417
|
year?: number;
|
|
415
418
|
with_cast?: string;
|
|
416
419
|
with_crew?: string;
|
|
417
420
|
with_people?: string;
|
|
418
421
|
}
|
|
419
422
|
interface TvShowQueryOptions extends DiscoverQueryOptions {
|
|
423
|
+
sort_by?: TvSortOption;
|
|
420
424
|
"air_date.gte"?: string;
|
|
421
425
|
"air_date.lte"?: string;
|
|
422
426
|
"first_air_date.gte"?: string;
|
|
423
427
|
"first_air_date.lte"?: string;
|
|
424
428
|
first_air_date_year?: number;
|
|
425
|
-
|
|
426
|
-
with_networks?: string;
|
|
429
|
+
include_adult?: boolean;
|
|
427
430
|
include_null_first_air_dates?: boolean;
|
|
428
431
|
screened_theatrically?: boolean;
|
|
432
|
+
timezone?: string;
|
|
433
|
+
with_networks?: number | string;
|
|
434
|
+
with_origin_country?: string;
|
|
429
435
|
with_status?: string;
|
|
430
436
|
with_type?: string;
|
|
431
437
|
}
|
|
@@ -1568,17 +1574,57 @@ interface WatchProviders {
|
|
|
1568
1574
|
//# sourceMappingURL=watchProviders.d.ts.map
|
|
1569
1575
|
//#endregion
|
|
1570
1576
|
//#region src/utils/api.d.ts
|
|
1577
|
+
/**
|
|
1578
|
+
* Lightweight TMDB v3 API client.
|
|
1579
|
+
*
|
|
1580
|
+
* - Sends requests to `https://api.themoviedb.org/3`.
|
|
1581
|
+
* - Supports authentication via:
|
|
1582
|
+
* - v4 API Read Access Token (Bearer), and/or
|
|
1583
|
+
* - v3 API key via `api_key` query parameter.
|
|
1584
|
+
*
|
|
1585
|
+
* Notes:
|
|
1586
|
+
* - Many endpoints accept either method depending on your TMDB settings.
|
|
1587
|
+
* - When an API key is present, it is appended as `api_key` in the query string.
|
|
1588
|
+
*/
|
|
1571
1589
|
declare class API {
|
|
1590
|
+
/**
|
|
1591
|
+
* Optional v3 API key (sent as `api_key` query param).
|
|
1592
|
+
*/
|
|
1572
1593
|
private apiKey?;
|
|
1594
|
+
/**
|
|
1595
|
+
* Optional v4 read access token (sent as `Authorization: Bearer ...`).
|
|
1596
|
+
*/
|
|
1573
1597
|
private accessToken?;
|
|
1598
|
+
/**
|
|
1599
|
+
* Create a new API client.
|
|
1600
|
+
*
|
|
1601
|
+
* @param {TokenType} auth - Authentication information.
|
|
1602
|
+
*/
|
|
1574
1603
|
constructor(auth: TokenType);
|
|
1575
1604
|
/**
|
|
1576
|
-
* Generic GET
|
|
1577
|
-
*
|
|
1578
|
-
* @template
|
|
1605
|
+
* Generic HTTP GET request.
|
|
1606
|
+
*
|
|
1607
|
+
* @template T - Response JSON type.
|
|
1608
|
+
* @template O - Query options (query params) type.
|
|
1609
|
+
*
|
|
1610
|
+
* @param {string} path - The TMDB path beginning with `/`, e.g. `/movie/550`.
|
|
1611
|
+
* @param {O} [options] - Query parameters to serialize.
|
|
1612
|
+
*
|
|
1613
|
+
* @returns {Promise<T>} Resolves with parsed JSON typed as `T`.
|
|
1614
|
+
* @throws {ErrorResponse} Rejects with parsed TMDB error payload when `response.ok` is false.
|
|
1579
1615
|
*/
|
|
1580
1616
|
get<T, O extends Record<string, unknown> = Record<string, unknown>>(path: string, options?: O): Promise<T>;
|
|
1581
1617
|
}
|
|
1618
|
+
/**
|
|
1619
|
+
* Serializes an options object into a query string.
|
|
1620
|
+
*
|
|
1621
|
+
* - Skips `undefined` and `null`.
|
|
1622
|
+
* - Arrays are expanded into repeated keys:
|
|
1623
|
+
* `{ with_genres: ["12", "16"] }` -> `with_genres=12&with_genres=16`
|
|
1624
|
+
*
|
|
1625
|
+
* @param {Record<string, unknown>} [options] - Options to serialize.
|
|
1626
|
+
* @returns {string} Query string without the leading `?`.
|
|
1627
|
+
*/
|
|
1582
1628
|
declare const parseOptions: (options?: Record<string, unknown>) => string;
|
|
1583
1629
|
//# sourceMappingURL=api.d.ts.map
|
|
1584
1630
|
//#endregion
|
|
@@ -1796,9 +1842,24 @@ type TokenType = string | TMDBConfig;
|
|
|
1796
1842
|
//# sourceMappingURL=types.d.ts.map
|
|
1797
1843
|
//#endregion
|
|
1798
1844
|
//#region src/@types/models/baseEndpoint.d.ts
|
|
1845
|
+
/**
|
|
1846
|
+
* Base class for all TMDB API endpoints.
|
|
1847
|
+
*
|
|
1848
|
+
* Provides a configured {@link API} client instance to subclasses.
|
|
1849
|
+
*/
|
|
1799
1850
|
declare class BaseEndpoint {
|
|
1800
1851
|
protected readonly auth: TokenType;
|
|
1852
|
+
/**
|
|
1853
|
+
* Low-level HTTP client wrapper used by all endpoints.
|
|
1854
|
+
*/
|
|
1801
1855
|
protected api: API;
|
|
1856
|
+
/**
|
|
1857
|
+
* Create a new endpoint instance.
|
|
1858
|
+
*
|
|
1859
|
+
* @param {TokenType} auth - Authentication information.
|
|
1860
|
+
* - If a string: treated as a v4 API Read Access Token (Bearer token).
|
|
1861
|
+
* - If an object: can include an API key and/or access token, depending on your {@link TokenType}.
|
|
1862
|
+
*/
|
|
1802
1863
|
constructor(auth: TokenType);
|
|
1803
1864
|
}
|
|
1804
1865
|
//# sourceMappingURL=baseEndpoint.d.ts.map
|
|
@@ -1806,40 +1867,64 @@ declare class BaseEndpoint {
|
|
|
1806
1867
|
//#region src/endpoints/account.d.ts
|
|
1807
1868
|
/**
|
|
1808
1869
|
* Represents an endpoint for retrieving account details.
|
|
1870
|
+
*
|
|
1871
|
+
* TMDB v3 reference:
|
|
1872
|
+
* - GET /account/{account_id}
|
|
1873
|
+
*
|
|
1874
|
+
* Note:
|
|
1875
|
+
* TMDB does not expose a generic "GET /account" for account details. You must
|
|
1876
|
+
* provide an `account_id`. Most apps obtain it from an auth flow and then cache
|
|
1877
|
+
* it for subsequent requests.
|
|
1809
1878
|
*/
|
|
1810
1879
|
declare class AccountEndpoint extends BaseEndpoint {
|
|
1811
1880
|
protected readonly access_token: TokenType;
|
|
1812
1881
|
/**
|
|
1813
1882
|
* Constructs a new AccountEndpoint instance.
|
|
1814
|
-
*
|
|
1883
|
+
*
|
|
1884
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
1815
1885
|
*/
|
|
1816
1886
|
constructor(access_token: TokenType);
|
|
1817
1887
|
/**
|
|
1818
1888
|
* Retrieves account details asynchronously.
|
|
1889
|
+
*
|
|
1890
|
+
* TMDB: GET /account/{account_id}
|
|
1891
|
+
*
|
|
1892
|
+
* @param {number} accountId - The TMDB account ID.
|
|
1819
1893
|
* @returns {Promise<AccountDetails>} A Promise that resolves with the account details.
|
|
1820
1894
|
*/
|
|
1821
|
-
details(): Promise<AccountDetails>;
|
|
1895
|
+
details(accountId: number): Promise<AccountDetails>;
|
|
1822
1896
|
}
|
|
1823
1897
|
//# sourceMappingURL=account.d.ts.map
|
|
1824
1898
|
//#endregion
|
|
1825
1899
|
//#region src/endpoints/certification.d.ts
|
|
1826
1900
|
/**
|
|
1827
1901
|
* Represents an endpoint for retrieving certifications for movies and TV shows.
|
|
1902
|
+
*
|
|
1903
|
+
* TMDB v3 reference:
|
|
1904
|
+
* - GET /certification/movie/list
|
|
1905
|
+
* - GET /certification/tv/list
|
|
1828
1906
|
*/
|
|
1829
1907
|
declare class CertificationEndpoint extends BaseEndpoint {
|
|
1830
1908
|
protected readonly access_token: TokenType;
|
|
1831
1909
|
/**
|
|
1832
1910
|
* Constructs a new CertificationEndpoint instance.
|
|
1833
|
-
*
|
|
1911
|
+
*
|
|
1912
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
1834
1913
|
*/
|
|
1835
1914
|
constructor(access_token: TokenType);
|
|
1836
1915
|
/**
|
|
1837
1916
|
* Retrieves certifications for movies asynchronously.
|
|
1917
|
+
*
|
|
1918
|
+
* TMDB: GET /certification/movie/list
|
|
1919
|
+
*
|
|
1838
1920
|
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for movies.
|
|
1839
1921
|
*/
|
|
1840
1922
|
movies(): Promise<Certifications>;
|
|
1841
1923
|
/**
|
|
1842
1924
|
* Retrieves certifications for TV shows asynchronously.
|
|
1925
|
+
*
|
|
1926
|
+
* TMDB: GET /certification/tv/list
|
|
1927
|
+
*
|
|
1843
1928
|
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for TV shows.
|
|
1844
1929
|
*/
|
|
1845
1930
|
tv(): Promise<Certifications>;
|
|
@@ -1849,28 +1934,43 @@ declare class CertificationEndpoint extends BaseEndpoint {
|
|
|
1849
1934
|
//#region src/endpoints/changes.d.ts
|
|
1850
1935
|
/**
|
|
1851
1936
|
* Represents an endpoint for retrieving changes in movies, TV shows, and persons.
|
|
1937
|
+
*
|
|
1938
|
+
* TMDB v3 reference:
|
|
1939
|
+
* - GET /movie/changes
|
|
1940
|
+
* - GET /tv/changes
|
|
1941
|
+
* - GET /person/changes
|
|
1852
1942
|
*/
|
|
1853
1943
|
declare class ChangeEndpoint extends BaseEndpoint {
|
|
1854
1944
|
protected readonly access_token: TokenType;
|
|
1855
1945
|
/**
|
|
1856
1946
|
* Constructs a new ChangeEndpoint instance.
|
|
1857
|
-
*
|
|
1947
|
+
*
|
|
1948
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
1858
1949
|
*/
|
|
1859
1950
|
constructor(access_token: TokenType);
|
|
1860
1951
|
/**
|
|
1861
1952
|
* Retrieves changes in movies asynchronously.
|
|
1953
|
+
*
|
|
1954
|
+
* TMDB: GET /movie/changes
|
|
1955
|
+
*
|
|
1862
1956
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
1863
1957
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in movies.
|
|
1864
1958
|
*/
|
|
1865
1959
|
movies(options?: ChangeOption): Promise<MediaChanges>;
|
|
1866
1960
|
/**
|
|
1867
1961
|
* Retrieves changes in TV shows asynchronously.
|
|
1962
|
+
*
|
|
1963
|
+
* TMDB: GET /tv/changes
|
|
1964
|
+
*
|
|
1868
1965
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
1869
1966
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in TV shows.
|
|
1870
1967
|
*/
|
|
1871
1968
|
tv(options?: ChangeOption): Promise<MediaChanges>;
|
|
1872
1969
|
/**
|
|
1873
1970
|
* Retrieves changes related to persons asynchronously.
|
|
1971
|
+
*
|
|
1972
|
+
* TMDB: GET /person/changes
|
|
1973
|
+
*
|
|
1874
1974
|
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
1875
1975
|
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes related to persons.
|
|
1876
1976
|
*/
|
|
@@ -1987,22 +2087,33 @@ declare class CreditsEndpoint extends BaseEndpoint {
|
|
|
1987
2087
|
//#region src/endpoints/discover.d.ts
|
|
1988
2088
|
/**
|
|
1989
2089
|
* Represents an endpoint for discovering movies and TV shows based on various criteria.
|
|
2090
|
+
*
|
|
2091
|
+
* TMDB v3 reference:
|
|
2092
|
+
* - GET /discover/movie
|
|
2093
|
+
* - GET /discover/tv
|
|
1990
2094
|
*/
|
|
1991
2095
|
declare class DiscoverEndpoint extends BaseEndpoint {
|
|
1992
2096
|
protected readonly access_token: TokenType;
|
|
1993
2097
|
/**
|
|
1994
2098
|
* Constructs a new DiscoverEndpoint instance.
|
|
1995
|
-
*
|
|
2099
|
+
*
|
|
2100
|
+
* @param {TokenType} access_token - The access token used for authentication.
|
|
1996
2101
|
*/
|
|
1997
2102
|
constructor(access_token: TokenType);
|
|
1998
2103
|
/**
|
|
1999
2104
|
* Retrieves a list of movies based on the provided query options asynchronously.
|
|
2105
|
+
*
|
|
2106
|
+
* TMDB: GET /discover/movie
|
|
2107
|
+
*
|
|
2000
2108
|
* @param {MovieQueryOptions} [options] - Optional parameters for refining the movie discovery.
|
|
2001
2109
|
* @returns {Promise<MovieDiscoverResult>} A Promise that resolves with the movie discovery results.
|
|
2002
2110
|
*/
|
|
2003
2111
|
movie(options?: MovieQueryOptions): Promise<MovieDiscoverResult>;
|
|
2004
2112
|
/**
|
|
2005
2113
|
* Retrieves a list of TV shows based on the provided query options asynchronously.
|
|
2114
|
+
*
|
|
2115
|
+
* TMDB: GET /discover/tv
|
|
2116
|
+
*
|
|
2006
2117
|
* @param {TvShowQueryOptions} [options] - Optional parameters for refining the TV show discovery.
|
|
2007
2118
|
* @returns {Promise<TvShowDiscoverResult>} A Promise that resolves with the TV show discovery results.
|
|
2008
2119
|
*/
|
|
@@ -2807,5 +2918,5 @@ declare class TMDB {
|
|
|
2807
2918
|
watchProviders: WatchProvidersEndpoint;
|
|
2808
2919
|
}
|
|
2809
2920
|
//#endregion
|
|
2810
|
-
export { API, AccountDetails, AggregateCast, AggregateCredits, AggregateCrew, AiringTodayResult, AlternativeNames, AlternativeTitles, AppendToResponse, AppendToResponseMediaType, AppendToResponseMovieKey, AppendToResponsePersonKey, AppendToResponseTvEpisodeKey, AppendToResponseTvKey, AppendToResponseTvSeasonKey, AuthorDetails, Avatar, BackdropSizes, BaseEndpoint, BelongingMovies, BelongsToCollection, Buy, Cast, CastRole, Certification, Certifications, Change, ChangeItem, ChangeKeys, ChangeOption, Changes, Collection, CollectionImageOptions, CollectionSearchOptions, Company, CompanyDetails, CompanyImages, Configuration, ContentRatings, ContentRatingsResult, CreatedBy, CreditResponse, CreditSeason, Credits, Crew, CrewJob, Dates, DetailedCollection, DiscoverQueryOptions, Episode, EpisodeGroup, EpisodeGroups, EpisodeSelection, ErrorResponse, ExternalIdOptions, ExternalIds, ExternalSource, FindResult, Flatrate, Genre, Genres, Gravatar, GuestStar, Image, ImageCollection, ImageConfiguration, ImageFormat, ImageFormats, ImageSize, ImageSizes, Images, Keyword, Keywords, KeywordsOptions, KnownFor, LanguageOption, LastEpisodeToAir, LatestMovie, Latesttv, LogoSizes, Media$1 as Media, MediaChange, MediaChanges, MediaType, Movie, MovieChangeValue, MovieDetails, MovieDiscoverResult, MovieList, MovieLists, MovieQueryOptions, MovieSearchOptions, MovieWithMediaType, MoviesImageSearchOptions, MoviesPlayingNow, MultiSearchOptions, MultiSearchResult, Name, Network, NetworkDetails, NetworkImages, NextEpisodeToAir, OnTheAir, OnTheAirResult, PageOption, ParentCompany, PeopleImages, PeopleSearchOptions, Person, PersonChangeValue, PersonCombinedCredits, PersonDetails, PersonMovieCast, PersonMovieCredit, PersonMovieCrew, PersonTranslations, PersonTvShowCast, PersonTvShowCredit, PersonTvShowCrew, PersonWithMediaType, PopularMovies, PopularPersons, PopularTvShowResult, Populartv, PosterSizes, ProductionCompany, ProductionCountry, ProfileSizes, Recommendation, Recommendations, RegionOption, ReleaseDate, ReleaseDateResult, ReleaseDateType, ReleaseDates, Rent, Review, ReviewDetails, Reviews, ScreenedTheatrically, ScreenedTheatricallyResult, Search, SearchOptions, Season, SeasonDetails, SeasonSelection, SimilarMovies, SimilarTvShow, Similartv,
|
|
2921
|
+
export { API, AccountDetails, AggregateCast, AggregateCredits, AggregateCrew, AiringTodayResult, AlternativeNames, AlternativeTitles, AppendToResponse, AppendToResponseMediaType, AppendToResponseMovieKey, AppendToResponsePersonKey, AppendToResponseTvEpisodeKey, AppendToResponseTvKey, AppendToResponseTvSeasonKey, AuthorDetails, Avatar, BackdropSizes, BaseEndpoint, BelongingMovies, BelongsToCollection, Buy, Cast, CastRole, Certification, Certifications, Change, ChangeItem, ChangeKeys, ChangeOption, Changes, Collection, CollectionImageOptions, CollectionSearchOptions, Company, CompanyDetails, CompanyImages, Configuration, ContentRatings, ContentRatingsResult, CreatedBy, CreditResponse, CreditSeason, Credits, Crew, CrewJob, Dates, DetailedCollection, DiscoverQueryOptions, Episode, EpisodeGroup, EpisodeGroups, EpisodeSelection, ErrorResponse, ExternalIdOptions, ExternalIds, ExternalSource, FindResult, Flatrate, Genre, Genres, Gravatar, GuestStar, Image, ImageCollection, ImageConfiguration, ImageFormat, ImageFormats, ImageSize, ImageSizes, Images, Keyword, Keywords, KeywordsOptions, KnownFor, LanguageOption, LastEpisodeToAir, LatestMovie, Latesttv, LogoSizes, Media$1 as Media, MediaChange, MediaChanges, MediaType, Movie, MovieChangeValue, MovieDetails, MovieDiscoverResult, MovieList, MovieLists, MovieQueryOptions, MovieSearchOptions, MovieSortOption, MovieWithMediaType, MoviesImageSearchOptions, MoviesPlayingNow, MultiSearchOptions, MultiSearchResult, Name, Network, NetworkDetails, NetworkImages, NextEpisodeToAir, OnTheAir, OnTheAirResult, PageOption, ParentCompany, PeopleImages, PeopleSearchOptions, Person, PersonChangeValue, PersonCombinedCredits, PersonDetails, PersonMovieCast, PersonMovieCredit, PersonMovieCrew, PersonTranslations, PersonTvShowCast, PersonTvShowCredit, PersonTvShowCrew, PersonWithMediaType, PopularMovies, PopularPersons, PopularTvShowResult, Populartv, PosterSizes, ProductionCompany, ProductionCountry, ProfileSizes, Recommendation, Recommendations, RegionOption, ReleaseDate, ReleaseDateResult, ReleaseDateType, ReleaseDates, Rent, Review, ReviewDetails, Reviews, ScreenedTheatrically, ScreenedTheatricallyResult, Search, SearchOptions, Season, SeasonDetails, SeasonSelection, SimilarMovies, SimilarTvShow, Similartv, SpokenLanguage, StillSizes, TMDB, TMDBConfig, TMDB_IMAGE_BASE_URL, TV, TVWithMediaType, TaggedImage, TaggedImages, TimeWindow, TimezoneOption, Title, TokenType, TopRatedMovies, TopRatedTvShowResult, TopRatedtv, Translation, TranslationData, Translations, TrendingMediaType, TrendingResults, TvEpisodeChangeValue, TvEpisodeCredit, TvEpisodeImageSearchOptions, TvEpisodeTranslations, TvEpisodeVideoSearchOptions, TvSearchOptions, TvSeasonChangeValue, TvSeasonImageSearchOptions, TvSeasonVideoSearchOptions, TvShowChangeValue, TvShowDetails, TvShowDiscoverResult, TvShowImageOptions, TvShowQueryOptions, TvShowVideoOptions, TvSortOption, UpcomingMovies, Video, Videos, WatchLocale, WatchMonetizationType, WatchProviders, WatchRegion, WatchRegionsResponse, formImage, getFullImagePath, parseOptions, tvAiringToday };
|
|
2811
2922
|
//# sourceMappingURL=index.d.cts.map
|