@lorenzopant/tmdb 0.0.6 → 0.0.8
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/.husky/pre-commit +2 -0
- package/dist/endpoints/movies.d.ts +20 -5
- package/dist/endpoints/movies.js +17 -1
- package/dist/errors/tmdb.d.ts +2 -2
- package/dist/tests/movies/movies.integration.test.js +19 -0
- package/dist/tests/movies/movies.test.js +2 -2
- package/dist/tmdb.d.ts +2 -2
- package/dist/types/common.d.ts +26 -26
- package/dist/types/movies.d.ts +73 -34
- package/dist/types/params.d.ts +23 -21
- package/eslint.config.mjs +6 -0
- package/package.json +15 -5
- package/vitest.config.mts +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ApiClient } from "../client";
|
|
2
2
|
import { TMDBOptions } from "../tmdb";
|
|
3
3
|
import { Changes } from "../types/common";
|
|
4
|
-
import { MovieAlternativeTitles, MovieCredits, MovieDetails, MovieExternalIDs, MovieImages, MovieKeywords, MovieReleaseDates,
|
|
5
|
-
import { MovieAlternativeTitlesParams, MovieChangesParams, MovieCreditsParams, MovieDetailsParams, MovieExternalIDsParams, MovieImagesParams, MovieKeywordsParams, MovieRecommendationsParams, MovieReleaseDatesParams, MovieSimilarParams, MovieTranslationsParams, MovieVideosParams, MovieWathProvidersParams
|
|
4
|
+
import { MovieAlternativeTitles, MovieAppendToResponseNamespace, MovieCredits, MovieDetails, MovieDetailsWithAppends, MovieExternalIDs, MovieImages, MovieKeywords, MovieRecommendations, MovieReleaseDates, MovieReviews, MovieSimilar, MovieTranslations, MovieVideos, MovieWatchProvider } from "../types/movies";
|
|
5
|
+
import { MovieAlternativeTitlesParams, MovieChangesParams, MovieCreditsParams, MovieDetailsParams, MovieExternalIDsParams, MovieImagesParams, MovieKeywordsParams, MovieRecommendationsParams, MovieReleaseDatesParams, MovieReviewsParams, MovieSimilarParams, MovieTranslationsParams, MovieVideosParams, MovieWathProvidersParams } from "../types/params";
|
|
6
6
|
export declare const MOVIE_ENDPOINTS: {
|
|
7
7
|
MOVIE: string;
|
|
8
8
|
ALTERNATIVE_TITLES: string;
|
|
@@ -18,6 +18,7 @@ export declare const MOVIE_ENDPOINTS: {
|
|
|
18
18
|
TRANSLATIONS: string;
|
|
19
19
|
VIDEOS: string;
|
|
20
20
|
WATCH_PROVIDERS: string;
|
|
21
|
+
REVIEWS: string;
|
|
21
22
|
};
|
|
22
23
|
export declare class MoviesAPI {
|
|
23
24
|
private client;
|
|
@@ -34,7 +35,9 @@ export declare class MoviesAPI {
|
|
|
34
35
|
* @returns A promise that resolves to the movie details.
|
|
35
36
|
* @reference https://developer.themoviedb.org/reference/movie-details
|
|
36
37
|
*/
|
|
37
|
-
details(params: MovieDetailsParams
|
|
38
|
+
details<T extends readonly MovieAppendToResponseNamespace[] = []>(params: MovieDetailsParams & {
|
|
39
|
+
append_to_response?: T[number] | T;
|
|
40
|
+
}): Promise<T extends [] ? MovieDetails : MovieDetailsWithAppends<T>>;
|
|
38
41
|
/**
|
|
39
42
|
* Alternative Titles
|
|
40
43
|
* GET - https://api.themoviedb.org/3/movie/{movie_id}/alternative_titles
|
|
@@ -133,7 +136,7 @@ export declare class MoviesAPI {
|
|
|
133
136
|
* @returns A promise that resolves to a paginated response of similar movies.
|
|
134
137
|
* @reference https://developer.themoviedb.org/reference/movie-recommendations
|
|
135
138
|
*/
|
|
136
|
-
recommendations(params: MovieRecommendationsParams): Promise<
|
|
139
|
+
recommendations(params: MovieRecommendationsParams): Promise<MovieRecommendations>;
|
|
137
140
|
/**
|
|
138
141
|
* Release Dates
|
|
139
142
|
* GET - https://api.themoviedb.org/3/movie/{movie_id}/release_dates
|
|
@@ -151,6 +154,18 @@ export declare class MoviesAPI {
|
|
|
151
154
|
* @reference https://developer.themoviedb.org/reference/movie-release-dates
|
|
152
155
|
*/
|
|
153
156
|
release_dates(params: MovieReleaseDatesParams): Promise<MovieReleaseDates>;
|
|
157
|
+
/**
|
|
158
|
+
* Reviews
|
|
159
|
+
* GET - https://api.themoviedb.org/3/movie/{movie_id}/reviews
|
|
160
|
+
*
|
|
161
|
+
* Get the user reviews for a movie.
|
|
162
|
+
* @param movie_id The ID of the movie.
|
|
163
|
+
* @param page Page number of the results to return. Defaults to 1.
|
|
164
|
+
* @param language Language code to filter the results. Default is "en-US".
|
|
165
|
+
* @returns A promise that resolves to a paginated response of movies reviews.
|
|
166
|
+
* @reference https://developer.themoviedb.org/reference/movie-reviews
|
|
167
|
+
*/
|
|
168
|
+
reviews(params: MovieReviewsParams): Promise<MovieReviews>;
|
|
154
169
|
/**
|
|
155
170
|
* Similar
|
|
156
171
|
* GET -https://api.themoviedb.org/3/movie/{movie_id}/similar
|
|
@@ -164,7 +179,7 @@ export declare class MoviesAPI {
|
|
|
164
179
|
* @returns A promise that resolves to a paginated response of similar movies.
|
|
165
180
|
* @reference https://developer.themoviedb.org/reference/movie-similar
|
|
166
181
|
*/
|
|
167
|
-
similar(params: MovieSimilarParams): Promise<
|
|
182
|
+
similar(params: MovieSimilarParams): Promise<MovieSimilar>;
|
|
168
183
|
/**
|
|
169
184
|
* Translations
|
|
170
185
|
* GET - https://api.themoviedb.org/3/movie/{movie_id}/translations
|
package/dist/endpoints/movies.js
CHANGED
|
@@ -13,10 +13,10 @@ export const MOVIE_ENDPOINTS = {
|
|
|
13
13
|
TRANSLATIONS: "/translations",
|
|
14
14
|
VIDEOS: "/videos",
|
|
15
15
|
WATCH_PROVIDERS: "/watch/providers",
|
|
16
|
+
REVIEWS: "/reviews",
|
|
16
17
|
// Missing:
|
|
17
18
|
// ACCOUNT_STATES
|
|
18
19
|
// LISTS
|
|
19
|
-
// REVIEWS
|
|
20
20
|
// ADD RATING
|
|
21
21
|
// DELETE RATING
|
|
22
22
|
};
|
|
@@ -189,6 +189,22 @@ export class MoviesAPI {
|
|
|
189
189
|
const endpoint = `${MOVIE_ENDPOINTS.MOVIE}/${params.movie_id}${MOVIE_ENDPOINTS.RELEASE_DATES}`;
|
|
190
190
|
return this.client.request(endpoint);
|
|
191
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Reviews
|
|
194
|
+
* GET - https://api.themoviedb.org/3/movie/{movie_id}/reviews
|
|
195
|
+
*
|
|
196
|
+
* Get the user reviews for a movie.
|
|
197
|
+
* @param movie_id The ID of the movie.
|
|
198
|
+
* @param page Page number of the results to return. Defaults to 1.
|
|
199
|
+
* @param language Language code to filter the results. Default is "en-US".
|
|
200
|
+
* @returns A promise that resolves to a paginated response of movies reviews.
|
|
201
|
+
* @reference https://developer.themoviedb.org/reference/movie-reviews
|
|
202
|
+
*/
|
|
203
|
+
async reviews(params) {
|
|
204
|
+
const { language = this.defaultOptions.language, ...rest } = params;
|
|
205
|
+
const endpoint = `${MOVIE_ENDPOINTS.MOVIE}/${params.movie_id}${MOVIE_ENDPOINTS.REVIEWS}`;
|
|
206
|
+
return this.client.request(endpoint, { language, ...rest });
|
|
207
|
+
}
|
|
192
208
|
/**
|
|
193
209
|
* Similar
|
|
194
210
|
* GET -https://api.themoviedb.org/3/movie/{movie_id}/similar
|
package/dist/errors/tmdb.d.ts
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* @property status_code - The numeric code representing the type of error encountered.
|
|
6
6
|
* @property status_message - A descriptive message providing details about the error.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
8
|
+
export interface TMDBAPIErrorResponse {
|
|
9
9
|
success: boolean;
|
|
10
10
|
status_code: number;
|
|
11
11
|
status_message: string;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
/**
|
|
14
14
|
* Represents a generic error or an error specific to the TMDB (The Movie Database) API.
|
|
15
15
|
* This error class extends the built-in `Error` class and includes additional
|
|
@@ -25,6 +25,15 @@ describe("Movies (integration)", () => {
|
|
|
25
25
|
expect(error).toBeInstanceOf(TMDBError);
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
|
+
it("(MOVIE DETAILS) should get movie details with appended response", async () => {
|
|
29
|
+
const movie_id = 550; // Fight Club
|
|
30
|
+
const movie = await tmdb.movies.details({ movie_id, append_to_response: ["reviews"] });
|
|
31
|
+
expect(movie).toBeDefined();
|
|
32
|
+
expect(movie.id).toBe(movie_id);
|
|
33
|
+
expect(movie.title).toBe("Fight Club");
|
|
34
|
+
expect(movie.reviews.results).toBeDefined();
|
|
35
|
+
expect(movie.reviews.results.length).toBeGreaterThanOrEqual(0);
|
|
36
|
+
});
|
|
28
37
|
it("(MOVIE ALTERNATIVE TITLES) should get movie alternative titles", async () => {
|
|
29
38
|
const movie_id = 550; // Fight Club
|
|
30
39
|
const movie_titles = await tmdb.movies.alternative_titles({ movie_id });
|
|
@@ -106,6 +115,16 @@ describe("Movies (integration)", () => {
|
|
|
106
115
|
expect(release_dates.results[0].iso_3166_1).toBeDefined();
|
|
107
116
|
expect(release_dates.results[0].release_dates.length).toBeGreaterThan(0);
|
|
108
117
|
});
|
|
118
|
+
it("(MOVIE REVIEWS) should get movie reviews", async () => {
|
|
119
|
+
const movie_id = 550; // Fight Club
|
|
120
|
+
const reviews = await tmdb.movies.reviews({ movie_id });
|
|
121
|
+
expect(reviews).toBeDefined();
|
|
122
|
+
expect(reviews.results.length).toBeGreaterThan(0);
|
|
123
|
+
expect(reviews.results[0].id).toBeDefined();
|
|
124
|
+
expect(reviews.page).toBe(1);
|
|
125
|
+
expect(reviews.total_results).toBeGreaterThan(0);
|
|
126
|
+
expect(reviews.total_pages).toBeGreaterThan(0);
|
|
127
|
+
});
|
|
109
128
|
it("(MOVIE SIMILAR) should get similar movies", async () => {
|
|
110
129
|
const movie_id = 550;
|
|
111
130
|
const similar = await tmdb.movies.similar({ movie_id });
|
|
@@ -13,9 +13,9 @@ describe("MoviesAPI", () => {
|
|
|
13
13
|
});
|
|
14
14
|
it("should call client.request with the correct parameters", async () => {
|
|
15
15
|
const movie_id = 550;
|
|
16
|
-
const append_to_response = ["credits", "images"];
|
|
17
16
|
const language = "en";
|
|
18
|
-
|
|
17
|
+
const append_to_response = ["credits", "images"];
|
|
18
|
+
await moviesAPI.details({ movie_id, language, append_to_response });
|
|
19
19
|
expect(clientMock.request).toHaveBeenCalledOnce();
|
|
20
20
|
expect(clientMock.request).toHaveBeenCalledWith("/movie/550", {
|
|
21
21
|
movie_id,
|
package/dist/tmdb.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { MoviesAPI } from "./endpoints/movies";
|
|
|
3
3
|
import { SearchAPI } from "./endpoints/search";
|
|
4
4
|
import { CountryISO3166_1 } from "./types/countries";
|
|
5
5
|
import { LanguageISO6391 } from "./types/lang";
|
|
6
|
-
export
|
|
6
|
+
export interface TMDBOptions {
|
|
7
7
|
/**
|
|
8
8
|
* The language to use for requests (ISO 639-1 code)
|
|
9
9
|
* This provides localization and translated data.
|
|
@@ -16,7 +16,7 @@ export type TMDBOptions = {
|
|
|
16
16
|
* If not set, TMDB may fall back to a default or global data.
|
|
17
17
|
*/
|
|
18
18
|
region?: CountryISO3166_1;
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
export declare class TMDB {
|
|
21
21
|
private client;
|
|
22
22
|
private options;
|
package/dist/types/common.d.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Represents a genre of a movie or TV show.
|
|
3
3
|
*/
|
|
4
|
-
export
|
|
4
|
+
export interface Genre {
|
|
5
5
|
id: number;
|
|
6
6
|
name: string;
|
|
7
|
-
}
|
|
7
|
+
}
|
|
8
8
|
/**
|
|
9
9
|
* Represents a production company involved in creating a movie or TV show.
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export interface ProductionCompany {
|
|
12
12
|
id: number;
|
|
13
13
|
logo_path: string | null;
|
|
14
14
|
name: string;
|
|
15
15
|
origin_country: string;
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
17
|
/**
|
|
18
18
|
* Represents a country where a movie or TV show was produced.
|
|
19
19
|
*/
|
|
20
|
-
export
|
|
20
|
+
export interface ProductionCountry {
|
|
21
21
|
iso_3166_1: string;
|
|
22
22
|
name: string;
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
24
|
/**
|
|
25
25
|
* Represents a spoken language in a movie or TV show.
|
|
26
26
|
*/
|
|
27
|
-
export
|
|
27
|
+
export interface SpokenLanguage {
|
|
28
28
|
english_name: string;
|
|
29
29
|
iso_639_1: string;
|
|
30
30
|
name: string;
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
/**
|
|
33
33
|
* Represents a collection of movies.
|
|
34
34
|
*/
|
|
35
|
-
export
|
|
35
|
+
export interface Collection {
|
|
36
36
|
id: number;
|
|
37
37
|
name: string;
|
|
38
38
|
poster_path: string | null;
|
|
39
39
|
backdrop_path: string | null;
|
|
40
|
-
}
|
|
40
|
+
}
|
|
41
41
|
/**
|
|
42
42
|
* Represents a cast member in a movie or TV show.
|
|
43
43
|
*/
|
|
44
|
-
export
|
|
44
|
+
export interface Cast {
|
|
45
45
|
adult: boolean;
|
|
46
46
|
gender: number | null;
|
|
47
47
|
id: number;
|
|
@@ -54,11 +54,11 @@ export type Cast = {
|
|
|
54
54
|
character: string;
|
|
55
55
|
credit_id: string;
|
|
56
56
|
order: number;
|
|
57
|
-
}
|
|
57
|
+
}
|
|
58
58
|
/**
|
|
59
59
|
* Represents a crew member in a movie or TV show.
|
|
60
60
|
*/
|
|
61
|
-
export
|
|
61
|
+
export interface Crew {
|
|
62
62
|
adult: boolean;
|
|
63
63
|
gender: number | null;
|
|
64
64
|
id: number;
|
|
@@ -70,27 +70,27 @@ export type Crew = {
|
|
|
70
70
|
credit_id: string;
|
|
71
71
|
department: string;
|
|
72
72
|
job: string;
|
|
73
|
-
}
|
|
74
|
-
export
|
|
73
|
+
}
|
|
74
|
+
export interface Keyword {
|
|
75
75
|
id: number;
|
|
76
76
|
name: string;
|
|
77
|
-
}
|
|
78
|
-
export
|
|
77
|
+
}
|
|
78
|
+
export interface Changes {
|
|
79
79
|
changes: Change[];
|
|
80
|
-
}
|
|
81
|
-
export
|
|
80
|
+
}
|
|
81
|
+
export interface Change {
|
|
82
82
|
key: string;
|
|
83
83
|
items: ChangeItem[];
|
|
84
|
-
}
|
|
85
|
-
export
|
|
84
|
+
}
|
|
85
|
+
export interface ChangeItem {
|
|
86
86
|
id: number;
|
|
87
87
|
action: string;
|
|
88
88
|
time: string;
|
|
89
89
|
iso_639_1: string;
|
|
90
90
|
iso_3166_1: string;
|
|
91
91
|
value: any;
|
|
92
|
-
}
|
|
93
|
-
export
|
|
92
|
+
}
|
|
93
|
+
export interface ImageItem {
|
|
94
94
|
aspect_ratio: number;
|
|
95
95
|
height: number;
|
|
96
96
|
iso_639_1: string | null;
|
|
@@ -98,8 +98,8 @@ export type ImageItem = {
|
|
|
98
98
|
vote_average: number;
|
|
99
99
|
vote_count: number;
|
|
100
100
|
width: number;
|
|
101
|
-
}
|
|
102
|
-
export
|
|
101
|
+
}
|
|
102
|
+
export interface VideoItem {
|
|
103
103
|
iso_649_1: string;
|
|
104
104
|
iso_3166_1: string;
|
|
105
105
|
name: string;
|
|
@@ -110,4 +110,4 @@ export type VideoItem = {
|
|
|
110
110
|
official: boolean;
|
|
111
111
|
published_at: string;
|
|
112
112
|
id: string;
|
|
113
|
-
}
|
|
113
|
+
}
|
package/dist/types/movies.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Cast, Collection, Crew, Genre, ImageItem, Keyword, ProductionCompany, ProductionCountry, SpokenLanguage, VideoItem } from "./common";
|
|
1
|
+
import { Cast, Changes, Collection, Crew, Genre, ImageItem, Keyword, ProductionCompany, ProductionCountry, SpokenLanguage, VideoItem } from "./common";
|
|
2
2
|
import { ReleaseType } from "./enums";
|
|
3
|
+
import { PaginatedResponse } from "./params";
|
|
3
4
|
import { ISO3166Country } from "./utility";
|
|
4
|
-
export
|
|
5
|
+
export interface MovieDetails {
|
|
5
6
|
adult: boolean;
|
|
6
7
|
backdrop_path: string | null;
|
|
7
8
|
belongs_to_collection: Collection | null;
|
|
@@ -28,8 +29,8 @@ export type MovieDetails = {
|
|
|
28
29
|
video: boolean;
|
|
29
30
|
vote_average: number;
|
|
30
31
|
vote_count: number;
|
|
31
|
-
}
|
|
32
|
-
export
|
|
32
|
+
}
|
|
33
|
+
export interface MovieResultItem {
|
|
33
34
|
backdrop_path: string;
|
|
34
35
|
id: number;
|
|
35
36
|
title: string;
|
|
@@ -45,59 +46,78 @@ export type MovieResultItem = {
|
|
|
45
46
|
video: boolean;
|
|
46
47
|
vote_average: number;
|
|
47
48
|
vote_count: number;
|
|
48
|
-
}
|
|
49
|
-
export
|
|
49
|
+
}
|
|
50
|
+
export interface MovieAlternativeTitles {
|
|
50
51
|
id: number;
|
|
51
52
|
titles: MovieAlternativeTitle[];
|
|
52
|
-
}
|
|
53
|
-
export
|
|
53
|
+
}
|
|
54
|
+
export interface MovieAlternativeTitle {
|
|
54
55
|
title: string;
|
|
55
56
|
iso_3166_1: string;
|
|
56
57
|
type: string;
|
|
57
|
-
}
|
|
58
|
-
export type
|
|
58
|
+
}
|
|
59
|
+
export type MovieChanges = Changes;
|
|
60
|
+
export interface MovieCredits {
|
|
59
61
|
id: number;
|
|
60
62
|
cast: Cast[];
|
|
61
63
|
crew: Crew[];
|
|
62
|
-
}
|
|
63
|
-
export
|
|
64
|
+
}
|
|
65
|
+
export interface MovieExternalIDs {
|
|
64
66
|
id: number;
|
|
65
67
|
imdb_id: string | null;
|
|
66
68
|
facebook_id: string | null;
|
|
67
69
|
twitter_id: string | null;
|
|
68
70
|
instagram_id: string | null;
|
|
69
|
-
}
|
|
70
|
-
export
|
|
71
|
+
}
|
|
72
|
+
export interface MovieKeywords {
|
|
71
73
|
id: number;
|
|
72
74
|
keywords: Keyword[];
|
|
73
|
-
}
|
|
74
|
-
export
|
|
75
|
+
}
|
|
76
|
+
export interface MovieImages {
|
|
75
77
|
id: number;
|
|
76
78
|
backdrops: ImageItem[];
|
|
77
79
|
logos: ImageItem[];
|
|
78
80
|
posters: ImageItem[];
|
|
79
|
-
}
|
|
80
|
-
export type
|
|
81
|
+
}
|
|
82
|
+
export type MovieRecommendations = PaginatedResponse<MovieResultItem>;
|
|
83
|
+
export type MovieSimilar = PaginatedResponse<MovieResultItem>;
|
|
84
|
+
export interface MovieReleaseDates {
|
|
81
85
|
id: number;
|
|
82
86
|
results: MovieReleaseDateResult[];
|
|
83
|
-
}
|
|
84
|
-
export
|
|
87
|
+
}
|
|
88
|
+
export interface MovieReleaseDateResult {
|
|
85
89
|
iso_3166_1: string;
|
|
86
90
|
release_dates: MovieReleaseDate[];
|
|
87
|
-
}
|
|
88
|
-
export
|
|
91
|
+
}
|
|
92
|
+
export interface MovieReleaseDate {
|
|
89
93
|
certification: string;
|
|
90
94
|
iso_639_1: string;
|
|
91
95
|
release_date: string;
|
|
92
96
|
type: ReleaseType | number;
|
|
93
97
|
note: string;
|
|
94
98
|
descriptors: any[];
|
|
95
|
-
}
|
|
96
|
-
export type
|
|
99
|
+
}
|
|
100
|
+
export type MovieReviews = PaginatedResponse<MovieReview>;
|
|
101
|
+
export interface MovieReview {
|
|
102
|
+
author: string;
|
|
103
|
+
author_details: MovieReviewAuthorDetails;
|
|
104
|
+
content: string;
|
|
105
|
+
created_at: string;
|
|
106
|
+
id: string;
|
|
107
|
+
updated_at: string;
|
|
108
|
+
url: string;
|
|
109
|
+
}
|
|
110
|
+
export interface MovieReviewAuthorDetails {
|
|
111
|
+
name: string;
|
|
112
|
+
username: string;
|
|
113
|
+
avatar_path?: string;
|
|
114
|
+
rating?: number;
|
|
115
|
+
}
|
|
116
|
+
export interface MovieTranslations {
|
|
97
117
|
id: number;
|
|
98
118
|
translations: MovieTranslationResults[];
|
|
99
|
-
}
|
|
100
|
-
export
|
|
119
|
+
}
|
|
120
|
+
export interface MovieTranslationResults {
|
|
101
121
|
iso_3166_1: string;
|
|
102
122
|
iso_639_1: string;
|
|
103
123
|
name: string;
|
|
@@ -109,24 +129,43 @@ export type MovieTranslationResults = {
|
|
|
109
129
|
tagline: string;
|
|
110
130
|
title: string;
|
|
111
131
|
};
|
|
112
|
-
}
|
|
113
|
-
export
|
|
132
|
+
}
|
|
133
|
+
export interface MovieVideos {
|
|
114
134
|
id: number;
|
|
115
135
|
results: VideoItem[];
|
|
116
|
-
}
|
|
117
|
-
export
|
|
136
|
+
}
|
|
137
|
+
export interface MovieWatchProvider {
|
|
118
138
|
id: number;
|
|
119
139
|
results: Record<ISO3166Country, WatchProvider[]>;
|
|
120
|
-
}
|
|
121
|
-
export
|
|
140
|
+
}
|
|
141
|
+
export interface WatchProvider {
|
|
122
142
|
link: string;
|
|
123
143
|
flatrate: WatchProviderItem[];
|
|
124
144
|
rent: WatchProviderItem[];
|
|
125
145
|
buy: WatchProviderItem[];
|
|
126
|
-
}
|
|
127
|
-
export
|
|
146
|
+
}
|
|
147
|
+
export interface WatchProviderItem {
|
|
128
148
|
logo_path: string;
|
|
129
149
|
provider_id: number;
|
|
130
150
|
provider_name: string;
|
|
131
151
|
display_priority: number;
|
|
152
|
+
}
|
|
153
|
+
/** Append To Response */
|
|
154
|
+
export type MovieAppendToResponseNamespace = "alternative_titles" | "changes" | "credits" | "external_ids" | "images" | "keywords" | "recommendations" | "release_dates" | "reviews" | "similar" | "translations" | "videos";
|
|
155
|
+
export interface MovieAppendableMap {
|
|
156
|
+
alternative_titles: MovieAlternativeTitles;
|
|
157
|
+
changes: MovieChanges;
|
|
158
|
+
credits: MovieCredits;
|
|
159
|
+
external_ids: MovieExternalIDs;
|
|
160
|
+
images: MovieImages;
|
|
161
|
+
keywords: MovieKeywords;
|
|
162
|
+
recommendations: MovieRecommendations;
|
|
163
|
+
release_dates: MovieReleaseDates;
|
|
164
|
+
reviews: MovieReviews;
|
|
165
|
+
similar: MovieSimilar;
|
|
166
|
+
translations: MovieTranslations;
|
|
167
|
+
videos: MovieVideos;
|
|
168
|
+
}
|
|
169
|
+
export type MovieDetailsWithAppends<T extends readonly MovieAppendToResponseNamespace[]> = MovieDetails & {
|
|
170
|
+
[K in T[number]]: MovieAppendableMap[K];
|
|
132
171
|
};
|
package/dist/types/params.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CountryISO3166_1 } from "./countries";
|
|
2
2
|
import { LanguageISO6391 } from "./lang";
|
|
3
|
-
|
|
3
|
+
import { MovieAppendToResponseNamespace } from "./movies";
|
|
4
|
+
export interface PaginatedResponse<T> {
|
|
4
5
|
page: number;
|
|
5
6
|
total_pages: number;
|
|
6
7
|
total_results: number;
|
|
7
8
|
results: T[];
|
|
8
|
-
}
|
|
9
|
-
export
|
|
9
|
+
}
|
|
10
|
+
export interface SearchMoviesParams {
|
|
10
11
|
query: string;
|
|
11
12
|
include_adult?: boolean;
|
|
12
13
|
language?: LanguageISO6391;
|
|
@@ -14,47 +15,48 @@ export type SearchMoviesParams = {
|
|
|
14
15
|
primary_release_year?: string;
|
|
15
16
|
region?: CountryISO3166_1;
|
|
16
17
|
year?: string;
|
|
17
|
-
}
|
|
18
|
-
export
|
|
18
|
+
}
|
|
19
|
+
export interface MovieListParams {
|
|
19
20
|
language?: LanguageISO6391;
|
|
20
21
|
page?: number;
|
|
21
22
|
region?: CountryISO3166_1;
|
|
22
|
-
}
|
|
23
|
-
export
|
|
23
|
+
}
|
|
24
|
+
export interface MovieDetailsParams {
|
|
24
25
|
movie_id: number;
|
|
25
|
-
append_to_response?:
|
|
26
|
+
append_to_response?: MovieAppendToResponseNamespace[];
|
|
26
27
|
language?: LanguageISO6391;
|
|
27
|
-
}
|
|
28
|
-
export
|
|
28
|
+
}
|
|
29
|
+
export interface MovieAlternativeTitlesParams {
|
|
29
30
|
movie_id: number;
|
|
30
31
|
country?: CountryISO3166_1;
|
|
31
|
-
}
|
|
32
|
-
export
|
|
32
|
+
}
|
|
33
|
+
export interface MovieCreditsParams {
|
|
33
34
|
movie_id: number;
|
|
34
35
|
language?: LanguageISO6391;
|
|
35
|
-
}
|
|
36
|
-
export
|
|
36
|
+
}
|
|
37
|
+
export interface MovieKeywordsParams {
|
|
37
38
|
movie_id: number;
|
|
38
|
-
}
|
|
39
|
+
}
|
|
39
40
|
export type MovieExternalIDsParams = MovieKeywordsParams;
|
|
40
41
|
export type MovieReleaseDatesParams = MovieKeywordsParams;
|
|
41
42
|
export type MovieTranslationsParams = MovieKeywordsParams;
|
|
42
43
|
export type MovieWathProvidersParams = MovieKeywordsParams;
|
|
43
|
-
export
|
|
44
|
+
export interface MovieChangesParams {
|
|
44
45
|
movie_id: number;
|
|
45
46
|
page?: number;
|
|
46
47
|
start_date?: string;
|
|
47
48
|
end_date?: string;
|
|
48
|
-
}
|
|
49
|
-
export
|
|
49
|
+
}
|
|
50
|
+
export interface MovieImagesParams {
|
|
50
51
|
movie_id: number;
|
|
51
52
|
language?: LanguageISO6391;
|
|
52
53
|
include_image_language?: LanguageISO6391;
|
|
53
|
-
}
|
|
54
|
-
export
|
|
54
|
+
}
|
|
55
|
+
export interface MovieRecommendationsParams {
|
|
55
56
|
movie_id: number;
|
|
56
57
|
page?: number;
|
|
57
58
|
language?: LanguageISO6391;
|
|
58
|
-
}
|
|
59
|
+
}
|
|
59
60
|
export type MovieSimilarParams = MovieRecommendationsParams;
|
|
60
61
|
export type MovieVideosParams = MovieCreditsParams;
|
|
62
|
+
export type MovieReviewsParams = MovieRecommendationsParams;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lorenzopant/tmdb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "A completely type-safe The Movie Database (TMDB) API wrapper for typescript applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,23 +17,33 @@
|
|
|
17
17
|
"movies"
|
|
18
18
|
],
|
|
19
19
|
"devDependencies": {
|
|
20
|
+
"@eslint/compat": "^1.3.1",
|
|
21
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
22
|
+
"@eslint/js": "^9.30.0",
|
|
20
23
|
"@types/node": "^22.15.2",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.35.0",
|
|
25
|
+
"@typescript-eslint/parser": "^8.35.0",
|
|
21
26
|
"@vitest/coverage-v8": "^3.1.2",
|
|
22
27
|
"@vitest/ui": "^3.1.2",
|
|
23
28
|
"dotenv": "^16.5.0",
|
|
29
|
+
"eslint": "^9.30.0",
|
|
30
|
+
"eslint-config-prettier": "^10.1.5",
|
|
31
|
+
"eslint-plugin-import": "^2.32.0",
|
|
32
|
+
"husky": "^9.1.7",
|
|
33
|
+
"pino": "^9.7.0",
|
|
24
34
|
"release-it": "^19.0.3",
|
|
25
35
|
"release-it-pnpm": "^4.6.6",
|
|
26
36
|
"typescript": "^5.8.3",
|
|
37
|
+
"typescript-eslint": "^8.35.0",
|
|
38
|
+
"vite": "^7.0.0",
|
|
27
39
|
"vitest": "^3.2.4"
|
|
28
40
|
},
|
|
29
|
-
"dependencies": {
|
|
30
|
-
"vite": "^7.0.0"
|
|
31
|
-
},
|
|
32
41
|
"scripts": {
|
|
33
42
|
"build": "tsc",
|
|
34
43
|
"build:watch": "tsc --watch",
|
|
35
44
|
"test": "vitest",
|
|
36
45
|
"test:ui": "vitest --ui",
|
|
37
|
-
"test:coverage": "vitest --coverage"
|
|
46
|
+
"test:coverage": "vitest --coverage",
|
|
47
|
+
"lint": "eslint ."
|
|
38
48
|
}
|
|
39
49
|
}
|
package/vitest.config.mts
CHANGED