mirror of
https://github.com/movie-web/movie-web.git
synced 2025-09-13 18:03:25 +00:00
use external ids endpoint for imdb ids
This commit is contained in:
@@ -6,15 +6,18 @@ import {
|
||||
MWSeasonMeta,
|
||||
TMDBContentTypes,
|
||||
TMDBEpisodeShort,
|
||||
TMDBExternalIds,
|
||||
TMDBMediaResult,
|
||||
TMDBMediaStatic,
|
||||
TMDBMovieData,
|
||||
TMDBMovieExternalIds,
|
||||
TMDBMovieResponse,
|
||||
TMDBMovieResult,
|
||||
TMDBSearchResultStatic,
|
||||
TMDBSeason,
|
||||
TMDBSeasonMetaResult,
|
||||
TMDBShowData,
|
||||
TMDBShowExternalIds,
|
||||
TMDBShowResponse,
|
||||
TMDBShowResult,
|
||||
} from "./types";
|
||||
@@ -170,6 +173,28 @@ export abstract class Tmdb {
|
||||
title: e.name,
|
||||
}));
|
||||
}
|
||||
|
||||
public static async getExternalIds(
|
||||
id: string,
|
||||
type: TMDBContentTypes
|
||||
): Promise<TMDBExternalIds> {
|
||||
let data;
|
||||
|
||||
switch (type) {
|
||||
case "movie":
|
||||
data = await Tmdb.get<TMDBMovieExternalIds>(
|
||||
`/movie/${id}/external_ids`
|
||||
);
|
||||
break;
|
||||
case "show":
|
||||
data = await Tmdb.get<TMDBShowExternalIds>(`/tv/${id}/external_ids`);
|
||||
break;
|
||||
default:
|
||||
throw new Error("Invalid media type");
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
export async function formatTMDBSearchResult(
|
||||
|
Reference in New Issue
Block a user