Skip to content

Commit 32833eb

Browse files
committed
feat(tmdb): adds movie endpoints
feat(tmdb): adds people endpoints feat(tmdb): search & people feat(tmdb): series endpoint feat(tmdb): episode endpoints
1 parent 735c13a commit 32833eb

30 files changed

+3670
-72
lines changed

src/models/tmdb/tmdb-account.model.ts

+26
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,29 @@ export type TmdbAccount = {
1818
iso_639_1: string;
1919
avatar: TmdbAccountAvatar;
2020
};
21+
22+
export type TmdbAccountStatus = {
23+
id: number;
24+
favorite: boolean;
25+
rated?:
26+
| false
27+
| {
28+
value: number;
29+
};
30+
watchlist: boolean;
31+
};
32+
33+
export type TmdbAccountEpisodeStatus = {
34+
id: number;
35+
episode_number: number;
36+
rated:
37+
| false
38+
| {
39+
value: number;
40+
};
41+
};
42+
43+
export type TmdbAccountSeasonStatus = {
44+
id: number;
45+
results: TmdbAccountEpisodeStatus[];
46+
};

src/models/tmdb/tmdb-change.model.ts

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type { RecursiveRecord } from '~/utils/typescript.utils';
2+
3+
export type TmdbChange<T = RecursiveRecord | string | number | boolean> = {
4+
id: string;
5+
action: string;
6+
/** * YYY-MM-DD HH:mm:ss UTC */
7+
time: string;
8+
/** ISO 639-1 language code */
9+
iso_639_1: string;
10+
/** ISO 3166-1 country code */
11+
iso_3166_1: string;
12+
original_value?: T;
13+
value?: T;
14+
};
15+
16+
export type TmdbChanges<T extends RecursiveRecord = TmdbChange> = {
17+
changes: Array<{
18+
key: string;
19+
items: T[];
20+
}>;
21+
};
+16-14
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
1+
import type { TmdbImageShort } from '~/models/tmdb/tmdb-image.model';
12
import type { TmdbMovie } from '~/models/tmdb/tmdb-movie.model';
3+
import type { TmdbShow } from '~/models/tmdb/tmdb-show.model';
24

35
export type TmdbCollection = {
46
id: number;
57
name: string;
68
overview?: string;
79
poster_path: string;
810
backdrop_path: string;
9-
parts?: TmdbMovie[];
10-
};
11-
12-
export type TmdbCollectionImage = {
13-
file_path: string;
14-
/** ISO 639-1 language code */
15-
iso_639_1: string;
16-
aspect_ratio: number;
17-
height: number;
18-
width: number;
19-
vote_average: number;
20-
vote_count: number;
11+
parts?: (TmdbMovie | TmdbShow)[];
2112
};
2213

2314
export type TmdbCollectionImages = {
2415
/** The id of the collection. */
2516
id: number;
26-
backdrops?: TmdbCollectionImage[];
27-
posters?: TmdbCollectionImage[];
17+
backdrops?: TmdbImageShort[];
18+
posters?: TmdbImageShort[];
19+
};
20+
21+
export type TmdbSearchCollection = {
22+
adult: boolean;
23+
backdrop_path: string;
24+
id: number;
25+
name: string;
26+
original_language: string;
27+
original_name: string;
28+
overview: string;
29+
poster_path: string;
2830
};

src/models/tmdb/tmdb-company.model.ts

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export type TmdbCompanyShort = {
2+
id: number;
3+
logo_path?: string;
4+
name: string;
5+
origin_country: string;
6+
};
7+
8+
export type TmdbCompany = TmdbCompanyShort & {
9+
parent_company?: TmdbCompany;
10+
description?: string;
11+
headquarters?: string;
12+
homepage?: string;
13+
};

src/models/tmdb/tmdb-credit.model.ts

+140
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { TmdbEpisodeShort } from '~/models/tmdb/tmdb-episode.model';
22
import type { TmdbPersonShort } from '~/models/tmdb/tmdb-person.model';
33
import type { TmdbSeasonShort } from '~/models/tmdb/tmdb-season.model';
44
import type { TmdbShowShort } from '~/models/tmdb/tmdb-show.model';
5+
import type { RecursiveRecord } from '~/utils/typescript.utils';
56

