@lorenzopant/tmdb 1.20.0 → 1.20.2

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 CHANGED
@@ -20,122 +20,260 @@ npm install @lorenzopant/tmdb
20
20
  // or
21
21
  pnpm add @lorenzopant/tmdb
22
22
  // or
23
- yard add @lorenzopant/tmdb
23
+ yarn add @lorenzopant/tmdb
24
24
  ```
25
25
 
26
26
  ---
27
27
 
28
- ## Usage
28
+ ## Quick Start
29
29
 
30
30
  ```typescript
31
- import { TMDB } from "@lorenzopant/tmdb";
32
-
33
- const tmdb = new TMDB("your_access_token");
34
-
35
- async function searchMovies() {
36
- try {
37
- const movies = await tmdb.search.movies({ query: "Fight Club" });
38
- console.log(movies);
39
- } catch (error) {
40
- if (error instanceof TMDBError) {
41
- console.error("TMDB Error:", error.message);
42
- console.error("HTTP Status:", error.http_status_code);
43
- console.error("TMDB Status Code:", error.tmdb_status_code);
44
- } else {
45
- console.error("Unknown error:", error);
46
- }
47
- }
48
- }
31
+ import { TMDB, TMDBError } from "@lorenzopant/tmdb";
32
+
33
+ const tmdb = new TMDB(process.env.TMDB_ACCESS_TOKEN!);
49
34
 
50
- searchMovies();
35
+ const movie = await tmdb.movies.details({ movie_id: 550 });
36
+ console.log(movie.title); // "Fight Club"
51
37
  ```
52
38
 
53
39
  ---
54
40
 
55
- ## API
41
+ ## Namespaces
42
+
43
+ Every namespace maps directly to a TMDB API section. All methods are fully typed.
44
+
45
+ | Namespace | Description |
46
+ | ------------------------ | ----------------------------------------------------------------- |
47
+ | `tmdb.movies` | Movie details, credits, images, videos, recommendations, and more |
48
+ | `tmdb.movie_lists` | Now Playing, Popular, Top Rated, Upcoming |
49
+ | `tmdb.tv_series` | TV series details, credits, seasons, episode groups |
50
+ | `tmdb.tv_lists` | Airing Today, On The Air, Popular, Top Rated TV |
51
+ | `tmdb.tv_seasons` | Season details, credits, images |
52
+ | `tmdb.tv_episodes` | Episode details, credits, images |
53
+ | `tmdb.tv_episode_groups` | Episode group details |
54
+ | `tmdb.search` | Search movies, TV shows, people, collections, keywords |
55
+ | `tmdb.discover` | Discover movies and TV shows by filter |
56
+ | `tmdb.trending` | Trending movies, TV, and people |
57
+ | `tmdb.people` | Person details, credits, images, translations |
58
+ | `tmdb.people_lists` | Popular people |
59
+ | `tmdb.collections` | Collection details and images |
60
+ | `tmdb.companies` | Company details, alternative names, images |
61
+ | `tmdb.credits` | Credit details |
62
+ | `tmdb.genres` | Movie and TV genre lists |
63
+ | `tmdb.keywords` | Keyword details and associated movies |
64
+ | `tmdb.certifications` | Movie and TV certifications per region |
65
+ | `tmdb.changes` | Recent content changes |
66
+ | `tmdb.configuration` | TMDB configuration, countries, languages, timezones |
67
+ | `tmdb.find` | Find resources by external ID (IMDb, TVDB, etc.) |
68
+ | `tmdb.networks` | TV network details |
69
+ | `tmdb.watch_providers` | Watch providers by region |
70
+ | `tmdb.lists` | User-created list management |
71
+ | `tmdb.account` | Account details and user lists |
72
+ | `tmdb.authentication` | Token-based authentication flows |
73
+ | `tmdb.guest_sessions` | Guest session rated movies/TV/episodes |
74
+ | `tmdb.reviews` | Review details |
75
+ | `tmdb.images` | Image URL builder (see below) |
76
+ | `tmdb.v4` | TMDB API v4 (auth, account, lists — requires JWT) |
56
77
 
57
- ### `TMDB`
78
+ ---
58
79
 
59
- The main client class. **Each API method supports all the parameters supported by TMDB API**, for example the search method supports: query, language, region, year, primary_release_year and so on...
80
+ ## Constructor Options
60
81
 
61
- #### Constructor
82
+ ```typescript
83
+ const tmdb = new TMDB(accessToken, {
84
+ language: "en-US", // ISO 639-1: default language for all requests
85
+ region: "US", // ISO 3166-1: default region for all requests
86
+ timezone: "America/New_York", // default timezone for TV airing queries
87
+ logger: true, // enable built-in request/response logging
88
+ deduplication: true, // deduplicate concurrent identical requests (default: true)
89
+ rate_limit: true, // auto-queue requests to stay within TMDB rate limits
90
+ cache: true, // enable in-memory TTL-based response caching
91
+ images: {
92
+ secure_images_url: true,
93
+ default_image_sizes: { posters: "w500", backdrops: "w780" },
94
+ },
95
+ });
96
+ ```
97
+
98
+ ### `logger`
62
99
 
63
100
  ```typescript
