@lorenzopant/tmdb 1.17.1 → 1.17.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.
Files changed (141) hide show
  1. package/dist/index.d.ts +5087 -4
  2. package/dist/index.js +3721 -5
  3. package/package.json +12 -5
  4. package/dist/client.d.ts +0 -51
  5. package/dist/client.js +0 -166
  6. package/dist/endpoints/base.d.ts +0 -22
  7. package/dist/endpoints/base.js +0 -32
  8. package/dist/endpoints/certifications.d.ts +0 -20
  9. package/dist/endpoints/certifications.js +0 -24
  10. package/dist/endpoints/changes.d.ts +0 -40
  11. package/dist/endpoints/changes.js +0 -46
  12. package/dist/endpoints/collections.d.ts +0 -39
  13. package/dist/endpoints/collections.js +0 -52
  14. package/dist/endpoints/companies.d.ts +0 -37
  15. package/dist/endpoints/companies.js +0 -49
  16. package/dist/endpoints/configuration.d.ts +0 -72
  17. package/dist/endpoints/configuration.js +0 -83
  18. package/dist/endpoints/credits.d.ts +0 -16
  19. package/dist/endpoints/credits.js +0 -22
  20. package/dist/endpoints/discover.d.ts +0 -36
  21. package/dist/endpoints/discover.js +0 -61
  22. package/dist/endpoints/find.d.ts +0 -16
  23. package/dist/endpoints/find.js +0 -21
  24. package/dist/endpoints/genres.d.ts +0 -25
  25. package/dist/endpoints/genres.js +0 -28
  26. package/dist/endpoints/keywords.d.ts +0 -29
  27. package/dist/endpoints/keywords.js +0 -38
  28. package/dist/endpoints/movie_lists.d.ts +0 -53
  29. package/dist/endpoints/movie_lists.js +0 -65
  30. package/dist/endpoints/movies.d.ts +0 -202
  31. package/dist/endpoints/movies.js +0 -255
  32. package/dist/endpoints/networks.d.ts +0 -36
  33. package/dist/endpoints/networks.js +0 -46
  34. package/dist/endpoints/people.d.ts +0 -91
  35. package/dist/endpoints/people.js +0 -128
  36. package/dist/endpoints/people_lists.d.ts +0 -16
  37. package/dist/endpoints/people_lists.js +0 -16
  38. package/dist/endpoints/reviews.d.ts +0 -14
  39. package/dist/endpoints/reviews.js +0 -16
  40. package/dist/endpoints/search.d.ts +0 -88
  41. package/dist/endpoints/search.js +0 -102
  42. package/dist/endpoints/trending.d.ts +0 -36
  43. package/dist/endpoints/trending.js +0 -48
  44. package/dist/endpoints/tv_episode_groups.d.ts +0 -13
  45. package/dist/endpoints/tv_episode_groups.js +0 -16
  46. package/dist/endpoints/tv_episodes.d.ts +0 -110
  47. package/dist/endpoints/tv_episodes.js +0 -136
  48. package/dist/endpoints/tv_seasons.d.ts +0 -128
  49. package/dist/endpoints/tv_seasons.js +0 -164
  50. package/dist/endpoints/tv_series.d.ts +0 -244
  51. package/dist/endpoints/tv_series.js +0 -311
  52. package/dist/endpoints/tv_series_lists.d.ts +0 -51
  53. package/dist/endpoints/tv_series_lists.js +0 -63
  54. package/dist/endpoints/watch_providers.d.ts +0 -34
  55. package/dist/endpoints/watch_providers.js +0 -46
  56. package/dist/errors/messages.d.ts +0 -15
  57. package/dist/errors/messages.js +0 -47
  58. package/dist/errors/tmdb.d.ts +0 -45
  59. package/dist/errors/tmdb.js +0 -39
  60. package/dist/images/images.d.ts +0 -12
  61. package/dist/images/images.js +0 -26
  62. package/dist/routes.d.ts +0 -157
  63. package/dist/routes.js +0 -157
  64. package/dist/tmdb.d.ts +0 -61
  65. package/dist/tmdb.js +0 -94
  66. package/dist/types/collections.d.ts +0 -72
  67. package/dist/types/collections.js +0 -1
  68. package/dist/types/common/certifications.d.ts +0 -19
  69. package/dist/types/common/certifications.js +0 -1
  70. package/dist/types/common/changes.d.ts +0 -44
  71. package/dist/types/common/changes.js +0 -1
  72. package/dist/types/common/images.d.ts +0 -64
  73. package/dist/types/common/images.js +0 -1
  74. package/dist/types/common/index.d.ts +0 -6
  75. package/dist/types/common/index.js +0 -6
  76. package/dist/types/common/media.d.ts +0 -305
  77. package/dist/types/common/media.js +0 -1
  78. package/dist/types/common/pagination.d.ts +0 -6
  79. package/dist/types/common/pagination.js +0 -1
  80. package/dist/types/common/params.d.ts +0 -27
  81. package/dist/types/common/params.js +0 -1
  82. package/dist/types/companies.d.ts +0 -53
  83. package/dist/types/companies.js +0 -1
  84. package/dist/types/config/configuration.d.ts +0 -56
  85. package/dist/types/config/configuration.js +0 -1
  86. package/dist/types/config/countries.d.ts +0 -3
  87. package/dist/types/config/countries.js +0 -1257
  88. package/dist/types/config/images.d.ts +0 -49
  89. package/dist/types/config/images.js +0 -13
  90. package/dist/types/config/index.d.ts +0 -6
  91. package/dist/types/config/index.js +0 -6
  92. package/dist/types/config/languages.d.ts +0 -11
  93. package/dist/types/config/languages.js +0 -1
  94. package/dist/types/config/options.d.ts +0 -46
  95. package/dist/types/config/options.js +0 -1
  96. package/dist/types/config/timezones.d.ts +0 -751
  97. package/dist/types/config/timezones.js +0 -1149
  98. package/dist/types/credits.d.ts +0 -148
  99. package/dist/types/credits.js +0 -1
  100. package/dist/types/discover.d.ts +0 -130
  101. package/dist/types/discover.js +0 -27
  102. package/dist/types/enums.d.ts +0 -8
  103. package/dist/types/enums.js +0 -9
  104. package/dist/types/find.d.ts +0 -103
  105. package/dist/types/find.js +0 -1
  106. package/dist/types/index.d.ts +0 -21
  107. package/dist/types/index.js +0 -21
  108. package/dist/types/keywords.d.ts +0 -19
  109. package/dist/types/keywords.js +0 -1
  110. package/dist/types/movies.d.ts +0 -304
  111. package/dist/types/movies.js +0 -1
  112. package/dist/types/networks.d.ts +0 -45
  113. package/dist/types/networks.js +0 -1
  114. package/dist/types/people-lists.d.ts +0 -5
  115. package/dist/types/people-lists.js +0 -1
  116. package/dist/types/people.d.ts +0 -214
  117. package/dist/types/people.js +0 -1
  118. package/dist/types/reviews.d.ts +0 -22
  119. package/dist/types/reviews.js +0 -1
  120. package/dist/types/search.d.ts +0 -198
  121. package/dist/types/search.js +0 -1
  122. package/dist/types/trending.d.ts +0 -55
  123. package/dist/types/trending.js +0 -1
  124. package/dist/types/tv-episode-groups.d.ts +0 -63
  125. package/dist/types/tv-episode-groups.js +0 -13
  126. package/dist/types/tv-episodes.d.ts +0 -98
  127. package/dist/types/tv-episodes.js +0 -1
  128. package/dist/types/tv-seasons.d.ts +0 -133
  129. package/dist/types/tv-seasons.js +0 -1
  130. package/dist/types/tv-series.d.ts +0 -445
  131. package/dist/types/tv-series.js +0 -1
  132. package/dist/types/utility.d.ts +0 -16
  133. package/dist/types/utility.js +0 -10
  134. package/dist/types/watch-providers.d.ts +0 -34
  135. package/dist/types/watch-providers.js +0 -1
  136. package/dist/utils/index.d.ts +0 -2
  137. package/dist/utils/index.js +0 -2
  138. package/dist/utils/jwt.d.ts +0 -1
  139. package/dist/utils/jwt.js +0 -61
  140. package/dist/utils/logger.d.ts +0 -18
  141. package/dist/utils/logger.js +0 -40
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@lorenzopant/tmdb",
3
- "version": "1.17.1",
3
+ "version": "1.17.2",
4
+ "type": "module",
4
5
  "description": "A completely type-safe The Movie Database (TMDB) API wrapper for typescript applications.",
