feat: upcoming movies on discover
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import { number } from 'yup';
|
||||
|
||||
interface SearchOptions {
|
||||
query: string;
|
||||
@@ -100,6 +101,14 @@ interface TmdbSearchTvResponse extends TmdbPaginatedResponse {
|
||||
results: TmdbTvResult[];
|
||||
}
|
||||
|
||||
interface TmdbUpcomingMoviesResponse extends TmdbPaginatedResponse {
|
||||
dates: {
|
||||
maximum: string;
|
||||
minimum: string;
|
||||
};
|
||||
results: TmdbMovieResult[];
|
||||
}
|
||||
|
||||
interface TmdbExternalIdResponse {
|
||||
movie_results: TmdbMovieResult[];
|
||||
tv_results: TmdbTvResult[];
|
||||
@@ -520,6 +529,30 @@ class TheMovieDb {
|
||||
}
|
||||
};
|
||||
|
||||
public getUpcomingMovies = async ({
|
||||
page = 1,
|
||||
language = 'en-US',
|
||||
}: {
|
||||
page: number;
|
||||
language: string;
|
||||
}): Promise<TmdbUpcomingMoviesResponse> => {
|
||||
try {
|
||||
const response = await this.axios.get<TmdbUpcomingMoviesResponse>(
|
||||
'/movie/upcoming',
|
||||
{
|
||||
params: {
|
||||
page,
|
||||
language,
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
return response.data;
|
||||
} catch (e) {
|
||||
throw new Error(`[TMDB] Failed to fetch upcoming movies: ${e.message}`);
|
||||
}
|
||||
};
|
||||
|
||||
public getAllTrending = async ({
|
||||
page = 1,
|
||||
timeWindow = 'day',
|
||||
|
||||
Reference in New Issue
Block a user