64
- const tmdb = new TMDB(accessToken: string, options?: TMDBOptions);
101
+ // Built-in console logger
102
+ const tmdb = new TMDB(token, { logger: true });
103
+
104
+ // Custom logger function
105
+ const tmdb = new TMDB(token, {
106
+ logger: (entry) => {
107
+ if (entry.type === "response") {
108
+ console.log(`[TMDB] ${entry.endpoint} → ${entry.status} (${entry.durationMs}ms)`);
109
+ }
110
+ },
111
+ });
65
112
  ```
66
113
 
67
- - `accessToken`: **required**. Your TMDB API v4 access token.
68
- - `options.logger`: Enable debug logging for all network requests.
114
+ ### `rate_limit`
69
115
 
70
- Example:
116
+ Automatically queues requests to stay within TMDB's API limits (~40 req/s). Useful for bulk scripts.
71
117
 
72
118
  ```typescript
73
- const tmdb = new TMDB("your_access_token", { logger: true });
119
+ // Default limits
120
+ const tmdb = new TMDB(token, { rate_limit: true });
121
+
122
+ // Custom budget
123
+ const tmdb = new TMDB(token, { rate_limit: { max_requests: 30, per_ms: 1_000 } });
74
124
  ```
75
125
 
76
- Custom logger:
126
+ ### `cache`
127
+
128
+ In-memory TTL-based caching for GET requests. Entries expire lazily on access.
77
129
 
78
130
  ```typescript
