tmdb_api/tvshow/
mod.rs

1use crate::common::country::Country;
2use crate::common::language::Language;
3use crate::company::CompanyShort;
4use crate::genre::Genre;
5use crate::people::PersonShort;
6
7pub mod aggregate_credits;
8
9pub mod content_rating;
10
11pub mod details;
12pub mod episode;
13
14pub mod images;
15
16pub mod keywords;
17
18pub mod latest;
19
20pub mod popular;
21
22pub mod search;
23pub mod season;
24
25pub mod similar;
26
27pub mod watch_providers;
28
29#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
30pub struct TVShowBase {
31    pub id: u64,
32    pub name: String,
33    pub original_name: String,
34    pub original_language: String,
35    pub origin_country: Vec<String>,
36    #[serde(default)]
37    pub overview: Option<String>,
38    #[serde(deserialize_with = "crate::util::empty_string::deserialize")]
39    pub first_air_date: Option<chrono::NaiveDate>,
40    #[serde(default)]
41    pub poster_path: Option<String>,
42    #[serde(default)]
43    pub backdrop_path: Option<String>,
44    pub popularity: f64,
45    pub vote_count: u64,
46    pub vote_average: f64,
47    #[serde(default)]
48    pub adult: bool,
49}
50
51#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
52pub struct TVShowShort {
53    #[serde(flatten)]
54    pub inner: TVShowBase,
55    pub genre_ids: Vec<u64>,
56}
57
58#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
59pub struct EpisodeShort {
60    pub air_date: Option<chrono::NaiveDate>,
61    pub episode_number: u64,
62    pub id: u64,
63    pub name: String,
64    #[serde(deserialize_with = "crate::util::empty_string::deserialize")]
65    pub overview: Option<String>,
66    pub production_code: String,
67    pub season_number: u64,
68    pub still_path: Option<String>,
69    pub vote_average: f64,
70    pub vote_count: u64,
71}
72
73#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
74pub struct Episode {
75    #[serde(flatten)]
76    pub inner: EpisodeShort,
77    //
78    pub crew: Vec<PersonShort>,
79    pub guest_stars: Vec<PersonShort>,
80}
81
82#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
83pub struct SeasonBase {
84    #[serde(deserialize_with = "crate::util::empty_string::deserialize")]
85    pub air_date: Option<chrono::NaiveDate>,
86    pub id: u64,
87    pub name: String,
88    #[serde(deserialize_with = "crate::util::empty_string::deserialize")]
89    pub overview: Option<String>,
90    pub poster_path: Option<String>,
91    pub season_number: u64,
92}
93
94#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
95pub struct SeasonShort {
96    #[serde(flatten)]
97    pub inner: SeasonBase,
98    //
99    pub episode_count: u64,
100}
101
102#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
103pub struct Season {
104    pub _id: String,
105    #[serde(flatten)]
106    pub inner: SeasonBase,
107    pub episodes: Vec<Episode>,
108}
109
110#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
111pub struct TVShow {
112    #[serde(flatten)]
113    pub inner: TVShowBase,
114    pub created_by: Vec<PersonShort>,
115    pub episode_run_time: Vec<u64>,
116    pub genres: Vec<Genre>,
117    pub homepage: String,
118    pub in_production: bool,
119    pub languages: Vec<String>,
120    #[serde(deserialize_with = "crate::util::empty_string::deserialize")]
121    pub last_air_date: Option<chrono::NaiveDate>,
122    pub last_episode_to_air: Option<EpisodeShort>,
123    pub next_episode_to_air: Option<EpisodeShort>,
124    pub networks: Vec<CompanyShort>,
125    /// Unlikely to be `None` but found with 81040.
126    /// In this case, could be computed by summing the `episodes_count` of the `seasons` field.
127    pub number_of_episodes: Option<u64>,
128    pub number_of_seasons: u64,
129    pub production_companies: Vec<CompanyShort>,
130    pub production_countries: Vec<Country>,
131    pub seasons: Vec<SeasonShort>,
132    pub spoken_languages: Vec<Language>,
133    pub status: String,
134    #[serde(deserialize_with = "crate::util::empty_string::deserialize")]
135    pub tagline: Option<String>,
136    #[serde(rename = "type")]
137    pub ttype: String,
138}