@lorenzopant/tmdb 1.19.0 → 1.20.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.d.mts +483 -6
- package/dist/index.mjs +355 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -542,6 +542,20 @@ declare class TMDBLogger {
|
|
|
542
542
|
private static defaultLogger;
|
|
543
543
|
}
|
|
544
544
|
//#endregion
|
|
545
|
+
//#region src/utils/rate-limiter.d.ts
|
|
546
|
+
type RateLimitOptions = {
|
|
547
|
+
/**
|
|
548
|
+
* Maximum number of requests allowed within the window.
|
|
549
|
+
* @default 40
|
|
550
|
+
*/
|
|
551
|
+
max_requests?: number;
|
|
552
|
+
/**
|
|
553
|
+
* Window size in milliseconds.
|
|
554
|
+
* @default 1_000
|
|
555
|
+
*/
|
|
556
|
+
per_ms?: number;
|
|
557
|
+
};
|
|
558
|
+
//#endregion
|
|
545
559
|
//#region src/types/config/timezones.d.ts
|
|
546
560
|
type Timezone = TimezoneTuple[number];
|
|
547
561
|
type TimezoneTuple = (typeof TIMEZONE_DATA)[number]["zones"];
|
|
@@ -1439,6 +1453,27 @@ type TMDBOptions = {
|
|
|
1439
1453
|
onError?: ResponseErrorInterceptor;
|
|
1440
1454
|
};
|
|
1441
1455
|
};
|
|
1456
|
+
/**
|
|
1457
|
+
* When enabled, outgoing requests are queued to stay within TMDB's API rate limits.
|
|
1458
|
+
*
|
|
1459
|
+
* - `true` — uses the default limits (approximately 40 requests per second).
|
|
1460
|
+
* - Pass a {@link RateLimitOptions} object to customize `max_requests` and/or `per_ms`.
|
|
1461
|
+
*
|
|
1462
|
+
* Requests that exceed the budget are held in a FIFO queue and dispatched as
|
|
1463
|
+
* slots become available. This is especially useful for bulk data-fetching scripts.
|
|
1464
|
+
*
|
|
1465
|
+
* @default false (disabled)
|
|
1466
|
+
*
|
|
1467
|
+
* @example
|
|
1468
|
+
* ```ts
|
|
1469
|
+
* // Enable with defaults (~40 req / s)
|
|
1470
|
+
* const tmdb = new TMDB(token, { rate_limit: true });
|
|
1471
|
+
*
|
|
1472
|
+
* // Custom budget
|
|
1473
|
+
* const tmdb = new TMDB(token, { rate_limit: { max_requests: 30, per_ms: 1_000 } });
|
|
1474
|
+
* ```
|
|
1475
|
+
*/
|
|
1476
|
+
rate_limit?: boolean | RateLimitOptions;
|
|
1442
1477
|
};
|
|
1443
1478
|
//#endregion
|
|
1444
1479
|
//#region src/types/common/certifications.d.ts
|
|
@@ -3400,6 +3435,237 @@ type V4AuthDeleteAccessTokenResponse = {
|
|
|
3400
3435
|
status_message: string;
|
|
3401
3436
|
};
|
|
3402
3437
|
//#endregion
|
|
3438
|
+
//#region src/types/v4/lists.d.ts
|
|
3439
|
+
/** A media type used in v4 list items. */
|
|
3440
|
+
type V4ListMediaType = "movie" | "tv";
|
|
3441
|
+
/**
|
|
3442
|
+
* A single item reference used when adding, updating, or removing items from a v4 list.
|
|
3443
|
+
*/
|
|
3444
|
+
type V4ListItemInput = {
|
|
3445
|
+
/** The TMDB media type. */media_type: V4ListMediaType; /** The TMDB media ID. */
|
|
3446
|
+
media_id: number; /** Optional per-item comment. */
|
|
3447
|
+
comment?: string;
|
|
3448
|
+
};
|
|
3449
|
+
/** Standard status/success response returned by mutating v4 list endpoints. */
|
|
3450
|
+
type V4ListStatusResponse = {
|
|
3451
|
+
/** Always `true` on success. */success: boolean; /** TMDB internal status code. */
|
|
3452
|
+
status_code: number; /** Human-readable status message. */
|
|
3453
|
+
status_message: string;
|
|
3454
|
+
};
|
|
3455
|
+
/** Request body for POST /4/list. */
|
|
3456
|
+
type V4CreateListBody = {
|
|
3457
|
+
/** The name of the list. */name: string; /** ISO 639-1 language code (e.g. `"en"`). */
|
|
3458
|
+
iso_639_1: string; /** Optional description for the list. */
|
|
3459
|
+
description?: string; /** Whether the list is public. Defaults to `true`. */
|
|
3460
|
+
public?: boolean;
|
|
3461
|
+
};
|
|
3462
|
+
/**
|
|
3463
|
+
* Response from POST /4/list.
|
|
3464
|
+
* Returns the new list's ID alongside a standard status payload.
|
|
3465
|
+
*/
|
|
3466
|
+
type V4CreateListResponse = V4ListStatusResponse & {
|
|
3467
|
+
/** The TMDB ID of the newly created list. */id: number;
|
|
3468
|
+
};
|
|
3469
|
+
/** Parameters for GET /4/list/{list_id}. */
|
|
3470
|
+
type V4ListDetailsParams = {
|
|
3471
|
+
/** The TMDB list ID. */list_id: number; /** Language for localized fields. Defaults to `en-US`. */
|
|
3472
|
+
language?: Language; /** Page number. Defaults to `1`. */
|
|
3473
|
+
page?: number;
|
|
3474
|
+
};
|
|
3475
|
+
/**
|
|
3476
|
+
* A single media item returned inside a v4 list's results array.
|
|
3477
|
+
* Fields vary slightly between movie and TV show entries; common fields are listed here.
|
|
3478
|
+
*/
|
|
3479
|
+
type V4ListResult = {
|
|
3480
|
+
/** Whether the item is adult-only content. */adult: boolean; /** Backdrop image path, or `null` if unavailable. */
|
|
3481
|
+
backdrop_path?: string; /** TMDB ID. */
|
|
3482
|
+
id: number; /** The media type. */
|
|
3483
|
+
media_type: V4ListMediaType; /** Original language. */
|
|
3484
|
+
original_language: string; /** Poster image path, or `null` if unavailable. */
|
|
3485
|
+
poster_path?: string; /** Popularity score. */
|
|
3486
|
+
popularity: number; /** Vote average. */
|
|
3487
|
+
vote_average: number; /** Total vote count. */
|
|
3488
|
+
vote_count: number; /** Movie: original title. */
|
|
3489
|
+
original_title?: string; /** Movie: release date (YYYY-MM-DD). */
|
|
3490
|
+
release_date?: string; /** Movie: title. */
|
|
3491
|
+
title?: string; /** Movie: whether the movie has a video. */
|
|
3492
|
+
video?: boolean; /** TV: original name. */
|
|
3493
|
+
original_name?: string; /** TV: first air date (YYYY-MM-DD). */
|
|
3494
|
+
first_air_date?: string; /** TV: name. */
|
|
3495
|
+
name?: string; /** TV: origin countries. */
|
|
3496
|
+
origin_country?: string[];
|
|
3497
|
+
};
|
|
3498
|
+
/**
|
|
3499
|
+
* Full list detail response from GET /4/list/{list_id}.
|
|
3500
|
+
* Includes paginated results.
|
|
3501
|
+
*/
|
|
3502
|
+
type V4ListDetails = {
|
|
3503
|
+
/** The TMDB list ID. */id: number; /** Display name. */
|
|
3504
|
+
name: string; /** Description text. */
|
|
3505
|
+
description: string; /** Username of the list creator. */
|
|
3506
|
+
created_by: string; /** Backdrop image path, or `null`. */
|
|
3507
|
+
backdrop_path?: string; /** Cover poster image path, or `null`. */
|
|
3508
|
+
poster_path?: string; /** Whether the list is publicly visible. */
|
|
3509
|
+
public: boolean; /** ISO 639-1 language code. */
|
|
3510
|
+
iso_639_1: string; /** ISO 3166-1 country code. */
|
|
3511
|
+
iso_3166_1: string; /** Total number of items in the list. */
|
|
3512
|
+
item_count: number; /** Average rating across all rated items. */
|
|
3513
|
+
average_rating: number; /** Total combined runtime of all items (minutes). */
|
|
3514
|
+
runtime: number; /** Active sort_by mode. */
|
|
3515
|
+
sort_by: string; /** Total revenue of items in the list. */
|
|
3516
|
+
revenue: number; /** Per-item comments keyed by `"movie:{id}"` or `"tv:{id}"`. */
|
|
3517
|
+
comments: Record<string, string | null>; /** Internal TMDB object IDs. */
|
|
3518
|
+
object_ids: Record<string, string>; /** Current page of results. */
|
|
3519
|
+
page: number; /** Total number of pages. */
|
|
3520
|
+
total_pages: number; /** Total number of items. */
|
|
3521
|
+
total_results: number; /** Paginated media items. */
|
|
3522
|
+
results: V4ListResult[];
|
|
3523
|
+
};
|
|
3524
|
+
/** Request body for PUT /4/list/{list_id}. */
|
|
3525
|
+
type V4UpdateListBody = {
|
|
3526
|
+
/** The TMDB list ID. */list_id: number; /** New display name. */
|
|
3527
|
+
name?: string; /** New description. */
|
|
3528
|
+
description?: string; /** Change visibility. */
|
|
3529
|
+
public?: boolean; /** Sort field (e.g. `"original_order.asc"`, `"vote_average.desc"`). */
|
|
3530
|
+
sort_by?: string;
|
|
3531
|
+
};
|
|
3532
|
+
/** Parameters for DELETE /4/list/{list_id}. */
|
|
3533
|
+
type V4DeleteListParams = {
|
|
3534
|
+
/** The TMDB list ID. */list_id: number;
|
|
3535
|
+
};
|
|
3536
|
+
/** Request body for POST /4/list/{list_id}/items. */
|
|
3537
|
+
type V4AddListItemsBody = {
|
|
3538
|
+
/** Array of items to add. */items: V4ListItemInput[];
|
|
3539
|
+
};
|
|
3540
|
+
/** Per-item result within an add/update items response. */
|
|
3541
|
+
type V4ListItemResult = {
|
|
3542
|
+
/** Whether this individual item was successfully processed. */success: boolean; /** The media type. */
|
|
3543
|
+
media_type: V4ListMediaType; /** The TMDB media ID. */
|
|
3544
|
+
media_id: number;
|
|
3545
|
+
};
|
|
3546
|
+
/** Response from POST /4/list/{list_id}/items (add) and PUT /4/list/{list_id}/items (update). */
|
|
3547
|
+
type V4AddListItemsResponse = V4ListStatusResponse & {
|
|
3548
|
+
/** Per-item success status. */results: V4ListItemResult[];
|
|
3549
|
+
};
|
|
3550
|
+
/** Request body for PUT /4/list/{list_id}/items (update comments). */
|
|
3551
|
+
type V4UpdateListItemsBody = V4AddListItemsBody;
|
|
3552
|
+
/** Response from PUT /4/list/{list_id}/items. */
|
|
3553
|
+
type V4UpdateListItemsResponse = V4AddListItemsResponse;
|
|
3554
|
+
/** Request body for DELETE /4/list/{list_id}/items. */
|
|
3555
|
+
type V4RemoveListItemsBody = {
|
|
3556
|
+
/** Array of items to remove. */items: Pick<V4ListItemInput, "media_type" | "media_id">[];
|
|
3557
|
+
};
|
|
3558
|
+
/** Parameters for GET /4/list/{list_id}/item_status. */
|
|
3559
|
+
type V4ListItemStatusParams = {
|
|
3560
|
+
/** The TMDB list ID. */list_id: number; /** The media type to check. */
|
|
3561
|
+
media_type: V4ListMediaType; /** The TMDB media ID to check. */
|
|
3562
|
+
media_id: number;
|
|
3563
|
+
};
|
|
3564
|
+
/**
|
|
3565
|
+
* Response from GET /4/list/{list_id}/item_status.
|
|
3566
|
+
*/
|
|
3567
|
+
type V4ListItemStatusResponse = {
|
|
3568
|
+
/** The TMDB list ID. */id: number; /** The media type. */
|
|
3569
|
+
media_type: V4ListMediaType; /** The TMDB media ID. */
|
|
3570
|
+
media_id: number;
|
|
3571
|
+
};
|
|
3572
|
+
//#endregion
|
|
3573
|
+
//#region src/types/guest_sessions.d.ts
|
|
3574
|
+
/** Common query params for paginated guest session rated lists. */
|
|
3575
|
+
type GuestSessionRatedParams = {
|
|
3576
|
+
/** The guest session ID. */guest_session_id: string; /** Sort direction for the results. */
|
|
3577
|
+
sort_by?: AccountSortBy;
|
|
3578
|
+
} & WithLanguage & WithPage;
|
|
3579
|
+
/** Paginated response of rated movies for a guest session. */
|
|
3580
|
+
type GuestSessionRatedMoviesResponse = PaginatedResponse<AccountRatedMovieItem>;
|
|
3581
|
+
/** Paginated response of rated TV shows for a guest session. */
|
|
3582
|
+
type GuestSessionRatedTVResponse = PaginatedResponse<AccountRatedTVItem>;
|
|
3583
|
+
/** Paginated response of rated TV episodes for a guest session. */
|
|
3584
|
+
type GuestSessionRatedEpisodesResponse = PaginatedResponse<AccountRatedEpisodeItem>;
|
|
3585
|
+
//#endregion
|
|
3586
|
+
//#region src/types/lists.d.ts
|
|
3587
|
+
/** Standard mutation response returned by add_movie, remove_movie, clear, and delete. */
|
|
3588
|
+
type ListMutationResponse = {
|
|
3589
|
+
/** TMDB internal status code. */status_code: number; /** Human-readable status message. */
|
|
3590
|
+
status_message: string;
|
|
3591
|
+
};
|
|
3592
|
+
/** Query params for list mutation endpoints that require a session and a list ID. */
|
|
3593
|
+
type ListMutationParams = {
|
|
3594
|
+
/** TMDB list ID. */list_id: number; /** v3 session ID (required). */
|
|
3595
|
+
session_id: string;
|
|
3596
|
+
};
|
|
3597
|
+
/** A single item inside a TMDB v3 list (movie with media_type). */
|
|
3598
|
+
type ListItem = {
|
|
3599
|
+
/** Whether the item is adult content. */adult: boolean; /** Path to the backdrop image, if available. */
|
|
3600
|
+
backdrop_path?: string; /** Array of genre IDs. */
|
|
3601
|
+
genre_ids: number[]; /** Unique TMDB ID of the item. */
|
|
3602
|
+
id: number; /** Media type — always `"movie"` for v3 lists. */
|
|
3603
|
+
media_type: string; /** ISO 639-1 original language code. */
|
|
3604
|
+
original_language: string; /** Original title. */
|
|
3605
|
+
original_title: string; /** Plot overview. */
|
|
3606
|
+
overview: string; /** Popularity score. */
|
|
3607
|
+
popularity: number; /** Path to the poster image, if available. */
|
|
3608
|
+
poster_path?: string; /** Release date (YYYY-MM-DD). */
|
|
3609
|
+
release_date: string; /** Localized title. */
|
|
3610
|
+
title: string; /** Whether the item has a video. */
|
|
3611
|
+
video: boolean; /** Average TMDB vote score. */
|
|
3612
|
+
vote_average: number; /** Total number of TMDB votes. */
|
|
3613
|
+
vote_count: number;
|
|
3614
|
+
};
|
|
3615
|
+
/** Full details of a TMDB v3 list. */
|
|
3616
|
+
type ListDetails = {
|
|
3617
|
+
/** Display name of the list creator. */created_by: string; /** Description of the list. */
|
|
3618
|
+
description: string; /** Number of users who have favorited this list. */
|
|
3619
|
+
favorite_count: number; /** Unique TMDB list ID (returned as a string by the API). */
|
|
3620
|
+
id: string; /** Array of items in the list. */
|
|
3621
|
+
items: ListItem[]; /** Total number of items in the list. */
|
|
3622
|
+
item_count: number; /** ISO 639-1 language the list is written in. */
|
|
3623
|
+
iso_639_1: string; /** Display name of the list. */
|
|
3624
|
+
name: string; /** Path to the list's poster image, if set. */
|
|
3625
|
+
poster_path?: string;
|
|
3626
|
+
};
|
|
3627
|
+
/** Query params for the list details endpoint. */
|
|
3628
|
+
type ListDetailsParams = {
|
|
3629
|
+
/** TMDB list ID. */list_id: number;
|
|
3630
|
+
} & WithLanguage & WithPage;
|
|
3631
|
+
/** Request body for creating a new list. */
|
|
3632
|
+
type ListCreateBody = {
|
|
3633
|
+
/** Display name of the list. */name: string; /** Description of the list. */
|
|
3634
|
+
description: string; /** ISO 639-1 language code for the list. */
|
|
3635
|
+
language: string;
|
|
3636
|
+
};
|
|
3637
|
+
/** Query params for the create list endpoint. */
|
|
3638
|
+
type ListCreateParams = {
|
|
3639
|
+
/** v3 session ID (required). */session_id: string;
|
|
3640
|
+
};
|
|
3641
|
+
/** Response from creating a new list. */
|
|
3642
|
+
type ListCreateResponse = {
|
|
3643
|
+
/** Human-readable status message. */status_message: string; /** Whether the list was created successfully. */
|
|
3644
|
+
success: boolean; /** TMDB internal status code. */
|
|
3645
|
+
status_code: number; /** The ID of the newly created list. */
|
|
3646
|
+
list_id: number;
|
|
3647
|
+
};
|
|
3648
|
+
/** Request body for add_movie and remove_movie. */
|
|
3649
|
+
type ListMovieBody = {
|
|
3650
|
+
/** TMDB movie ID to add or remove. */media_id: number;
|
|
3651
|
+
};
|
|
3652
|
+
/** Query params for clearing all items from a list. */
|
|
3653
|
+
type ListClearParams = {
|
|
3654
|
+
/** TMDB list ID. */list_id: number; /** v3 session ID (required). */
|
|
3655
|
+
session_id: string; /** Must be `true` to confirm the operation. */
|
|
3656
|
+
confirm: boolean;
|
|
3657
|
+
};
|
|
3658
|
+
/** Query params for the check item status endpoint. */
|
|
3659
|
+
type ListItemStatusParams = {
|
|
3660
|
+
/** TMDB list ID. */list_id: number; /** TMDB movie ID to check. */
|
|
3661
|
+
movie_id?: number;
|
|
3662
|
+
} & WithLanguage;
|
|
3663
|
+
/** Response from the check item status endpoint. */
|
|
3664
|
+
type ListItemStatusResponse = {
|
|
3665
|
+
/** The TMDB list ID. */id: number; /** Whether the movie is present in the list. */
|
|
3666
|
+
item_present: boolean;
|
|
3667
|
+
};
|
|
3668
|
+
//#endregion
|
|
3403
3669
|
//#region src/client.d.ts
|
|
3404
3670
|
declare class ApiClient {
|
|
3405
3671
|
private accessToken;
|
|
@@ -3413,6 +3679,7 @@ declare class ApiClient {
|
|
|
3413
3679
|
*/
|
|
3414
3680
|
private inflightRequests;
|
|
3415
3681
|
private deduplication;
|
|
3682
|
+
private rateLimiter?;
|
|
3416
3683
|
private requestInterceptors;
|
|
3417
3684
|
private onSuccessInterceptor?;
|
|
3418
3685
|
private onErrorInterceptor?;
|
|
@@ -3422,6 +3689,7 @@ declare class ApiClient {
|
|
|
3422
3689
|
logger?: boolean | TMDBLoggerFn;
|
|
3423
3690
|
deduplication?: boolean;
|
|
3424
3691
|
images?: ImagesConfig;
|
|
3692
|
+
rate_limit?: boolean | RateLimitOptions;
|
|
3425
3693
|
interceptors?: {
|
|
3426
3694
|
request?: RequestInterceptor | RequestInterceptor[];
|
|
3427
3695
|
response?: {
|
|
@@ -3468,15 +3736,19 @@ declare class ApiClient {
|
|
|
3468
3736
|
private sanitizeNulls;
|
|
3469
3737
|
private handleError;
|
|
3470
3738
|
/**
|
|
3471
|
-
* Makes an authenticated mutation request
|
|
3472
|
-
* Unlike `request()`, mutations are never deduplicated since they change server state.
|
|
3739
|
+
* Makes an authenticated mutation request to the TMDB API.
|
|
3740
|
+
* Unlike `request()`, mutations are **never deduplicated** since they change server state.
|
|
3741
|
+
*
|
|
3742
|
+
* Accepts `"GET"` in addition to the standard mutation verbs for the rare TMDB endpoints
|
|
3743
|
+
* (e.g. `GET /4/list/{id}/clear`) that are specified as GET but carry side effects and
|
|
3744
|
+
* must therefore not be collapsed by the deduplication layer.
|
|
3473
3745
|
*
|
|
3474
3746
|
* @param method - HTTP method to use
|
|
3475
3747
|
* @param endpoint - API path (e.g. "/account/123/favorite")
|
|
3476
|
-
* @param body - JSON body to send (omit for DELETE requests without a body)
|
|
3748
|
+
* @param body - JSON body to send (omit for DELETE/GET requests without a body)
|
|
3477
3749
|
* @param params - Optional query string parameters (e.g. session_id)
|
|
3478
3750
|
*/
|
|
3479
|
-
mutate<T>(method: "POST" | "PUT" | "DELETE", endpoint: string, body?: Record<string, unknown>, params?: Record<string, unknown | undefined>): Promise<T>;
|
|
3751
|
+
mutate<T>(method: "GET" | "POST" | "PUT" | "DELETE", endpoint: string, body?: Record<string, unknown>, params?: Record<string, unknown | undefined>): Promise<T>;
|
|
3480
3752
|
/**
|
|
3481
3753
|
* Shared fetch + response-parsing pipeline used by both `request` and `mutate`.
|
|
3482
3754
|
* Handles URL construction, auth, logging, error mapping, and null sanitisation.
|
|
@@ -5151,6 +5423,111 @@ declare class AuthenticationAPI extends TMDBAPIBase {
|
|
|
5151
5423
|
delete_session(body: AuthDeleteSessionBody): Promise<AuthDeleteSessionResponse>;
|
|
5152
5424
|
}
|
|
5153
5425
|
//#endregion
|
|
5426
|
+
//#region src/endpoints/guest_sessions.d.ts
|
|
5427
|
+
declare class GuestSessionsAPI extends TMDBAPIBase {
|
|
5428
|
+
private guestSessionPath;
|
|
5429
|
+
private guestSessionSubPath;
|
|
5430
|
+
/**
|
|
5431
|
+
* Rated Movies
|
|
5432
|
+
* GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/movies
|
|
5433
|
+
*
|
|
5434
|
+
* Get the rated movies for a guest session.
|
|
5435
|
+
* @param params Guest session ID, optional language, page, and sort_by.
|
|
5436
|
+
* @reference https://developer.themoviedb.org/reference/guest-session-rated-movies
|
|
5437
|
+
*/
|
|
5438
|
+
rated_movies(params: GuestSessionRatedParams): Promise<GuestSessionRatedMoviesResponse>;
|
|
5439
|
+
/**
|
|
5440
|
+
* Rated TV
|
|
5441
|
+
* GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/tv
|
|
5442
|
+
*
|
|
5443
|
+
* Get the rated TV shows for a guest session.
|
|
5444
|
+
* @param params Guest session ID, optional language, page, and sort_by.
|
|
5445
|
+
* @reference https://developer.themoviedb.org/reference/guest-session-rated-tv
|
|
5446
|
+
*/
|
|
5447
|
+
rated_tv(params: GuestSessionRatedParams): Promise<GuestSessionRatedTVResponse>;
|
|
5448
|
+
/**
|
|
5449
|
+
* Rated TV Episodes
|
|
5450
|
+
* GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/tv/episodes
|
|
5451
|
+
*
|
|
5452
|
+
* Get the rated TV episodes for a guest session.
|
|
5453
|
+
* @param params Guest session ID, optional language, page, and sort_by.
|
|
5454
|
+
* @reference https://developer.themoviedb.org/reference/guest-session-rated-tv-episodes
|
|
5455
|
+
*/
|
|
5456
|
+
rated_tv_episodes(params: GuestSessionRatedParams): Promise<GuestSessionRatedEpisodesResponse>;
|
|
5457
|
+
}
|
|
5458
|
+
//#endregion
|
|
5459
|
+
//#region src/endpoints/lists.d.ts
|
|
5460
|
+
declare class ListsAPI extends TMDBAPIBase {
|
|
5461
|
+
private listPath;
|
|
5462
|
+
private listSubPath;
|
|
5463
|
+
/**
|
|
5464
|
+
* Details
|
|
5465
|
+
* GET - https://api.themoviedb.org/3/list/{list_id}
|
|
5466
|
+
*
|
|
5467
|
+
* Get the details of a list.
|
|
5468
|
+
* @param params List ID and optional language and page.
|
|
5469
|
+
* @reference https://developer.themoviedb.org/reference/list-details
|
|
5470
|
+
*/
|
|
5471
|
+
details(params: ListDetailsParams): Promise<ListDetails>;
|
|
5472
|
+
/**
|
|
5473
|
+
* Create
|
|
5474
|
+
* POST - https://api.themoviedb.org/3/list
|
|
5475
|
+
*
|
|
5476
|
+
* Create a new list.
|
|
5477
|
+
* @param params session_id query param (required).
|
|
5478
|
+
* @param body name, description, and language for the new list.
|
|
5479
|
+
* @reference https://developer.themoviedb.org/reference/list-create
|
|
5480
|
+
*/
|
|
5481
|
+
create(params: ListCreateParams, body: ListCreateBody): Promise<ListCreateResponse>;
|
|
5482
|
+
/**
|
|
5483
|
+
* Delete
|
|
5484
|
+
* DELETE - https://api.themoviedb.org/3/list/{list_id}
|
|
5485
|
+
*
|
|
5486
|
+
* Delete a list.
|
|
5487
|
+
* @param params List ID and session_id (required).
|
|
5488
|
+
* @reference https://developer.themoviedb.org/reference/list-delete
|
|
5489
|
+
*/
|
|
5490
|
+
delete(params: ListMutationParams): Promise<ListMutationResponse>;
|
|
5491
|
+
/**
|
|
5492
|
+
* Add Movie
|
|
5493
|
+
* POST - https://api.themoviedb.org/3/list/{list_id}/add_item
|
|
5494
|
+
*
|
|
5495
|
+
* Add a movie to a list.
|
|
5496
|
+
* @param params List ID and session_id (required).
|
|
5497
|
+
* @param body media_id of the movie to add.
|
|
5498
|
+
* @reference https://developer.themoviedb.org/reference/list-add-movie
|
|
5499
|
+
*/
|
|
5500
|
+
add_movie(params: ListMutationParams, body: ListMovieBody): Promise<ListMutationResponse>;
|
|
5501
|
+
/**
|
|
5502
|
+
* Remove Movie
|
|
5503
|
+
* POST - https://api.themoviedb.org/3/list/{list_id}/remove_item
|
|
5504
|
+
*
|
|
5505
|
+
* Remove a movie from a list.
|
|
5506
|
+
* @param params List ID and session_id (required).
|
|
5507
|
+
* @param body media_id of the movie to remove.
|
|
5508
|
+
* @reference https://developer.themoviedb.org/reference/list-remove-movie
|
|
5509
|
+
*/
|
|
5510
|
+
remove_movie(params: ListMutationParams, body: ListMovieBody): Promise<ListMutationResponse>;
|
|
5511
|
+
/**
|
|
5512
|
+
* Check Item Status
|
|
5513
|
+
* GET - https://api.themoviedb.org/3/list/{list_id}/item_status
|
|
5514
|
+
*
|
|
5515
|
+
* Check if a movie has already been added to a list.
|
|
5516
|
+
* @param params List ID and optional movie_id and language.
|
|
5517
|
+
* @reference https://developer.themoviedb.org/reference/list-check-item-status
|
|
5518
|
+
*/
|
|
5519
|
+
check_item_status(params: ListItemStatusParams): Promise<ListItemStatusResponse>;
|
|
5520
|
+
/**
|
|
5521
|
+
* Clear
|
|
5522
|
+
* POST - https://api.themoviedb.org/3/list/{list_id}/clear
|
|
5523
|
+
*
|
|
5524
|
+
* Clear all items from a list. Pass `confirm: true` to confirm the operation.
|
|
5525
|
+
* @param params List ID, session_id, and confirm flag (required).
|
|
5526
|
+
* @reference https://developer.themoviedb.org/reference/list-clear
|
|
5527
|
+
*/
|
|
5528
|
+
clear(params: ListClearParams): Promise<ListMutationResponse>;
|
|
5529
|
+
}
|
|
5530
|
+
//#endregion
|
|
5154
5531
|
//#region src/endpoints/v4/auth.d.ts
|
|
5155
5532
|
declare class V4AuthAPI extends TMDBAPIBase {
|
|
5156
5533
|
/**
|
|
@@ -5192,7 +5569,105 @@ declare class V4AuthAPI extends TMDBAPIBase {
|
|
|
5192
5569
|
declare class V4AccountAPI extends TMDBAPIBase {}
|
|
5193
5570
|
//#endregion
|
|
5194
5571
|
//#region src/endpoints/v4/lists.d.ts
|
|
5195
|
-
declare class V4ListsAPI extends TMDBAPIBase {
|
|
5572
|
+
declare class V4ListsAPI extends TMDBAPIBase {
|
|
5573
|
+
private listPath;
|
|
5574
|
+
/**
|
|
5575
|
+
* Create List
|
|
5576
|
+
* POST - https://api.themoviedb.org/4/list
|
|
5577
|
+
*
|
|
5578
|
+
* Create a new v4 list. The authenticated user becomes the owner.
|
|
5579
|
+
* @param body List name and ISO 639-1 language code are required.
|
|
5580
|
+
* @reference https://developer.themoviedb.org/reference/list-create
|
|
5581
|
+
*/
|
|
5582
|
+
create(body: V4CreateListBody): Promise<V4CreateListResponse>;
|
|
5583
|
+
/**
|
|
5584
|
+
* List Details
|
|
5585
|
+
* GET - https://api.themoviedb.org/4/list/{list_id}
|
|
5586
|
+
*
|
|
5587
|
+
* Retrieve the details and paginated items of a specific list.
|
|
5588
|
+
* @param params `list_id` is required. Optionally pass `language` and `page`.
|
|
5589
|
+
* @reference https://developer.themoviedb.org/reference/list-details
|
|
5590
|
+
*/
|
|
5591
|
+
details({
|
|
5592
|
+
list_id,
|
|
5593
|
+
...params
|
|
5594
|
+
}: V4ListDetailsParams): Promise<V4ListDetails>;
|
|
5595
|
+
/**
|
|
5596
|
+
* Update List
|
|
5597
|
+
* PUT - https://api.themoviedb.org/4/list/{list_id}
|
|
5598
|
+
*
|
|
5599
|
+
* Update the metadata (name, description, visibility, sort order) of an existing list.
|
|
5600
|
+
* @param body `list_id` plus any fields to change.
|
|
5601
|
+
* @reference https://developer.themoviedb.org/reference/list-update
|
|
5602
|
+
*/
|
|
5603
|
+
update({
|
|
5604
|
+
list_id,
|
|
5605
|
+
...body
|
|
5606
|
+
}: V4UpdateListBody): Promise<V4ListStatusResponse>;
|
|
5607
|
+
/**
|
|
5608
|
+
* Delete List
|
|
5609
|
+
* DELETE - https://api.themoviedb.org/4/list/{list_id}
|
|
5610
|
+
*
|
|
5611
|
+
* Permanently delete a list. This action cannot be undone.
|
|
5612
|
+
* @param params.list_id The TMDB list ID to delete.
|
|
5613
|
+
* @reference https://developer.themoviedb.org/reference/list-delete
|
|
5614
|
+
*/
|
|
5615
|
+
delete({
|
|
5616
|
+
list_id
|
|
5617
|
+
}: V4DeleteListParams): Promise<V4ListStatusResponse>;
|
|
5618
|
+
/**
|
|
5619
|
+
* Add Items
|
|
5620
|
+
* POST - https://api.themoviedb.org/4/list/{list_id}/items
|
|
5621
|
+
*
|
|
5622
|
+
* Add one or more movies or TV shows to a list. For each item the response
|
|
5623
|
+
* includes whether it was added successfully.
|
|
5624
|
+
* @param list_id The TMDB list ID.
|
|
5625
|
+
* @param body Array of `{ media_type, media_id }` objects to add.
|
|
5626
|
+
* @reference https://developer.themoviedb.org/reference/list-add-items
|
|
5627
|
+
*/
|
|
5628
|
+
add_items(list_id: number, body: V4AddListItemsBody): Promise<V4AddListItemsResponse>;
|
|
5629
|
+
/**
|
|
5630
|
+
* Update Items
|
|
5631
|
+
* PUT - https://api.themoviedb.org/4/list/{list_id}/items
|
|
5632
|
+
*
|
|
5633
|
+
* Update per-item comments for items already in the list.
|
|
5634
|
+
* @param list_id The TMDB list ID.
|
|
5635
|
+
* @param body Array of `{ media_type, media_id, comment }` objects.
|
|
5636
|
+
* @reference https://developer.themoviedb.org/reference/list-update-items
|
|
5637
|
+
*/
|
|
5638
|
+
update_items(list_id: number, body: V4UpdateListItemsBody): Promise<V4UpdateListItemsResponse>;
|
|
5639
|
+
/**
|
|
5640
|
+
* Remove Items
|
|
5641
|
+
* DELETE - https://api.themoviedb.org/4/list/{list_id}/items
|
|
5642
|
+
*
|
|
5643
|
+
* Remove one or more items from the list.
|
|
5644
|
+
* @param list_id The TMDB list ID.
|
|
5645
|
+
* @param body Array of `{ media_type, media_id }` objects to remove.
|
|
5646
|
+
* @reference https://developer.themoviedb.org/reference/list-remove-items
|
|
5647
|
+
*/
|
|
5648
|
+
remove_items(list_id: number, body: V4RemoveListItemsBody): Promise<V4ListStatusResponse>;
|
|
5649
|
+
/**
|
|
5650
|
+
* Check Item Status
|
|
5651
|
+
* GET - https://api.themoviedb.org/4/list/{list_id}/item_status
|
|
5652
|
+
*
|
|
5653
|
+
* Check whether a specific movie or TV show is already present in the list.
|
|
5654
|
+
* @param params `list_id`, `media_type`, and `media_id` are all required.
|
|
5655
|
+
* @reference https://developer.themoviedb.org/reference/list-item-status
|
|
5656
|
+
*/
|
|
5657
|
+
item_status({
|
|
5658
|
+
list_id,
|
|
5659
|
+
...params
|
|
5660
|
+
}: V4ListItemStatusParams): Promise<V4ListItemStatusResponse>;
|
|
5661
|
+
/**
|
|
5662
|
+
* Clear List
|
|
5663
|
+
* GET - https://api.themoviedb.org/4/list/{list_id}/clear
|
|
5664
|
+
*
|
|
5665
|
+
* Remove all items from the list without deleting the list itself.
|
|
5666
|
+
* @param list_id The TMDB list ID to clear.
|
|
5667
|
+
* @reference https://developer.themoviedb.org/reference/list-clear
|
|
5668
|
+
*/
|
|
5669
|
+
clear(list_id: number): Promise<V4ListStatusResponse>;
|
|
5670
|
+
}
|
|
5196
5671
|
//#endregion
|
|
5197
5672
|
//#region src/tmdb.v4.d.ts
|
|
5198
5673
|
/**
|
|
@@ -5262,6 +5737,8 @@ declare class TMDB {
|
|
|
5262
5737
|
people: PeopleAPI;
|
|
5263
5738
|
account: AccountAPI;
|
|
5264
5739
|
authentication: AuthenticationAPI;
|
|
5740
|
+
guest_sessions: GuestSessionsAPI;
|
|
5741
|
+
lists: ListsAPI;
|
|
5265
5742
|
/**
|
|
5266
5743
|
* TMDB API v4 namespaces. Access via `tmdb.v4.auth`, `tmdb.v4.account`, `tmdb.v4.lists`.
|
|
5267
5744
|
* Requires a Bearer (JWT) access token — throws if the instance was created with an API key.
|
|
@@ -5312,4 +5789,4 @@ declare function hasLogoPath(data: unknown): data is {
|
|
|
5312
5789
|
logo_path: string;
|
|
5313
5790
|
};
|
|
5314
5791
|
//#endregion
|
|
5315
|
-
export { AccountAPI, AccountAddFavoriteBody, AccountAddToWatchlistBody, AccountAvatar, AccountDetails, AccountDetailsParams, AccountListItem, AccountListsParams, AccountListsResponse, AccountMediaListParams, AccountMovieItem, AccountMovieListResponse, AccountMutationParams, AccountMutationResponse, AccountRatedEpisodeItem, AccountRatedEpisodesResponse, AccountRatedMovieItem, AccountRatedMoviesResponse, AccountRatedTVItem, AccountRatedTVResponse, AccountSortBy, AccountTVItem, AccountTVListResponse, AlternativeName, AlternativeNamesResult, AlternativeTitle, AuthCreateSessionBody, AuthCreateSessionResponse, AuthCreateSessionWithLoginBody, AuthDeleteSessionBody, AuthDeleteSessionResponse, AuthGuestSessionResponse, AuthRequestTokenResponse, AuthValidateKeyResponse, AuthenticationAPI, BACKDROP_SIZES, BackdropSize, Cast, CertificationItem, Certifications, CertificationsAPI, Change, ChangeItem, ChangeResultItem, Changes, ChangesAPI, Collection, CollectionBaseParam, CollectionDetailsParams, CollectionImages, CollectionImagesParams, CollectionItem, CollectionResultItem, CollectionTranslationData, CollectionTranslations, CollectionsAPI, CompaniesAPI, Company, CompanyAlternativeName, CompanyAlternativeNames, CompanyAlternativeNamesParams, CompanyBaseParam, CompanyDetailsParams, CompanyImages, CompanyImagesParams, CompanyResultItem, CompanySummary, ConfigurationAPI, ConfigurationCountriesParams, ConfigurationCountry, ConfigurationJob, ConfigurationLanguage, ConfigurationResponse, ConfigurationTimezone, ContentRating, CountryISO3166_1, Credit, CreditBaseParam, CreditDetails, CreditDetailsMedia, CreditDetailsMovieMedia, CreditDetailsParams, CreditDetailsPerson, CreditDetailsTVEpisode, CreditDetailsTVMedia, CreditDetailsTVSeason, CreditsAPI, Crew, DateRange, DefaultImageSizesConfig, DiscoverAPI, DiscoverFilterExpression, DiscoverMovieParams, DiscoverMovieSortBy, DiscoverTVParams, DiscoverTVResultItem, DiscoverTVSortBy, DiscoverTVStatus, DiscoverTVType, FileType, FindAPI, FindByIDParams, FindExternalSource, FindMovieResultItem, FindPersonResultItem, FindResults, FindTVEpisodeResultItem, FindTVResultItem, FindTVSeasonResultItem, Genre, GenresAPI, GenresResponse, IMAGE_BASE_URL, IMAGE_SECURE_BASE_URL, ImageCollectionKey, ImageConfiguration, ImageItem, ImageSize, ImageSizeTypes, ImagesConfig, ImagesResult, Keyword, KeywordBaseParam, KeywordDetailsParams, KeywordMoviesParams, KeywordResultItem, KeywordsAPI, KnownForItem, KnownForMovie, KnownForTV, LOGO_SIZES, Language, LanguageISO6391, LiteralUnion, LogoSize, MediaType, MediaWatchProviders, MovieAlternativeTitles, MovieAlternativeTitlesParams, MovieAppendToResponseNamespace, MovieAppendableMap, MovieChanges, MovieChangesParams, MovieCollection, MovieCredits, MovieCreditsParams, MovieDetails, MovieDetailsParams, MovieDetailsWithAppends, MovieExternalIDs, MovieExternalIDsParams, MovieImages, MovieImagesParams, MovieKeywords, MovieKeywordsParams, MovieListParams, MovieListsAPI, MovieRecommendations, MovieRecommendationsParams, MovieReleaseDate, MovieReleaseDateResult, MovieReleaseDates, MovieReleaseDatesParams, MovieResultItem, MovieReviews, MovieReviewsParams, MovieSimilar, MovieSimilarParams, MovieTranslationData, MovieTranslations, MovieTranslationsParams, MovieVideos, MovieVideosParams, MovieWatchProvidersParams, MoviesAPI, MultiSearchResultItem, Network, NetworkBaseParams, NetworkImages, NetworkItem, NetworksAPI, OrganizationImage, POSTER_SIZES, PROFILE_SIZES, PaginatedResponse, PeopleAPI, PeopleListParams, PeopleListsAPI, PersonAppendToResponseNamespace, PersonAppendableMap, PersonBaseParam, PersonChanges, PersonChangesParams, PersonCombinedCastCredit, PersonCombinedCredits, PersonCombinedCrewCredit, PersonCreditsParams, PersonDetails, PersonDetailsParams, PersonDetailsWithAppends, PersonExternalIDs, PersonExternalIDsParams, PersonImages, PersonImagesParams, PersonMovieCastCredit, PersonMovieCredits, PersonMovieCrewCredit, PersonResultItem, PersonTVCastCredit, PersonTVCredits, PersonTVCrewCredit, PersonTaggedImage, PersonTaggedImageMedia, PersonTaggedImages, PersonTaggedImagesParams, PersonTranslationData, PersonTranslations, PersonTranslationsParams, PosterSize, Prettify, PrimaryTranslations, ProductionCompany, ProductionCountry, ProfileSize, RequestInterceptor, RequestInterceptorContext, ResponseErrorInterceptor, ResponseSuccessInterceptor, Review, ReviewAuthorDetails, ReviewDetails, ReviewDetailsParams, ReviewsAPI, STILL_SIZES, SearchAPI, SearchCollectionsParams, SearchCompanyParams, SearchKeywordsParams, SearchMoviesParams, SearchMultiParams, SearchPersonParams, SearchTVSeriesParams, SpokenLanguage, StillSize, TMDB, TMDBCountries, TMDBError, TMDBLogger, TMDBLoggerEntry, TMDBLoggerFn, TMDBOptions, TMDBQueryParams, TMDBv4, TVAggregateCredits, TVAggregateCreditsCastItem, TVAggregateCreditsCrewItem, TVAggregateCreditsParams, TVAlternativeTitles, TVAppendToResponseNamespace, TVAppendableMap, TVBaseParam, TVChangeParams, TVContentRatings, TVCreditJob, TVCreditRole, TVCredits, TVCreditsParams, TVDetailsParams, TVDetailsWithAppends, TVEpisode, TVEpisodeAppendToResponseNamespace, TVEpisodeAppendableMap, TVEpisodeBaseParams, TVEpisodeCredits, TVEpisodeCreditsParams, TVEpisodeDetailsParams, TVEpisodeDetailsWithAppends, TVEpisodeExternalIDs, TVEpisodeGroupDetails, TVEpisodeGroupDetailsItem, TVEpisodeGroupEpisode, TVEpisodeGroupItem, TVEpisodeGroupParams, TVEpisodeGroupType, TVEpisodeGroups, TVEpisodeGroupsAPI, TVEpisodeId, TVEpisodeImages, TVEpisodeImagesParams, TVEpisodeItem, TVEpisodeTranslationData, TVEpisodeTranslations, TVEpisodeVideos, TVEpisodesAPI, TVExternalIDs, TVImageItem, TVImages, TVImagesParams, TVKeywords, TVRecommendations, TVRecommendationsParams, TVReviews, TVReviewsParams, TVScreenedTheatrically, TVScreeningItem, TVSeason, TVSeasonAggregateCredits, TVSeasonAggregateCreditsParams, TVSeasonAppendToResponseNamespace, TVSeasonAppendableMap, TVSeasonBaseParams, TVSeasonChanges, TVSeasonChangesParams, TVSeasonCredits, TVSeasonCreditsParams, TVSeasonDetailsParams, TVSeasonDetailsWithAppends, TVSeasonEpisode, TVSeasonExternalIDs, TVSeasonId, TVSeasonImages, TVSeasonImagesParams, TVSeasonItem, TVSeasonTranslationData, TVSeasonTranslations, TVSeasonVideos, TVSeasonVideosParams, TVSeasonWatchProvidersParams, TVSeasonsAPI, TVSeriesAPI, TVSeriesChanges, TVSeriesDetails, TVSeriesListItem, TVSeriesListParams, TVSeriesLists, TVSeriesListsAPI, TVSeriesListsParams, TVSeriesResultItem, TVSimilar, TVSimilarParams, TVTranslationData, TVTranslations, TVVideos, Timezone, Translation, TranslationResults, TrendingAPI, TrendingAllResult, TrendingMovieResult, TrendingParams, TrendingPersonResult, TrendingTVResult, TrendingTimeWindow, V4AccountAPI, V4AuthAPI, V4AuthAccessTokenResponse, V4AuthCreateAccessTokenBody, V4AuthCreateRequestTokenBody, V4AuthDeleteAccessTokenBody, V4AuthDeleteAccessTokenResponse, V4AuthRequestTokenResponse, V4ListsAPI, VideoItem, VideoResults, WatchMonetizationType, WatchProvider, WatchProviderDisplayPriorities, WatchProviderItem, WatchProviderListItem, WatchProviderListParams, WatchProviderListResponse, WatchProviderRegionsParams, WatchProviderRegionsResponse, WatchProvidersAPI, WithLanguage, WithLanguagePage, WithPage, WithPageAndDateRange, WithParams, WithRegion, hasBackdropPath, hasLogoPath, hasPosterPath, hasProfilePath, hasStillPath, isJwt, isKnownForMovie, isKnownForTV, isPlainObject, isRecord };
|
|
5792
|
+
export { AccountAPI, AccountAddFavoriteBody, AccountAddToWatchlistBody, AccountAvatar, AccountDetails, AccountDetailsParams, AccountListItem, AccountListsParams, AccountListsResponse, AccountMediaListParams, AccountMovieItem, AccountMovieListResponse, AccountMutationParams, AccountMutationResponse, AccountRatedEpisodeItem, AccountRatedEpisodesResponse, AccountRatedMovieItem, AccountRatedMoviesResponse, AccountRatedTVItem, AccountRatedTVResponse, AccountSortBy, AccountTVItem, AccountTVListResponse, AlternativeName, AlternativeNamesResult, AlternativeTitle, AuthCreateSessionBody, AuthCreateSessionResponse, AuthCreateSessionWithLoginBody, AuthDeleteSessionBody, AuthDeleteSessionResponse, AuthGuestSessionResponse, AuthRequestTokenResponse, AuthValidateKeyResponse, AuthenticationAPI, BACKDROP_SIZES, BackdropSize, Cast, CertificationItem, Certifications, CertificationsAPI, Change, ChangeItem, ChangeResultItem, Changes, ChangesAPI, Collection, CollectionBaseParam, CollectionDetailsParams, CollectionImages, CollectionImagesParams, CollectionItem, CollectionResultItem, CollectionTranslationData, CollectionTranslations, CollectionsAPI, CompaniesAPI, Company, CompanyAlternativeName, CompanyAlternativeNames, CompanyAlternativeNamesParams, CompanyBaseParam, CompanyDetailsParams, CompanyImages, CompanyImagesParams, CompanyResultItem, CompanySummary, ConfigurationAPI, ConfigurationCountriesParams, ConfigurationCountry, ConfigurationJob, ConfigurationLanguage, ConfigurationResponse, ConfigurationTimezone, ContentRating, CountryISO3166_1, Credit, CreditBaseParam, CreditDetails, CreditDetailsMedia, CreditDetailsMovieMedia, CreditDetailsParams, CreditDetailsPerson, CreditDetailsTVEpisode, CreditDetailsTVMedia, CreditDetailsTVSeason, CreditsAPI, Crew, DateRange, DefaultImageSizesConfig, DiscoverAPI, DiscoverFilterExpression, DiscoverMovieParams, DiscoverMovieSortBy, DiscoverTVParams, DiscoverTVResultItem, DiscoverTVSortBy, DiscoverTVStatus, DiscoverTVType, FileType, FindAPI, FindByIDParams, FindExternalSource, FindMovieResultItem, FindPersonResultItem, FindResults, FindTVEpisodeResultItem, FindTVResultItem, FindTVSeasonResultItem, Genre, GenresAPI, GenresResponse, GuestSessionRatedEpisodesResponse, GuestSessionRatedMoviesResponse, GuestSessionRatedParams, GuestSessionRatedTVResponse, GuestSessionsAPI, IMAGE_BASE_URL, IMAGE_SECURE_BASE_URL, ImageCollectionKey, ImageConfiguration, ImageItem, ImageSize, ImageSizeTypes, ImagesConfig, ImagesResult, Keyword, KeywordBaseParam, KeywordDetailsParams, KeywordMoviesParams, KeywordResultItem, KeywordsAPI, KnownForItem, KnownForMovie, KnownForTV, LOGO_SIZES, Language, LanguageISO6391, ListClearParams, ListCreateBody, ListCreateParams, ListCreateResponse, ListDetails, ListDetailsParams, ListItem, ListItemStatusParams, ListItemStatusResponse, ListMovieBody, ListMutationParams, ListMutationResponse, ListsAPI, LiteralUnion, LogoSize, MediaType, MediaWatchProviders, MovieAlternativeTitles, MovieAlternativeTitlesParams, MovieAppendToResponseNamespace, MovieAppendableMap, MovieChanges, MovieChangesParams, MovieCollection, MovieCredits, MovieCreditsParams, MovieDetails, MovieDetailsParams, MovieDetailsWithAppends, MovieExternalIDs, MovieExternalIDsParams, MovieImages, MovieImagesParams, MovieKeywords, MovieKeywordsParams, MovieListParams, MovieListsAPI, MovieRecommendations, MovieRecommendationsParams, MovieReleaseDate, MovieReleaseDateResult, MovieReleaseDates, MovieReleaseDatesParams, MovieResultItem, MovieReviews, MovieReviewsParams, MovieSimilar, MovieSimilarParams, MovieTranslationData, MovieTranslations, MovieTranslationsParams, MovieVideos, MovieVideosParams, MovieWatchProvidersParams, MoviesAPI, MultiSearchResultItem, Network, NetworkBaseParams, NetworkImages, NetworkItem, NetworksAPI, OrganizationImage, POSTER_SIZES, PROFILE_SIZES, PaginatedResponse, PeopleAPI, PeopleListParams, PeopleListsAPI, PersonAppendToResponseNamespace, PersonAppendableMap, PersonBaseParam, PersonChanges, PersonChangesParams, PersonCombinedCastCredit, PersonCombinedCredits, PersonCombinedCrewCredit, PersonCreditsParams, PersonDetails, PersonDetailsParams, PersonDetailsWithAppends, PersonExternalIDs, PersonExternalIDsParams, PersonImages, PersonImagesParams, PersonMovieCastCredit, PersonMovieCredits, PersonMovieCrewCredit, PersonResultItem, PersonTVCastCredit, PersonTVCredits, PersonTVCrewCredit, PersonTaggedImage, PersonTaggedImageMedia, PersonTaggedImages, PersonTaggedImagesParams, PersonTranslationData, PersonTranslations, PersonTranslationsParams, PosterSize, Prettify, PrimaryTranslations, ProductionCompany, ProductionCountry, ProfileSize, RequestInterceptor, RequestInterceptorContext, ResponseErrorInterceptor, ResponseSuccessInterceptor, Review, ReviewAuthorDetails, ReviewDetails, ReviewDetailsParams, ReviewsAPI, STILL_SIZES, SearchAPI, SearchCollectionsParams, SearchCompanyParams, SearchKeywordsParams, SearchMoviesParams, SearchMultiParams, SearchPersonParams, SearchTVSeriesParams, SpokenLanguage, StillSize, TMDB, TMDBCountries, TMDBError, TMDBLogger, TMDBLoggerEntry, TMDBLoggerFn, TMDBOptions, TMDBQueryParams, TMDBv4, TVAggregateCredits, TVAggregateCreditsCastItem, TVAggregateCreditsCrewItem, TVAggregateCreditsParams, TVAlternativeTitles, TVAppendToResponseNamespace, TVAppendableMap, TVBaseParam, TVChangeParams, TVContentRatings, TVCreditJob, TVCreditRole, TVCredits, TVCreditsParams, TVDetailsParams, TVDetailsWithAppends, TVEpisode, TVEpisodeAppendToResponseNamespace, TVEpisodeAppendableMap, TVEpisodeBaseParams, TVEpisodeCredits, TVEpisodeCreditsParams, TVEpisodeDetailsParams, TVEpisodeDetailsWithAppends, TVEpisodeExternalIDs, TVEpisodeGroupDetails, TVEpisodeGroupDetailsItem, TVEpisodeGroupEpisode, TVEpisodeGroupItem, TVEpisodeGroupParams, TVEpisodeGroupType, TVEpisodeGroups, TVEpisodeGroupsAPI, TVEpisodeId, TVEpisodeImages, TVEpisodeImagesParams, TVEpisodeItem, TVEpisodeTranslationData, TVEpisodeTranslations, TVEpisodeVideos, TVEpisodesAPI, TVExternalIDs, TVImageItem, TVImages, TVImagesParams, TVKeywords, TVRecommendations, TVRecommendationsParams, TVReviews, TVReviewsParams, TVScreenedTheatrically, TVScreeningItem, TVSeason, TVSeasonAggregateCredits, TVSeasonAggregateCreditsParams, TVSeasonAppendToResponseNamespace, TVSeasonAppendableMap, TVSeasonBaseParams, TVSeasonChanges, TVSeasonChangesParams, TVSeasonCredits, TVSeasonCreditsParams, TVSeasonDetailsParams, TVSeasonDetailsWithAppends, TVSeasonEpisode, TVSeasonExternalIDs, TVSeasonId, TVSeasonImages, TVSeasonImagesParams, TVSeasonItem, TVSeasonTranslationData, TVSeasonTranslations, TVSeasonVideos, TVSeasonVideosParams, TVSeasonWatchProvidersParams, TVSeasonsAPI, TVSeriesAPI, TVSeriesChanges, TVSeriesDetails, TVSeriesListItem, TVSeriesListParams, TVSeriesLists, TVSeriesListsAPI, TVSeriesListsParams, TVSeriesResultItem, TVSimilar, TVSimilarParams, TVTranslationData, TVTranslations, TVVideos, Timezone, Translation, TranslationResults, TrendingAPI, TrendingAllResult, TrendingMovieResult, TrendingParams, TrendingPersonResult, TrendingTVResult, TrendingTimeWindow, V4AccountAPI, V4AddListItemsBody, V4AddListItemsResponse, V4AuthAPI, V4AuthAccessTokenResponse, V4AuthCreateAccessTokenBody, V4AuthCreateRequestTokenBody, V4AuthDeleteAccessTokenBody, V4AuthDeleteAccessTokenResponse, V4AuthRequestTokenResponse, V4CreateListBody, V4CreateListResponse, V4DeleteListParams, V4ListDetails, V4ListDetailsParams, V4ListItemInput, V4ListItemResult, V4ListItemStatusParams, V4ListItemStatusResponse, V4ListMediaType, V4ListResult, V4ListStatusResponse, V4ListsAPI, V4RemoveListItemsBody, V4UpdateListBody, V4UpdateListItemsBody, V4UpdateListItemsResponse, VideoItem, VideoResults, WatchMonetizationType, WatchProvider, WatchProviderDisplayPriorities, WatchProviderItem, WatchProviderListItem, WatchProviderListParams, WatchProviderListResponse, WatchProviderRegionsParams, WatchProviderRegionsResponse, WatchProvidersAPI, WithLanguage, WithLanguagePage, WithPage, WithPageAndDateRange, WithParams, WithRegion, hasBackdropPath, hasLogoPath, hasPosterPath, hasProfilePath, hasStillPath, isJwt, isKnownForMovie, isKnownForTV, isPlainObject, isRecord };
|
package/dist/index.mjs
CHANGED
|
@@ -296,6 +296,60 @@ var ImageAPI = class {
|
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
298
|
//#endregion
|
|
299
|
+
//#region src/utils/rate-limiter.ts
|
|
300
|
+
/**
|
|
301
|
+
* A sliding-window rate limiter that queues callers when the request budget is exhausted.
|
|
302
|
+
*
|
|
303
|
+
* Callers `await acquire()` before dispatching a fetch. If the number of requests made
|
|
304
|
+
* within the last `per_ms` milliseconds is below `max_requests`, the caller is released
|
|
305
|
+
* immediately. Otherwise it waits until enough time has passed for older timestamps to
|
|
306
|
+
* leave the window, then proceeds.
|
|
307
|
+
*
|
|
308
|
+
* The internal queue is processed serially by a single `process()` loop so there are no
|
|
309
|
+
* race conditions between concurrent callers.
|
|
310
|
+
*/
|
|
311
|
+
var RateLimiter = class {
|
|
312
|
+
maxRequests;
|
|
313
|
+
windowMs;
|
|
314
|
+
timestamps = [];
|
|
315
|
+
queue = [];
|
|
316
|
+
processing = false;
|
|
317
|
+
constructor(options = {}) {
|
|
318
|
+
const maxRequests = options.max_requests ?? 40;
|
|
319
|
+
const perMs = options.per_ms ?? 1e3;
|
|
320
|
+
if (!Number.isFinite(maxRequests) || !Number.isInteger(maxRequests) || maxRequests < 1) throw new RangeError(`rate_limit.max_requests must be a finite integer >= 1 (got ${maxRequests})`);
|
|
321
|
+
if (!Number.isFinite(perMs) || !Number.isInteger(perMs) || perMs < 1) throw new RangeError(`rate_limit.per_ms must be a finite integer >= 1 (got ${perMs})`);
|
|
322
|
+
this.maxRequests = maxRequests;
|
|
323
|
+
this.windowMs = perMs;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Resolves when a request slot is available within the current window.
|
|
327
|
+
* Requests that cannot be dispatched immediately are queued in FIFO order.
|
|
328
|
+
*/
|
|
329
|
+
acquire() {
|
|
330
|
+
return new Promise((resolve) => {
|
|
331
|
+
this.queue.push(resolve);
|
|
332
|
+
if (!this.processing) this.process();
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
async process() {
|
|
336
|
+
this.processing = true;
|
|
337
|
+
while (this.queue.length > 0) {
|
|
338
|
+
const now = Date.now();
|
|
339
|
+
this.timestamps = this.timestamps.filter((t) => now - t < this.windowMs);
|
|
340
|
+
if (this.timestamps.length < this.maxRequests) {
|
|
341
|
+
this.timestamps.push(Date.now());
|
|
342
|
+
this.queue.shift()();
|
|
343
|
+
} else {
|
|
344
|
+
const oldest = this.timestamps[0];
|
|
345
|
+
const waitMs = this.windowMs - (Date.now() - oldest) + 1;
|
|
346
|
+
await new Promise((r) => setTimeout(r, waitMs));
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
this.processing = false;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
//#endregion
|
|
299
353
|
//#region src/client.ts
|
|
300
354
|
var ApiClient = class {
|
|
301
355
|
accessToken;
|
|
@@ -309,6 +363,7 @@ var ApiClient = class {
|
|
|
309
363
|
*/
|
|
310
364
|
inflightRequests = /* @__PURE__ */ new Map();
|
|
311
365
|
deduplication;
|
|
366
|
+
rateLimiter;
|
|
312
367
|
requestInterceptors;
|
|
313
368
|
onSuccessInterceptor;
|
|
314
369
|
onErrorInterceptor;
|
|
@@ -318,6 +373,7 @@ var ApiClient = class {
|
|
|
318
373
|
this.baseUrl = `https://api.themoviedb.org/${options.version ?? 3}`;
|
|
319
374
|
this.logger = TMDBLogger.from(options.logger);
|
|
320
375
|
this.deduplication = options.deduplication !== false;
|
|
376
|
+
if (options.rate_limit) this.rateLimiter = new RateLimiter(options.rate_limit === true ? {} : options.rate_limit);
|
|
321
377
|
const raw = options.interceptors?.request;
|
|
322
378
|
this.requestInterceptors = raw == null ? [] : Array.isArray(raw) ? raw : [raw];
|
|
323
379
|
this.onSuccessInterceptor = options.interceptors?.response?.onSuccess;
|
|
@@ -419,12 +475,16 @@ var ApiClient = class {
|
|
|
419
475
|
throw error;
|
|
420
476
|
}
|
|
421
477
|
/**
|
|
422
|
-
* Makes an authenticated mutation request
|
|
423
|
-
* Unlike `request()`, mutations are never deduplicated since they change server state.
|
|
478
|
+
* Makes an authenticated mutation request to the TMDB API.
|
|
479
|
+
* Unlike `request()`, mutations are **never deduplicated** since they change server state.
|
|
480
|
+
*
|
|
481
|
+
* Accepts `"GET"` in addition to the standard mutation verbs for the rare TMDB endpoints
|
|
482
|
+
* (e.g. `GET /4/list/{id}/clear`) that are specified as GET but carry side effects and
|
|
483
|
+
* must therefore not be collapsed by the deduplication layer.
|
|
424
484
|
*
|
|
425
485
|
* @param method - HTTP method to use
|
|
426
486
|
* @param endpoint - API path (e.g. "/account/123/favorite")
|
|
427
|
-
* @param body - JSON body to send (omit for DELETE requests without a body)
|
|
487
|
+
* @param body - JSON body to send (omit for DELETE/GET requests without a body)
|
|
428
488
|
* @param params - Optional query string parameters (e.g. session_id)
|
|
429
489
|
*/
|
|
430
490
|
async mutate(method, endpoint, body, params = {}) {
|
|
@@ -435,6 +495,7 @@ var ApiClient = class {
|
|
|
435
495
|
* Handles URL construction, auth, logging, error mapping, and null sanitisation.
|
|
436
496
|
*/
|
|
437
497
|
async execute(method, endpoint, params, body) {
|
|
498
|
+
const bodyJson = body !== void 0 ? JSON.stringify(body) : void 0;
|
|
438
499
|
const ctx = await this.runRequestInterceptors({
|
|
439
500
|
endpoint,
|
|
440
501
|
params,
|
|
@@ -452,6 +513,7 @@ var ApiClient = class {
|
|
|
452
513
|
method,
|
|
453
514
|
endpoint: effectiveEndpoint
|
|
454
515
|
});
|
|
516
|
+
if (this.rateLimiter) await this.rateLimiter.acquire();
|
|
455
517
|
let res;
|
|
456
518
|
try {
|
|
457
519
|
res = await fetch(url.toString(), {
|
|
@@ -460,7 +522,7 @@ var ApiClient = class {
|
|
|
460
522
|
Authorization: `Bearer ${this.accessToken}`,
|
|
461
523
|
"Content-Type": "application/json;charset=utf-8"
|
|
462
524
|
} : { "Content-Type": "application/json;charset=utf-8" },
|
|
463
|
-
...
|
|
525
|
+
...bodyJson !== void 0 ? { body: bodyJson } : {}
|
|
464
526
|
});
|
|
465
527
|
} catch (error) {
|
|
466
528
|
this.logger?.log({
|
|
@@ -661,7 +723,20 @@ const ENDPOINTS = {
|
|
|
661
723
|
PERSON: "/trending/person"
|
|
662
724
|
},
|
|
663
725
|
REVIEWS: { DETAILS: "/review" },
|
|
664
|
-
PEOPLE_LISTS: { POPULAR: "/person/popular" }
|
|
726
|
+
PEOPLE_LISTS: { POPULAR: "/person/popular" },
|
|
727
|
+
LISTS: {
|
|
728
|
+
DETAILS: "/list",
|
|
729
|
+
ADD_ITEM: "/add_item",
|
|
730
|
+
ITEM_STATUS: "/item_status",
|
|
731
|
+
CLEAR: "/clear",
|
|
732
|
+
REMOVE_ITEM: "/remove_item"
|
|
733
|
+
},
|
|
734
|
+
GUEST_SESSIONS: {
|
|
735
|
+
DETAILS: "/guest_session",
|
|
736
|
+
RATED_MOVIES: "/rated/movies",
|
|
737
|
+
RATED_TV: "/rated/tv",
|
|
738
|
+
RATED_TV_EPISODES: "/rated/tv/episodes"
|
|
739
|
+
}
|
|
665
740
|
};
|
|
666
741
|
/**
|
|
667
742
|
* TMDB API v4 endpoint fragments.
|
|
@@ -685,7 +760,8 @@ const ENDPOINTS_V4 = {
|
|
|
685
760
|
LISTS: {
|
|
686
761
|
DETAILS: "/list",
|
|
687
762
|
ITEMS: "/items",
|
|
688
|
-
ITEM_STATUS: "/item_status"
|
|
763
|
+
ITEM_STATUS: "/item_status",
|
|
764
|
+
CLEAR: "/clear"
|
|
689
765
|
}
|
|
690
766
|
};
|
|
691
767
|
//#endregion
|
|
@@ -710,6 +786,7 @@ var TMDBAPIBase = class {
|
|
|
710
786
|
this.client = new ApiClient(accessTokenOrClient, {
|
|
711
787
|
logger: defaultOptions.logger,
|
|
712
788
|
deduplication: defaultOptions.deduplication,
|
|
789
|
+
rate_limit: defaultOptions.rate_limit,
|
|
713
790
|
interceptors: defaultOptions.interceptors
|
|
714
791
|
});
|
|
715
792
|
} else if (accessTokenOrClient instanceof ApiClient) this.client = accessTokenOrClient;
|
|
@@ -2909,6 +2986,163 @@ var AuthenticationAPI = class extends TMDBAPIBase {
|
|
|
2909
2986
|
}
|
|
2910
2987
|
};
|
|
2911
2988
|
//#endregion
|
|
2989
|
+
//#region src/endpoints/guest_sessions.ts
|
|
2990
|
+
var GuestSessionsAPI = class extends TMDBAPIBase {
|
|
2991
|
+
guestSessionPath(guest_session_id) {
|
|
2992
|
+
return `${ENDPOINTS.GUEST_SESSIONS.DETAILS}/${guest_session_id}`;
|
|
2993
|
+
}
|
|
2994
|
+
guestSessionSubPath(guest_session_id, route) {
|
|
2995
|
+
return `${this.guestSessionPath(guest_session_id)}${route}`;
|
|
2996
|
+
}
|
|
2997
|
+
/**
|
|
2998
|
+
* Rated Movies
|
|
2999
|
+
* GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/movies
|
|
3000
|
+
*
|
|
3001
|
+
* Get the rated movies for a guest session.
|
|
3002
|
+
* @param params Guest session ID, optional language, page, and sort_by.
|
|
3003
|
+
* @reference https://developer.themoviedb.org/reference/guest-session-rated-movies
|
|
3004
|
+
*/
|
|
3005
|
+
async rated_movies(params) {
|
|
3006
|
+
const { guest_session_id, language = this.defaultOptions.language, ...rest } = params;
|
|
3007
|
+
return this.client.request(this.guestSessionSubPath(guest_session_id, ENDPOINTS.GUEST_SESSIONS.RATED_MOVIES), {
|
|
3008
|
+
language,
|
|
3009
|
+
...rest
|
|
3010
|
+
});
|
|
3011
|
+
}
|
|
3012
|
+
/**
|
|
3013
|
+
* Rated TV
|
|
3014
|
+
* GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/tv
|
|
3015
|
+
*
|
|
3016
|
+
* Get the rated TV shows for a guest session.
|
|
3017
|
+
* @param params Guest session ID, optional language, page, and sort_by.
|
|
3018
|
+
* @reference https://developer.themoviedb.org/reference/guest-session-rated-tv
|
|
3019
|
+
*/
|
|
3020
|
+
async rated_tv(params) {
|
|
3021
|
+
const { guest_session_id, language = this.defaultOptions.language, ...rest } = params;
|
|
3022
|
+
return this.client.request(this.guestSessionSubPath(guest_session_id, ENDPOINTS.GUEST_SESSIONS.RATED_TV), {
|
|
3023
|
+
language,
|
|
3024
|
+
...rest
|
|
3025
|
+
});
|
|
3026
|
+
}
|
|
3027
|
+
/**
|
|
3028
|
+
* Rated TV Episodes
|
|
3029
|
+
* GET - https://api.themoviedb.org/3/guest_session/{guest_session_id}/rated/tv/episodes
|
|
3030
|
+
*
|
|
3031
|
+
* Get the rated TV episodes for a guest session.
|
|
3032
|
+
* @param params Guest session ID, optional language, page, and sort_by.
|
|
3033
|
+
* @reference https://developer.themoviedb.org/reference/guest-session-rated-tv-episodes
|
|
3034
|
+
*/
|
|
3035
|
+
async rated_tv_episodes(params) {
|
|
3036
|
+
const { guest_session_id, language = this.defaultOptions.language, ...rest } = params;
|
|
3037
|
+
return this.client.request(this.guestSessionSubPath(guest_session_id, ENDPOINTS.GUEST_SESSIONS.RATED_TV_EPISODES), {
|
|
3038
|
+
language,
|
|
3039
|
+
...rest
|
|
3040
|
+
});
|
|
3041
|
+
}
|
|
3042
|
+
};
|
|
3043
|
+
//#endregion
|
|
3044
|
+
//#region src/endpoints/lists.ts
|
|
3045
|
+
var ListsAPI = class extends TMDBAPIBase {
|
|
3046
|
+
listPath(list_id) {
|
|
3047
|
+
return `${ENDPOINTS.LISTS.DETAILS}/${list_id}`;
|
|
3048
|
+
}
|
|
3049
|
+
listSubPath(list_id, route) {
|
|
3050
|
+
return `${this.listPath(list_id)}${route}`;
|
|
3051
|
+
}
|
|
3052
|
+
/**
|
|
3053
|
+
* Details
|
|
3054
|
+
* GET - https://api.themoviedb.org/3/list/{list_id}
|
|
3055
|
+
*
|
|
3056
|
+
* Get the details of a list.
|
|
3057
|
+
* @param params List ID and optional language and page.
|
|
3058
|
+
* @reference https://developer.themoviedb.org/reference/list-details
|
|
3059
|
+
*/
|
|
3060
|
+
async details(params) {
|
|
3061
|
+
const { list_id, language = this.defaultOptions.language, ...rest } = params;
|
|
3062
|
+
return this.client.request(this.listPath(list_id), {
|
|
3063
|
+
language,
|
|
3064
|
+
...rest
|
|
3065
|
+
});
|
|
3066
|
+
}
|
|
3067
|
+
/**
|
|
3068
|
+
* Create
|
|
3069
|
+
* POST - https://api.themoviedb.org/3/list
|
|
3070
|
+
*
|
|
3071
|
+
* Create a new list.
|
|
3072
|
+
* @param params session_id query param (required).
|
|
3073
|
+
* @param body name, description, and language for the new list.
|
|
3074
|
+
* @reference https://developer.themoviedb.org/reference/list-create
|
|
3075
|
+
*/
|
|
3076
|
+
async create(params, body) {
|
|
3077
|
+
return this.client.mutate("POST", ENDPOINTS.LISTS.DETAILS, body, params);
|
|
3078
|
+
}
|
|
3079
|
+
/**
|
|
3080
|
+
* Delete
|
|
3081
|
+
* DELETE - https://api.themoviedb.org/3/list/{list_id}
|
|
3082
|
+
*
|
|
3083
|
+
* Delete a list.
|
|
3084
|
+
* @param params List ID and session_id (required).
|
|
3085
|
+
* @reference https://developer.themoviedb.org/reference/list-delete
|
|
3086
|
+
*/
|
|
3087
|
+
async delete(params) {
|
|
3088
|
+
const { list_id, ...queryParams } = params;
|
|
3089
|
+
return this.client.mutate("DELETE", this.listPath(list_id), void 0, queryParams);
|
|
3090
|
+
}
|
|
3091
|
+
/**
|
|
3092
|
+
* Add Movie
|
|
3093
|
+
* POST - https://api.themoviedb.org/3/list/{list_id}/add_item
|
|
3094
|
+
*
|
|
3095
|
+
* Add a movie to a list.
|
|
3096
|
+
* @param params List ID and session_id (required).
|
|
3097
|
+
* @param body media_id of the movie to add.
|
|
3098
|
+
* @reference https://developer.themoviedb.org/reference/list-add-movie
|
|
3099
|
+
*/
|
|
3100
|
+
async add_movie(params, body) {
|
|
3101
|
+
const { list_id, ...queryParams } = params;
|
|
3102
|
+
return this.client.mutate("POST", this.listSubPath(list_id, ENDPOINTS.LISTS.ADD_ITEM), body, queryParams);
|
|
3103
|
+
}
|
|
3104
|
+
/**
|
|
3105
|
+
* Remove Movie
|
|
3106
|
+
* POST - https://api.themoviedb.org/3/list/{list_id}/remove_item
|
|
3107
|
+
*
|
|
3108
|
+
* Remove a movie from a list.
|
|
3109
|
+
* @param params List ID and session_id (required).
|
|
3110
|
+
* @param body media_id of the movie to remove.
|
|
3111
|
+
* @reference https://developer.themoviedb.org/reference/list-remove-movie
|
|
3112
|
+
*/
|
|
3113
|
+
async remove_movie(params, body) {
|
|
3114
|
+
const { list_id, ...queryParams } = params;
|
|
3115
|
+
return this.client.mutate("POST", this.listSubPath(list_id, ENDPOINTS.LISTS.REMOVE_ITEM), body, queryParams);
|
|
3116
|
+
}
|
|
3117
|
+
/**
|
|
3118
|
+
* Check Item Status
|
|
3119
|
+
* GET - https://api.themoviedb.org/3/list/{list_id}/item_status
|
|
3120
|
+
*
|
|
3121
|
+
* Check if a movie has already been added to a list.
|
|
3122
|
+
* @param params List ID and optional movie_id and language.
|
|
3123
|
+
* @reference https://developer.themoviedb.org/reference/list-check-item-status
|
|
3124
|
+
*/
|
|
3125
|
+
async check_item_status(params) {
|
|
3126
|
+
const { list_id, language = this.defaultOptions.language, ...rest } = params;
|
|
3127
|
+
return this.client.request(this.listSubPath(list_id, ENDPOINTS.LISTS.ITEM_STATUS), {
|
|
3128
|
+
language,
|
|
3129
|
+
...rest
|
|
3130
|
+
});
|
|
3131
|
+
}
|
|
3132
|
+
/**
|
|
3133
|
+
* Clear
|
|
3134
|
+
* POST - https://api.themoviedb.org/3/list/{list_id}/clear
|
|
3135
|
+
*
|
|
3136
|
+
* Clear all items from a list. Pass `confirm: true` to confirm the operation.
|
|
3137
|
+
* @param params List ID, session_id, and confirm flag (required).
|
|
3138
|
+
* @reference https://developer.themoviedb.org/reference/list-clear
|
|
3139
|
+
*/
|
|
3140
|
+
async clear(params) {
|
|
3141
|
+
const { list_id, ...queryParams } = params;
|
|
3142
|
+
return this.client.mutate("POST", this.listSubPath(list_id, ENDPOINTS.LISTS.CLEAR), void 0, queryParams);
|
|
3143
|
+
}
|
|
3144
|
+
};
|
|
3145
|
+
//#endregion
|
|
2912
3146
|
//#region src/endpoints/v4/auth.ts
|
|
2913
3147
|
var V4AuthAPI = class extends TMDBAPIBase {
|
|
2914
3148
|
/**
|
|
@@ -2956,7 +3190,114 @@ var V4AuthAPI = class extends TMDBAPIBase {
|
|
|
2956
3190
|
var V4AccountAPI = class extends TMDBAPIBase {};
|
|
2957
3191
|
//#endregion
|
|
2958
3192
|
//#region src/endpoints/v4/lists.ts
|
|
2959
|
-
var V4ListsAPI = class extends TMDBAPIBase {
|
|
3193
|
+
var V4ListsAPI = class extends TMDBAPIBase {
|
|
3194
|
+
listPath(list_id) {
|
|
3195
|
+
return `${ENDPOINTS_V4.LISTS.DETAILS}/${list_id}`;
|
|
3196
|
+
}
|
|
3197
|
+
/**
|
|
3198
|
+
* Create List
|
|
3199
|
+
* POST - https://api.themoviedb.org/4/list
|
|
3200
|
+
*
|
|
3201
|
+
* Create a new v4 list. The authenticated user becomes the owner.
|
|
3202
|
+
* @param body List name and ISO 639-1 language code are required.
|
|
3203
|
+
* @reference https://developer.themoviedb.org/reference/list-create
|
|
3204
|
+
*/
|
|
3205
|
+
async create(body) {
|
|
3206
|
+
return this.client.mutate("POST", ENDPOINTS_V4.LISTS.DETAILS, body);
|
|
3207
|
+
}
|
|
3208
|
+
/**
|
|
3209
|
+
* List Details
|
|
3210
|
+
* GET - https://api.themoviedb.org/4/list/{list_id}
|
|
3211
|
+
*
|
|
3212
|
+
* Retrieve the details and paginated items of a specific list.
|
|
3213
|
+
* @param params `list_id` is required. Optionally pass `language` and `page`.
|
|
3214
|
+
* @reference https://developer.themoviedb.org/reference/list-details
|
|
3215
|
+
*/
|
|
3216
|
+
async details({ list_id, ...params }) {
|
|
3217
|
+
return this.client.request(this.listPath(list_id), this.withLanguage(params));
|
|
3218
|
+
}
|
|
3219
|
+
/**
|
|
3220
|
+
* Update List
|
|
3221
|
+
* PUT - https://api.themoviedb.org/4/list/{list_id}
|
|
3222
|
+
*
|
|
3223
|
+
* Update the metadata (name, description, visibility, sort order) of an existing list.
|
|
3224
|
+
* @param body `list_id` plus any fields to change.
|
|
3225
|
+
* @reference https://developer.themoviedb.org/reference/list-update
|
|
3226
|
+
*/
|
|
3227
|
+
async update({ list_id, ...body }) {
|
|
3228
|
+
return this.client.mutate("PUT", this.listPath(list_id), body);
|
|
3229
|
+
}
|
|
3230
|
+
/**
|
|
3231
|
+
* Delete List
|
|
3232
|
+
* DELETE - https://api.themoviedb.org/4/list/{list_id}
|
|
3233
|
+
*
|
|
3234
|
+
* Permanently delete a list. This action cannot be undone.
|
|
3235
|
+
* @param params.list_id The TMDB list ID to delete.
|
|
3236
|
+
* @reference https://developer.themoviedb.org/reference/list-delete
|
|
3237
|
+
*/
|
|
3238
|
+
async delete({ list_id }) {
|
|
3239
|
+
return this.client.mutate("DELETE", this.listPath(list_id), {});
|
|
3240
|
+
}
|
|
3241
|
+
/**
|
|
3242
|
+
* Add Items
|
|
3243
|
+
* POST - https://api.themoviedb.org/4/list/{list_id}/items
|
|
3244
|
+
*
|
|
3245
|
+
* Add one or more movies or TV shows to a list. For each item the response
|
|
3246
|
+
* includes whether it was added successfully.
|
|
3247
|
+
* @param list_id The TMDB list ID.
|
|
3248
|
+
* @param body Array of `{ media_type, media_id }` objects to add.
|
|
3249
|
+
* @reference https://developer.themoviedb.org/reference/list-add-items
|
|
3250
|
+
*/
|
|
3251
|
+
async add_items(list_id, body) {
|
|
3252
|
+
return this.client.mutate("POST", `${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.ITEMS}`, body);
|
|
3253
|
+
}
|
|
3254
|
+
/**
|
|
3255
|
+
* Update Items
|
|
3256
|
+
* PUT - https://api.themoviedb.org/4/list/{list_id}/items
|
|
3257
|
+
*
|
|
3258
|
+
* Update per-item comments for items already in the list.
|
|
3259
|
+
* @param list_id The TMDB list ID.
|
|
3260
|
+
* @param body Array of `{ media_type, media_id, comment }` objects.
|
|
3261
|
+
* @reference https://developer.themoviedb.org/reference/list-update-items
|
|
3262
|
+
*/
|
|
3263
|
+
async update_items(list_id, body) {
|
|
3264
|
+
return this.client.mutate("PUT", `${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.ITEMS}`, body);
|
|
3265
|
+
}
|
|
3266
|
+
/**
|
|
3267
|
+
* Remove Items
|
|
3268
|
+
* DELETE - https://api.themoviedb.org/4/list/{list_id}/items
|
|
3269
|
+
*
|
|
3270
|
+
* Remove one or more items from the list.
|
|
3271
|
+
* @param list_id The TMDB list ID.
|
|
3272
|
+
* @param body Array of `{ media_type, media_id }` objects to remove.
|
|
3273
|
+
* @reference https://developer.themoviedb.org/reference/list-remove-items
|
|
3274
|
+
*/
|
|
3275
|
+
async remove_items(list_id, body) {
|
|
3276
|
+
return this.client.mutate("DELETE", `${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.ITEMS}`, body);
|
|
3277
|
+
}
|
|
3278
|
+
/**
|
|
3279
|
+
* Check Item Status
|
|
3280
|
+
* GET - https://api.themoviedb.org/4/list/{list_id}/item_status
|
|
3281
|
+
*
|
|
3282
|
+
* Check whether a specific movie or TV show is already present in the list.
|
|
3283
|
+
* @param params `list_id`, `media_type`, and `media_id` are all required.
|
|
3284
|
+
* @reference https://developer.themoviedb.org/reference/list-item-status
|
|
3285
|
+
*/
|
|
3286
|
+
async item_status({ list_id, ...params }) {
|
|
3287
|
+
return this.client.request(`${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.ITEM_STATUS}`, params);
|
|
3288
|
+
}
|
|
3289
|
+
/**
|
|
3290
|
+
* Clear List
|
|
3291
|
+
* GET - https://api.themoviedb.org/4/list/{list_id}/clear
|
|
3292
|
+
*
|
|
3293
|
+
* Remove all items from the list without deleting the list itself.
|
|
3294
|
+
* @param list_id The TMDB list ID to clear.
|
|
3295
|
+
* @reference https://developer.themoviedb.org/reference/list-clear
|
|
3296
|
+
*/
|
|
3297
|
+
async clear(list_id) {
|
|
3298
|
+
return this.client.mutate("GET", `${this.listPath(list_id)}${ENDPOINTS_V4.LISTS.CLEAR}`);
|
|
3299
|
+
}
|
|
3300
|
+
};
|
|
2960
3301
|
//#endregion
|
|
2961
3302
|
//#region src/tmdb.v4.ts
|
|
2962
3303
|
/**
|
|
@@ -2998,6 +3339,7 @@ var TMDBv4 = class {
|
|
|
2998
3339
|
logger: options.logger,
|
|
2999
3340
|
deduplication: options.deduplication,
|
|
3000
3341
|
images: options.images,
|
|
3342
|
+
rate_limit: options.rate_limit,
|
|
3001
3343
|
interceptors: options.interceptors
|
|
3002
3344
|
});
|
|
3003
3345
|
this.auth = new V4AuthAPI(this.client, options);
|
|
@@ -3038,6 +3380,8 @@ var TMDB = class {
|
|
|
3038
3380
|
people;
|
|
3039
3381
|
account;
|
|
3040
3382
|
authentication;
|
|
3383
|
+
guest_sessions;
|
|
3384
|
+
lists;
|
|
3041
3385
|
/**
|
|
3042
3386
|
* TMDB API v4 namespaces. Access via `tmdb.v4.auth`, `tmdb.v4.account`, `tmdb.v4.lists`.
|
|
3043
3387
|
* Requires a Bearer (JWT) access token — throws if the instance was created with an API key.
|
|
@@ -3061,6 +3405,7 @@ var TMDB = class {
|
|
|
3061
3405
|
logger: options.logger,
|
|
3062
3406
|
deduplication: options.deduplication,
|
|
3063
3407
|
images: options.images,
|
|
3408
|
+
rate_limit: options.rate_limit,
|
|
3064
3409
|
interceptors: options.interceptors
|
|
3065
3410
|
});
|
|
3066
3411
|
this.movies = new MoviesAPI(this.client, this.options);
|
|
@@ -3090,6 +3435,8 @@ var TMDB = class {
|
|
|
3090
3435
|
this.people = new PeopleAPI(this.client, this.options);
|
|
3091
3436
|
this.account = new AccountAPI(this.client, this.options);
|
|
3092
3437
|
this.authentication = new AuthenticationAPI(this.client, this.options);
|
|
3438
|
+
this.guest_sessions = new GuestSessionsAPI(this.client, this.options);
|
|
3439
|
+
this.lists = new ListsAPI(this.client, this.options);
|
|
3093
3440
|
}
|
|
3094
3441
|
};
|
|
3095
3442
|
//#endregion
|
|
@@ -4408,4 +4755,4 @@ let TVEpisodeGroupType = /* @__PURE__ */ function(TVEpisodeGroupType) {
|
|
|
4408
4755
|
return TVEpisodeGroupType;
|
|
4409
4756
|
}({});
|
|
4410
4757
|
//#endregion
|
|
4411
|
-
export { AccountAPI, AuthenticationAPI, BACKDROP_SIZES, CertificationsAPI, ChangesAPI, CollectionsAPI, CompaniesAPI, ConfigurationAPI, CreditsAPI, DiscoverAPI, DiscoverTVStatus, DiscoverTVType, FindAPI, GenresAPI, IMAGE_BASE_URL, IMAGE_SECURE_BASE_URL, KeywordsAPI, LOGO_SIZES, MovieListsAPI, MoviesAPI, NetworksAPI, POSTER_SIZES, PROFILE_SIZES, PeopleAPI, PeopleListsAPI, ReviewsAPI, STILL_SIZES, SearchAPI, TMDB, TMDBCountries, TMDBError, TMDBLogger, TMDBv4, TVEpisodeGroupType, TVEpisodeGroupsAPI, TVEpisodesAPI, TVSeasonsAPI, TVSeriesAPI, TVSeriesListsAPI, TrendingAPI, V4AccountAPI, V4AuthAPI, V4ListsAPI, WatchProvidersAPI, hasBackdropPath, hasLogoPath, hasPosterPath, hasProfilePath, hasStillPath, isJwt, isKnownForMovie, isKnownForTV, isPlainObject, isRecord };
|
|
4758
|
+
export { AccountAPI, AuthenticationAPI, BACKDROP_SIZES, CertificationsAPI, ChangesAPI, CollectionsAPI, CompaniesAPI, ConfigurationAPI, CreditsAPI, DiscoverAPI, DiscoverTVStatus, DiscoverTVType, FindAPI, GenresAPI, GuestSessionsAPI, IMAGE_BASE_URL, IMAGE_SECURE_BASE_URL, KeywordsAPI, LOGO_SIZES, ListsAPI, MovieListsAPI, MoviesAPI, NetworksAPI, POSTER_SIZES, PROFILE_SIZES, PeopleAPI, PeopleListsAPI, ReviewsAPI, STILL_SIZES, SearchAPI, TMDB, TMDBCountries, TMDBError, TMDBLogger, TMDBv4, TVEpisodeGroupType, TVEpisodeGroupsAPI, TVEpisodesAPI, TVSeasonsAPI, TVSeriesAPI, TVSeriesListsAPI, TrendingAPI, V4AccountAPI, V4AuthAPI, V4ListsAPI, WatchProvidersAPI, hasBackdropPath, hasLogoPath, hasPosterPath, hasProfilePath, hasStillPath, isJwt, isKnownForMovie, isKnownForTV, isPlainObject, isRecord };
|