Skip to content

Commit

Permalink
commands(tmdb): make some structs private.
Browse files Browse the repository at this point in the history
also shuffle around how the tmdb models are laid out and fix comment
spacing.
  • Loading branch information
evieluvsrainbows committed Aug 1, 2024
1 parent 1fc2f0f commit 9fc65c1
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 63 deletions.
6 changes: 3 additions & 3 deletions src/commands/search/tmdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ use serenity::all::{CreateActionRow, CreateButton, CreateEmbed, CreateEmbedFoote
use std::time::Duration;

#[derive(Deserialize)]
pub struct SearchResponse {
struct SearchResponse {
pub results: Vec<SearchResult>
}

#[derive(Deserialize)]
pub struct SearchResult {
struct SearchResult {
pub id: u64
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct Collection {
struct Collection {
pub name: String, // The name of the collection.
pub overview: String, // The overview of the collection.
pub poster_path: String, // The poster belonging to the collection.
Expand Down
121 changes: 61 additions & 60 deletions src/models/tmdb/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,44 @@ pub struct SimplifiedMovie {
pub title: String // The title of the movie.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct Show {
pub backdrop_path: Option<String>, // The show's backdrop path.
pub created_by: Vec<CreatedBy>, // The show's creators.
pub episode_run_time: Vec<i64>, // An array containing the show's episode runtimes.
pub first_air_date: NaiveDate, // The date the show first aired.
pub genres: Vec<Genre>, // The genres that the show is in.
pub homepage: String, // The show's homepage.
pub id: i64, // The show's id on The Movie Database.
pub in_production: bool, // Whether or not the show is currently in production.
pub languages: Vec<String>, // The show's available languages.
pub last_air_date: NaiveDate, // When the show last aired an episode.
pub last_episode_to_air: EpisodeToAir, // The show's last aired episode.
pub name: String, // The name of the show.
pub next_episode_to_air: Option<EpisodeToAir>, // The show's next scheduled episode.
pub networks: Vec<NetworkOrStudio>, // The networks or services that air the show.
pub number_of_episodes: i64, // The total number of episodes the show has aired.
pub number_of_seasons: i64, // The total number of seasons the show has released.
pub origin_country: Vec<String>, // The country where the show originated.
pub original_language: String, // The original language of the show.
pub original_name: String, // The show's original name.
pub overview: String, // The show's overview.
pub popularity: f64, // An integer containing the show's popularity value.
pub poster_path: Option<String>, // The show's poster path.
#[serde(rename = "production_companies")]
pub studios: Vec<NetworkOrStudio>, // The studios that produce and manage the show.
pub seasons: Vec<Season>, // A vector array containing information on the show's individual seasons.
pub spoken_languages: Vec<Language>, // A vector array containing information about the show's spoken languages.
pub status: String, // The status of the show; can be Returning Series, Cancelled, or Ended.
pub tagline: String, // The show's tagline.
#[serde(rename = "type")]
pub format: String, // The format of the show; can be Scripted, News, or Unscripted.
pub vote_average: f64, // The show's average user score on The Movie Database.
pub vote_count: i64, // The show's total amount of user votes on The Movie Database.
// pub external_ids: ExternalId // The external IDs associated with the show, e.g. the external IMDb ID.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct Collection {
Expand All @@ -49,66 +87,6 @@ pub struct Collection {
pub backdrop_path: String // the backdrop of the collection.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct Genre {
pub id: u64, // The genre's ID.
pub name: String // The genre's name.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct ProductionCompany {
pub name: String, // The friendly name of the production company.
pub id: u64, // The ID of the production company on The Movie Database.
pub origin_country: String // The country of origin of the production company.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct ProductionCountry {
pub iso_3166_1: String, // The ISO standard shortcode of the production country.
pub name: String // The friendly name of the production country.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct Show {
pub backdrop_path: Option<String>, // The show's backdrop path.
pub created_by: Vec<CreatedBy>, // The show's creators.
pub episode_run_time: Vec<i64>, // An array containing the show's episode runtimes.
pub first_air_date: NaiveDate, // The date the show first aired.
pub genres: Vec<Genre>, // The genres that the show is in.
pub homepage: String, // The show's homepage.
pub id: i64, // The show's id on The Movie Database.
pub in_production: bool, // Whether or not the show is currently in production.
pub languages: Vec<String>, // The show's available languages.
pub last_air_date: NaiveDate, // When the show last aired an episode.
pub last_episode_to_air: EpisodeToAir, // The show's last aired episode.
pub name: String, // The name of the show.
pub next_episode_to_air: Option<EpisodeToAir>, // The show's next scheduled episode.
pub networks: Vec<NetworkOrStudio>, // The networks or services that air the show.
pub number_of_episodes: i64, // The total number of episodes the show has aired.
pub number_of_seasons: i64, // The total number of seasons the show has released.
pub origin_country: Vec<String>, // The country where the show originated.
pub original_language: String, // The original language of the show.
pub original_name: String, // The show's original name.
pub overview: String, // The show's overview.
pub popularity: f64, // An integer containing the show's popularity value.
pub poster_path: Option<String>, // The show's poster path.
#[serde(rename = "production_companies")]
pub studios: Vec<NetworkOrStudio>, // The studios that produce and manage the show.
pub seasons: Vec<Season>, // A vector array containing information on the show's individual seasons.
pub spoken_languages: Vec<Language>, // A vector array containing information about the show's spoken languages.
pub status: String, // The status of the show; can be Returning Series, Cancelled, or Ended.
pub tagline: String, // The show's tagline.
#[serde(rename = "type")]
pub format: String, // The format of the show; can be Scripted, News, or Unscripted.
pub vote_average: f64, // The show's average user score on The Movie Database.
pub vote_count: i64, // The show's total amount of user votes on The Movie Database.
// pub external_ids: ExternalId // The external IDs associated with the show, e.g. the external IMDb ID.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct CreatedBy {
Expand All @@ -119,6 +97,13 @@ pub struct CreatedBy {
pub profile_path: Option<String> // The (optional) profile path of the given creator.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct Genre {
pub id: u64, // The genre's ID.
pub name: String // The genre's name.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct EpisodeToAir {
Expand Down Expand Up @@ -155,6 +140,7 @@ pub struct Season {
pub season_number: i64 // The season's numerical number.
}


#[derive(Deserialize)]
#[rustfmt::skip]
pub struct Language {
Expand All @@ -176,3 +162,18 @@ pub struct ExternalId {
pub twitter_id: Option<String>, // The ID of the show's Twitter profile.
pub id: Option<i64> // The show's The Movie Database identifier.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct ProductionCompany {
pub name: String, // The friendly name of the production company.
pub id: u64, // The ID of the production company on The Movie Database.
pub origin_country: String // The country of origin of the production company.
}

#[derive(Deserialize)]
#[rustfmt::skip]
pub struct ProductionCountry {
pub iso_3166_1: String, // The ISO standard shortcode of the production country.
pub name: String // The friendly name of the production country.
}

0 comments on commit 9fc65c1

Please sign in to comment.