5
6
  "main": "dist/index.js",
6
7
  "types": "dist/index.d.ts",
@@ -17,8 +18,8 @@
17
18
  "url": "https://github.com/lorenzopant/tmdb/issues"
18
19
  },
19
20
  "scripts": {
20
- "build": "rm -rf dist && tsc",
21
- "dev": "tsc --watch",
21
+ "build": "tsup",
22
+ "dev": "tsup --watch",
22
23
  "typecheck": "tsc --noEmit",
23
24
  "test": "vitest",
24
25
  "test:unit": "vitest run --exclude '**/*.integration.test.ts'",
@@ -58,20 +59,26 @@
58
59
  "release-it": "^19.0.3",
59
60
  "release-it-pnpm": "^4.6.6",
60
61
  "ts-morph": "^27.0.2",
62
+ "tsup": "^8.5.1",
61
63
  "tsx": "^4.21.0",
62
64
  "typescript": "^5.8.3",
63
65
  "typescript-eslint": "^8.35.0",
64
66
  "vite": "^7.0.0",
65
67
  "vitest": "^4.0.9"
66
68
  },
69
+ "pnpm": {
70
+ "overrides": {
71
+ "basic-ftp": "5.2.0"
72
+ }
73
+ },
67
74
  "exports": {
68
75
  ".": {
69
76
  "import": "./dist/index.js",
70
77
  "types": "./dist/index.d.ts"
71
78
  },
72
79
  "./types": {
73
- "types": "./dist/types/index.d.ts",
74
- "default": "./dist/types/index.js"
80
+ "import": "./dist/index.js",
81
+ "types": "./dist/index.d.ts"
75
82
  }
76
83
  }
