@tdanks2000/tmdb-wrapper 1.0.0 → 1.0.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 +11 -0
- package/dist/@types/endpoints/configuration.d.ts +1 -0
- package/dist/@types/endpoints/configuration.d.ts.map +1 -1
- package/dist/@types/endpoints/discover.d.ts +53 -0
- package/dist/@types/endpoints/discover.d.ts.map +1 -1
- package/dist/@types/endpoints/genre.d.ts +7 -0
- package/dist/@types/endpoints/genre.d.ts.map +1 -0
- package/dist/@types/endpoints/genre.js +2 -0
- package/dist/@types/endpoints/index.d.ts +1 -0
- package/dist/@types/endpoints/index.d.ts.map +1 -1
- package/dist/@types/endpoints/index.js +1 -0
- package/dist/@types/endpoints/movies.d.ts +7 -1
- package/dist/@types/endpoints/movies.d.ts.map +1 -1
- package/dist/@types/endpoints/search.d.ts +24 -1
- package/dist/@types/endpoints/search.d.ts.map +1 -1
- package/dist/@types/endpoints/tvEpisode.d.ts +13 -1
- package/dist/@types/endpoints/tvEpisode.d.ts.map +1 -1
- package/dist/@types/endpoints/tvSeasons.d.ts +13 -1
- package/dist/@types/endpoints/tvSeasons.d.ts.map +1 -1
- package/dist/@types/models/baseEndpoint.d.ts +1 -1
- package/dist/@types/models/baseEndpoint.js +1 -1
- package/dist/endpoints/account.d.ts +12 -1
- package/dist/endpoints/account.d.ts.map +1 -1
- package/dist/endpoints/account.js +12 -1
- package/dist/endpoints/certification.d.ts +16 -1
- package/dist/endpoints/certification.d.ts.map +1 -1
- package/dist/endpoints/certification.js +16 -1
- package/dist/endpoints/changes.d.ts +23 -1
- package/dist/endpoints/changes.d.ts.map +1 -1
- package/dist/endpoints/changes.js +26 -4
- package/dist/endpoints/collections.d.ts +26 -1
- package/dist/endpoints/collections.d.ts.map +1 -1
- package/dist/endpoints/collections.js +26 -1
- package/dist/endpoints/companies.d.ts +23 -1
- package/dist/endpoints/companies.d.ts.map +1 -1
- package/dist/endpoints/companies.js +23 -1
- package/dist/endpoints/configuration.d.ts +12 -1
- package/dist/endpoints/configuration.d.ts.map +1 -1
- package/dist/endpoints/configuration.js +12 -1
- package/dist/endpoints/credits.d.ts +13 -1
- package/dist/endpoints/credits.d.ts.map +1 -1
- package/dist/endpoints/credits.js +13 -1
- package/dist/endpoints/discover.d.ts +18 -55
- package/dist/endpoints/discover.d.ts.map +1 -1
- package/dist/endpoints/discover.js +18 -1
- package/dist/endpoints/find.d.ts +14 -1
- package/dist/endpoints/find.d.ts.map +1 -1
- package/dist/endpoints/find.js +14 -1
- package/dist/endpoints/genre.d.ts +18 -7
- package/dist/endpoints/genre.d.ts.map +1 -1
- package/dist/endpoints/genre.js +18 -1
- package/dist/endpoints/keywords.d.ts +19 -1
- package/dist/endpoints/keywords.d.ts.map +1 -1
- package/dist/endpoints/keywords.js +22 -4
- package/dist/endpoints/movies.d.ts +115 -9
- package/dist/endpoints/movies.d.ts.map +1 -1
- package/dist/endpoints/movies.js +115 -3
- package/dist/endpoints/networks.d.ts +23 -1
- package/dist/endpoints/networks.d.ts.map +1 -1
- package/dist/endpoints/networks.js +23 -1
- package/dist/endpoints/people.d.ts +69 -1
- package/dist/endpoints/people.d.ts.map +1 -1
- package/dist/endpoints/people.js +69 -1
- package/dist/endpoints/review.d.ts +13 -1
- package/dist/endpoints/review.d.ts.map +1 -1
- package/dist/endpoints/review.js +13 -1
- package/dist/endpoints/search.d.ts +43 -24
- package/dist/endpoints/search.d.ts.map +1 -1
- package/dist/endpoints/search.js +43 -1
- package/dist/endpoints/trending.d.ts +17 -2
- package/dist/endpoints/trending.d.ts.map +1 -1
- package/dist/endpoints/trending.js +16 -1
- package/dist/endpoints/tvEpisodes.d.ts +48 -11
- package/dist/endpoints/tvEpisodes.d.ts.map +1 -1
- package/dist/endpoints/tvEpisodes.js +50 -1
- package/dist/endpoints/tvSeasons.d.ts +56 -11
- package/dist/endpoints/tvSeasons.d.ts.map +1 -1
- package/dist/endpoints/tvSeasons.js +58 -1
- package/dist/endpoints/tvShows.d.ts +135 -4
- package/dist/endpoints/tvShows.d.ts.map +1 -1
- package/dist/endpoints/tvShows.js +134 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +4 -3
- package/src/@types/endpoints/configuration.ts +1 -0
- package/src/@types/endpoints/discover.ts +56 -0
- package/src/@types/endpoints/genre.ts +3 -0
- package/src/@types/endpoints/index.ts +1 -0
- package/src/@types/endpoints/movies.ts +8 -1
- package/src/@types/endpoints/search.ts +30 -1
- package/src/@types/endpoints/tvEpisode.ts +15 -1
- package/src/@types/endpoints/tvSeasons.ts +15 -1
- package/src/endpoints/account.ts +11 -0
- package/src/endpoints/certification.ts +15 -0
- package/src/endpoints/changes.ts +25 -3
- package/src/endpoints/collections.ts +25 -0
- package/src/endpoints/companies.ts +22 -0
- package/src/endpoints/configuration.ts +11 -0
- package/src/endpoints/credits.ts +12 -0
- package/src/endpoints/discover.ts +24 -57
- package/src/endpoints/find.ts +13 -0
- package/src/endpoints/genre.ts +18 -5
- package/src/endpoints/keywords.ts +21 -3
- package/src/endpoints/movies.ts +114 -8
- package/src/endpoints/networks.ts +22 -0
- package/src/endpoints/people.ts +68 -0
- package/src/endpoints/review.ts +12 -0
- package/src/endpoints/search.ts +47 -32
- package/src/endpoints/trending.ts +17 -2
- package/src/endpoints/tvEpisodes.ts +50 -13
- package/src/endpoints/tvSeasons.ts +58 -13
- package/src/endpoints/tvShows.ts +138 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountEndpoint, CertificationEndpoint, ChangeEndpoint, CollectionsEndpoint, ConfigurationEndpoint, CreditsEndpoint, DiscoverEndpoint, FindEndpoint, GenreEndpoint, KeywordsEndpoint, MoviesEndpoint, PeopleEndpoint, ReviewEndpoint, SearchEndpoint, TrendingEndpoint, TvEpisodesEndpoint, TvSeasonsEndpoint, TvShowsEndpoint } from '
|
|
1
|
+
import { AccountEndpoint, CertificationEndpoint, ChangeEndpoint, CollectionsEndpoint, ConfigurationEndpoint, CreditsEndpoint, DiscoverEndpoint, FindEndpoint, GenreEndpoint, KeywordsEndpoint, MoviesEndpoint, PeopleEndpoint, ReviewEndpoint, SearchEndpoint, TrendingEndpoint, TvEpisodesEndpoint, TvSeasonsEndpoint, TvShowsEndpoint } from './endpoints';
|
|
2
2
|
declare class TMDB {
|
|
3
3
|
constructor(access_token: string);
|
|
4
4
|
account: AccountEndpoint;
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.TMDB = void 0;
|
|
18
|
-
const endpoints_1 = require("
|
|
18
|
+
const endpoints_1 = require("./endpoints");
|
|
19
19
|
class TMDB {
|
|
20
20
|
constructor(access_token) {
|
|
21
21
|
this.account = new endpoints_1.AccountEndpoint(access_token);
|
package/package.json
CHANGED
|
@@ -27,14 +27,15 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"private": false,
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "
|
|
30
|
+
"build": "pnpm tsc && pnpm tsc-alias",
|
|
31
31
|
"release": "yarn version && npm publish",
|
|
32
|
-
"preversion": "
|
|
32
|
+
"preversion": "pnpm run build"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^20.11.20",
|
|
36
36
|
"ts-node": "^10.9.2",
|
|
37
|
+
"tsc-alias": "^1.8.8",
|
|
37
38
|
"typescript": "^5.3.3"
|
|
38
39
|
},
|
|
39
|
-
"version": "1.0.
|
|
40
|
+
"version": "1.0.2"
|
|
40
41
|
}
|
|
@@ -29,3 +29,59 @@ export interface TvShowDiscoverResult {
|
|
|
29
29
|
total_results: number;
|
|
30
30
|
total_pages: number;
|
|
31
31
|
}
|
|
32
|
+
|
|
33
|
+
export interface DiscoverQueryOptions {
|
|
34
|
+
language?: string;
|
|
35
|
+
sort_by?: SortOption;
|
|
36
|
+
page?: number;
|
|
37
|
+
'vote_average.gte'?: number;
|
|
38
|
+
'vote_count.gte'?: number;
|
|
39
|
+
'vote_count.lte'?: number;
|
|
40
|
+
'vote_average.lte'?: number;
|
|
41
|
+
with_watch_providers?: string;
|
|
42
|
+
watch_region?: string;
|
|
43
|
+
without_companies?: string;
|
|
44
|
+
with_watch_monetization_types?: 'flatrate' | 'free' | 'ads' | 'rent' | 'buy';
|
|
45
|
+
'with_runtime.gte'?: number;
|
|
46
|
+
'with_runtime.lte'?: number;
|
|
47
|
+
with_genres?: string;
|
|
48
|
+
without_genres?: string;
|
|
49
|
+
with_original_language?: string;
|
|
50
|
+
without_keywords?: string;
|
|
51
|
+
with_keywords?: string;
|
|
52
|
+
with_companies?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface MovieQueryOptions extends DiscoverQueryOptions {
|
|
56
|
+
region?: string;
|
|
57
|
+
certification_country?: string;
|
|
58
|
+
certification?: string;
|
|
59
|
+
'certification.lte'?: string;
|
|
60
|
+
'certification.gte'?: string;
|
|
61
|
+
include_adult?: boolean;
|
|
62
|
+
include_video?: boolean;
|
|
63
|
+
primary_release_year?: number;
|
|
64
|
+
'primary_release_date.gte'?: string;
|
|
65
|
+
'primary_release_date.lte'?: string;
|
|
66
|
+
'release_date.gte'?: string;
|
|
67
|
+
'release_date.lte'?: string;
|
|
68
|
+
with_release_type?: string;
|
|
69
|
+
year?: number;
|
|
70
|
+
with_cast?: string;
|
|
71
|
+
with_crew?: string;
|
|
72
|
+
with_people?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface TvShowQueryOptions extends DiscoverQueryOptions {
|
|
76
|
+
'air_date.gte'?: string;
|
|
77
|
+
'air_date.lte'?: string;
|
|
78
|
+
'first_air_date.gte'?: string;
|
|
79
|
+
'first_air_date.lte'?: string;
|
|
80
|
+
first_air_date_year?: number;
|
|
81
|
+
timezone?: string;
|
|
82
|
+
with_networks?: string;
|
|
83
|
+
include_null_first_air_dates?: boolean;
|
|
84
|
+
screened_theatrically?: boolean;
|
|
85
|
+
with_status?: string;
|
|
86
|
+
with_type?: string;
|
|
87
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Genre, Movie, ProductionCompany, ProductionCountry, SpokenLanguage } from '..';
|
|
1
|
+
import { Genre, LanguageOption, Movie, ProductionCompany, ProductionCountry, SpokenLanguage } from '..';
|
|
2
2
|
|
|
3
3
|
export interface BelongsToCollection {
|
|
4
4
|
id: number;
|
|
@@ -160,3 +160,10 @@ export type MovieChangeValue =
|
|
|
160
160
|
credit_id: string;
|
|
161
161
|
}
|
|
162
162
|
| unknown;
|
|
163
|
+
|
|
164
|
+
export interface MoviesImageSearchOptions extends LanguageOption {
|
|
165
|
+
/**
|
|
166
|
+
* a list of ISO-639-1 values to query
|
|
167
|
+
*/
|
|
168
|
+
include_image_language?: string[];
|
|
169
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MovieWithMediaType, PersonWithMediaType, TVWithMediaType } from '..';
|
|
1
|
+
import { LanguageOption, MovieWithMediaType, PageOption, PersonWithMediaType, RegionOption, TVWithMediaType } from '..';
|
|
2
2
|
|
|
3
3
|
export interface Search<T> {
|
|
4
4
|
page: number;
|
|
@@ -8,3 +8,32 @@ export interface Search<T> {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export type MultiSearchResult = MovieWithMediaType | TVWithMediaType | PersonWithMediaType;
|
|
11
|
+
|
|
12
|
+
export interface SearchOptions {
|
|
13
|
+
query: string;
|
|
14
|
+
page?: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface MovieSearchOptions extends SearchOptions, LanguageOption, PageOption, RegionOption {
|
|
18
|
+
include_adult?: boolean;
|
|
19
|
+
year?: number;
|
|
20
|
+
primary_release_year?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface CollectionSearchOptions extends SearchOptions, LanguageOption, PageOption, RegionOption {
|
|
24
|
+
include_adult?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface TvSearchOptions extends SearchOptions, LanguageOption, PageOption {
|
|
28
|
+
include_adult?: boolean;
|
|
29
|
+
year?: number;
|
|
30
|
+
first_air_date_year?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface PeopleSearchOptions extends SearchOptions, LanguageOption, PageOption {
|
|
34
|
+
include_adult?: boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface MultiSearchOptions extends SearchOptions, LanguageOption, PageOption {
|
|
38
|
+
include_adult?: boolean;
|
|
39
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Credits, Crew } from '..';
|
|
1
|
+
import { Credits, Crew, LanguageOption } from '..';
|
|
2
2
|
|
|
3
3
|
export interface EpisodeSelection {
|
|
4
4
|
tvShowID: number;
|
|
@@ -56,3 +56,17 @@ export interface TvEpisodeTranslations {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
export type TvEpisodeChangeValue = string | unknown;
|
|
59
|
+
|
|
60
|
+
export interface TvEpisodeImageSearchOptions extends LanguageOption {
|
|
61
|
+
/**
|
|
62
|
+
* a list of ISO-639-1 values to query
|
|
63
|
+
*/
|
|
64
|
+
include_image_language?: string[];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface TvEpisodeVideoSearchOptions extends LanguageOption {
|
|
68
|
+
/**
|
|
69
|
+
* a list of ISO-639-1 values to query
|
|
70
|
+
*/
|
|
71
|
+
include_video_language?: string[];
|
|
72
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Episode } from '..';
|
|
1
|
+
import { Episode, LanguageOption } from '..';
|
|
2
2
|
|
|
3
3
|
export interface SeasonSelection {
|
|
4
4
|
tvShowID: number;
|
|
@@ -21,3 +21,17 @@ export type TvSeasonChangeValue =
|
|
|
21
21
|
episode_id: number;
|
|
22
22
|
episode_number: number;
|
|
23
23
|
};
|
|
24
|
+
|
|
25
|
+
export interface TvSeasonImageSearchOptions extends LanguageOption {
|
|
26
|
+
/**
|
|
27
|
+
* a list of ISO-639-1 values to query
|
|
28
|
+
*/
|
|
29
|
+
include_image_language?: string[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface TvSeasonVideoSearchOptions extends LanguageOption {
|
|
33
|
+
/**
|
|
34
|
+
* a list of ISO-639-1 values to query
|
|
35
|
+
*/
|
|
36
|
+
include_video_language?: string[];
|
|
37
|
+
}
|
package/src/endpoints/account.ts
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { AccountDetails, BaseEndpoint } from '@/@types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents an endpoint for retrieving account details.
|
|
5
|
+
*/
|
|
3
6
|
export class AccountEndpoint extends BaseEndpoint {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new AccountEndpoint instance.
|
|
9
|
+
* @param {string} access_token - The access token used for authentication.
|
|
10
|
+
*/
|
|
4
11
|
constructor(access_token: string) {
|
|
5
12
|
super(access_token);
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves account details asynchronously.
|
|
17
|
+
* @returns {Promise<AccountDetails>} A Promise that resolves with the account details.
|
|
18
|
+
*/
|
|
8
19
|
async details(): Promise<AccountDetails> {
|
|
9
20
|
return await this.api.get('/account');
|
|
10
21
|
}
|
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import { BaseEndpoint, Certifications } from '@/@types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents an endpoint for retrieving certifications for movies and TV shows.
|
|
5
|
+
*/
|
|
3
6
|
export class CertificationEndpoint extends BaseEndpoint {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new CertificationEndpoint instance.
|
|
9
|
+
* @param {string} access_token - The access token used for authentication.
|
|
10
|
+
*/
|
|
4
11
|
constructor(protected readonly access_token: string) {
|
|
5
12
|
super(access_token);
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves certifications for movies asynchronously.
|
|
17
|
+
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for movies.
|
|
18
|
+
*/
|
|
8
19
|
async movies(): Promise<Certifications> {
|
|
9
20
|
return await this.api.get<Certifications>('/certification/movie/list');
|
|
10
21
|
}
|
|
11
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves certifications for TV shows asynchronously.
|
|
25
|
+
* @returns {Promise<Certifications>} A Promise that resolves with the certifications for TV shows.
|
|
26
|
+
*/
|
|
12
27
|
async tv(): Promise<Certifications> {
|
|
13
28
|
return await this.api.get<Certifications>('/certification/tv/list');
|
|
14
29
|
}
|
package/src/endpoints/changes.ts
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
1
1
|
import { BaseEndpoint, ChangeOption, MediaChanges } from '@/@types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents an endpoint for retrieving changes in movies, TV shows, and persons.
|
|
5
|
+
*/
|
|
3
6
|
export class ChangeEndpoint extends BaseEndpoint {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new ChangeEndpoint instance.
|
|
9
|
+
* @param {string} access_token - The access token used for authentication.
|
|
10
|
+
*/
|
|
4
11
|
constructor(protected readonly access_token: string) {
|
|
5
12
|
super(access_token);
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves changes in movies asynchronously.
|
|
17
|
+
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
18
|
+
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in movies.
|
|
19
|
+
*/
|
|
8
20
|
async movies(options?: ChangeOption): Promise<MediaChanges> {
|
|
9
|
-
return await this.api.get<MediaChanges>(
|
|
21
|
+
return await this.api.get<MediaChanges>('/movie/changes', options);
|
|
10
22
|
}
|
|
11
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves changes in TV shows asynchronously.
|
|
26
|
+
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
27
|
+
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes in TV shows.
|
|
28
|
+
*/
|
|
12
29
|
async tv(options?: ChangeOption): Promise<MediaChanges> {
|
|
13
|
-
return await this.api.get<MediaChanges>(
|
|
30
|
+
return await this.api.get<MediaChanges>('/tv/changes', options);
|
|
14
31
|
}
|
|
15
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves changes related to persons asynchronously.
|
|
35
|
+
* @param {ChangeOption} [options] - Optional parameters for filtering the changes.
|
|
36
|
+
* @returns {Promise<MediaChanges>} A Promise that resolves with the changes related to persons.
|
|
37
|
+
*/
|
|
16
38
|
async person(options?: ChangeOption): Promise<MediaChanges> {
|
|
17
|
-
return await this.api.get<MediaChanges>(
|
|
39
|
+
return await this.api.get<MediaChanges>('/person/change', options);
|
|
18
40
|
}
|
|
19
41
|
}
|
|
@@ -9,15 +9,34 @@ import {
|
|
|
9
9
|
|
|
10
10
|
const BASE_COLLECTION = '/collection';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Represents an endpoint for accessing collections and their details.
|
|
14
|
+
*/
|
|
12
15
|
export class CollectionsEndpoint extends BaseEndpoint {
|
|
16
|
+
/**
|
|
17
|
+
* Constructs a new CollectionsEndpoint instance.
|
|
18
|
+
* @param {string} access_token - The access token used for authentication.
|
|
19
|
+
*/
|
|
13
20
|
constructor(protected readonly access_token: string) {
|
|
14
21
|
super(access_token);
|
|
15
22
|
}
|
|
16
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves details of a specific collection asynchronously.
|
|
26
|
+
* @param {number} id - The ID of the collection.
|
|
27
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the language.
|
|
28
|
+
* @returns {Promise<DetailedCollection>} A Promise that resolves with the detailed information of the collection.
|
|
29
|
+
*/
|
|
17
30
|
async details(id: number, options?: LanguageOption): Promise<DetailedCollection> {
|
|
18
31
|
return await this.api.get<DetailedCollection>(`${BASE_COLLECTION}/${id}`, options);
|
|
19
32
|
}
|
|
20
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves images associated with a specific collection asynchronously.
|
|
36
|
+
* @param {number} id - The ID of the collection.
|
|
37
|
+
* @param {CollectionImageOptions} [options] - Optional parameters for specifying image options.
|
|
38
|
+
* @returns {Promise<ImageCollection>} A Promise that resolves with the collection images.
|
|
39
|
+
*/
|
|
21
40
|
async images(id: number, options?: CollectionImageOptions): Promise<ImageCollection> {
|
|
22
41
|
const computedOptions = {
|
|
23
42
|
include_image_language: options?.include_image_language?.join(','),
|
|
@@ -26,6 +45,12 @@ export class CollectionsEndpoint extends BaseEndpoint {
|
|
|
26
45
|
return await this.api.get<ImageCollection>(`${BASE_COLLECTION}/${id}/images`, computedOptions);
|
|
27
46
|
}
|
|
28
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Retrieves translations for a specific collection asynchronously.
|
|
50
|
+
* @param {number} id - The ID of the collection.
|
|
51
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the language.
|
|
52
|
+
* @returns {Promise<Translations>} A Promise that resolves with the translations of the collection.
|
|
53
|
+
*/
|
|
29
54
|
async translations(id: number, options?: LanguageOption): Promise<Translations> {
|
|
30
55
|
return await this.api.get<Translations>(`${BASE_COLLECTION}/${id}/translations`, options);
|
|
31
56
|
}
|
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
import { AlternativeNames, BaseEndpoint, CompanyDetails, CompanyImages } from '@/@types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents an endpoint for accessing company details and related information.
|
|
5
|
+
*/
|
|
3
6
|
export class CompaniesEndpoint extends BaseEndpoint {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new CompaniesEndpoint instance.
|
|
9
|
+
* @param {string} access_token - The access token used for authentication.
|
|
10
|
+
*/
|
|
4
11
|
constructor(protected readonly access_token: string) {
|
|
5
12
|
super(access_token);
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves details of a specific company asynchronously.
|
|
17
|
+
* @param {number} id - The ID of the company.
|
|
18
|
+
* @returns {Promise<CompanyDetails>} A Promise that resolves with the detailed information of the company.
|
|
19
|
+
*/
|
|
8
20
|
async details(id: number): Promise<CompanyDetails> {
|
|
9
21
|
return await this.api.get<CompanyDetails>(`/company/${id}`);
|
|
10
22
|
}
|
|
11
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves alternative names of a specific company asynchronously.
|
|
26
|
+
* @param {number} id - The ID of the company.
|
|
27
|
+
* @returns {Promise<AlternativeNames>} A Promise that resolves with the alternative names of the company.
|
|
28
|
+
*/
|
|
12
29
|
async alternativeNames(id: number): Promise<AlternativeNames> {
|
|
13
30
|
return await this.api.get<AlternativeNames>(`/company/${id}/alternative_names`);
|
|
14
31
|
}
|
|
15
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Retrieves images associated with a specific company asynchronously.
|
|
35
|
+
* @param {number} id - The ID of the company.
|
|
36
|
+
* @returns {Promise<CompanyImages>} A Promise that resolves with the images of the company.
|
|
37
|
+
*/
|
|
16
38
|
async images(id: number): Promise<CompanyImages> {
|
|
17
39
|
return await this.api.get<CompanyImages>(`/company/${id}/images`);
|
|
18
40
|
}
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
import { BaseEndpoint, Configuration } from '@/@types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents an endpoint for retrieving current system configuration.
|
|
5
|
+
*/
|
|
3
6
|
export class ConfigurationEndpoint extends BaseEndpoint {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new ConfigurationEndpoint instance.
|
|
9
|
+
* @param {string} access_token - The access token used for authentication.
|
|
10
|
+
*/
|
|
4
11
|
constructor(protected readonly access_token: string) {
|
|
5
12
|
super(access_token);
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves the current system configuration asynchronously.
|
|
17
|
+
* @returns {Promise<Configuration>} A Promise that resolves with the current system configuration.
|
|
18
|
+
*/
|
|
8
19
|
async getCurrent(): Promise<Configuration> {
|
|
9
20
|
return await this.api.get<Configuration>(`/configuration`);
|
|
10
21
|
}
|
package/src/endpoints/credits.ts
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
import { BaseEndpoint, CreditResponse } from '@/@types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents an endpoint for retrieving credit details.
|
|
5
|
+
*/
|
|
3
6
|
export class CreditsEndpoint extends BaseEndpoint {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new CreditsEndpoint instance.
|
|
9
|
+
* @param {string} access_token - The access token used for authentication.
|
|
10
|
+
*/
|
|
4
11
|
constructor(protected readonly access_token: string) {
|
|
5
12
|
super(access_token);
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves credit details by ID asynchronously.
|
|
17
|
+
* @param {string} id - The ID of the credit.
|
|
18
|
+
* @returns {Promise<CreditResponse>} A Promise that resolves with the credit details.
|
|
19
|
+
*/
|
|
8
20
|
async getById(id: string): Promise<CreditResponse> {
|
|
9
21
|
return await this.api.get<CreditResponse>(`/credit/${id}`);
|
|
10
22
|
}
|
|
@@ -1,72 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BaseEndpoint,
|
|
3
|
+
MovieDiscoverResult,
|
|
4
|
+
MovieQueryOptions,
|
|
5
|
+
TvShowDiscoverResult,
|
|
6
|
+
TvShowQueryOptions,
|
|
7
|
+
} from '@/@types';
|
|
2
8
|
|
|
3
9
|
const BASE_DISCOVER = '/discover';
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
page?: number;
|
|
9
|
-
'vote_average.gte'?: number;
|
|
10
|
-
'vote_count.gte'?: number;
|
|
11
|
-
'vote_count.lte'?: number;
|
|
12
|
-
'vote_average.lte'?: number;
|
|
13
|
-
with_watch_providers?: string;
|
|
14
|
-
watch_region?: string;
|
|
15
|
-
without_companies?: string;
|
|
16
|
-
with_watch_monetization_types?: 'flatrate' | 'free' | 'ads' | 'rent' | 'buy';
|
|
17
|
-
'with_runtime.gte'?: number;
|
|
18
|
-
'with_runtime.lte'?: number;
|
|
19
|
-
with_genres?: string;
|
|
20
|
-
without_genres?: string;
|
|
21
|
-
with_original_language?: string;
|
|
22
|
-
without_keywords?: string;
|
|
23
|
-
with_keywords?: string;
|
|
24
|
-
with_companies?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface MovieQueryOptions extends DiscoverQueryOptions {
|
|
28
|
-
region?: string;
|
|
29
|
-
certification_country?: string;
|
|
30
|
-
certification?: string;
|
|
31
|
-
'certification.lte'?: string;
|
|
32
|
-
'certification.gte'?: string;
|
|
33
|
-
include_adult?: boolean;
|
|
34
|
-
include_video?: boolean;
|
|
35
|
-
primary_release_year?: number;
|
|
36
|
-
'primary_release_date.gte'?: string;
|
|
37
|
-
'primary_release_date.lte'?: string;
|
|
38
|
-
'release_date.gte'?: string;
|
|
39
|
-
'release_date.lte'?: string;
|
|
40
|
-
with_release_type?: string;
|
|
41
|
-
year?: number;
|
|
42
|
-
with_cast?: string;
|
|
43
|
-
with_crew?: string;
|
|
44
|
-
with_people?: string;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface TvShowQueryOptions extends DiscoverQueryOptions {
|
|
48
|
-
'air_date.gte'?: string;
|
|
49
|
-
'air_date.lte'?: string;
|
|
50
|
-
'first_air_date.gte'?: string;
|
|
51
|
-
'first_air_date.lte'?: string;
|
|
52
|
-
first_air_date_year?: number;
|
|
53
|
-
timezone?: string;
|
|
54
|
-
with_networks?: string;
|
|
55
|
-
include_null_first_air_dates?: boolean;
|
|
56
|
-
screened_theatrically?: boolean;
|
|
57
|
-
with_status?: string;
|
|
58
|
-
with_type?: string;
|
|
59
|
-
}
|
|
60
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Represents an endpoint for discovering movies and TV shows based on various criteria.
|
|
13
|
+
*/
|
|
61
14
|
export class DiscoverEndpoint extends BaseEndpoint {
|
|
15
|
+
/**
|
|
16
|
+
* Constructs a new DiscoverEndpoint instance.
|
|
17
|
+
* @param {string} access_token - The access token used for authentication.
|
|
18
|
+
*/
|
|
62
19
|
constructor(access_token: string) {
|
|
63
20
|
super(access_token);
|
|
64
21
|
}
|
|
65
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves a list of movies based on the provided query options asynchronously.
|
|
25
|
+
* @param {MovieQueryOptions} [options] - Optional parameters for refining the movie discovery.
|
|
26
|
+
* @returns {Promise<MovieDiscoverResult>} A Promise that resolves with the movie discovery results.
|
|
27
|
+
*/
|
|
66
28
|
async movie(options?: MovieQueryOptions): Promise<MovieDiscoverResult> {
|
|
67
29
|
return await this.api.get<MovieDiscoverResult>(`${BASE_DISCOVER}/movie`, options);
|
|
68
30
|
}
|
|
69
31
|
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves a list of TV shows based on the provided query options asynchronously.
|
|
34
|
+
* @param {TvShowQueryOptions} [options] - Optional parameters for refining the TV show discovery.
|
|
35
|
+
* @returns {Promise<TvShowDiscoverResult>} A Promise that resolves with the TV show discovery results.
|
|
36
|
+
*/
|
|
70
37
|
async tvShow(options?: TvShowQueryOptions): Promise<TvShowDiscoverResult> {
|
|
71
38
|
return await this.api.get<TvShowDiscoverResult>(`${BASE_DISCOVER}/tv`, options);
|
|
72
39
|
}
|
package/src/endpoints/find.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import { BaseEndpoint, ExternalIdOptions, FindResult } from '@/@types';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents an endpoint for finding media by external ID.
|
|
5
|
+
*/
|
|
3
6
|
export class FindEndpoint extends BaseEndpoint {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new FindEndpoint instance.
|
|
9
|
+
* @param {string} access_token - The access token used for authentication.
|
|
10
|
+
*/
|
|
4
11
|
constructor(access_token: string) {
|
|
5
12
|
super(access_token);
|
|
6
13
|
}
|
|
7
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves media by external ID asynchronously.
|
|
17
|
+
* @param {string} externalId - The external ID of the media.
|
|
18
|
+
* @param {ExternalIdOptions} options - Options for finding media by external ID.
|
|
19
|
+
* @returns {Promise<FindResult>} A Promise that resolves with the result of the find operation.
|
|
20
|
+
*/
|
|
8
21
|
async byId(externalId: string, options: ExternalIdOptions): Promise<FindResult> {
|
|
9
22
|
return await this.api.get<FindResult>(`/find/${externalId}`, options);
|
|
10
23
|
}
|
package/src/endpoints/genre.ts
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
|
-
import { BaseEndpoint, LanguageOption } from '@/@types';
|
|
2
|
-
|
|
3
|
-
export interface Genres {
|
|
4
|
-
genres: Array<{ id: number; name: string }>;
|
|
5
|
-
}
|
|
1
|
+
import { BaseEndpoint, Genres, LanguageOption } from '@/@types';
|
|
6
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Represents an endpoint for retrieving genre information for movies and TV shows.
|
|
5
|
+
*/
|
|
7
6
|
export class GenreEndpoint extends BaseEndpoint {
|
|
7
|
+
/**
|
|
8
|
+
* Constructs a new GenreEndpoint instance.
|
|
9
|
+
* @param {string} access_token - The access token used for authentication.
|
|
10
|
+
*/
|
|
8
11
|
constructor(protected readonly access_token: string) {
|
|
9
12
|
super(access_token);
|
|
10
13
|
}
|
|
11
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Retrieves genre information for movies asynchronously.
|
|
17
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the language.
|
|
18
|
+
* @returns {Promise<Genres>} A Promise that resolves with the genre information for movies.
|
|
19
|
+
*/
|
|
12
20
|
async movies(options?: LanguageOption): Promise<Genres> {
|
|
13
21
|
return await this.api.get<Genres>('/genre/movie/list', options);
|
|
14
22
|
}
|
|
15
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves genre information for TV shows asynchronously.
|
|
26
|
+
* @param {LanguageOption} [options] - Optional parameters for specifying the language.
|
|
27
|
+
* @returns {Promise<Genres>} A Promise that resolves with the genre information for TV shows.
|
|
28
|
+
*/
|
|
16
29
|
async tv(options?: LanguageOption): Promise<Genres> {
|
|
17
30
|
return await this.api.get<Genres>('/genre/tv/list', options);
|
|
18
31
|
}
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import { BaseEndpoint, BelongingMovies, Keyword, KeywordsOptions } from '@/@types';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const BASE_KEYWORD = '/keyword';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Represents an endpoint for accessing keyword details and related movies.
|
|
7
|
+
*/
|
|
5
8
|
export class KeywordsEndpoint extends BaseEndpoint {
|
|
9
|
+
/**
|
|
10
|
+
* Constructs a new KeywordsEndpoint instance.
|
|
11
|
+
* @param {string} access_token - The access token used for authentication.
|
|
12
|
+
*/
|
|
6
13
|
constructor(access_token: string) {
|
|
7
14
|
super(access_token);
|
|
8
15
|
}
|
|
9
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves details of a specific keyword asynchronously.
|
|
19
|
+
* @param {number} keywordId - The ID of the keyword.
|
|
20
|
+
* @returns {Promise<Keyword>} A Promise that resolves with the details of the keyword.
|
|
21
|
+
*/
|
|
10
22
|
async details(keywordId: number): Promise<Keyword> {
|
|
11
|
-
return await this.api.get<Keyword>(`${
|
|
23
|
+
return await this.api.get<Keyword>(`${BASE_KEYWORD}/${keywordId}`);
|
|
12
24
|
}
|
|
13
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Retrieves movies belonging to a specific keyword asynchronously.
|
|
28
|
+
* @param {number} keywordId - The ID of the keyword.
|
|
29
|
+
* @param {KeywordsOptions} [options] - Optional parameters for refining the search.
|
|
30
|
+
* @returns {Promise<BelongingMovies>} A Promise that resolves with the movies belonging to the keyword.
|
|
31
|
+
*/
|
|
14
32
|
async belongingMovies(keywordId: number, options?: KeywordsOptions): Promise<BelongingMovies> {
|
|
15
|
-
return await this.api.get<BelongingMovies>(`${
|
|
33
|
+
return await this.api.get<BelongingMovies>(`${BASE_KEYWORD}/${keywordId}/movies`, options);
|
|
16
34
|
}
|
|
17
35
|
}
|