@lorenzopant/tmdb 1.17.0 → 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 -17
  5. package/dist/client.js +0 -114
  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 -36
  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.0",
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,17 +0,0 @@
1
- import { TMDBLoggerFn } from "./utils/logger";
2
- export declare class ApiClient {
3
- private accessToken;
4
- private baseUrl;
5
- private logger?;
6
- constructor(accessToken: string, options?: {
7
- logger?: boolean | TMDBLoggerFn;
8
- });
9
- request<T>(endpoint: string, params?: Record<string, unknown | undefined>): Promise<T>;
10
- /**
11
- * Recursively converts null values to undefined in API responses.
12
- * This allows optional properties to model fields that TMDB returns as nullable.
13
- * Response types for nullable fields should account for possible undefined values.
14
- */
15
- private sanitizeNulls;
16
- private handleError;
17
- }
package/dist/client.js DELETED
@@ -1,114 +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
- constructor(accessToken, options = {}) {
9
- this.accessToken = accessToken;
10
- this.logger = TMDBLogger.from(options.logger);
11
- }
12
- async request(endpoint, params = {}) {
13
- const url = new URL(`${this.baseUrl}${endpoint}`);
14
- const jwt = isJwt(this.accessToken);
15
- for (const [key, value] of Object.entries(params)) {
16
- if (value === undefined)
17
- continue;
18
- url.searchParams.append(key, String(value));
19
- }
20
- if (!jwt) {
21
- url.searchParams.append("api_key", this.accessToken);
22
- }
23
- const startedAt = Date.now();
24
- this.logger?.log({
25
- type: "request",
26
- method: "GET",
27
- endpoint,
28
- });
29
- let res;
30
- try {
31
- res = await fetch(url.toString(), {
32
- headers: jwt
33
- ? {
34
- Authorization: `Bearer ${this.accessToken}`,
35
- "Content-Type": "application/json;charset=utf-8",
36
- }
37
- : {
38
- "Content-Type": "application/json;charset=utf-8",
39
- },
40
- });
41
- }
42
- catch (error) {
43
- this.logger?.log({
44
- type: "error",
45
- method: "GET",
46
- endpoint,
47
- errorMessage: error instanceof Error ? error.message : String(error),
48
- durationMs: Date.now() - startedAt,
49
- });
50
- throw error;
51
- }
52
- if (!res.ok)
53
- await this.handleError(res, endpoint);
54
- this.logger?.log({
55
- type: "response",
56
- method: "GET",
57
- endpoint,
58
- status: res.status,
59
- statusText: res.statusText,
60
- durationMs: Date.now() - startedAt,
61
- });
62
- const data = await res.json();
63
- return this.sanitizeNulls(data);
64
- }
65
- /**
66
- * Recursively converts null values to undefined in API responses.
67
- * This allows optional properties to model fields that TMDB returns as nullable.
68
- * Response types for nullable fields should account for possible undefined values.
69
- */
70
- sanitizeNulls(value) {
71
- // Only convert null to undefined, keep undefined as-is
72
- if (value === null) {
73
- return undefined;
74
- }
75
- if (typeof value !== "object") {
76
- return value;
77
- }
78
- if (Array.isArray(value)) {
79
- return value.map((v) => this.sanitizeNulls(v));
80
- }
81
- const sanitized = {};
82
- for (const [key, val] of Object.entries(value)) {
83
- sanitized[key] = this.sanitizeNulls(val);
84
- }
85
- return sanitized;
86
- }
87
- async handleError(res, endpoint) {
88
- let errorMessage = res.statusText;
89
- let tmdbStatusCode = -1;
90
- try {
91
- const errorBody = await res.json();
92
- if (errorBody && typeof errorBody === "object") {
93
- const err = errorBody;
94
- errorMessage = err.status_message || errorMessage;
95
- tmdbStatusCode = err.status_code || -1;
96
- }
97
- }
98
- catch (error) {
99
- console.error(`Unknown error: ${error}`);
100
- // If response is not JSON, fallback to HTTP status text
101
- }
102
- this.logger?.log({
103
- type: "error",
104
- method: "GET",
105
- endpoint,
106
- status: res.status,
107
- statusText: res.statusText,
108
- tmdbStatusCode,
109
- errorMessage,
110
- });
111
- const error = new TMDBError(errorMessage, res.status, tmdbStatusCode);
112
- throw error;
113
- }
114
- }
@@ -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
- }
@@ -1,72 +0,0 @@
1
- import { ConfigurationCountry } from "../types";
2
- import { ConfigurationCountriesParams, ConfigurationJob, ConfigurationLanguage, ConfigurationResponse, ConfigurationTimezone } from "../types/config/configuration";
3
- import { TMDBAPIBase } from "./base";
4
- export declare class ConfigurationAPI extends TMDBAPIBase {
5
- /**
6
- * Details
7
- * GET - https://api.themoviedb.org/3/configuration
8
- *
9
- * Query the API configuration details.
10
- * The data returned here in the configuration endpoint is designed to provide some of
11
- * the required information you'll need as you integrate our API.
12
- * For example, you can get a list of valid image sizes and the valid image address.
13
- * @reference https://developer.themoviedb.org/reference/configuration-details
14
- */
15
- details(): Promise<ConfigurationResponse>;
16
- /**
17
- * Countries
18
- * GET - https://api.themoviedb.org/3/configuration/countries
19
- *
20
- * Get the list of countries (ISO 3166-1 tags) used throughout TMDB.
21
- * @param language Language (Defaults to en-US)
22
- * @reference https://developer.themoviedb.org/reference/configuration-countries
23
- */
24
- countries(params?: ConfigurationCountriesParams): Promise<ConfigurationCountry[]>;
25
- /**
26
- * Jobs
27
- * GET - https://api.themoviedb.org/3/configuration/jobs
28
- *
29
- * Get the list of the jobs and departments used throughout TMDB.
30
- * @reference https://developer.themoviedb.org/reference/configuration-jobs
31
- */
32
- jobs(): Promise<ConfigurationJob[]>;
33
- /**
34
- * Languages
35
- * GET - https://api.themoviedb.org/3/configuration/languages
36
- *
37
- * Get the list of the languages (ISO 639-1 tags) used throughout TMDB.
38
- * @reference https://developer.themoviedb.org/reference/configuration-languages
39
- */
40
- languages(): Promise<ConfigurationLanguage[]>;
41
- /**
42
- * Primary Translations
43
- * GET - https://api.themoviedb.org/3/configuration/primary_translations
44
- *
45
- * Get a list of the officially supported translations on TMDB.
46
- *
47
- * While it's technically possible to add a translation in any one of the languages we have added to TMDB
48
- * (we don't restrict content), the ones listed in this method are the ones
49
- * we also support for localizing the website with which means they are "primary" translations.
50
- *
51
- * These are all specified as IETF tags to identify the languages we use on TMDB. There is one exception which is image languages.
52
- * They are currently only designated by a ISO-639-1 tag.
53
- * This is a planned upgrade for the future.
54
- *
55
- * We're always open to adding more if you think one should be added.
56
- * You can ask about getting a new primary translation added by posting on the forums.
57
- *
58
- * One more thing to mention, these are the translations that map to our website translation project.
59
- * You can view and contribute to that project here.
60
- *
61
- * @reference https://developer.themoviedb.org/reference/configuration-primary-translations
62
- */
63
- primary_translations(): Promise<string[]>;
64
- /**
65
- * Timezones
66
- * GET - https://api.themoviedb.org/3/configuration/timezones
67
- *
68
- * Get the list of timezones used throughout TMDB.
69
- * @reference https://developer.themoviedb.org/reference/configuration-timezones
70
- */
71
- timezones(): Promise<ConfigurationTimezone[]>;
72
- }