Skip to content

Commit 6c2ba7b

Browse files
committed
feat(tmdb): add endpoints
1 parent b41a01a commit 6c2ba7b

26 files changed

+1672
-106
lines changed

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

+19
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,26 @@ import type { TmdbMovie } from '~/models/tmdb/tmdb-movie.model';
33
export type TmdbCollection = {
44
id: number;
55
name: string;
6+
overview?: string;
67
poster_path: string;
78
backdrop_path: string;
89
parts?: TmdbMovie[];
910
};
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;
21+
};
22+
23+
export type TmdbCollectionImages = {
24+
/** The id of the collection. */
25+
id: number;
26+
backdrops?: TmdbCollectionImage[];
27+
posters?: TmdbCollectionImage[];
28+
};

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

Whitespace-only changes.

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

+18
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,21 @@ export type TmdbConfiguration = {
1010
};
1111
change_keys: string[];
1212
};
13+
14+
export type TmdbConfigurationCounty = {
15+
/** The ISO 3166-1 code of the country */
16+
iso_3166_1: string;
17+
english_name: string;
18+
native_name: string;
19+
};
20+
21+
export type TmdbConfigurationJobs = {
22+
department: string;
23+
jobs: string[];
24+
};
25+
26+
export type TmdbConfigurationTimezones = {
27+
/** The ISO 3166-1 code of the country */
28+
iso_3166_1: string;
29+
zones: string[];
30+
};

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