67
export type TmdbCreditSeason = Omit<TmdbSeasonShort, 'vote_average'> & {
78
show_id: number;
@@ -32,3 +33,142 @@ export type TmdbCredit = {
3233
id: string;
3334
person: TmdbCreditPerson;
3435
};
36+
37+
export type TmdbMovieCreditCast = TmdbPersonShort & {
38+
original_name: string;
39+
cast_id: number;
40+
character: string;
41+
credit_id: string;
42+
order: number;
43+
};
44+
45+
export type TmdbMovieCreditCrew = TmdbPersonShort & {
46+
original_name: string;
47+
credit_id: string;
48+
department: string;
49+
job: string;
50+
};
51+
52+
export type TmdbMovieCredit = {
53+
id: number;
54+
cast: TmdbMovieCreditCast[];
55+
crew: TmdbMovieCreditCrew[];
56+
};
57+
58+
type BasePersonCredit = {
59+
adult: boolean;
60+
backdrop_path: string;
61+
genre_ids: number[];
62+
id: number;
63+
original_language: string;
64+
overview: string;
65+
popularity: number;
66+
poster_path: string;
67+
vote_average: number;
68+
vote_count: number;
69+
credit_id: string;
70+
};
71+
72+
export type TmdbPersonCredit = BasePersonCredit & {
73+
original_title: string;
74+
release_date: string;
75+
title: string;
76+
video: boolean;
77+
};
78+
79+
export type TmdbCombinedPerson = TmdbPersonCredit & {
80+
media_type: string;
81+
};
82+
83+
export type TmdbCombinedCast<T extends RecursiveRecord> = {
84+
character: string;
85+
order?: number;
86+
} & T;
87+
88+
export type TmdbCombinedCrew<T extends RecursiveRecord> = {
89+
department: string;
90+
job: string;
91+
} & T;
92+
93+
export type TmdbCombinedCredit = {
94+
id: number;
95+
cast: TmdbCombinedCast<TmdbCombinedPerson>[];
96+
crew: TmdbCombinedCrew<TmdbCombinedPerson>[];
97+
};
98+
99+
export type TmdbPersonMovieCredits = {
100+
id: number;
101+
cast: TmdbCombinedCast<TmdbPersonCredit>[];
102+
crew: TmdbCombinedCrew<TmdbPersonCredit>[];
103+
};
104+
105+
type TmdbPersonShowCredit = BasePersonCredit & {
106+
origin_country: string[];
107+
original_name: string;
108+
first_air_date: string;
109+
name: string;
110+
episode_count: number;
111+
};
112+
113+
export type TmdbPersonShowCredits = {
114+
id: number;
115+
cast: TmdbCombinedCast<TmdbPersonShowCredit>[];
116+
crew: TmdbCombinedCrew<TmdbPersonShowCredit>[];
117+
};
118+
119+
export type TmdbShowAggregateCreditRole = {
120+
credit_id: string;
121+
character: string;
122+
episode_count: number;
123+
};
124+
125+
export type TmdbAggregateCreditCast = TmdbPersonShort & {
126+
roles: TmdbShowAggregateCreditRole[];
127+
total_episode_count: number;
128+
order: number;
129+
};
130+
131+
export type TmdbAggregateCreditJob = {
132+
credit_id: string;
133+
job: string;
134+
episode_count: number;
135+
};
136+
137+
export type TmdbAggregateCreditCrew = TmdbPersonShort & {
138+
jobs: TmdbAggregateCreditJob[];
139+
department: string;
140+
total_episode_count: number;
141+
};
142+
143+
export type TmdbAggregateCredits = {
144+
id: number;
145+
cast: TmdbAggregateCreditCast[];
146+
crew: TmdbAggregateCreditCrew[];
147+
};
148+
149+
export type TmdbShowCreditCast = TmdbPersonShort & {
150+
original_name: string;
151+
character: string;
152+
credit_id: string;
153+
order: number;
154+
};
155+
156+
export type TmdbShowCreditCrew = TmdbPersonShort & {
157+
original_name: string;
158+
credit_id: string;
159+
department: string;
160+
job: string;
161+
};
162+
163+
export type TmdbShowCredits = {
164+
id: number;
165+
cast: TmdbShowCreditCast[];
166+
crew: TmdbShowCreditCrew[];
167+
};
168+
169+
export type TmdbEpisodeCredits = {
170+
id: number;
171+
cast: TmdbShowCreditCast[];
172+
crew: TmdbShowCreditCrew[];
173+
guest_stars: TmdbShowCreditCast[];
174+
};

src/models/tmdb/tmdb-entity.model.ts

+41
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,44 @@ export type TmdbAccountRating = {
5353
created_at: string;
5454
value: number;
5555
};
56+
57+
export type TmdbVideo = {
58+
id: string;
59+
/** ISO 639-1 language code */
60+
iso_639_1: string;
61+
/** ISO 3166-1 country code */
62+
iso_3166_1: string;
63+
key: string;
64+
name: string;
65+
site: string;
66+
size: number;
67+
type: string;
68+
official: boolean;
69+
published_at: string;
70+
};
71+
72+
export type TmdbAlternativeName = {
73+
name: string;
74+
type: string;
75+
};
76+
77+
export type TmdbAlternativeNames = {
78+
id: number;
79+
results: TmdbAlternativeName[];
80+
};
81+
82+
export type TmdbAlternativeTitle = TmdbAlternativeName & {
83+
title: string;
84+
};
85+
86+
export type TmdbAlternativeTitles = {
87+
id: number;
88+
results: TmdbAlternativeTitle[];
89+
};
90+
91+
export type TmdbContentRating = {
92+
description: string;
93+
/** The ISO 3166-1 code of the country */
94+
iso_3166_1: string;
95+
rating: string;
96+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import type { EntityTypes, Extended, Short, TmdbNetwork } from '~/models/tmdb/tmdb-entity.model';
2+
import type { TmdbEpisodeShort } from '~/models/tmdb/tmdb-episode.model';
3+
4+
export type TmdbEpisodeGroupShort = {
5+
description: string;
6+
episode_count: number;
7+
group_count: number;
8+
id: string;
9+
name: string;
10+
network: TmdbNetwork;
11+
type: number;
12+
};
13+
14+
export type TmdbEpisodeGroupEpisode = TmdbEpisodeShort & {
15+
show_id: number;
16+
order: number;
17+
};
18+
19+
export type TmdbEpisodeGroupItem = {
20+
id: string;
21+
name: string;
22+
order: number;
23+
locked: boolean;
24+
episodes: TmdbEpisodeGroupEpisode[];
25+
};
26+
27+
export type TmdbEpisodeGroupExtended = TmdbEpisodeGroupShort & {
28+
groups: TmdbEpisodeGroupItem[];
29+
};
30+
31+
export type TmdbEpisodeGroup<T extends EntityTypes = Short> = T extends Extended
32+
? TmdbEpisodeGroupExtended
33+
: T extends Short
34+
? TmdbEpisodeGroupShort
35+
: TmdbEpisodeGroupExtended | TmdbEpisodeGroupShort;

src/models/tmdb/tmdb-image.model.ts

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import type { EntityTypes, Extended, Short } from '~/models/tmdb/tmdb-entity.model';
2+
import type { TmdbMovieShort } from '~/models/tmdb/tmdb-movie.model';
3+
import type { TmdbShowShort } from '~/models/tmdb/tmdb-show.model';
4+
5+
export type TmdbImageShort = {
6+
file_path: string;
7+
/** ISO 639-1 language code */
8+
iso_639_1: string;
9+
aspect_ratio: number;
10+
height: number;
11+
width: number;
12+
vote_average: number;
13+
vote_count: number;
14+
};
15+
16+
export type TmdbImageExtended = Omit<TmdbImageShort, 'iso_639_1'> & {
17+
id: string;
18+
file_type: string;
19+
};
20+
21+
export type TmdbImages = {
22+
id: number;
23+
logos: TmdbImageExtended[];
24+
};
25+
26+
export type TmdbImage<T extends EntityTypes = Short> = T extends Short
27+
? TmdbImageShort
28+
: T extends Extended
29+
? TmdbImageExtended
30+
: TmdbImageShort | TmdbImageExtended;
31+
32+
export type TmdbTaggedImage = TmdbImageShort & {
33+
id: string;
34+
image_type: string;
35+
media_type: string;
36+
media: TmdbMovieShort | TmdbShowShort;
37+
};

src/models/tmdb/tmdb-list.model.ts

+4
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,7 @@ export type TmdbListV3 = {
4848
name: string;
4949
poster_path: string;
5050
};
51+
52+
export type TmdbShowListV3 = Omit<TmdbListV3, 'list_type'> & {
53+
iso_3166_1: string;
54+
};

0 commit comments

Comments
 (0)