feat(tv): show cast for the entire show instead of only the last season (#778)

This uses TMDb's `aggregate_credits` instead of `credits` to get the show's cast for all seasons.

Fixes #775
This commit is contained in:
Danshil Mungur
2021-01-31 04:50:15 +04:00
committed by GitHub
parent e2b800000d
commit b239598e64
3 changed files with 28 additions and 4 deletions

View File

@@ -126,6 +126,14 @@ export interface TmdbCreditCast {
profile_path?: string;
}
export interface TmdbAggregateCreditCast extends TmdbCreditCast {
roles: {
credit_id: string;
character: string;
episode_count: number;
}[];
}
export interface TmdbCreditCrew {
credit_id: string;
gender?: number;
@@ -293,8 +301,10 @@ export interface TmdbTvDetails {
type: string;
vote_average: number;
vote_count: number;
aggregate_credits: {
cast: TmdbAggregateCreditCast[];
};
credits: {
cast: TmdbCreditCast[];
crew: TmdbCreditCrew[];
};
external_ids: TmdbExternalIds;
@@ -499,7 +509,8 @@ class TheMovieDb {
const response = await this.axios.get<TmdbTvDetails>(`/tv/${tvId}`, {
params: {
language,
append_to_response: 'credits,external_ids,keywords,videos',
append_to_response:
'aggregate_credits,credits,external_ids,keywords,videos',
},
});