+10-47
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,23 @@
1-
export type TmdbCreditSeason = {
2-
air_date: string;
3-
episode_count: number;
4-
id: number;
5-
name: string;
6-
overview: string;
7-
poster_path: string;
8-
season_number: number;
1+
import type { TmdbEpisodeShort } from '~/models/tmdb/tmdb-episode.model';
2+
import type { TmdbPersonShort } from '~/models/tmdb/tmdb-person.model';
3+
import type { TmdbSeasonShort } from '~/models/tmdb/tmdb-season.model';
4+
import type { TmdbShowShort } from '~/models/tmdb/tmdb-show.model';
5+
6+
export type TmdbCreditSeason = Omit<TmdbSeasonShort, 'vote_average'> & {
97
show_id: number;
108
};
119

12-
export type TmdbCreditPerson = {
13-
adult: boolean;
14-
id: number;
15-
name: string;
10+
export type TmdbCreditPerson = TmdbPersonShort & {
1611
original_name: string;
1712
media_type: string;
18-
popularity: number;
19-
gender: number;
20-
known_for_department: string;
21-
profile_path: string;
2213
};
2314

24-
export type TmdbCreditEpisode = {
25-
id: number;
26-
name: string;
27-
overview: string;
28-
media_type: string;
29-
vote_average: number;
30-
vote_count: number;
31-
/** Air date of the episode (YYYY-MM-DD) */
32-
air_date: string;
33-
episode_number: number;
34-
episode_type: string;
35-
production_code: string;
36-
runtime: number;
37-
season_number: number;
15+
export type TmdbCreditEpisode = TmdbEpisodeShort & {
3816
show_id: number;
39-
still_path: string;
17+
episode_type: string;
4018
};
4119

42-
export type TmdbCreditMedia = {
43-
adult: boolean;
44-
backdrop_path: string;
45-
id: number;
46-
name: string;
47-
original_language: string;
48-
original_name: string;
49-
overview: string;
50-
poster_path: string;
51-
media_type: string;
52-
genre_ids: number[];
53-
popularity: number;
54-
first_air_date: string;
55-
vote_average: number;
56-
vote_count: number;
57-
origin_country: string[];
20+
export type TmdbCreditMedia = TmdbShowShort & {
5821
character: string;
5922
episodes: TmdbCreditEpisode[];
6023
seasons: TmdbCreditSeason[];
+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
export type TmdbDiscoverMovieQuery = {
2+
/** use in conjunction with region */
3+
certification: string;
4+
/** use in conjunction with region */
5+
'certification.gte': string;
6+
/** use in conjunction with region */
7+
'certification.lte': string;
8+
/** use in conjunction with the certification, certification.gte and certification.lte filters */
9+
certification_country: string;
10+
include_adult: boolean;
11+
include_video: boolean;
12+
language: string;
13+
primary_release_year: number;
14+
'primary_release_date.gte': string;
15+
'primary_release_date.lte': string;
16+
region: string;
17+
'release_date.gte': string;
18+
'release_date.lte': string;
19+
/** Default: popularity.desc */
20+
sort_by:
21+
| 'original_title.asc'
22+
| 'original_title.desc'
23+
| 'popularity.asc'
24+
| 'popularity.desc'
25+
| 'revenue.asc'
26+
| 'revenue.desc'
27+
| 'primary_release_date.asc'
28+
| 'title.asc'
29+
| 'title.desc'
30+
| 'primary_release_date.desc'
31+
| 'vote_average.asc'
32+
| 'vote_average.desc'
33+
| 'vote_count.asc'
34+
| 'vote_count.desc';
35+
'vote_average.gte': number;
36+
'vote_average.lte': number;
37+
'vote_count.gte': number;
38+
'vote_count.lte': number;
39+
watch_region: string;
40+
/** can be a comma (AND) or pipe (OR) separated query */
41+
with_cast: string;
42+
/** can be a comma (AND) or pipe (OR) separated query */
43+
with_companies: string;
44+
/** can be a comma (AND) or pipe (OR) separated query */
45+
with_crew: string;
46+
/** can be a comma (AND) or pipe (OR) separated query */
47+
with_genres: string;
48+
/** can be a comma (AND) or pipe (OR) separated query */
49+
with_keywords: string;
50+
with_origin_country: string;
51+
with_original_language: string;
52+
/** can be a comma (AND) or pipe (OR) separated query */
53+
with_people: string;
54+
/** possible values are: [1, 2, 3, 4, 5, 6] can be a comma (AND) or pipe (OR) separated query, can be used in conjunction with region */
55+
with_release_type: string;
56+
'with_runtime.gte': number;
57+
'with_runtime.lte': number;
58+
/** possible values are: [flatrate, free, ads, rent, buy] use in conjunction with watch_region, can be a comma (AND) or pipe (OR) separated query */
59+
with_watch_monetization_types: string;
60+
/** use in conjunction with watch_region, can be a comma (AND) or pipe (OR) separated query */
61+
with_watch_providers: string;
62+
without_companies: string;
63+
without_genres: string;
64+
without_keywords: string;
65+
without_watch_providers: string;
66+
year: number;
67+
};
68+
69+
export type TmdbDiscoverTvQuery = {
70+
'air_date.gte': string;
71+
'air_date.lte': string;
72+
first_air_date_year: number;
73+
'first_air_date.gte': string;
74+
'first_air_date.lte': string;
75+
include_adult: boolean;
76+
include_null_first_air_dates: boolean;
77+
language: string;
78+
screened_theatrically: boolean;
79+
/** Default: popularity.desc */
80+
sort_by:
81+
| 'first_air_date.asc'
82+
| 'first_air_date.desc'
83+
| 'name.asc'
84+
| 'name.desc'
85+
| 'original_name.asc'
86+
| 'original_name.desc'
87+
| 'popularity.asc'
88+
| 'popularity.desc'
89+
| 'vote_average.asc'
90+
| 'vote_average.desc'
91+
| 'vote_count.asc'
92+
| 'vote_count.desc';
93+
timezone: string;
94+
'vote_average.gte': number;
95+
'vote_average.lte': number;
96+
'vote_count.gte': number;
97+
'vote_count.lte': number;
98+
watch_region: string;
99+
/** can be a comma (AND) or pipe (OR) separated query */
100+
with_companies: string;
101+
/** can be a comma (AND) or pipe (OR) separated query */
102+
with_genres: string;
103+
/** can be a comma (AND) or pipe (OR) separated query */
104+
with_keywords: string;
105+
with_networks: string;
106+
with_origin_country: string;
107+
with_original_language: string;
108+
'with_runtime.gte': number;
109+
'with_runtime.lte': number;
110+
/** possible values are: [0, 1, 2, 3, 4, 5], can be a comma (AND) or pipe (OR) separated query */
111+
with_status: string;
112+
/** possible values are: [flatrate, free, ads, rent, buy] use in conjunction with watch_region, can be a comma (AND) or pipe (OR) separated query */
113+
with_watch_monetization_types: string;
114+
/** use in conjunction with watch_region, can be a comma (AND) or pipe (OR) separated query */
115+
with_watch_providers: string;
116+
without_companies: string;
117+
without_genres: string;
118+
without_keywords: string;
119+
without_watch_providers: string;
120+
/** possible values are: [0, 1, 2, 3, 4, 5, 6], can be a comma (AND) or pipe (OR) separated query */
121+
with_type: string;
122+
};

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

+1-11
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@ export type TmdbGenre = {
1515
name: string;
1616
};
1717

18-
export type TmdbCompany = {
19-
id: number;
20-
logo_path?: string;
21-
name: string;
22-
origin_country: string;
23-
parent_company?: TmdbCompany;
24-
description?: string;
25-
headquarters?: string;
26-
homepage?: string;
27-
};
28-
2918
export type TmdbCountry = {
3019
/** The ISO 3166-1 code of the country */
3120
iso_3166_1: string;
@@ -34,6 +23,7 @@ export type TmdbCountry = {
3423

3524
export type TmdbLanguage = {
3625
english_name: string;
26+
/** The ISO 639-1 code of the language */
3727
iso_639_1: string;
3828
name: string;
3929
};

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

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
import type { TmdbCollection } from '~/models/tmdb/tmdb-collection.model';
2-
import type {
3-
EntityTypes,
4-
Extended,
5-
Short,
6-
TmdbAccountRating,
7-
TmdbCompany,
8-
TmdbCountry,
9-
TmdbGenre,
10-
TmdbLanguage,
11-
} from '~/models/tmdb/tmdb-entity.model';
2+
import type { EntityTypes, Extended, Short, TmdbAccountRating, TmdbCountry, TmdbGenre, TmdbLanguage } from '~/models/tmdb/tmdb-entity.model';
3+
import type { TmdbCompanyModel } from '~/models/tmdb/tmdb.company.model';
124

135
export type TmdbMovieShort = {
146
media_type?: 'movie';
@@ -35,7 +27,7 @@ export type TmdbMovieExtended = TmdbMovieShort & {
3527
genres: TmdbGenre[];
3628
homepage: string;
3729
imdb_id: string;
38-
production_companies: TmdbCompany[];
30+
production_companies: TmdbCompanyModel[];
3931
production_countries: TmdbCountry[];
4032
revenue: number;
4133
runtime: number;
@@ -53,3 +45,7 @@ export type TmdbMovie<T extends EntityTypes = Short> = T extends Extended
5345
export type TmdbMovieRating = TmdbMovie & {
5446
account_rating: TmdbAccountRating;
5547
};
48+
49+
export type TmdbMovieGuestRating = TmdbMovie & {
50+
rating: number;
51+
};

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ import type {
33
Extended,
44
Short,
55
TmdbAccountRating,
6-
TmdbCompany,
76
TmdbCountry,
87
TmdbGenre,
98
TmdbLanguage,
109
TmdbNetwork,
1110
} from '~/models/tmdb/tmdb-entity.model';
1211
import type { TmdbEpisode } from '~/models/tmdb/tmdb-episode.model';
1312
import type { TmdbSeason } from '~/models/tmdb/tmdb-season.model';
13+
import type { TmdbCompanyModel } from '~/models/tmdb/tmdb.company.model';
1414

1515
export type TmdbPersonShow = {
1616
id: number;
@@ -52,7 +52,7 @@ export type TmdbShowExtended = TmdbShowShort & {
5252
networks: TmdbNetwork[];
5353
number_of_episodes: number;
5454
number_of_seasons: number;
55-
production_companies: TmdbCompany[];
55+
production_companies: TmdbCompanyModel[];
5656
production_countries: TmdbCountry[];
5757
seasons: TmdbSeason[];
5858
spoken_languages: TmdbLanguage[];
@@ -70,3 +70,6 @@ export type TmdbShow<T extends EntityTypes = Short> = T extends Extended
7070
export type TmdbShowRating = TmdbShowShort & {
7171
account_rating: TmdbAccountRating;
7272
};
73+
export type TmdbShowGuestRating = TmdbShowShort & {
74+
rating: number;
75+
};
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
export type TmdbTranslation = {
2+
iso_3166_1: string;
3+
iso_639_1: string;
4+
name: string;
5+
english_name: string;
6+
data: {
7+
title: string;
8+
overview: string;
9+
homepage: string;
10+
};
11+
};
12+
13+
export type TmdbTranslations = {
14+
id: number;
15+
translations: TmdbTranslation[];
16+
};

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

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
export type TmdbCompanyModel = {
2+
id: number;
3+
logo_path?: string;
4+
name: string;
5+
origin_country: string;
6+
parent_company?: TmdbCompanyModel;
7+
description?: string;
8+
headquarters?: string;
9+
homepage?: string;
10+
};
11+
12+
export type TmdbCompanyAlternativeName = {
13+
name: string;
14+
type: string;
15+
};
16+
17+
export type TmdbCompanyAlternativeNames = {
18+
/** The company id */
19+
id: number;
20+
results: TmdbCompanyAlternativeName[];
21+
};
22+
23+
export type TmdbCompanyImage = {
24+
id: string;
25+
file_path: string;
26+
file_type: string;
27+
aspect_ratio: number;
28+
height: number;
29+
width: number;
30+
vote_average: number;
31+
vote_count: number;
32+
};
33+
34+
export type TmdbCompanyImages = {
35+
id: number;
36+
logos: TmdbCompanyImage[];
37+
};

0 commit comments

Comments
 (0)