@segha/tmdb 0.0.1 → 0.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/API/Endpoints.ts +89 -0
- package/API/Methods.ts +237 -0
- package/API/index.ts +21 -0
- package/DataTypes/Genre.ts +8 -0
- package/DataTypes/Image.ts +27 -0
- package/DataTypes/Language.ts +9 -0
- package/DataTypes/Pagination.ts +8 -0
- package/DataTypes/ProductionCompany.ts +10 -0
- package/DataTypes/ProductionCountry.ts +8 -0
- package/DataTypes/Video.ts +22 -0
- package/DataTypes/index.ts +7 -0
- package/Movies/Movie.ts +20 -0
- package/Movies/MovieDetails.ts +30 -0
- package/Movies/MoviesResponse.ts +12 -0
- package/Movies/SearchMovies.ts +10 -0
- package/Movies/index.ts +4 -0
- package/TVSeries/Creator.ts +9 -0
- package/TVSeries/Episode.ts +18 -0
- package/TVSeries/Network.ts +8 -0
- package/TVSeries/SearchSeries.ts +12 -0
- package/TVSeries/Season.ts +11 -0
- package/TVSeries/Serie.ts +19 -0
- package/TVSeries/SerieDetails.ts +43 -0
- package/TVSeries/SeriesResponse.ts +12 -0
- package/TVSeries/index.ts +4 -0
- package/package.json +2 -1
package/API/Endpoints.ts
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const SearchMoviesEndpoint = z.literal('/search/movie').describe('Search for movies by their original, translated and alternative titles.');
|
|
4
|
+
export const SearchTVEndpoint = z.literal('/search/tv').describe('Search for TV shows by their original, translated and also known as names.');
|
|
5
|
+
|
|
6
|
+
export const NowPlayingMoviesEndpoint = z.literal('/movie/now_playing').describe('Get a list of movies that are currently in theatres.');
|
|
7
|
+
export const PopularMoviesEndpoint = z.literal('/movie/popular').describe('Get a list of movies ordered by popularity.');
|
|
8
|
+
export const TopRatedMoviesEndpoint = z.literal('/movie/top_rated').describe('Get a list of movies ordered by rating.');
|
|
9
|
+
export const UpcomingMoviesEndpoint = z.literal('/movie/upcoming').describe('Get a list of movies that are being released soon.');
|
|
10
|
+
export const MovieDetailsEndpoint = z.literal('/movie/{movie_id}').describe('Get the top level details of a movie by ID.');
|
|
11
|
+
export const MovieImagesEndpoint = z.literal('/movie/{movie_id}/images').describe('Get the images that belong to a movie.');
|
|
12
|
+
export const MovieVideosEndpoint = z.literal('/movie/{movie_id}/videos').describe('Get the videos that belong to a movie.');
|
|
13
|
+
export const MovieSimilarEndpoint = z.literal('/movie/{movie_id}/similar').describe('Get the similar movies based on genres and keywords.');
|
|
14
|
+
|
|
15
|
+
export const AiringTodayTVEndpoint = z.literal('/tv/airing_today').describe('Get a list of TV shows airing today.');
|
|
16
|
+
export const OnTheAirTVEndpoint = z.literal('/tv/on_the_air').describe('Get a list of TV shows that air in the next 7 days.');
|
|
17
|
+
export const PopularTVEndpoint = z.literal('/tv/popular').describe('Get a list of TV shows ordered by popularity.');
|
|
18
|
+
export const TopRatedTVEndpoint = z.literal('/tv/top_rated').describe('Get a list of TV shows ordered by rating.');
|
|
19
|
+
export const TVDetailsEndpoint = z.literal('/tv/{tv_id}').describe('Get the top level details of a TV show by ID.');
|
|
20
|
+
export const TVImagesEndpoint = z.literal('/tv/{tv_id}/images').describe('Get the images that belong to a TV show.');
|
|
21
|
+
export const TVVideosEndpoint = z.literal('/tv/{tv_id}/videos').describe('Get the videos that belong to a TV show.');
|
|
22
|
+
export const TVSimilarEndpoint = z.literal('/tv/{tv_id}/similar').describe('Get the similar TV shows.');
|
|
23
|
+
|
|
24
|
+
export const SearchEndpoints = z.union([
|
|
25
|
+
SearchMoviesEndpoint,
|
|
26
|
+
SearchTVEndpoint,
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
export const MovieEndpoints = z.union([
|
|
30
|
+
NowPlayingMoviesEndpoint,
|
|
31
|
+
PopularMoviesEndpoint,
|
|
32
|
+
TopRatedMoviesEndpoint,
|
|
33
|
+
UpcomingMoviesEndpoint,
|
|
34
|
+
MovieDetailsEndpoint,
|
|
35
|
+
MovieImagesEndpoint,
|
|
36
|
+
MovieVideosEndpoint,
|
|
37
|
+
MovieSimilarEndpoint,
|
|
38
|
+
]);
|
|
39
|
+
|
|
40
|
+
export const TVEndpoints = z.union([
|
|
41
|
+
AiringTodayTVEndpoint,
|
|
42
|
+
OnTheAirTVEndpoint,
|
|
43
|
+
PopularTVEndpoint,
|
|
44
|
+
TopRatedTVEndpoint,
|
|
45
|
+
TVDetailsEndpoint,
|
|
46
|
+
TVImagesEndpoint,
|
|
47
|
+
TVVideosEndpoint,
|
|
48
|
+
TVSimilarEndpoint,
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
export const AllEndpoints = z.union([
|
|
52
|
+
SearchEndpoints,
|
|
53
|
+
MovieEndpoints,
|
|
54
|
+
TVEndpoints,
|
|
55
|
+
]);
|
|
56
|
+
|
|
57
|
+
export const EndpointsSchema = z.object({
|
|
58
|
+
search: z.object({
|
|
59
|
+
movies: SearchMoviesEndpoint,
|
|
60
|
+
tv: SearchTVEndpoint,
|
|
61
|
+
}),
|
|
62
|
+
movie: z.object({
|
|
63
|
+
now_playing: NowPlayingMoviesEndpoint,
|
|
64
|
+
popular: PopularMoviesEndpoint,
|
|
65
|
+
top_rated: TopRatedMoviesEndpoint,
|
|
66
|
+
upcoming: UpcomingMoviesEndpoint,
|
|
67
|
+
details: MovieDetailsEndpoint,
|
|
68
|
+
images: MovieImagesEndpoint,
|
|
69
|
+
videos: MovieVideosEndpoint,
|
|
70
|
+
similar: MovieSimilarEndpoint,
|
|
71
|
+
}),
|
|
72
|
+
tv: z.object({
|
|
73
|
+
airing_today: AiringTodayTVEndpoint,
|
|
74
|
+
on_the_air: OnTheAirTVEndpoint,
|
|
75
|
+
popular: PopularTVEndpoint,
|
|
76
|
+
top_rated: TopRatedTVEndpoint,
|
|
77
|
+
details: TVDetailsEndpoint,
|
|
78
|
+
images: TVImagesEndpoint,
|
|
79
|
+
videos: TVVideosEndpoint,
|
|
80
|
+
similar: TVSimilarEndpoint,
|
|
81
|
+
}),
|
|
82
|
+
}).describe('API Endpoints');
|
|
83
|
+
|
|
84
|
+
export type SearchEndpoints = z.infer<typeof SearchEndpoints>;
|
|
85
|
+
export type MovieEndpoints = z.infer<typeof MovieEndpoints>;
|
|
86
|
+
export type TVEndpoints = z.infer<typeof TVEndpoints>;
|
|
87
|
+
export type AllEndpoints = z.infer<typeof AllEndpoints>;
|
|
88
|
+
|
|
89
|
+
export type Endpoints = z.infer<typeof EndpointsSchema>;
|
package/API/Methods.ts
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
import { AiringTodayTVEndpoint, MovieDetailsEndpoint, MovieImagesEndpoint, MovieSimilarEndpoint, MovieVideosEndpoint, NowPlayingMoviesEndpoint, OnTheAirTVEndpoint, PopularMoviesEndpoint, PopularTVEndpoint, SearchMoviesEndpoint, SearchTVEndpoint, TopRatedMoviesEndpoint, TopRatedTVEndpoint, TVDetailsEndpoint, TVImagesEndpoint, TVSimilarEndpoint, TVVideosEndpoint, UpcomingMoviesEndpoint } from "./Endpoints";
|
|
4
|
+
import { MoviesResponseSchema } from "../Movies/MoviesResponse";
|
|
5
|
+
import { MovieDetailsSchema, MovieDetailsParamsSchema } from "../Movies/MovieDetails";
|
|
6
|
+
import { SearchMoviesParamsSchema } from "../Movies/SearchMovies";
|
|
7
|
+
import { SeriesResponseSchema } from "../TVSeries/SeriesResponse";
|
|
8
|
+
import { SearchSeriesParamsSchema } from "../TVSeries/SearchSeries";
|
|
9
|
+
import { ImagesResponseSchema, PaginationParamsSchema, VideosResponseSchema } from "../DataTypes";
|
|
10
|
+
import { SerieDetailsParamsSchema, SerieDetailsSchema } from "../TVSeries/SerieDetails";
|
|
11
|
+
|
|
12
|
+
export const MethodsSchema = z.object({
|
|
13
|
+
search: z.object({
|
|
14
|
+
movies: z.object({
|
|
15
|
+
get: z.object({
|
|
16
|
+
endpoint: SearchMoviesEndpoint,
|
|
17
|
+
parameters: z.object({
|
|
18
|
+
query: SearchMoviesParamsSchema,
|
|
19
|
+
}),
|
|
20
|
+
responses: z.object({
|
|
21
|
+
'200': MoviesResponseSchema,
|
|
22
|
+
}),
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
tv: z.object({
|
|
26
|
+
get: z.object({
|
|
27
|
+
endpoint: SearchTVEndpoint,
|
|
28
|
+
parameters: z.object({
|
|
29
|
+
query: SearchSeriesParamsSchema,
|
|
30
|
+
}),
|
|
31
|
+
responses: z.object({
|
|
32
|
+
'200': SeriesResponseSchema,
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
}),
|
|
36
|
+
}),
|
|
37
|
+
movie: z.object({
|
|
38
|
+
now_playing: z.object({
|
|
39
|
+
get: z.object({
|
|
40
|
+
endpoint: NowPlayingMoviesEndpoint,
|
|
41
|
+
parameters: z.object({
|
|
42
|
+
query: PaginationParamsSchema,
|
|
43
|
+
}),
|
|
44
|
+
responses: z.object({
|
|
45
|
+
'200': MoviesResponseSchema,
|
|
46
|
+
}),
|
|
47
|
+
}),
|
|
48
|
+
}),
|
|
49
|
+
popular: z.object({
|
|
50
|
+
get: z.object({
|
|
51
|
+
endpoint: PopularMoviesEndpoint,
|
|
52
|
+
parameters: z.object({
|
|
53
|
+
query: PaginationParamsSchema,
|
|
54
|
+
}),
|
|
55
|
+
responses: z.object({
|
|
56
|
+
'200': MoviesResponseSchema,
|
|
57
|
+
}),
|
|
58
|
+
}),
|
|
59
|
+
}),
|
|
60
|
+
top_rated: z.object({
|
|
61
|
+
get: z.object({
|
|
62
|
+
endpoint: TopRatedMoviesEndpoint,
|
|
63
|
+
parameters: z.object({
|
|
64
|
+
query: PaginationParamsSchema,
|
|
65
|
+
}),
|
|
66
|
+
responses: z.object({
|
|
67
|
+
'200': MoviesResponseSchema,
|
|
68
|
+
}),
|
|
69
|
+
}),
|
|
70
|
+
}),
|
|
71
|
+
upcoming: z.object({
|
|
72
|
+
get: z.object({
|
|
73
|
+
endpoint: UpcomingMoviesEndpoint,
|
|
74
|
+
parameters: z.object({
|
|
75
|
+
query: PaginationParamsSchema,
|
|
76
|
+
}),
|
|
77
|
+
responses: z.object({
|
|
78
|
+
'200': MoviesResponseSchema,
|
|
79
|
+
}),
|
|
80
|
+
}),
|
|
81
|
+
}),
|
|
82
|
+
details: z.object({
|
|
83
|
+
get: z.object({
|
|
84
|
+
endpoint: MovieDetailsEndpoint,
|
|
85
|
+
parameters: z.object({
|
|
86
|
+
url: z.object({
|
|
87
|
+
movie_id: z.number().describe('Movie ID'),
|
|
88
|
+
}),
|
|
89
|
+
query: MovieDetailsParamsSchema,
|
|
90
|
+
}),
|
|
91
|
+
responses: z.object({
|
|
92
|
+
'200': MovieDetailsSchema,
|
|
93
|
+
}),
|
|
94
|
+
}),
|
|
95
|
+
}),
|
|
96
|
+
images: z.object({
|
|
97
|
+
get: z.object({
|
|
98
|
+
endpoint: MovieImagesEndpoint,
|
|
99
|
+
parameters: z.object({
|
|
100
|
+
url: z.object({
|
|
101
|
+
movie_id: z.number().describe('Movie ID'),
|
|
102
|
+
}),
|
|
103
|
+
}),
|
|
104
|
+
responses: z.object({
|
|
105
|
+
'200': ImagesResponseSchema,
|
|
106
|
+
}),
|
|
107
|
+
}),
|
|
108
|
+
}),
|
|
109
|
+
videos: z.object({
|
|
110
|
+
get: z.object({
|
|
111
|
+
endpoint: MovieVideosEndpoint,
|
|
112
|
+
parameters: z.object({
|
|
113
|
+
url: z.object({
|
|
114
|
+
movie_id: z.number().describe('Movie ID'),
|
|
115
|
+
}),
|
|
116
|
+
}),
|
|
117
|
+
responses: z.object({
|
|
118
|
+
'200': VideosResponseSchema,
|
|
119
|
+
}),
|
|
120
|
+
}),
|
|
121
|
+
}),
|
|
122
|
+
similar: z.object({
|
|
123
|
+
get: z.object({
|
|
124
|
+
endpoint: MovieSimilarEndpoint,
|
|
125
|
+
parameters: z.object({
|
|
126
|
+
url: z.object({
|
|
127
|
+
movie_id: z.number().describe('Movie ID'),
|
|
128
|
+
}),
|
|
129
|
+
}),
|
|
130
|
+
responses: z.object({
|
|
131
|
+
'200': MoviesResponseSchema,
|
|
132
|
+
}),
|
|
133
|
+
}),
|
|
134
|
+
}),
|
|
135
|
+
}),
|
|
136
|
+
tv: z.object({
|
|
137
|
+
airing_today: z.object({
|
|
138
|
+
get: z.object({
|
|
139
|
+
endpoint: AiringTodayTVEndpoint,
|
|
140
|
+
parameters: z.object({
|
|
141
|
+
query: PaginationParamsSchema,
|
|
142
|
+
}),
|
|
143
|
+
responses: z.object({
|
|
144
|
+
'200': SeriesResponseSchema,
|
|
145
|
+
}),
|
|
146
|
+
}),
|
|
147
|
+
}),
|
|
148
|
+
on_the_air: z.object({
|
|
149
|
+
get: z.object({
|
|
150
|
+
endpoint: OnTheAirTVEndpoint,
|
|
151
|
+
parameters: z.object({
|
|
152
|
+
query: PaginationParamsSchema,
|
|
153
|
+
}),
|
|
154
|
+
responses: z.object({
|
|
155
|
+
'200': SeriesResponseSchema,
|
|
156
|
+
}),
|
|
157
|
+
}),
|
|
158
|
+
}),
|
|
159
|
+
popular: z.object({
|
|
160
|
+
get: z.object({
|
|
161
|
+
endpoint: PopularTVEndpoint,
|
|
162
|
+
parameters: z.object({
|
|
163
|
+
query: PaginationParamsSchema,
|
|
164
|
+
}),
|
|
165
|
+
responses: z.object({
|
|
166
|
+
'200': SeriesResponseSchema,
|
|
167
|
+
}),
|
|
168
|
+
}),
|
|
169
|
+
}),
|
|
170
|
+
top_rated: z.object({
|
|
171
|
+
get: z.object({
|
|
172
|
+
endpoint: TopRatedTVEndpoint,
|
|
173
|
+
parameters: z.object({
|
|
174
|
+
query: PaginationParamsSchema,
|
|
175
|
+
}),
|
|
176
|
+
responses: z.object({
|
|
177
|
+
'200': SeriesResponseSchema,
|
|
178
|
+
}),
|
|
179
|
+
}),
|
|
180
|
+
}),
|
|
181
|
+
details: z.object({
|
|
182
|
+
get: z.object({
|
|
183
|
+
endpoint: TVDetailsEndpoint,
|
|
184
|
+
parameters: z.object({
|
|
185
|
+
url: z.object({
|
|
186
|
+
tv_id: z.number().describe('TV ID'),
|
|
187
|
+
}),
|
|
188
|
+
query: SerieDetailsParamsSchema,
|
|
189
|
+
}),
|
|
190
|
+
responses: z.object({
|
|
191
|
+
'200': SerieDetailsSchema,
|
|
192
|
+
}),
|
|
193
|
+
}),
|
|
194
|
+
}),
|
|
195
|
+
images: z.object({
|
|
196
|
+
get: z.object({
|
|
197
|
+
endpoint: TVImagesEndpoint,
|
|
198
|
+
parameters: z.object({
|
|
199
|
+
url: z.object({
|
|
200
|
+
tv_id: z.number().describe('TV ID'),
|
|
201
|
+
}),
|
|
202
|
+
}),
|
|
203
|
+
responses: z.object({
|
|
204
|
+
'200': ImagesResponseSchema,
|
|
205
|
+
}),
|
|
206
|
+
}),
|
|
207
|
+
}),
|
|
208
|
+
videos: z.object({
|
|
209
|
+
get: z.object({
|
|
210
|
+
endpoint: TVVideosEndpoint,
|
|
211
|
+
parameters: z.object({
|
|
212
|
+
url: z.object({
|
|
213
|
+
tv_id: z.number().describe('TV ID'),
|
|
214
|
+
}),
|
|
215
|
+
}),
|
|
216
|
+
responses: z.object({
|
|
217
|
+
'200': VideosResponseSchema,
|
|
218
|
+
}),
|
|
219
|
+
}),
|
|
220
|
+
}),
|
|
221
|
+
similar: z.object({
|
|
222
|
+
get: z.object({
|
|
223
|
+
endpoint: TVSimilarEndpoint,
|
|
224
|
+
parameters: z.object({
|
|
225
|
+
url: z.object({
|
|
226
|
+
tv_id: z.number().describe('TV ID'),
|
|
227
|
+
}),
|
|
228
|
+
}),
|
|
229
|
+
responses: z.object({
|
|
230
|
+
'200': SeriesResponseSchema,
|
|
231
|
+
}),
|
|
232
|
+
}),
|
|
233
|
+
}),
|
|
234
|
+
}),
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
export type Methods = z.infer<typeof MethodsSchema>;
|
package/API/index.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
import { MethodsSchema } from "./Methods";
|
|
4
|
+
|
|
5
|
+
export const Version = z.literal("3").describe("API version");
|
|
6
|
+
export const BaseUrl = z.literal('https://api.themoviedb.org/3').describe('Base URL for the API');
|
|
7
|
+
export const ImageBaseUrl = z.literal('https://image.tmdb.org/t/p').describe('Base URL for images');
|
|
8
|
+
|
|
9
|
+
export const SpecSchema = z.object({
|
|
10
|
+
version: Version,
|
|
11
|
+
baseUrl: BaseUrl,
|
|
12
|
+
imageBaseUrl: ImageBaseUrl,
|
|
13
|
+
methods: MethodsSchema,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const ConfigurationSchema = z.object({
|
|
17
|
+
apiKey: z.string().describe('Your TMDB API key'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type Spec = z.infer<typeof SpecSchema>;
|
|
21
|
+
export type Configuration = z.infer<typeof ConfigurationSchema>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const ImageSchema = z.object({
|
|
4
|
+
aspect_ratio: z.number().describe('Aspect ratio'),
|
|
5
|
+
height: z.number().describe('Height'),
|
|
6
|
+
iso_639_1: z.string().nullable().describe('Spoken language ISO 639-1 code'),
|
|
7
|
+
file_path: z.string().describe('File path'),
|
|
8
|
+
vote_average: z.number().describe('Vote average'),
|
|
9
|
+
vote_count: z.number().describe('Vote count'),
|
|
10
|
+
width: z.number().describe('Width'),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const ImagesResponseSchema = z.object({
|
|
14
|
+
id: z.number().describe('Image ID'),
|
|
15
|
+
backdrops: z.array(ImageSchema).describe('Backdrops'),
|
|
16
|
+
logos: z.array(ImageSchema).describe('Logos'),
|
|
17
|
+
posters: z.array(ImageSchema).describe('Posters'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const PosterSizeSchema = z.enum(['w92', 'w154', 'w185', 'w342', 'w500', 'w780', 'original']).describe('Poster size');
|
|
21
|
+
export const BackdropSizeSchema = z.enum(['w300', 'w780', 'w1280', 'original']).describe('Backdrop size');
|
|
22
|
+
|
|
23
|
+
export type BackdropSize = z.infer<typeof BackdropSizeSchema>;
|
|
24
|
+
export type PosterSize = z.infer<typeof PosterSizeSchema>;
|
|
25
|
+
|
|
26
|
+
export type Image = z.infer<typeof ImageSchema>;
|
|
27
|
+
export type ImagesResponse = z.infer<typeof ImagesResponseSchema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const LanguageSchema = z.object({
|
|
4
|
+
iso_639_1: z.string().describe('Spoken language ISO 639-1 code'),
|
|
5
|
+
name: z.string().describe('Spoken language name'),
|
|
6
|
+
english_name: z.string().describe('Spoken language English name'),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type Language = z.infer<typeof LanguageSchema>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const PaginationParamsSchema = z.object({
|
|
4
|
+
page: z.number().describe('Page number'),
|
|
5
|
+
language: z.string().describe('Language code'),
|
|
6
|
+
}).describe('Pagination parameters');
|
|
7
|
+
|
|
8
|
+
export type PaginationParams = z.infer<typeof PaginationParamsSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const ProductionCompanySchema = z.object({
|
|
4
|
+
id: z.number().describe('Unique identifier for the production company'),
|
|
5
|
+
name: z.string().describe('Production company name'),
|
|
6
|
+
logo_path: z.string().nullable().describe('Logo path (relative URL)'),
|
|
7
|
+
origin_country: z.string().describe('Production company origin country'),
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
export type ProductionCompany = z.infer<typeof ProductionCompanySchema>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const ProductionCountrySchema = z.object({
|
|
4
|
+
iso_3166_1: z.string().describe('Production country ISO 3166-1 Alpha-2 code'),
|
|
5
|
+
name: z.string().describe('Production country name'),
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
export type ProductionCountry = z.infer<typeof ProductionCountrySchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const VideoSchema = z.object({
|
|
4
|
+
iso_639_1: z.string().describe('Spoken language ISO 639-1 code'),
|
|
5
|
+
iso_3166_1: z.string().describe('Production country ISO 3166-1 Alpha-2 code'),
|
|
6
|
+
name: z.string().describe('Video name'),
|
|
7
|
+
key: z.string().describe('Video key'),
|
|
8
|
+
site: z.string().describe('Video site'),
|
|
9
|
+
size: z.number().describe('Video size'),
|
|
10
|
+
type: z.string().describe('Video type'),
|
|
11
|
+
official: z.boolean().describe('Video official'),
|
|
12
|
+
published_at: z.string().describe('Video published at'),
|
|
13
|
+
id: z.string().describe('Video ID'),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const VideosResponseSchema = z.object({
|
|
17
|
+
id: z.number().describe('Video ID'),
|
|
18
|
+
results: z.array(VideoSchema).describe('Videos'),
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export type Video = z.infer<typeof VideoSchema>;
|
|
22
|
+
export type VideosResponse = z.infer<typeof VideosResponseSchema>;
|
package/Movies/Movie.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const MovieSchema = z.object({
|
|
4
|
+
id: z.number().describe('Unique identifier for the movie'),
|
|
5
|
+
title: z.string().describe('Movie title'),
|
|
6
|
+
original_title: z.string().describe('Original movie title (in original language)'),
|
|
7
|
+
original_language: z.string().describe('Original language code (e.g., \'en\', \'es\', \'fr\')'),
|
|
8
|
+
overview: z.string().describe('Movie overview/synopsis'),
|
|
9
|
+
poster_path: z.string().describe('Poster path (relative URL)'),
|
|
10
|
+
backdrop_path: z.string().describe('Backdrop path (relative URL)'),
|
|
11
|
+
release_date: z.string().describe('Release date (YYYY-MM-DD format)'),
|
|
12
|
+
vote_average: z.number().describe('Average vote rating (0-10)'),
|
|
13
|
+
vote_count: z.number().describe('Total number of votes'),
|
|
14
|
+
popularity: z.number().describe('Popularity score'),
|
|
15
|
+
adult: z.boolean().describe('Adult content flag'),
|
|
16
|
+
genre_ids: z.array(z.number()).describe('Array of genre IDs'),
|
|
17
|
+
video: z.boolean().describe('Video flag'),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export type Movie = z.infer<typeof MovieSchema>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
import z from "zod";
|
|
3
|
+
|
|
4
|
+
import { GenreSchema, ProductionCompanySchema, ProductionCountrySchema, LanguageSchema } from "../DataTypes";
|
|
5
|
+
import { MovieSchema } from "./Movie";
|
|
6
|
+
|
|
7
|
+
export const MovieDetailsSchema = MovieSchema.omit({
|
|
8
|
+
genre_ids: true,
|
|
9
|
+
}).extend({
|
|
10
|
+
genres: z.array(GenreSchema).describe('Movie genres'),
|
|
11
|
+
runtime: z.number().nullable().describe('Movie runtime in minutes'),
|
|
12
|
+
budget: z.number().describe('Budget in USD'),
|
|
13
|
+
revenue: z.number().describe('Revenue in USD'),
|
|
14
|
+
homepage: z.string().nullable().describe('Homepage URL'),
|
|
15
|
+
imdb_id: z.string().nullable().describe('IMDB ID'),
|
|
16
|
+
production_companies: z.array(ProductionCompanySchema).describe('Production companies'),
|
|
17
|
+
production_countries: z.array(ProductionCountrySchema).describe('Production countries'),
|
|
18
|
+
spoken_languages: z.array(LanguageSchema).describe('Spoken languages'),
|
|
19
|
+
status: z.string().describe('Current status (Released, Post Production, etc.)'),
|
|
20
|
+
tagline: z.string().nullable().describe('Tagline'),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const MovieDetailsParamsSchema = z.object({
|
|
24
|
+
append_to_response: z.string().optional().describe('Append to response'),
|
|
25
|
+
include_image_language: z.string().optional().describe('Include image language'),
|
|
26
|
+
language: z.string().optional().describe('Language'),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export type MovieDetails = z.infer<typeof MovieDetailsSchema>;
|
|
30
|
+
export type MovieDetailsParams = z.infer<typeof MovieDetailsParamsSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
import { MovieSchema } from "./Movie"
|
|
4
|
+
|
|
5
|
+
export const MoviesResponseSchema = z.object({
|
|
6
|
+
page: z.number().describe('Page number'),
|
|
7
|
+
results: z.array(MovieSchema).describe('Movies'),
|
|
8
|
+
total_pages: z.number().describe('Total pages'),
|
|
9
|
+
total_results: z.number().describe('Total results'),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export type MoviesResponse = z.infer<typeof MoviesResponseSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
import { PaginationParamsSchema } from "../DataTypes";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
export const SearchMoviesParamsSchema = PaginationParamsSchema.extend({
|
|
7
|
+
query: z.string().describe('Search query'),
|
|
8
|
+
include_adult: z.boolean().optional().describe('Include adult movies'),
|
|
9
|
+
year: z.number().optional().describe('Year'),
|
|
10
|
+
})
|
package/Movies/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const CreatorSchema = z.object({
|
|
4
|
+
id: z.number().describe('Unique identifier for the creator'),
|
|
5
|
+
credit_id: z.string().describe('Credit ID'),
|
|
6
|
+
name: z.string().describe('Creator name'),
|
|
7
|
+
gender: z.number().describe('Creator gender'),
|
|
8
|
+
profile_path: z.string().nullable().describe('Creator profile path (relative URL)'),
|
|
9
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const EpisodeSchema = z.object({
|
|
4
|
+
id: z.number().describe('Unique identifier for the episode'),
|
|
5
|
+
name: z.string().describe('Episode name'),
|
|
6
|
+
overview: z.string().nullable().describe('Episode overview/synopsis'),
|
|
7
|
+
vote_average: z.number().describe('Average vote rating (0-10)'),
|
|
8
|
+
vote_count: z.number().describe('Total number of votes'),
|
|
9
|
+
air_date: z.string().describe('Air date (YYYY-MM-DD format)'),
|
|
10
|
+
episode_number: z.number().describe('Episode number'),
|
|
11
|
+
production_code: z.string().describe('Production code'),
|
|
12
|
+
runtime: z.number().nullable().describe('Runtime in minutes'),
|
|
13
|
+
season_number: z.number().describe('Season number'),
|
|
14
|
+
show_id: z.number().describe('Show ID'),
|
|
15
|
+
still_path: z.string().nullable().describe('Still path (relative URL)'),
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export type Episode = z.infer<typeof EpisodeSchema>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const NetworkSchema = z.object({
|
|
4
|
+
id: z.number().describe('Unique identifier for the network'),
|
|
5
|
+
name: z.string().describe('Network name'),
|
|
6
|
+
logo_path: z.string().nullable().describe('Logo path (relative URL)'),
|
|
7
|
+
origin_country: z.string().describe('Network origin country'),
|
|
8
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
|
|
2
|
+
import z from "zod";
|
|
3
|
+
|
|
4
|
+
import { PaginationParamsSchema } from "../DataTypes";
|
|
5
|
+
|
|
6
|
+
export const SearchSeriesParamsSchema = PaginationParamsSchema.extend({
|
|
7
|
+
query: z.string().describe('Search query'),
|
|
8
|
+
include_adult: z.boolean().optional().describe('Include adult movies'),
|
|
9
|
+
year: z.number().optional().describe('Year'),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export type SearchSeriesParams = z.infer<typeof SearchSeriesParamsSchema>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const SeasonSchema = z.object({
|
|
4
|
+
air_date: z.string().describe('Air date (YYYY-MM-DD format)'),
|
|
5
|
+
episode_count: z.number().describe('Episode count'),
|
|
6
|
+
id: z.number().describe('Unique identifier for the season'),
|
|
7
|
+
name: z.string().describe('Season name'),
|
|
8
|
+
overview: z.string().nullable().describe('Season overview/synopsis'),
|
|
9
|
+
poster_path: z.string().nullable().describe('Poster path (relative URL)'),
|
|
10
|
+
season_number: z.number().describe('Season number'),
|
|
11
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
export const SerieSchema = z.object({
|
|
4
|
+
backdrop_path: z.string().nullable().describe('Backdrop path (relative URL)'),
|
|
5
|
+
first_air_date: z.string().nullable().describe('First air date (YYYY-MM-DD format)'),
|
|
6
|
+
genre_ids: z.array(z.number()).describe('Array of genre IDs'),
|
|
7
|
+
id: z.number().describe('Unique identifier for the serie'),
|
|
8
|
+
name: z.string().describe('Serie name'),
|
|
9
|
+
origin_country: z.array(z.string()).describe('Array of origin countries'),
|
|
10
|
+
original_language: z.string().describe('Original language code (e.g., \'en\', \'es\', \'fr\')'),
|
|
11
|
+
original_name: z.string().describe('Original serie name (in original language)'),
|
|
12
|
+
overview: z.string().nullable().describe('Serie overview/synopsis'),
|
|
13
|
+
popularity: z.number().describe('Popularity score'),
|
|
14
|
+
poster_path: z.string().nullable().describe('Poster path (relative URL)'),
|
|
15
|
+
vote_average: z.number().describe('Average vote rating (0-10)'),
|
|
16
|
+
vote_count: z.number().describe('Total number of votes'),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export type Serie = z.infer<typeof SerieSchema>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
import { GenreSchema, ProductionCompanySchema, ProductionCountrySchema, LanguageSchema } from "../DataTypes";
|
|
4
|
+
|
|
5
|
+
import { SerieSchema } from "./Serie";
|
|
6
|
+
import { SeasonSchema } from "./Season";
|
|
7
|
+
import { NetworkSchema } from "./Network";
|
|
8
|
+
import { CreatorSchema } from "./Creator";
|
|
9
|
+
import { EpisodeSchema } from "./Episode";
|
|
10
|
+
|
|
11
|
+
export const SerieDetailsSchema = SerieSchema.omit({
|
|
12
|
+
genre_ids: true,
|
|
13
|
+
}).extend({
|
|
14
|
+
adult: z.boolean().describe('Adult content flag'),
|
|
15
|
+
created_by: z.array(CreatorSchema).describe('Creators of the serie'),
|
|
16
|
+
episode_run_time: z.array(z.number()).describe('Episode runtime in minutes'),
|
|
17
|
+
genres: z.array(GenreSchema).describe('Genres of the serie'),
|
|
18
|
+
homepage: z.string().nullable().describe('Homepage URL'),
|
|
19
|
+
in_production: z.boolean().describe('In production flag'),
|
|
20
|
+
languages: z.array(z.string()).describe('Languages of the serie'),
|
|
21
|
+
last_air_date: z.string().describe('Last air date (YYYY-MM-DD format)'),
|
|
22
|
+
last_episode_to_air: EpisodeSchema.describe('Last episode to air'),
|
|
23
|
+
next_episode_to_air: z.string().describe('Next episode to air'),
|
|
24
|
+
networks: z.array(NetworkSchema).describe('Networks of the serie'),
|
|
25
|
+
number_of_episodes: z.number().describe('Number of episodes'),
|
|
26
|
+
number_of_seasons: z.number().describe('Number of seasons'),
|
|
27
|
+
production_companies: z.array(ProductionCompanySchema).describe('Production companies of the serie'),
|
|
28
|
+
production_countries: z.array(ProductionCountrySchema).describe('Production countries of the serie'),
|
|
29
|
+
seasons: z.array(SeasonSchema).describe('Seasons of the serie'),
|
|
30
|
+
spoken_languages: z.array(LanguageSchema).describe('Spoken languages of the serie'),
|
|
31
|
+
status: z.string().describe('Status of the serie'),
|
|
32
|
+
tagline: z.string().nullable().describe('Tagline of the serie'),
|
|
33
|
+
type: z.string().describe('Type of the serie'),
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const SerieDetailsParamsSchema = z.object({
|
|
37
|
+
append_to_response: z.string().optional().describe('Append to response'),
|
|
38
|
+
include_image_language: z.string().optional().describe('Include image language'),
|
|
39
|
+
language: z.string().optional().describe('Language'),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export type SerieDetails = z.infer<typeof SerieDetailsSchema>;
|
|
43
|
+
export type SerieDetailsParams = z.infer<typeof SerieDetailsParamsSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import z from "zod";
|
|
2
|
+
|
|
3
|
+
import { SerieSchema } from "./Serie"
|
|
4
|
+
|
|
5
|
+
export const SeriesResponseSchema = z.object({
|
|
6
|
+
page: z.number().describe('Page number'),
|
|
7
|
+
results: z.array(SerieSchema).describe('Series'),
|
|
8
|
+
total_pages: z.number().describe('Total pages'),
|
|
9
|
+
total_results: z.number().describe('Total results'),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export type SeriesResponse = z.infer<typeof SeriesResponseSchema>;
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@segha/tmdb",
|
|
3
|
+
"version": "0.0.2",
|
|
3
4
|
"description": "Schemas for TMDB",
|
|
4
5
|
"main": "index.ts",
|
|
5
6
|
"keywords": [
|
|
@@ -7,7 +8,6 @@
|
|
|
7
8
|
"zod",
|
|
8
9
|
"tmdb"
|
|
9
10
|
],
|
|
10
|
-
"version": "0.0.1",
|
|
11
11
|
"author": "Aitor Llamas Jiménez <aitorllj93@gmail.com>",
|
|
12
12
|
"homepage": "https://github.com/aitorllj93/segha",
|
|
13
13
|
"repository": {
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"files": [
|
|
40
40
|
"*.ts",
|
|
41
|
+
"**/*.ts",
|
|
41
42
|
"json-schemas/**/*.json",
|
|
42
43
|
"README.md",
|
|
43
44
|
"CHANGELOG.md"
|