77
84
  }
package/dist/client.d.ts DELETED
@@ -1,51 +0,0 @@
1
- import { TMDBLoggerFn } from "./utils/logger";
2
- export declare class ApiClient {
3
- private accessToken;
4
- private baseUrl;
5
- private logger?;
6
- /**
7
- * Tracks in-flight requests keyed by a deterministic string derived from the endpoint
8
- * and its parameters. When two identical requests are fired concurrently, the second
9
- * caller receives the same Promise as the first — only one fetch is made.
10
- * Entries are removed via `.finally()` so the map never holds settled promises.
11
- */
12
- private inflightRequests;
13
- private deduplication;
14
- constructor(accessToken: string, options?: {
15
- logger?: boolean | TMDBLoggerFn;
16
- deduplication?: boolean;
17
- });
18
- /**
19
- * Builds a stable, order-independent cache key for a request.
20
- *
21
- * `undefined` values are excluded (they are never serialised into the URL),
22
- * and the remaining entries are sorted alphabetically before joining so that
23
- * `{ language, page }` and `{ page, language }` produce the same key.
24
- */
25
- private buildRequestKey;
26
- /**
27
- * Makes an authenticated GET request to the TMDB API, returning the parsed and
28
- * null-sanitised response.
29
- *
30
- * **Deduplication:** when enabled (the default), concurrent calls with the same
31
- * `endpoint` + `params` share a single in-flight fetch. The second (and any
32
- * subsequent) caller receives the same `Promise` — no extra network request is made.
33
- * Once the promise settles (success or error) it is evicted from the map so the next
34
- * call triggers a fresh fetch. Deduplication can be disabled globally via
35
- * `TMDBOptions.deduplication = false`.
36
- */
37
- request<T>(endpoint: string, params?: Record<string, unknown | undefined>): Promise<T>;
38
- /**
39
- * The actual fetch + response-parsing pipeline. Called by `request()` only when no
40
- * matching in-flight promise exists. Handles URL construction, auth headers, logging,
41
- * error mapping, and null sanitisation.
42
- */
43
- private doRequest;
44
- /**
45
- * Recursively converts null values to undefined in API responses.
46
- * This allows optional properties to model fields that TMDB returns as nullable.
47
- * Response types for nullable fields should account for possible undefined values.
48
- */
49
- private sanitizeNulls;
50
- private handleError;
51
- }
package/dist/client.js DELETED
@@ -1,166 +0,0 @@
1
- import { TMDBError } from "./errors/tmdb";
2
- import { TMDBLogger } from "./utils/logger";
3
- import { isJwt } from "./utils";
4
- export class ApiClient {
5
- accessToken;
6
- baseUrl = "https://api.themoviedb.org/3";
7
- logger;
8
- /**
9
- * Tracks in-flight requests keyed by a deterministic string derived from the endpoint
10
- * and its parameters. When two identical requests are fired concurrently, the second
11
- * caller receives the same Promise as the first — only one fetch is made.
12
- * Entries are removed via `.finally()` so the map never holds settled promises.
13
- */
14
- inflightRequests = new Map();
15
- deduplication;
16
- constructor(accessToken, options = {}) {
17
- this.accessToken = accessToken;
18
- this.logger = TMDBLogger.from(options.logger);
19
- this.deduplication = options.deduplication !== false;
20
- }
21
- /**
22
- * Builds a stable, order-independent cache key for a request.
23
- *
24
- * `undefined` values are excluded (they are never serialised into the URL),
25
- * and the remaining entries are sorted alphabetically before joining so that
26
- * `{ language, page }` and `{ page, language }` produce the same key.
27
- */
28
- buildRequestKey(endpoint, params) {
29
- const definedEntries = Object.entries(params)
30
- .filter(([, v]) => v !== undefined)
31
- .sort(([a], [b]) => a.localeCompare(b))
32
- .map(([k, v]) => `${k}=${String(v)}`);
33
- return definedEntries.length > 0 ? `${endpoint}?${definedEntries.join("&")}` : endpoint;
34
- }
35
- /**
36
- * Makes an authenticated GET request to the TMDB API, returning the parsed and
37
- * null-sanitised response.
38
- *
39
- * **Deduplication:** when enabled (the default), concurrent calls with the same
40
- * `endpoint` + `params` share a single in-flight fetch. The second (and any
41
- * subsequent) caller receives the same `Promise` — no extra network request is made.
42
- * Once the promise settles (success or error) it is evicted from the map so the next
43
- * call triggers a fresh fetch. Deduplication can be disabled globally via
44
- * `TMDBOptions.deduplication = false`.
45
- */
46
- async request(endpoint, params = {}) {
47
- if (!this.deduplication)
48
- return this.doRequest(endpoint, params);
49
- const key = this.buildRequestKey(endpoint, params);
50
- const existing = this.inflightRequests.get(key);
51
- if (existing)
52
- return existing;
53
- const promise = this.doRequest(endpoint, params).finally(() => {
54
- this.inflightRequests.delete(key);
55
- });
56
- this.inflightRequests.set(key, promise);
57
- return promise;
58
- }
59
- /**
60
- * The actual fetch + response-parsing pipeline. Called by `request()` only when no
61
- * matching in-flight promise exists. Handles URL construction, auth headers, logging,
62
- * error mapping, and null sanitisation.
63
- */
64
- async doRequest(endpoint, params) {
65
- const url = new URL(`${this.baseUrl}${endpoint}`);
66
- const jwt = isJwt(this.accessToken);
67
- for (const [key, value] of Object.entries(params)) {
68
- if (value === undefined)
69
- continue;
70
- url.searchParams.append(key, String(value));
71
- }
72
- if (!jwt) {
73
- url.searchParams.append("api_key", this.accessToken);
74
- }
75
- const startedAt = Date.now();
76
- this.logger?.log({
77
- type: "request",
78
- method: "GET",
79
- endpoint,
80
- });
81
- let res;
82
- try {
83
- res = await fetch(url.toString(), {
84
- headers: jwt
85
- ? {
86
- Authorization: `Bearer ${this.accessToken}`,
87
- "Content-Type": "application/json;charset=utf-8",
88
- }
89
- : {
90
- "Content-Type": "application/json;charset=utf-8",
91
- },
92
- });
93
- }
94
- catch (error) {
95
- this.logger?.log({
96
- type: "error",
97
- method: "GET",
98
- endpoint,
99
- errorMessage: error instanceof Error ? error.message : String(error),
100
- durationMs: Date.now() - startedAt,
101
- });
102
- throw error;
103
- }
104
- if (!res.ok)
105
- await this.handleError(res, endpoint);
106
- this.logger?.log({
107
- type: "response",
108
- method: "GET",
109
- endpoint,
110
- status: res.status,
111
- statusText: res.statusText,
112
- durationMs: Date.now() - startedAt,
113
- });
114
- const data = await res.json();
115
- return this.sanitizeNulls(data);
116
- }
117
- /**
118
- * Recursively converts null values to undefined in API responses.
119
- * This allows optional properties to model fields that TMDB returns as nullable.
120
- * Response types for nullable fields should account for possible undefined values.
121
- */
122
- sanitizeNulls(value) {
123
- // Only convert null to undefined, keep undefined as-is
124
- if (value === null) {
125
- return undefined;
126
- }
127
- if (typeof value !== "object") {
128
- return value;
129
- }
130
- if (Array.isArray(value)) {
131
- return value.map((v) => this.sanitizeNulls(v));
132
- }
133
- const sanitized = {};
134
- for (const [key, val] of Object.entries(value)) {
135
- sanitized[key] = this.sanitizeNulls(val);
136
- }
137
- return sanitized;
138
- }
139
- async handleError(res, endpoint) {
140
- let errorMessage = res.statusText;
141
- let tmdbStatusCode = -1;
142
- try {
143
- const errorBody = await res.json();
144
- if (errorBody && typeof errorBody === "object") {
145
- const err = errorBody;
146
- errorMessage = err.status_message || errorMessage;
147
- tmdbStatusCode = err.status_code || -1;
148
- }
149
- }
150
- catch (error) {
151
- console.error(`Unknown error: ${error}`);
152
- // If response is not JSON, fallback to HTTP status text
153
- }
154
- this.logger?.log({
155
- type: "error",
156
- method: "GET",
157
- endpoint,
158
- status: res.status,
159
- statusText: res.statusText,
160
- tmdbStatusCode,
161
- errorMessage,
162
- });
163
- const error = new TMDBError(errorMessage, res.status, tmdbStatusCode);
164
- throw error;
165
- }
166
- }
@@ -1,22 +0,0 @@
1
- import { ApiClient } from "../client";
2
- import { Language } from "../types";
3
- import { TMDBOptions } from "../types/config";
4
- export declare abstract class TMDBAPIBase {
5
- protected client: ApiClient;
6
- protected defaultOptions: TMDBOptions;
7
- constructor(client: ApiClient, defaultOptions?: TMDBOptions);
8
- /**
9
- * Merges the endpoint's params with TMDB-wide defaults (language, region).
10
- * Works only for param types that include optional `language` and `region` fields.
11
- * Only request-safe defaults are merged — config-only options (logger, images, etc.) are excluded.
12
- */
13
- protected applyDefaults<T extends object>(params?: T): T | undefined;
14
- /**
15
- * Ensures params contains a language: prefer explicit param, fallback to defaultOptions.language.
16
- * If neither is present, returns the original params unmodified.
17
- * When params is undefined but a default language is set, returns { language: defaultLang }.
18
- */
19
- protected withLanguage<T extends {
20
- language?: Language;
21
- }>(params?: T): T | undefined;
22
- }
@@ -1,32 +0,0 @@
1
- export class TMDBAPIBase {
2
- client;
3
- defaultOptions;
4
- constructor(client, defaultOptions = {}) {
5
- this.client = client;
6
- this.defaultOptions = defaultOptions;
7
- }
8
- /**
9
- * Merges the endpoint's params with TMDB-wide defaults (language, region).
10
- * Works only for param types that include optional `language` and `region` fields.
11
- * Only request-safe defaults are merged — config-only options (logger, images, etc.) are excluded.
12
- */
13
- applyDefaults(params) {
14
- const { language, region } = this.defaultOptions;
15
- return { ...(language !== undefined && { language }), ...(region !== undefined && { region }), ...params };
16
- }
17
- /**
18
- * Ensures params contains a language: prefer explicit param, fallback to defaultOptions.language.
19
- * If neither is present, returns the original params unmodified.
20
- * When params is undefined but a default language is set, returns { language: defaultLang }.
21
- */
22
- withLanguage(params) {
23
- const defaultLang = this.defaultOptions?.language;
24
- if (!params)
25
- return defaultLang !== undefined ? { language: defaultLang } : undefined;
26
- if (params.language !== undefined)
27
- return params;
28
- if (defaultLang === undefined)
29
- return params;
30
- return { ...params, language: defaultLang };
31
- }
32
- }
@@ -1,20 +0,0 @@
1
- import { Certifications } from "../types";
2
- import { TMDBAPIBase } from "./base";
3
- export declare class CertificationsAPI extends TMDBAPIBase {
4
- /**
5
- * Movie Certifications
6
- * GET - https://api.themoviedb.org/3/certification/movie/list
7
- *
8
- * Get an up to date list of the officially supported movie certifications on TMDB.
9
- * @reference https://developer.themoviedb.org/reference/certification-movie-list
10
- */
11
- movie_certifications(): Promise<Certifications>;
12
- /**
13
- * TV Certifications
14
- * GET - https://api.themoviedb.org/3/certification/tv/list
15
- *
16
- * Get an up to date list of the officially supported tv certifications on TMDB.
17
- * @reference https://developer.themoviedb.org/reference/certification-tv-list
18
- */
19
- tv_certifications(): Promise<Certifications>;
20
- }
@@ -1,24 +0,0 @@
1
- import { ENDPOINTS } from "../routes";
2
- import { TMDBAPIBase } from "./base";
3
- export class CertificationsAPI extends TMDBAPIBase {
4
- /**
5
- * Movie Certifications
6
- * GET - https://api.themoviedb.org/3/certification/movie/list
7
- *
8
- * Get an up to date list of the officially supported movie certifications on TMDB.
9
- * @reference https://developer.themoviedb.org/reference/certification-movie-list
10
- */
11
- async movie_certifications() {
12
- return this.client.request(ENDPOINTS.CERTIFICATIONS.MOVIE_CERTIFICATIONS);
13
- }
14
- /**
15
- * TV Certifications
16
- * GET - https://api.themoviedb.org/3/certification/tv/list
17
- *
18
- * Get an up to date list of the officially supported tv certifications on TMDB.
19
- * @reference https://developer.themoviedb.org/reference/certification-tv-list
20
- */
21
- async tv_certifications() {
22
- return this.client.request(ENDPOINTS.CERTIFICATIONS.TV_CERTIFICATIONS);
23
- }
24
- }
@@ -1,40 +0,0 @@
1
- import { ChangeResultItem, PaginatedResponse, WithPageAndDateRange } from "../types";
2
- import { TMDBAPIBase } from "./base";
3
- export declare class ChangesAPI extends TMDBAPIBase {
4
- /**
5
- * Movie List
6
- * GET - https://api.themoviedb.org/3/movie/changes
7
- *
8
- * Get a list of all of the movie ids that have been changed in the past 24 hours.
9
- *
10
- * @param page Page number
11
- * @param start_date Start date for change items
12
- * @param end_date End date for change items
13
- * @reference https://developer.themoviedb.org/reference/changes-movie-list
14
- */
15
- movie_list(params?: WithPageAndDateRange): Promise<PaginatedResponse<ChangeResultItem>>;
16
- /**
17
- * People List
18
- * GET - https://api.themoviedb.org/3/person/changes
19
- *
20
- * Get a list of all of the person ids that have been changed in the past 24 hours.
21
- *
22
- * @param page Page number
23
- * @param start_date Start date for change items
24
- * @param end_date End date for change items
25
- * @reference https://developer.themoviedb.org/reference/changes-people-list
26
- */
27
- people_list(params?: WithPageAndDateRange): Promise<PaginatedResponse<ChangeResultItem>>;
28
- /**
29
- * TV List
30
- * GET - https://api.themoviedb.org/3/tv/changes
31
- *
32
- * Get a list of all of the tv show ids that have been changed in the past 24 hours.
33
- *
34
- * @param page Page number
35
- * @param start_date Start date for change items
36
- * @param end_date End date for change items
37
- * @reference https://developer.themoviedb.org/reference/changes-tv-list
38
- */
39
- tv_list(params?: WithPageAndDateRange): Promise<PaginatedResponse<ChangeResultItem>>;
40
- }
@@ -1,46 +0,0 @@
1
- import { ENDPOINTS } from "../routes";
2
- import { TMDBAPIBase } from "./base";
3
- export class ChangesAPI extends TMDBAPIBase {
4
- /**
5
- * Movie List
6
- * GET - https://api.themoviedb.org/3/movie/changes
7
- *
8
- * Get a list of all of the movie ids that have been changed in the past 24 hours.
9
- *
10
- * @param page Page number
11
- * @param start_date Start date for change items
12
- * @param end_date End date for change items
13
- * @reference https://developer.themoviedb.org/reference/changes-movie-list
14
- */
15
- async movie_list(params) {
16
- return this.client.request(ENDPOINTS.CHANGES.MOVIE_LIST, params);
17
- }
18
- /**
19
- * People List
20
- * GET - https://api.themoviedb.org/3/person/changes
21
- *
22
- * Get a list of all of the person ids that have been changed in the past 24 hours.
23
- *
24
- * @param page Page number
25
- * @param start_date Start date for change items
26
- * @param end_date End date for change items
27
- * @reference https://developer.themoviedb.org/reference/changes-people-list
28
- */
29
- async people_list(params) {
30
- return this.client.request(ENDPOINTS.CHANGES.PEOPLE_LIST, params);
31
- }
32
- /**
33
- * TV List
34
- * GET - https://api.themoviedb.org/3/tv/changes
35
- *
36
- * Get a list of all of the tv show ids that have been changed in the past 24 hours.
37
- *
38
- * @param page Page number
39
- * @param start_date Start date for change items
40
- * @param end_date End date for change items
41
- * @reference https://developer.themoviedb.org/reference/changes-tv-list
42
- */
43
- async tv_list(params) {
44
- return this.client.request(ENDPOINTS.CHANGES.TV_LIST, params);
45
- }
46
- }
@@ -1,39 +0,0 @@
1
- import { CollectionBaseParam, Collection, CollectionDetailsParams, CollectionImages, CollectionImagesParams, CollectionTranslations } from "../types/collections";
2
- import { TMDBAPIBase } from "./base";
3
- export declare class CollectionsAPI extends TMDBAPIBase {
4
- private collectionPath;
5
- /**
6
- * Details
7
- * GET - https://api.themoviedb.org/3/collection/{collection_id}
8
- *
9
- * Get collection details by ID.
10
- *
11
- * @param collection_id Unique identifier for the collection
12
- * @param language Language for the response
13
- * @reference https://developer.themoviedb.org/reference/collection-details
14
- */
15
- details(params: CollectionDetailsParams): Promise<Collection>;
16
- /**
17
- * Images
18
- * GET - https://api.themoviedb.org/3/collection/{collection_id}/images
19
- *
20
- * Get the images that belong to a collection.
21
- * This method will return the backdrops and posters that have been added to a collection.
22
- *
23
- * @param collection_id Unique identifier for the collection
24
- * @param language Language for the response
25
- * @param include_image_language Additional language for images
26
- * @reference https://developer.themoviedb.org/reference/collection-images
27
- */
28
- images(params: CollectionImagesParams): Promise<CollectionImages>;
29
- /**
30
- * Translations
31
- * GET - https://api.themoviedb.org/3/collection/{collection_id}/translations
32
- *
33
- * Get collection translations by ID.
34
- *
35
- * @param collection_id Unique identifier for the collection
36
- * @reference https://developer.themoviedb.org/reference/collection-translations
37
- */
38
- translations(params: CollectionBaseParam): Promise<CollectionTranslations>;
39
- }
@@ -1,52 +0,0 @@
1
- import { ENDPOINTS } from "../routes";
2
- import { TMDBAPIBase } from "./base";
3
- export class CollectionsAPI extends TMDBAPIBase {
4
- collectionPath(collection_id) {
5
- return `${ENDPOINTS.COLLECTIONS.DETAILS}/${collection_id}`;
6
- }
7
- /**
8
- * Details
9
- * GET - https://api.themoviedb.org/3/collection/{collection_id}
10
- *
11
- * Get collection details by ID.
12
- *
13
- * @param collection_id Unique identifier for the collection
14
- * @param language Language for the response
15
- * @reference https://developer.themoviedb.org/reference/collection-details
16
- */
17
- async details(params) {
18
- const { language = this.defaultOptions.language, ...rest } = params;
19
- const endpoint = this.collectionPath(params.collection_id);
20
- return this.client.request(endpoint, { language, ...rest });
21
- }
22
- /**
23
- * Images
24
- * GET - https://api.themoviedb.org/3/collection/{collection_id}/images
25
- *
26
- * Get the images that belong to a collection.
27
- * This method will return the backdrops and posters that have been added to a collection.
28
- *
29
- * @param collection_id Unique identifier for the collection
30
- * @param language Language for the response
31
- * @param include_image_language Additional language for images
32
- * @reference https://developer.themoviedb.org/reference/collection-images
33
- */
34
- async images(params) {
35
- const endpoint = `${this.collectionPath(params.collection_id)}${ENDPOINTS.COLLECTIONS.IMAGES}`;
36
- const requestParams = this.withLanguage(params) ?? params;
37
- return this.client.request(endpoint, requestParams);
38
- }
39
- /**
40
- * Translations
41
- * GET - https://api.themoviedb.org/3/collection/{collection_id}/translations
42
- *
43
- * Get collection translations by ID.
44
- *
45
- * @param collection_id Unique identifier for the collection
46
- * @reference https://developer.themoviedb.org/reference/collection-translations
47
- */
48
- async translations(params) {
49
- const endpoint = `${this.collectionPath(params.collection_id)}${ENDPOINTS.COLLECTIONS.TRANSLATIONS}`;
50
- return this.client.request(endpoint, params);
51
- }
52
- }
@@ -1,37 +0,0 @@
1
- import { Company, CompanyAlternativeNames, CompanyAlternativeNamesParams, CompanyImages, CompanyImagesParams, CompanyDetailsParams } from "../types/companies";
2
- import { TMDBAPIBase } from "./base";
3
- export declare class CompaniesAPI extends TMDBAPIBase {
4
- private companyPath;
5
- /**
6
- * Details
7
- * GET - https://api.themoviedb.org/3/company/{company_id}
8
- *
9
- * Get the company details by ID.
10
- *
11
- * @param company_id Unique identifier for the company
12
- * @reference https://developer.themoviedb.org/reference/company-details
13
- */
14
- details(params: CompanyDetailsParams): Promise<Company>;
15
- /**
16
- * Alternative names
17
- * GET - https://api.themoviedb.org/3/company/{company_id}/alternative_names
18
- *
19
- * Get the list of alternative names for a company.
20
- *
21
- * @param company_id Unique identifier for the company
22
- * @reference https://developer.themoviedb.org/reference/company-alternative-names
23
- */
24
- alternative_names(params: CompanyAlternativeNamesParams): Promise<CompanyAlternativeNames>;
25
- /**
26
- * Images
27
- * GET - https://api.themoviedb.org/3/company/{company_id}/images
28
- *
29
- * Get the logos for a company by ID.
30
- *
31
- * @param company_id Unique identifier for the company
32
- * @param language Language for the response
33
- * @param include_image_language Additional language for images
34
- * @reference https://developer.themoviedb.org/reference/company-images
35
- */
36
- images(params: CompanyImagesParams): Promise<CompanyImages>;
37
- }
@@ -1,49 +0,0 @@
1
- import { ENDPOINTS } from "../routes";
2
- import { TMDBAPIBase } from "./base";
3
- export class CompaniesAPI extends TMDBAPIBase {
4
- companyPath(company_id) {
5
- return `${ENDPOINTS.COMPANIES.DETAILS}/${company_id}`;
6
- }
7
- /**
8
- * Details
9
- * GET - https://api.themoviedb.org/3/company/{company_id}
10
- *
11
- * Get the company details by ID.
12
- *
13
- * @param company_id Unique identifier for the company
14
- * @reference https://developer.themoviedb.org/reference/company-details
15
- */
16
- async details(params) {
17
- const endpoint = this.companyPath(params.company_id);
18
- return this.client.request(endpoint, params);
19
- }
20
- /**
21
- * Alternative names
22
- * GET - https://api.themoviedb.org/3/company/{company_id}/alternative_names
23
- *
24
- * Get the list of alternative names for a company.
25
- *
26
- * @param company_id Unique identifier for the company
27
- * @reference https://developer.themoviedb.org/reference/company-alternative-names
28
- */
29
- async alternative_names(params) {
30
- const endpoint = `${this.companyPath(params.company_id)}${ENDPOINTS.COMPANIES.ALTERNATIVE_NAMES}`;
31
- return this.client.request(endpoint, params);
32
- }
33
- /**
34
- * Images
35
- * GET - https://api.themoviedb.org/3/company/{company_id}/images
36
- *
37
- * Get the logos for a company by ID.
38
- *
39
- * @param company_id Unique identifier for the company
40
- * @param language Language for the response
41
- * @param include_image_language Additional language for images
42
- * @reference https://developer.themoviedb.org/reference/company-images
43
- */
44
- async images(params) {
45
- const endpoint = `${this.companyPath(params.company_id)}${ENDPOINTS.COMPANIES.IMAGES}`;
46
- const requestParams = this.withLanguage(params) ?? params;
47
- return this.client.request(endpoint, requestParams);
48
- }
49
- }