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