Skip to content

Commit 9fc65c1

Browse files
commands(tmdb): make some structs private.
also shuffle around how the tmdb models are laid out and fix comment spacing.
1 parent 1fc2f0f commit 9fc65c1

File tree

2 files changed

+64
-63
lines changed

2 files changed

+64
-63
lines changed

src/commands/search/tmdb/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ use serenity::all::{CreateActionRow, CreateButton, CreateEmbed, CreateEmbedFoote
1212
use std::time::Duration;
1313

1414
#[derive(Deserialize)]
15-
pub struct SearchResponse {
15+
struct SearchResponse {
1616
pub results: Vec<SearchResult>
1717
}
1818

1919
#[derive(Deserialize)]
20-
pub struct SearchResult {
20+
struct SearchResult {
2121
pub id: u64
2222
}
2323

2424
#[derive(Deserialize)]
2525
#[rustfmt::skip]
26-
pub struct Collection {
26+
struct Collection {
2727
pub name: String, // The name of the collection.
2828
pub overview: String, // The overview of the collection.
2929
pub poster_path: String, // The poster belonging to the collection.

src/models/tmdb/mod.rs

Lines changed: 61 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,44 @@ pub struct SimplifiedMovie {
4040
pub title: String // The title of the movie.
4141
}
4242

43+
#[derive(Deserialize)]
44+
#[rustfmt::skip]
45+
pub struct Show {
46+
pub backdrop_path: Option<String>, // The show's backdrop path.
47+
pub created_by: Vec<CreatedBy>, // The show's creators.
48+
pub episode_run_time: Vec<i64>, // An array containing the show's episode runtimes.
49+
pub first_air_date: NaiveDate, // The date the show first aired.
50+
pub genres: Vec<Genre>, // The genres that the show is in.
51+
pub homepage: String, // The show's homepage.
52+
pub id: i64, // The show's id on The Movie Database.
53+
pub in_production: bool, // Whether or not the show is currently in production.
54+
pub languages: Vec<String>, // The show's available languages.
55+
pub last_air_date: NaiveDate, // When the show last aired an episode.
56+
pub last_episode_to_air: EpisodeToAir, // The show's last aired episode.
57+
pub name: String, // The name of the show.
58+
pub next_episode_to_air: Option<EpisodeToAir>, // The show's next scheduled episode.
59+
pub networks: Vec<NetworkOrStudio>, // The networks or services that air the show.
60+
pub number_of_episodes: i64, // The total number of episodes the show has aired.
61+
pub number_of_seasons: i64, // The total number of seasons the show has released.
62+
pub origin_country: Vec<String>, // The country where the show originated.
63+
pub original_language: String, // The original language of the show.
64+
pub original_name: String, // The show's original name.
65+
pub overview: String, // The show's overview.
66+
pub popularity: f64, // An integer containing the show's popularity value.
67+
pub poster_path: Option<String>, // The show's poster path.
68+
#[serde(rename = "production_companies")]
69+
pub studios: Vec<NetworkOrStudio>, // The studios that produce and manage the show.
70+
pub seasons: Vec<Season>, // A vector array containing information on the show's individual seasons.
71+
pub spoken_languages: Vec<Language>, // A vector array containing information about the show's spoken languages.
72+
pub status: String, // The status of the show; can be Returning Series, Cancelled, or Ended.
73+
pub tagline: String, // The show's tagline.
74+
#[serde(rename = "type")]
75+
pub format: String, // The format of the show; can be Scripted, News, or Unscripted.
76+
pub vote_average: f64, // The show's average user score on The Movie Database.
77+
pub vote_count: i64, // The show's total amount of user votes on The Movie Database.
78+
// pub external_ids: ExternalId // The external IDs associated with the show, e.g. the external IMDb ID.
79+
}
80+
4381
#[derive(Deserialize)]
4482
#[rustfmt::skip]
4583
pub struct Collection {
@@ -49,66 +87,6 @@ pub struct Collection {
4987
pub backdrop_path: String // the backdrop of the collection.
5088
}
5189

52-
#[derive(Deserialize)]
53-
#[rustfmt::skip]
54-
pub struct Genre {
55-
pub id: u64, // The genre's ID.
56-
pub name: String // The genre's name.
57-
}
58-
59-
#[derive(Deserialize)]
60-
#[rustfmt::skip]
61-
pub struct ProductionCompany {
62-
pub name: String, // The friendly name of the production company.
63-
pub id: u64, // The ID of the production company on The Movie Database.
64-
pub origin_country: String // The country of origin of the production company.
65-
}
66-
67-
#[derive(Deserialize)]
68-
#[rustfmt::skip]
69-
pub struct ProductionCountry {
70-
pub iso_3166_1: String, // The ISO standard shortcode of the production country.
71-
pub name: String // The friendly name of the production country.
72-
}
73-
74-
#[derive(Deserialize)]
75-
#[rustfmt::skip]
76-
pub struct Show {
77-
pub backdrop_path: Option<String>, // The show's backdrop path.
78-
pub created_by: Vec<CreatedBy>, // The show's creators.
79-
pub episode_run_time: Vec<i64>, // An array containing the show's episode runtimes.
80-
pub first_air_date: NaiveDate, // The date the show first aired.
81-
pub genres: Vec<Genre>, // The genres that the show is in.
82-
pub homepage: String, // The show's homepage.
83-
pub id: i64, // The show's id on The Movie Database.
84-
pub in_production: bool, // Whether or not the show is currently in production.
85-
pub languages: Vec<String>, // The show's available languages.
86-
pub last_air_date: NaiveDate, // When the show last aired an episode.
87-
pub last_episode_to_air: EpisodeToAir, // The show's last aired episode.
88-
pub name: String, // The name of the show.
89-
pub next_episode_to_air: Option<EpisodeToAir>, // The show's next scheduled episode.
90-
pub networks: Vec<NetworkOrStudio>, // The networks or services that air the show.
91-
pub number_of_episodes: i64, // The total number of episodes the show has aired.
92-
pub number_of_seasons: i64, // The total number of seasons the show has released.
93-
pub origin_country: Vec<String>, // The country where the show originated.
94-
pub original_language: String, // The original language of the show.
95-
pub original_name: String, // The show's original name.
96-
pub overview: String, // The show's overview.
97-
pub popularity: f64, // An integer containing the show's popularity value.
98-
pub poster_path: Option<String>, // The show's poster path.
99-
#[serde(rename = "production_companies")]
100-
pub studios: Vec<NetworkOrStudio>, // The studios that produce and manage the show.
101-
pub seasons: Vec<Season>, // A vector array containing information on the show's individual seasons.
102-
pub spoken_languages: Vec<Language>, // A vector array containing information about the show's spoken languages.
103-
pub status: String, // The status of the show; can be Returning Series, Cancelled, or Ended.
104-
pub tagline: String, // The show's tagline.
105-
#[serde(rename = "type")]
106-
pub format: String, // The format of the show; can be Scripted, News, or Unscripted.
107-
pub vote_average: f64, // The show's average user score on The Movie Database.
108-
pub vote_count: i64, // The show's total amount of user votes on The Movie Database.
109-
// pub external_ids: ExternalId // The external IDs associated with the show, e.g. the external IMDb ID.
110-
}
111-
11290
#[derive(Deserialize)]
11391
#[rustfmt::skip]
11492
pub struct CreatedBy {
@@ -119,6 +97,13 @@ pub struct CreatedBy {
11997
pub profile_path: Option<String> // The (optional) profile path of the given creator.
12098
}
12199

100+
#[derive(Deserialize)]
101+
#[rustfmt::skip]
102+
pub struct Genre {
103+
pub id: u64, // The genre's ID.
104+
pub name: String // The genre's name.
105+
}
106+
122107
#[derive(Deserialize)]
123108
#[rustfmt::skip]
124109
pub struct EpisodeToAir {
@@ -155,6 +140,7 @@ pub struct Season {
155140
pub season_number: i64 // The season's numerical number.
156141
}
157142

143+
158144
#[derive(Deserialize)]
159145
#[rustfmt::skip]
160146
pub struct Language {
@@ -176,3 +162,18 @@ pub struct ExternalId {
176162
pub twitter_id: Option<String>, // The ID of the show's Twitter profile.
177163
pub id: Option<i64> // The show's The Movie Database identifier.
178164
}
165+
166+
#[derive(Deserialize)]
167+
#[rustfmt::skip]
168+
pub struct ProductionCompany {
169+
pub name: String, // The friendly name of the production company.
170+
pub id: u64, // The ID of the production company on The Movie Database.
171+
pub origin_country: String // The country of origin of the production company.
172+
}
173+
174+
#[derive(Deserialize)]
175+
#[rustfmt::skip]
176+
pub struct ProductionCountry {
177+
pub iso_3166_1: String, // The ISO standard shortcode of the production country.
178+
pub name: String // The friendly name of the production country.
179+
}

0 commit comments

Comments
 (0)