mirror of
https://github.com/p-stream/p-stream.git
synced 2026-04-14 10:50:20 +00:00
add getRelatedMedia tmdb.ts function
This commit is contained in:
parent
cec7851d84
commit
5cd63c2a25
1 changed files with 13 additions and 0 deletions
|
|
@ -436,6 +436,19 @@ export async function getMediaCredits(
|
|||
return get<TMDBCredits>(`/${endpoint}/${id}/credits`);
|
||||
}
|
||||
|
||||
export async function getRelatedMedia(
|
||||
id: string,
|
||||
type: TMDBContentTypes,
|
||||
limit: number = 10,
|
||||
): Promise<TMDBMovieSearchResult[] | TMDBShowSearchResult[]> {
|
||||
const endpoint = type === TMDBContentTypes.MOVIE ? "movie" : "tv";
|
||||
const data = await get<{
|
||||
results: TMDBMovieSearchResult[] | TMDBShowSearchResult[];
|
||||
}>(`/${endpoint}/${id}/similar`);
|
||||
|
||||
return data.results.slice(0, limit);
|
||||
}
|
||||
|
||||
export async function getPersonDetails(id: string): Promise<TMDBPerson> {
|
||||
return get<TMDBPerson>(`/person/${id}`);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue