@lorenzopant/tmdb 1.0.4 → 1.0.10
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/.release-it.json +17 -7
- package/package.json +63 -63
- package/.env +0 -1
- package/dist/client.d.ts +0 -8
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -47
- package/dist/endpoints/base.d.ts +0 -20
- package/dist/endpoints/base.d.ts.map +0 -1
- package/dist/endpoints/base.js +0 -33
- package/dist/endpoints/configuration.d.ts +0 -73
- package/dist/endpoints/configuration.d.ts.map +0 -1
- package/dist/endpoints/configuration.js +0 -87
- package/dist/endpoints/movie_lists.d.ts +0 -64
- package/dist/endpoints/movie_lists.d.ts.map +0 -1
- package/dist/endpoints/movie_lists.js +0 -81
- package/dist/endpoints/movies.d.ts +0 -223
- package/dist/endpoints/movies.d.ts.map +0 -1
- package/dist/endpoints/movies.js +0 -279
- package/dist/endpoints/search.d.ts +0 -24
- package/dist/endpoints/search.d.ts.map +0 -1
- package/dist/endpoints/search.js +0 -28
- package/dist/errors/messages.d.ts +0 -16
- package/dist/errors/messages.d.ts.map +0 -1
- package/dist/errors/messages.js +0 -50
- package/dist/errors/tmdb.d.ts +0 -46
- package/dist/errors/tmdb.d.ts.map +0 -1
- package/dist/errors/tmdb.js +0 -43
- package/dist/images/images.d.ts +0 -13
- package/dist/images/images.d.ts.map +0 -1
- package/dist/images/images.js +0 -30
- package/dist/index.d.ts +0 -5
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -23
- package/dist/routes.d.ts +0 -11
- package/dist/routes.d.ts.map +0 -1
- package/dist/routes.js +0 -13
- package/dist/tmdb.d.ts +0 -22
- package/dist/tmdb.d.ts.map +0 -1
- package/dist/tmdb.js +0 -38
- package/dist/types/common.d.ts +0 -114
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/common.js +0 -3
- package/dist/types/configuration.d.ts +0 -31
- package/dist/types/configuration.d.ts.map +0 -1
- package/dist/types/configuration.js +0 -2
- package/dist/types/countries.d.ts +0 -8
- package/dist/types/countries.d.ts.map +0 -1
- package/dist/types/countries.js +0 -1260
- package/dist/types/enums.d.ts +0 -9
- package/dist/types/enums.d.ts.map +0 -1
- package/dist/types/enums.js +0 -12
- package/dist/types/images.d.ts +0 -14
- package/dist/types/images.d.ts.map +0 -1
- package/dist/types/images.js +0 -16
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -24
- package/dist/types/intl.d.ts +0 -2
- package/dist/types/intl.d.ts.map +0 -1
- package/dist/types/intl.js +0 -2
- package/dist/types/lang.d.ts +0 -12
- package/dist/types/lang.d.ts.map +0 -1
- package/dist/types/lang.js +0 -940
- package/dist/types/movies.d.ts +0 -172
- package/dist/types/movies.d.ts.map +0 -1
- package/dist/types/movies.js +0 -3
- package/dist/types/params.d.ts +0 -67
- package/dist/types/params.d.ts.map +0 -1
- package/dist/types/params.js +0 -2
- package/dist/types/utility.d.ts +0 -41
- package/dist/types/utility.d.ts.map +0 -1
- package/dist/types/utility.js +0 -2
package/.release-it.json
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"plugins": {
|
|
3
|
+
"release-it-pnpm": {}
|
|
4
|
+
},
|
|
5
|
+
"github": {
|
|
6
|
+
"release": true
|
|
7
|
+
},
|
|
8
|
+
"git": {
|
|
9
|
+
"commitMessage": "chore: release v${version}",
|
|
10
|
+
"release": true
|
|
11
|
+
},
|
|
12
|
+
"npm": {
|
|
13
|
+
"skipChecks": true
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
}
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
2
|
+
"name": "@lorenzopant/tmdb",
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "A completely type-safe The Movie Database (TMDB) API wrapper for typescript applications.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/lorenzopant/tmdb"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://lorenzopant-docs.vercel.app/",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/lorenzopant/tmdb/issues"
|
|
14
|
+
},
|
|
15
|
+
"author": "Lorenzo Pantano",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"keywords": [
|
|
18
|
+
"tmdb",
|
|
19
|
+
"typescript",
|
|
20
|
+
"api",
|
|
21
|
+
"movies"
|
|
22
|
+
],
|
|
23
|
+
"packageManager": "pnpm@8.8.0",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@eslint/compat": "^2.0.0",
|
|
26
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
27
|
+
"@eslint/js": "^9.30.0",
|
|
28
|
+
"@types/node": "^22.15.2",
|
|
29
|
+
"@typescript-eslint/eslint-plugin": "^8.35.0",
|
|
30
|
+
"@typescript-eslint/parser": "^8.35.0",
|
|
31
|
+
"@vitest/coverage-v8": "^4.0.9",
|
|
32
|
+
"@vitest/ui": "^4.0.10",
|
|
33
|
+
"dotenv": "^16.5.0",
|
|
34
|
+
"eslint": "^9.30.0",
|
|
35
|
+
"eslint-config-prettier": "^10.1.5",
|
|
36
|
+
"eslint-plugin-import": "^2.32.0",
|
|
37
|
+
"husky": "^9.1.7",
|
|
38
|
+
"release-it": "^19.0.3",
|
|
39
|
+
"release-it-pnpm": "^4.6.6",
|
|
40
|
+
"typescript": "^5.8.3",
|
|
41
|
+
"typescript-eslint": "^8.35.0",
|
|
42
|
+
"vite": "^7.0.0",
|
|
43
|
+
"vitest": "^4.0.9"
|
|
44
|
+
},
|
|
45
|
+
"exports": {
|
|
46
|
+
".": {
|
|
47
|
+
"import": "./dist/index.js",
|
|
48
|
+
"types": "./dist/index.d.ts"
|
|
49
|
+
},
|
|
50
|
+
"./types": {
|
|
51
|
+
"types": "./dist/types/index.d.ts",
|
|
52
|
+
"default": "./dist/types/index.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"build": "tsc",
|
|
57
|
+
"build:watch": "tsc --watch",
|
|
58
|
+
"test": "vitest",
|
|
59
|
+
"test:ui": "vitest --ui",
|
|
60
|
+
"test:coverage": "vitest --coverage",
|
|
61
|
+
"lint": "eslint .",
|
|
62
|
+
"patch": "npm version patch && npm publish"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/.env
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
TMDB_ACCESS_TOKEN=eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiJlYWQ5ZGI4NTUwYmNlM2RmYmNmZTQ3YjRjNWU2ZGI3OSIsIm5iZiI6MTYxMjE5OTAwOC4xMDcsInN1YiI6IjYwMTgzNDYwYmIxMDU3MDAzZjk1ZThlZCIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.-hv_iM_NKC9UWl3XgD8W-E6jzVo5bw8yUcW_rCCpJbU
|
package/dist/client.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export declare class ApiClient {
|
|
2
|
-
private accessToken;
|
|
3
|
-
private baseUrl;
|
|
4
|
-
constructor(accessToken: string);
|
|
5
|
-
request<T>(endpoint: string, params?: Record<string, unknown | undefined>): Promise<T>;
|
|
6
|
-
private handleError;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,qBAAa,SAAS;IACrB,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,OAAO,CAA0C;gBAE7C,WAAW,EAAE,MAAM;IAIzB,OAAO,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAM,GAAG,OAAO,CAAC,CAAC,CAAC;YAkBlF,WAAW;CAmBzB"}
|
package/dist/client.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiClient = void 0;
|
|
4
|
-
const tmdb_1 = require("./errors/tmdb");
|
|
5
|
-
class ApiClient {
|
|
6
|
-
accessToken;
|
|
7
|
-
baseUrl = "https://api.themoviedb.org/3";
|
|
8
|
-
constructor(accessToken) {
|
|
9
|
-
this.accessToken = accessToken;
|
|
10
|
-
}
|
|
11
|
-
async request(endpoint, params = {}) {
|
|
12
|
-
const url = new URL(`${this.baseUrl}${endpoint}`);
|
|
13
|
-
for (const [key, value] of Object.entries(params)) {
|
|
14
|
-
if (value === undefined)
|
|
15
|
-
continue;
|
|
16
|
-
url.searchParams.append(key, String(value));
|
|
17
|
-
}
|
|
18
|
-
const res = await fetch(url.toString(), {
|
|
19
|
-
headers: {
|
|
20
|
-
Authorization: `Bearer ${this.accessToken}`,
|
|
21
|
-
"Content-Type": "application/json;charset=utf-8",
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
if (!res.ok)
|
|
25
|
-
await this.handleError(res);
|
|
26
|
-
return res.json();
|
|
27
|
-
}
|
|
28
|
-
async handleError(res) {
|
|
29
|
-
let errorMessage = res.statusText;
|
|
30
|
-
let tmdbStatusCode = -1;
|
|
31
|
-
try {
|
|
32
|
-
const errorBody = await res.json();
|
|
33
|
-
if (errorBody && typeof errorBody === "object") {
|
|
34
|
-
const err = errorBody;
|
|
35
|
-
errorMessage = err.status_message || errorMessage;
|
|
36
|
-
tmdbStatusCode = err.status_code || -1;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
catch (error) {
|
|
40
|
-
console.error(`Unknown error: ${error}`);
|
|
41
|
-
// If response is not JSON, fallback to HTTP status text
|
|
42
|
-
}
|
|
43
|
-
const error = new tmdb_1.TMDBError(errorMessage, res.status, tmdbStatusCode);
|
|
44
|
-
throw error;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.ApiClient = ApiClient;
|
package/dist/endpoints/base.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ApiClient } from "../client";
|
|
2
|
-
import { LanguageISO6391, TMDBOptions } from "../types";
|
|
3
|
-
export declare abstract class TMDBAPIBase {
|
|
4
|
-
protected client: ApiClient;
|
|
5
|
-
protected defaultOptions: TMDBOptions;
|
|
6
|
-
constructor(client: ApiClient, defaultOptions?: TMDBOptions);
|
|
7
|
-
/**
|
|
8
|
-
* Merges the endpoint's params with TMDB-wide defaults (language, region).
|
|
9
|
-
* Works only for param types that include optional `language` and `region` fields.
|
|
10
|
-
*/
|
|
11
|
-
protected applyDefaults<T extends object>(params?: T): T | undefined;
|
|
12
|
-
/**
|
|
13
|
-
* Ensures params contains a language: prefer explicit param, fallback to defaultOptions.language.
|
|
14
|
-
* If neither is present, returns the original params unmodified.
|
|
15
|
-
*/
|
|
16
|
-
protected withLanguage<T extends {
|
|
17
|
-
language?: LanguageISO6391;
|
|
18
|
-
}>(params?: T): T | undefined;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=base.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/endpoints/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAExD,8BAAsB,WAAW;IAChC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC;IAC5B,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC;gBAE1B,MAAM,EAAE,SAAS,EAAE,cAAc,GAAE,WAAgB;IAK/D;;;OAGG;IACH,SAAS,CAAC,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;IAIpE;;;OAGG;IACH,SAAS,CAAC,YAAY,CAAC,CAAC,SAAS;QAAE,QAAQ,CAAC,EAAE,eAAe,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS;CAO3F"}
|
package/dist/endpoints/base.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TMDBAPIBase = void 0;
|
|
4
|
-
class TMDBAPIBase {
|
|
5
|
-
client;
|
|
6
|
-
defaultOptions;
|
|
7
|
-
constructor(client, defaultOptions = {}) {
|
|
8
|
-
this.client = client;
|
|
9
|
-
this.defaultOptions = defaultOptions;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Merges the endpoint's params with TMDB-wide defaults (language, region).
|
|
13
|
-
* Works only for param types that include optional `language` and `region` fields.
|
|
14
|
-
*/
|
|
15
|
-
applyDefaults(params) {
|
|
16
|
-
return { ...this.defaultOptions, ...params };
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Ensures params contains a language: prefer explicit param, fallback to defaultOptions.language.
|
|
20
|
-
* If neither is present, returns the original params unmodified.
|
|
21
|
-
*/
|
|
22
|
-
withLanguage(params) {
|
|
23
|
-
if (!params)
|
|
24
|
-
return undefined; // Handle undefined params
|
|
25
|
-
if (params.language !== undefined)
|
|
26
|
-
return params;
|
|
27
|
-
const defaultLang = this.defaultOptions?.language;
|
|
28
|
-
if (defaultLang === undefined)
|
|
29
|
-
return params;
|
|
30
|
-
return { ...params, language: defaultLang };
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.TMDBAPIBase = TMDBAPIBase;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Country } from "../types";
|
|
2
|
-
import { ConfigurationCountriesParams, ConfigurationJob, ConfigurationLanguage, ConfigurationResponse, ConfigurationTimezone } from "../types/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
|
-
get(): 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<Country[]>;
|
|
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
|
-
}
|
|
73
|
-
//# sourceMappingURL=configuration.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../src/endpoints/configuration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EACN,4BAA4B,EAC5B,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC,qBAAa,gBAAiB,SAAQ,WAAW;IAChD;;;;;;;;;OASG;IACG,GAAG,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAI3C;;;;;;;OAOG;IACG,SAAS,CAAC,MAAM,CAAC,EAAE,4BAA4B,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAI1E;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIzC;;;;;;OAMG;IACG,SAAS,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAInD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACG,oBAAoB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/C;;;;;;OAMG;IACG,SAAS,IAAI,OAAO,CAAC,qBAAqB,EAAE,CAAC;CAGnD"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConfigurationAPI = void 0;
|
|
4
|
-
const routes_1 = require("../routes");
|
|
5
|
-
const base_1 = require("./base");
|
|
6
|
-
class ConfigurationAPI extends base_1.TMDBAPIBase {
|
|
7
|
-
/**
|
|
8
|
-
* Details
|
|
9
|
-
* GET - https://api.themoviedb.org/3/configuration
|
|
10
|
-
*
|
|
11
|
-
* Query the API configuration details.
|
|
12
|
-
* The data returned here in the configuration endpoint is designed to provide some of
|
|
13
|
-
* the required information you'll need as you integrate our API.
|
|
14
|
-
* For example, you can get a list of valid image sizes and the valid image address.
|
|
15
|
-
* @reference https://developer.themoviedb.org/reference/configuration-details
|
|
16
|
-
*/
|
|
17
|
-
async get() {
|
|
18
|
-
return this.client.request(routes_1.ENDPOINTS.CONFIGURATION.DETAILS);
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Countries
|
|
22
|
-
* GET - https://api.themoviedb.org/3/configuration/countries
|
|
23
|
-
*
|
|
24
|
-
* Get the list of countries (ISO 3166-1 tags) used throughout TMDB.
|
|
25
|
-
* @param language Language (Defaults to en-US)
|
|
26
|
-
* @reference https://developer.themoviedb.org/reference/configuration-countries
|
|
27
|
-
*/
|
|
28
|
-
async countries(params) {
|
|
29
|
-
return this.client.request(routes_1.ENDPOINTS.CONFIGURATION.COUNTRIES, this.withLanguage(params));
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Jobs
|
|
33
|
-
* GET - https://api.themoviedb.org/3/configuration/jobs
|
|
34
|
-
*
|
|
35
|
-
* Get the list of the jobs and departments used throughout TMDB.
|
|
36
|
-
* @reference https://developer.themoviedb.org/reference/configuration-jobs
|
|
37
|
-
*/
|
|
38
|
-
async jobs() {
|
|
39
|
-
return this.client.request(routes_1.ENDPOINTS.CONFIGURATION.JOBS);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Languages
|
|
43
|
-
* GET - https://api.themoviedb.org/3/configuration/languages
|
|
44
|
-
*
|
|
45
|
-
* Get the list of the languages (ISO 639-1 tags) used throughout TMDB.
|
|
46
|
-
* @reference https://developer.themoviedb.org/reference/configuration-languages
|
|
47
|
-
*/
|
|
48
|
-
async languages() {
|
|
49
|
-
return this.client.request(routes_1.ENDPOINTS.CONFIGURATION.LANGUAGES);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Primary Translations
|
|
53
|
-
* GET - https://api.themoviedb.org/3/configuration/primary_translations
|
|
54
|
-
*
|
|
55
|
-
* Get a list of the officially supported translations on TMDB.
|
|
56
|
-
*
|
|
57
|
-
* While it's technically possible to add a translation in any one of the languages we have added to TMDB
|
|
58
|
-
* (we don't restrict content), the ones listed in this method are the ones
|
|
59
|
-
* we also support for localizing the website with which means they are "primary" translations.
|
|
60
|
-
*
|
|
61
|
-
* These are all specified as IETF tags to identify the languages we use on TMDB. There is one exception which is image languages.
|
|
62
|
-
* They are currently only designated by a ISO-639-1 tag.
|
|
63
|
-
* This is a planned upgrade for the future.
|
|
64
|
-
*
|
|
65
|
-
* We're always open to adding more if you think one should be added.
|
|
66
|
-
* You can ask about getting a new primary translation added by posting on the forums.
|
|
67
|
-
*
|
|
68
|
-
* One more thing to mention, these are the translations that map to our website translation project.
|
|
69
|
-
* You can view and contribute to that project here.
|
|
70
|
-
*
|
|
71
|
-
* @reference https://developer.themoviedb.org/reference/configuration-primary-translations
|
|
72
|
-
*/
|
|
73
|
-
async primary_translations() {
|
|
74
|
-
return this.client.request(routes_1.ENDPOINTS.CONFIGURATION.PRIMARY_TRANSLATIONS);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Timezones
|
|
78
|
-
* GET - https://api.themoviedb.org/3/configuration/timezones
|
|
79
|
-
*
|
|
80
|
-
* Get the list of timezones used throughout TMDB.
|
|
81
|
-
* @reference https://developer.themoviedb.org/reference/configuration-timezones
|
|
82
|
-
*/
|
|
83
|
-
async timezones() {
|
|
84
|
-
return this.client.request(routes_1.ENDPOINTS.CONFIGURATION.TIMEZONES);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
exports.ConfigurationAPI = ConfigurationAPI;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ApiClient } from "../client";
|
|
2
|
-
import { TMDBOptions } from "../types";
|
|
3
|
-
import { MovieResultItem } from "../types/movies";
|
|
4
|
-
import { MovieListParams, PaginatedResponse } from "../types/params";
|
|
5
|
-
export declare enum MovieListEndpoints {
|
|
6
|
-
NOW_PLAYING = "/now_playing",
|
|
7
|
-
POPULAR = "/popular",
|
|
8
|
-
TOP_RATED = "/top_rated",
|
|
9
|
-
UPCOMING = "/upcoming"
|
|
10
|
-
}
|
|
11
|
-
export declare class MovieListsAPI {
|
|
12
|
-
private client;
|
|
13
|
-
private defaultOptions;
|
|
14
|
-
constructor(client: ApiClient, defaultOptions?: TMDBOptions);
|
|
15
|
-
private withDefaults;
|
|
16
|
-
/**
|
|
17
|
-
* Fetch Movie List Wrapper
|
|
18
|
-
* @param endpoint Endpoint to call
|
|
19
|
-
* @param params Params for the request (language, page, region, etc)
|
|
20
|
-
* @returns Specific to endpoint (MovieListResult)
|
|
21
|
-
*/
|
|
22
|
-
private fetch_movie_list;
|
|
23
|
-
/**
|
|
24
|
-
* Now Playing
|
|
25
|
-
* GET - https://api.themoviedb.org/3/movie/now_playing
|
|
26
|
-
*
|
|
27
|
-
* Get a list of movies that are currently in theatres.
|
|
28
|
-
* @param language Language (Defaults to en-US or TMDB default)
|
|
29
|
-
* @param page Page (Defaults to 1)
|
|
30
|
-
* @param region ISO-3166-1 code
|
|
31
|
-
*/
|
|
32
|
-
now_playing(params?: MovieListParams): Promise<PaginatedResponse<MovieResultItem>>;
|
|
33
|
-
/**
|
|
34
|
-
* Popular
|
|
35
|
-
* GET - https://api.themoviedb.org/3/movie/popular
|
|
36
|
-
*
|
|
37
|
-
* Get a list of movies ordered by popularity.
|
|
38
|
-
* @param language Language (Defaults to en-US or TMDB default)
|
|
39
|
-
* @param page Page (Defaults to 1)
|
|
40
|
-
* @param region ISO-3166-1 code
|
|
41
|
-
*/
|
|
42
|
-
popular(params?: MovieListParams): Promise<PaginatedResponse<MovieResultItem>>;
|
|
43
|
-
/**
|
|
44
|
-
* Top Rated
|
|
45
|
-
* GET - https://api.themoviedb.org/3/movie/top_rated
|
|
46
|
-
*
|
|
47
|
-
* Get a list of movies ordered by rating.
|
|
48
|
-
* @param language Language (Defaults to en-US or TMDB default)
|
|
49
|
-
* @param page Page (Defaults to 1)
|
|
50
|
-
* @param region ISO-3166-1 code
|
|
51
|
-
*/
|
|
52
|
-
top_rated(params?: MovieListParams): Promise<PaginatedResponse<MovieResultItem>>;
|
|
53
|
-
/**
|
|
54
|
-
* Upcoming
|
|
55
|
-
* GET - https://api.themoviedb.org/3/movie/upcoming
|
|
56
|
-
*
|
|
57
|
-
* Get a list of movies that are being released soon.
|
|
58
|
-
* @param language Language (Defaults to en-US or TMDB default)
|
|
59
|
-
* @param page Page (Defaults to 1)
|
|
60
|
-
* @param region ISO-3166-1 code
|
|
61
|
-
*/
|
|
62
|
-
upcoming(params?: MovieListParams): Promise<PaginatedResponse<MovieResultItem>>;
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=movie_lists.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"movie_lists.d.ts","sourceRoot":"","sources":["../../src/endpoints/movie_lists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAIrE,oBAAY,kBAAkB;IAC7B,WAAW,iBAAiB;IAC5B,OAAO,aAAa;IACpB,SAAS,eAAe;IACxB,QAAQ,cAAc;CACtB;AAED,qBAAa,aAAa;IACzB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,cAAc,CAAc;gBAExB,MAAM,EAAE,SAAS,EAAE,cAAc,GAAE,WAAgB;IAK/D,OAAO,CAAC,YAAY;IAKpB;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB;IAIxB;;;;;;;;OAQG;IACG,WAAW,CAAC,MAAM,GAAE,eAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAI5F;;;;;;;;OAQG;IACG,OAAO,CAAC,MAAM,GAAE,eAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAIxF;;;;;;;;OAQG;IACG,SAAS,CAAC,MAAM,GAAE,eAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAI1F;;;;;;;;OAQG;IACG,QAAQ,CAAC,MAAM,GAAE,eAAoB,GAAG,OAAO,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;CAGzF"}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MovieListsAPI = exports.MovieListEndpoints = void 0;
|
|
4
|
-
const movies_1 = require("./movies");
|
|
5
|
-
var MovieListEndpoints;
|
|
6
|
-
(function (MovieListEndpoints) {
|
|
7
|
-
MovieListEndpoints["NOW_PLAYING"] = "/now_playing";
|
|
8
|
-
MovieListEndpoints["POPULAR"] = "/popular";
|
|
9
|
-
MovieListEndpoints["TOP_RATED"] = "/top_rated";
|
|
10
|
-
MovieListEndpoints["UPCOMING"] = "/upcoming";
|
|
11
|
-
})(MovieListEndpoints || (exports.MovieListEndpoints = MovieListEndpoints = {}));
|
|
12
|
-
class MovieListsAPI {
|
|
13
|
-
client;
|
|
14
|
-
defaultOptions;
|
|
15
|
-
constructor(client, defaultOptions = {}) {
|
|
16
|
-
this.client = client;
|
|
17
|
-
this.defaultOptions = defaultOptions;
|
|
18
|
-
}
|
|
19
|
-
withDefaults(params) {
|
|
20
|
-
const { language = this.defaultOptions.language, region = this.defaultOptions.region, ...rest } = params;
|
|
21
|
-
return { language, region, ...rest };
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Fetch Movie List Wrapper
|
|
25
|
-
* @param endpoint Endpoint to call
|
|
26
|
-
* @param params Params for the request (language, page, region, etc)
|
|
27
|
-
* @returns Specific to endpoint (MovieListResult)
|
|
28
|
-
*/
|
|
29
|
-
fetch_movie_list(endpoint, params = {}) {
|
|
30
|
-
return this.client.request(movies_1.MOVIE_ENDPOINTS.MOVIE + endpoint, this.withDefaults(params));
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Now Playing
|
|
34
|
-
* GET - https://api.themoviedb.org/3/movie/now_playing
|
|
35
|
-
*
|
|
36
|
-
* Get a list of movies that are currently in theatres.
|
|
37
|
-
* @param language Language (Defaults to en-US or TMDB default)
|
|
38
|
-
* @param page Page (Defaults to 1)
|
|
39
|
-
* @param region ISO-3166-1 code
|
|
40
|
-
*/
|
|
41
|
-
async now_playing(params = {}) {
|
|
42
|
-
return this.fetch_movie_list(MovieListEndpoints.NOW_PLAYING, params);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Popular
|
|
46
|
-
* GET - https://api.themoviedb.org/3/movie/popular
|
|
47
|
-
*
|
|
48
|
-
* Get a list of movies ordered by popularity.
|
|
49
|
-
* @param language Language (Defaults to en-US or TMDB default)
|
|
50
|
-
* @param page Page (Defaults to 1)
|
|
51
|
-
* @param region ISO-3166-1 code
|
|
52
|
-
*/
|
|
53
|
-
async popular(params = {}) {
|
|
54
|
-
return this.fetch_movie_list(MovieListEndpoints.POPULAR, params);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Top Rated
|
|
58
|
-
* GET - https://api.themoviedb.org/3/movie/top_rated
|
|
59
|
-
*
|
|
60
|
-
* Get a list of movies ordered by rating.
|
|
61
|
-
* @param language Language (Defaults to en-US or TMDB default)
|
|
62
|
-
* @param page Page (Defaults to 1)
|
|
63
|
-
* @param region ISO-3166-1 code
|
|
64
|
-
*/
|
|
65
|
-
async top_rated(params = {}) {
|
|
66
|
-
return this.fetch_movie_list(MovieListEndpoints.TOP_RATED, params);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Upcoming
|
|
70
|
-
* GET - https://api.themoviedb.org/3/movie/upcoming
|
|
71
|
-
*
|
|
72
|
-
* Get a list of movies that are being released soon.
|
|
73
|
-
* @param language Language (Defaults to en-US or TMDB default)
|
|
74
|
-
* @param page Page (Defaults to 1)
|
|
75
|
-
* @param region ISO-3166-1 code
|
|
76
|
-
*/
|
|
77
|
-
async upcoming(params = {}) {
|
|
78
|
-
return this.fetch_movie_list(MovieListEndpoints.UPCOMING, params);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
exports.MovieListsAPI = MovieListsAPI;
|