79
- const tmdb = new TMDB("your_access_token", {
80
- logger: (entry) => {
81
- if (entry.type === "response") {
82
- console.log("TMDB:", entry.endpoint, entry.status, entry.durationMs);
83
- }
131
+ // 5-minute TTL, no size limit (defaults)
132
+ const tmdb = new TMDB(token, { cache: true });
133
+
134
+ // Custom TTL and bounded size
135
+ const tmdb = new TMDB(token, {
136
+ cache: {
137
+ ttl: 60_000, // 60 seconds
138
+ max_size: 500, // evict oldest entry when limit is reached
139
+ excluded_endpoints: ["/trending", /\/discover\//],
140
+ },
141
+ });
142
+
143
+ // Runtime cache controls
144
+ tmdb.cache?.invalidate("/movie/now_playing"); // remove one entry
145
+ tmdb.cache?.clear(); // remove all entries
146
+ console.log(tmdb.cache?.size); // number of cached entries
147
+ ```
148
+
149
+ ### `interceptors`
150
+
151
+ Hook into every request or response globally.
152
+
153
+ ```typescript
154
+ const tmdb = new TMDB(token, {
155
+ interceptors: {
156
+ request: (ctx) => {
157
+ // Inject a param into every request
158
+ return { ...ctx, params: { ...ctx.params, include_adult: false } };
159
+ },
160
+ response: {
161
+ onSuccess: (data) => {
162
+ myAnalytics.track("tmdb_response", data);
163
+ },
164
+ onError: (error) => {
165
+ Sentry.captureException(error);
166
+ },
167
+ },
84
168
  },
85
169
  });
86
170
  ```
87
171
 
88
172
  ---
89
173
 
90
- ### `Search`
174
+ ## Examples
91
175
 
92
- Search for movies:
176
+ ### Movie details
93
177
 
94
178
  ```typescript
95
- tmdb.search.movies({ query: "Fight Club" });
179
+ const movie = await tmdb.movies.details({ movie_id: 550 });
180
+ console.log(movie.title); // "Fight Club"
181
+ console.log(movie.release_date); // "1999-10-15"
96
182
  ```
97
183
 
98
- Returns a **typed response** containing movies.
184
+ ### `append_to_response` typed overloads
99
185
 
100
- ---
186
+ Fetch related data in a single request. The return type is automatically extended with the appended fields.
187
+
188
+ ```typescript
189
+ const movie = await tmdb.movies.details({
190
+ movie_id: 550,
191
+ append_to_response: ["credits", "videos"],
192
+ });
101
193
 
102
- ### `Movie Lists`
194
+ // TypeScript knows these are present:
195
+ console.log(movie.credits.cast[0].name);
196
+ console.log(movie.videos.results[0].key);
197
+ ```
103
198
 
104
- Now Playing, Popular, Top Rated and Upcoming movies:
199
+ ### Search
105
200
 
106
201
  ```typescript
107
- tmdb.movie_lists.now_playing();
108
- tmdb.movie_lists.top_rated();
109
- tmdb.movie_lists.popular();
110
- tmdb.movie_lists.upcoming();
202
+ const results = await tmdb.search.movies({ query: "Inception", language: "en-US" });
203
+ console.log(results.results[0].title); // "Inception"
111
204
  ```
112
205
 
113
- Returns a **typed response** containing movies.
206
+ ### TV series
114
207
 
115
- ---
208
+ ```typescript
209
+ const show = await tmdb.tv_series.details({ series_id: 1396 });
210
+ console.log(show.name); // "Breaking Bad"
116
211
 
117
- ### `Movie`
212
+ const season = await tmdb.tv_seasons.details({ series_id: 1396, season_number: 1 });
213
+ console.log(season.episodes.length);
214
+ ```
118
215
 
119
- Details, alternative titles, changes, credits, external IDs and more:
216
+ ### Discover
120
217
 
121
218
  ```typescript
122
- tmdb.movie.details({ movie_id: 550 });
123
- tmdb.movie.alternative_titles({ movie_id: 550 });
124
- tmdb.movie.changes({ movie_id: 550 });
125
- tmdb.movie.credits({ movie_id: 550 });
126
- tmdb.movie.external_ids({ movie_id: 550 });
219
+ const action = await tmdb.discover.movies({
220
+ with_genres: "28",
221
+ sort_by: "vote_average.desc",
222
+ "vote_count.gte": 1000,
223
+ });
224
+ ```
127
225
 
128
- ...and more
226
+ ### Trending
227
+
228
+ ```typescript
229
+ const trending = await tmdb.trending.movies({ time_window: "week" });
129
230
  ```
130
231
 
131
- Returns a **typed response** containing movies.
232
+ ### Image URLs
233
+
234
+ ```typescript
235
+ const movie = await tmdb.movies.details({ movie_id: 550 });
236
+
237
+ // Build a full URL from a path
238
+ const posterUrl = tmdb.images.poster(movie.poster_path!, "w500");
239
+ const backdropUrl = tmdb.images.backdrop(movie.backdrop_path!, "w1280");
240
+
241
+ // Or enable auto-enrichment so all image paths in every response are resolved automatically
242
+ const tmdb = new TMDB(token, {
243
+ images: { autocomplete_images: true, secure_images_url: true },
244
+ });
245
+ ```
246
+
247
+ ### Error handling
248
+
249
+ ```typescript
250
+ import { TMDB, TMDBError } from "@lorenzopant/tmdb";
251
+
252
+ try {
253
+ const movie = await tmdb.movies.details({ movie_id: 0 });
254
+ } catch (error) {
255
+ if (error instanceof TMDBError) {
256
+ console.error(error.message); // human-readable message
257
+ console.error(error.http_status_code); // e.g. 404
258
+ console.error(error.tmdb_status_code); // TMDB-specific status code
259
+ }
260
+ }
261
+ ```
262
+
263
+ ### TMDB API v4 (requires JWT access token)
264
+
265
+ ```typescript
266
+ const tmdb = new TMDB(jwtAccessToken);
267
+
268
+ const lists = await tmdb.v4.lists.list({ account_id: "me" });
269
+ ```
132
270
 
133
271
  ---
134
272
 
135
273
  ## Requirements
136
274
 
137
- - Node.js 18+ recommended
138
- - Works on frontend (React, Vue) but **don't expose sensitive access tokens** to users!
275
+ - Node.js 18+
276
+ - Works in frontend frameworks (React, Vue, Next.js) **never expose your access token to the browser in production**
139
277
 
140
278
  ---
141
279
 
package/dist/index.d.mts CHANGED
@@ -466,6 +466,24 @@ type DefaultImageSizesConfig = {
466
466
  profiles?: ProfileSize;
467
467
  still?: StillSize;
468
468
  };
469
+ /**
470
+ * Per-collection language priority order used by `autocomplete_paths`.
471
+ *
472
+ * When set, image items in the matching collection array are reordered so that
473
+ * images whose `iso_639_1` matches earlier priority entries appear first.
474
+ * No items are ever dropped — only their order is affected.
475
+ *
476
+ * Special values:
477
+ * - `"null"` — matches untagged images (where `iso_639_1` is `null` or absent)
478
+ * - `"*"` — catch-all: consumes all remaining items at that position
479
+ *
480
+ * Items not matched by any entry are appended at the end.
481
+ *
482
+ * @example
483
+ * // Prefer textless posters → English → any fallback
484
+ * { posters: ["null", "en", "*"] }
485
+ */
486
+ type ImageLanguagePriorityConfig = Partial<Record<"backdrops" | "logos" | "posters" | "profiles" | "stills", string[]>>;
469
487
  type ImagesConfig = {
470
488
  /**
471
489
  * Whether to use the secure (HTTPS) image base URL.
@@ -485,6 +503,45 @@ type ImagesConfig = {
485
503
  * where fields like `poster_path` contain the original relative TMDB path.
486
504
  */
487
505
  autocomplete_paths?: boolean;
506
+ /**
507
+ * Controls the order of image items inside collection arrays (e.g. `posters`, `backdrops`)
508
+ * when `autocomplete_paths` is enabled.
509
+ *
510
+ * Use `"null"` to match untagged images, ISO-639-1 codes (e.g. `"en"`) to match
511
+ * language-specific images, and `"*"` as a catch-all fallback.
512
+ *
513
+ * Items not matched by any entry are appended at the end. No items are dropped.
514
+ *
515
+ * @example
516
+ * image_language_priority: {
517
+ * posters: ["null", "en", "*"],
518
+ * }
519
+ */
520
+ image_language_priority?: ImageLanguagePriorityConfig;
521
+ /**
522
+ * When `true`, automatically derives `include_image_language` from the language
523
+ * codes declared in `image_language_priority` and injects it into every `.images()`
524
+ * request — so TMDB returns the language variants that the priority config expects
525
+ * to sort.
526
+ *
527
+ * The injected value is the union of all language codes across all configured
528
+ * collections, with `"*"` excluded (it has no meaning as an HTTP parameter).
529
+ * An explicit `include_image_language` on the call site always takes precedence.
530
+ *
531
+ * Requires `image_language_priority` to be set; has no effect without it.
532
+ *
533
+ * @default false
534
+ *
535
+ * @example
536
+ * // Config: automatically fetch Italian + textless posters on every images() call
537
+ * images: {
538
+ * autocomplete_paths: true,
539
+ * image_language_priority: { posters: ["it", "null", "*"] },
540
+ * auto_include_image_language: true,
541
+ * }
542
+ * // Equivalent to always passing: include_image_language: ["it", "null"]
543
+ */
544
+ auto_include_image_language?: boolean;
488
545
  };
489
546
  //#endregion
490
547
  //#region src/errors/tmdb.d.ts
@@ -522,6 +579,43 @@ declare class TMDBError extends Error {
522
579
  constructor(message: string, http_status: number, tmdb_status_code?: number);
523
580
  }
524
581
  //#endregion
582
+ //#region src/utils/cache.d.ts
583
+ type CacheOptions = {
584
+ /**
585
+ * How long (in milliseconds) each cached entry remains valid.
586
+ * @default 300_000 (5 minutes)
587
+ */
588
+ ttl?: number;
589
+ /**
590
+ * Maximum number of entries to hold in memory.
591
+ * When the store is full the oldest entry is evicted before a new one is inserted.
592
+ * Defaults to unlimited.
593
+ */
594
+ max_size?: number;
595
+ /**
596
+ * Endpoints that should never be cached.
597
+ *
598
+ * Each pattern is matched against the full cache key (`endpoint?param=value&…`).
599
+ * - A `string` is matched with `key.startsWith(pattern)`.
600
+ * - A `RegExp` is tested with `pattern.test(key)`.
601
+ *
602
+ * `RegExp` patterns with the global (`g`) or sticky (`y`) flag are automatically
603
+ * normalized by stripping those flags. Stateful `lastIndex` mutations would otherwise
604
+ * cause flaky cache behaviour across repeated calls.
605
+ *
606
+ * @example
607
+ * ```ts
608
+ * // Never cache trending or any discover endpoint
609
+ * const tmdb = new TMDB(token, {
610
+ * cache: {
611
+ * excluded_endpoints: ["/trending", /\/discover\//],
612
+ * },
613
+ * });
614
+ * ```
615
+ */
616
+ excluded_endpoints?: (string | RegExp)[];
617
+ };
618
+ //#endregion
525
619
  //#region src/utils/logger.d.ts
526
620
  type TMDBLoggerEntry = {
527
621
  type: "request" | "response" | "error";
@@ -1474,6 +1568,28 @@ type TMDBOptions = {
1474
1568
  * ```
1475
1569
  */
1476
1570
  rate_limit?: boolean | RateLimitOptions;
1571
+ /**
1572
+ * Enables in-memory TTL-based caching for GET requests.
1573
+ *
1574
+ * - `true` — uses the default TTL of 5 minutes with no size limit.
1575
+ * - Pass a {@link CacheOptions} object to customize `ttl` and/or `max_size`.
1576
+ *
1577
+ * Cached responses are served immediately without hitting the network.
1578
+ * Entries expire lazily on access once the TTL has elapsed.
1579
+ * Only `GET` requests are cached; mutations are never cached.
1580
+ *
1581
+ * @default false (disabled)
1582
+ *
1583
+ * @example
1584
+ * ```ts
1585
+ * // Enable with defaults (5-minute TTL)
1586
+ * const tmdb = new TMDB(token, { cache: true });
1587
+ *
1588
+ * // Custom TTL and bounded size
1589
+ * const tmdb = new TMDB(token, { cache: { ttl: 60_000, max_size: 500 } });
1590
+ * ```
1591
+ */
1592
+ cache?: boolean | CacheOptions;
1477
1593
  };
1478
1594
  //#endregion
1479
1595
  //#region src/types/common/certifications.d.ts
@@ -3684,12 +3800,14 @@ declare class ApiClient {
3684
3800
  private onSuccessInterceptor?;
3685
3801
  private onErrorInterceptor?;
3686
3802
  private imageApi?;
3803
+ private responseCache?;
3687
3804
  constructor(accessToken: string, options?: {
3688
3805
  /** @internal API version to target. Used by TMDBv4 — not exposed in TMDBOptions. */version?: 3 | 4;
3689
3806
  logger?: boolean | TMDBLoggerFn;
3690
3807
  deduplication?: boolean;
3691
3808
  images?: ImagesConfig;
3692
3809
  rate_limit?: boolean | RateLimitOptions;
3810
+ cache?: boolean | CacheOptions;
3693
3811
  interceptors?: {
3694
3812
  request?: RequestInterceptor | RequestInterceptor[];
3695
3813
  response?: {
@@ -3723,6 +3841,20 @@ declare class ApiClient {
3723
3841
  * `TMDBOptions.deduplication = false`.
3724
3842
  */
3725
3843
  request<T>(endpoint: string, params?: Record<string, unknown | undefined>): Promise<T>;
3844
+ /**
3845
+ * Removes a single entry from the response cache.
3846
+ *
3847
+ * The key is built from `endpoint` + `params` using the same deterministic algorithm
3848
+ * as the cache itself, so the arguments must match exactly what was used in the original
3849
+ * request (including parameter values and casing).
3850
+ *
3851
+ * @returns `true` if an entry was found and removed, `false` if it was not cached.
3852
+ */
3853
+ invalidateCache(endpoint: string, params?: Record<string, unknown>): boolean;
3854
+ /** Removes all entries from the response cache. */
3855
+ clearCache(): void;
3856
+ /** Returns the number of entries currently held in the response cache. */
3857
+ get cacheSize(): number;
3726
3858
  /**
3727
3859
  * Runs all registered request interceptors in order, threading the context through each one.
3728
3860
  * If an interceptor returns a new context, it replaces the current context for the next interceptor.
@@ -3752,6 +3884,10 @@ declare class ApiClient {
3752
3884
  /**
3753
3885
  * Shared fetch + response-parsing pipeline used by both `request` and `mutate`.
3754
3886
  * Handles URL construction, auth, logging, error mapping, and null sanitisation.
3887
+ *
3888
+ * When called from `request()`, interceptors have already been applied and
3889
+ * `endpoint`/`params` are the effective (post-interceptor) values — interceptors
3890
+ * are skipped. When called from `mutate()`, interceptors run here as normal.
3755
3891
  */
3756
3892
  private execute;
3757
3893
  }
@@ -3775,6 +3911,16 @@ declare abstract class TMDBAPIBase {
3775
3911
  protected withLanguage<T extends {
3776
3912
  language?: Language;
3777
3913
  }>(params?: T): T | undefined;
3914
+ /**
3915
+ * When `images.auto_include_image_language` is enabled, derives `include_image_language`
3916
+ * from the language codes in `images.image_language_priority` and injects it into params.
3917
+ *
3918
+ * - An explicit `include_image_language` on the call site always wins.
3919
+ * - `"*"` is excluded — it has no meaning as an HTTP query parameter.
3920
+ * - Has no effect when `auto_include_image_language` is false/absent or when
3921
+ * `image_language_priority` is not configured.
3922
+ */
3923
+ protected injectImageLanguage<T extends object>(params: T): T;
3778
3924
  }
3779
3925
  //#endregion
3780
3926
  //#region src/endpoints/certifications.d.ts
@@ -4799,6 +4945,18 @@ declare class ImageAPI {
4799
4945
  * - Non-plain objects (e.g. Date/class instances) are returned unchanged
4800
4946
  */
4801
4947
  autocompleteImagePaths<T>(value: T, collectionKey?: ImageCollectionKey): T;
4948
+ /**
4949
+ * Reorders an image-item array according to a language priority list.
4950
+ *
4951
+ * Iterates through each priority entry in order:
4952
+ * - `"null"` matches items where `iso_639_1` is `null` or `undefined` (untagged)
4953
+ * - `"*"` consumes all remaining items as a catch-all and stops processing
4954
+ * - Any other string is matched against `iso_639_1` directly
4955
+ *
4956
+ * Items not matched by any entry are appended at the end.
4957
+ * No items are dropped — only their order changes.
4958
+ */
4959
+ private sortByLanguagePriority;
4802
4960
  private isImageCollectionKey;
4803
4961
  private isFullUrl;
4804
4962
  private buildImageUrl;
@@ -5696,11 +5854,8 @@ declare class V4ListsAPI extends TMDBAPIBase {
5696
5854
  */
5697
5855
  declare class TMDBv4 {
5698
5856
  private client;
5699
- /** v4 authentication — request token → access token → logout. */
5700
5857
  auth: V4AuthAPI;
5701
- /** v4 account — details, lists, favorites, watchlist, rated. */
5702
5858
  account: V4AccountAPI;
5703
- /** v4 lists — full CRUD for user-created lists. */
5704
5859
  lists: V4ListsAPI;
5705
5860
  constructor(accessToken: string, options?: TMDBOptions);
5706
5861
  }
@@ -5745,6 +5900,27 @@ declare class TMDB {
5745
5900
  */
5746
5901
  get v4(): TMDBv4;
5747
5902
  private _v4;
5903
+ /**
5904
+ * Response cache controls. Only available when `cache` was set in the constructor options.
5905
+ *
5906
+ * - `clear()` — remove all cached entries (e.g. after a user signs out or state resets).
5907
+ * - `invalidate(endpoint, params?)` — remove a single entry by endpoint + params.
5908
+ * - `size` — number of entries currently held in memory.
5909
+ *
5910
+ * @example
5911
+ * ```ts
5912
+ * // Invalidate now_playing after a mutation
5913
+ * tmdb.cache?.invalidate("/movie/now_playing");
5914
+ *
5915
+ * // Clear everything
5916
+ * tmdb.cache?.clear();
5917
+ * ```
5918
+ */
5919
+ get cache(): {
5920
+ clear(): void;
5921
+ invalidate(endpoint: string, params?: Record<string, unknown>): boolean;
5922
+ readonly size: number;
5923
+ } | undefined;
5748
5924
  /**
5749
5925
  * Creates a new TMDB instance.
5750
5926
  * @param accessToken The TMDB API access token.
@@ -5789,4 +5965,4 @@ declare function hasLogoPath(data: unknown): data is {
5789
5965
  logo_path: string;
5790
5966
  };
5791
5967
  //#endregion
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 };
5968
+ 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, ImageLanguagePriorityConfig, 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 };