Skip to content

Commit

Permalink
Merge pull request #30 from newmoneybigbucks/addingMissingFields
Browse files Browse the repository at this point in the history
Added missing fields (TMDB API docs do not list all the fields the endpoint can return)
  • Loading branch information
JorrinKievit authored Mar 28, 2024
2 parents 6a6746b + 0c20bfb commit 9ed0f6d
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 19 deletions.
10 changes: 10 additions & 0 deletions .changeset/hot-beds-crash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"tmdb-js-node": minor
"tmdb-js-web": minor
---

- Add "adult" field to TvGetDetailsBaseResponse
- Removed "original_title" from person credits
- Credit fields are now optional

Thanks to @newmoneybigbucks!
15 changes: 11 additions & 4 deletions packages/core/src/types/v3/people/base-cast-crew-credits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export interface PeoplePersonCredit {
credit_id: string;
}

interface PeopleCastAndCrewGetCombinedGetTvCredit extends PeoplePersonCredit {
original_title: string;
interface PeopleCastAndCrewGetCombinedGetMovieCredit extends PeoplePersonCredit {
release_date: string;
title: string;
video: boolean;
Expand All @@ -28,11 +27,19 @@ interface PeopleCrewCreditSpecificFields {
department: string;
}

export interface PeopleBaseCastGetMovieGetCombinedCredit extends PeopleCastAndCrewGetCombinedGetTvCredit, PeoplePersonCredit, PeopleCastCreditSpecificFields {
export interface PeopleBaseCastGetMovieCredit extends PeopleCastAndCrewGetCombinedGetMovieCredit, PeopleCastCreditSpecificFields {
order: number;
}

export type PeopleBaseCrewGetMovieGetCombinedCredit = PeopleCastAndCrewGetCombinedGetTvCredit & PeoplePersonCredit & PeopleCrewCreditSpecificFields;
export type PeopleBaseCrewGetMovieCredit = PeopleCastAndCrewGetCombinedGetMovieCredit & PeopleCrewCreditSpecificFields;

export type PeopleBaseCastGetTvCredit = PeoplePersonCredit & { character: string };
export type PeopleBaseCrewGetTvCredit = PeoplePersonCredit & PeopleCrewCreditSpecificFields;

export interface PeopleGetTvCreditsPerson {
origin_country: string[];
original_name: string;
first_air_date: string;
name: string;
episode_count: number;
}
6 changes: 3 additions & 3 deletions packages/core/src/types/v3/people/get-combined-credits.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { PeopleBaseCrewGetMovieGetCombinedCredit, PeopleBaseCastGetMovieGetCombinedCredit } from "./base-cast-crew-credits";
import { PeopleBaseCrewGetMovieCredit, PeopleBaseCastGetMovieCredit, PeopleGetTvCreditsPerson } from "./base-cast-crew-credits";

export interface PeopleGetCombinedCreditsResponse {
cast: PeopleGetCombinedCreditsCast[];
crew: PeopleGetCombinedCreditsCrew[];
id: number;
}

export type PeopleGetCombinedCreditsCast = PeopleBaseCastGetMovieGetCombinedCredit & { media_type: "movie" | "tv" };
export type PeopleGetCombinedCreditsCrew = PeopleBaseCrewGetMovieGetCombinedCredit & { media_type: "movie" | "tv" };
export type PeopleGetCombinedCreditsCast = PeopleBaseCastGetMovieCredit & { media_type: "movie" | "tv"; original_title?: string } & Partial<PeopleGetTvCreditsPerson>;
export type PeopleGetCombinedCreditsCrew = PeopleBaseCrewGetMovieCredit & { media_type: "movie" | "tv"; original_title?: string } & Partial<PeopleGetTvCreditsPerson>;

export interface PeopleGetCombinedCreditsParams {
language?: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/types/v3/people/get-movie-credits.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { PeopleBaseCastGetMovieGetCombinedCredit, PeopleBaseCrewGetMovieGetCombinedCredit } from "./base-cast-crew-credits";
import { PeopleBaseCastGetMovieCredit, PeopleBaseCrewGetMovieCredit } from "./base-cast-crew-credits";

export interface PeopleGetMovieCreditsResponse {
cast: PeopleGetMovieCreditsCast[];
crew: PeopleGetMovieCreditsCrew[];
id: number;
}

export type PeopleGetMovieCreditsCast = PeopleBaseCastGetMovieGetCombinedCredit;
export type PeopleGetMovieCreditsCrew = PeopleBaseCrewGetMovieGetCombinedCredit;
export type PeopleGetMovieCreditsCast = PeopleBaseCastGetMovieCredit & { original_title: string };
export type PeopleGetMovieCreditsCrew = PeopleBaseCrewGetMovieCredit & { original_title: string };

export interface PeopleGetMovieCreditsParams {
language?: string;
Expand Down
10 changes: 1 addition & 9 deletions packages/core/src/types/v3/people/get-tv-credits.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
import { PeopleBaseCastGetTvCredit, PeopleBaseCrewGetTvCredit } from "./base-cast-crew-credits";
import { PeopleBaseCastGetTvCredit, PeopleBaseCrewGetTvCredit, PeopleGetTvCreditsPerson } from "./base-cast-crew-credits";

export interface PeopleGetTvCreditsResponse {
cast: PeopleGetTvCreditsCast[];
crew: PeopleGetTvCreditsCrew[];
id: number;
}

export interface PeopleGetTvCreditsPerson {
origin_country: string[];
original_name: string;
first_air_date: string;
name: string;
episode_count: number;
}

export type PeopleGetTvCreditsCast = PeopleGetTvCreditsPerson & PeopleBaseCastGetTvCredit;
export type PeopleGetTvCreditsCrew = PeopleGetTvCreditsPerson & PeopleBaseCrewGetTvCredit;

Expand Down
1 change: 1 addition & 0 deletions packages/core/src/types/v3/people/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export * from "./get-popular";
export * from "./get-tagged-images";
export * from "./get-translations";
export * from "./get-tv-credits";
export type { PeopleGetTvCreditsPerson } from "./base-cast-crew-credits";
1 change: 1 addition & 0 deletions packages/core/src/types/v3/tv/get-details.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AppendToResponseType, TVAppendToResponse } from "../../append-to-response";

export interface TVGetDetailsBaseResponse {
adult: boolean;
backdrop_path: string;
created_by: TVGetDetailsCreatedBy[];
episode_run_time: number[];
Expand Down

0 comments on commit 9ed0f6d

Please sign in to comment.