diff options
Diffstat (limited to 'trakt-rs/src/smo.rs')
-rw-r--r-- | trakt-rs/src/smo.rs | 87 |
1 files changed, 84 insertions, 3 deletions
diff --git a/trakt-rs/src/smo.rs b/trakt-rs/src/smo.rs index 29ce36d..234d20a 100644 --- a/trakt-rs/src/smo.rs +++ b/trakt-rs/src/smo.rs @@ -181,13 +181,13 @@ pub struct UserStats { pub struct List { pub name: EmojiString, pub description: EmojiString, - pub privacy: String, + pub privacy: ListPrivacy, pub share_link: String, pub r#type: ListType, pub display_numbers: bool, pub allow_comments: bool, - pub sort_by: String, - pub sort_how: String, + pub sort_by: ListSortBy, + pub sort_how: ListSortHow, #[serde(with = "time::serde::iso8601")] pub created_at: OffsetDateTime, #[serde(with = "time::serde::iso8601")] @@ -208,6 +208,40 @@ pub enum ListType { Favorites, } +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum ListSortBy { + Rank, + Added, + Title, + Released, + Runtime, + Popularity, + Percentage, + Votes, + MyRating, + Random, + Watched, + Collected, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum ListSortHow { + Asc, + Desc, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum ListPrivacy { + #[default] + Private, + Link, + Friends, + Public, +} + #[derive(Debug, Clone, PartialEq, Deserialize)] pub struct Ratings { pub rating: f32, @@ -246,3 +280,50 @@ pub struct Sharing { pub mastodon: bool, pub tumblr: bool, } + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default, Serialize)] +#[serde(rename_all = "lowercase")] +pub enum CommentType { + #[default] + All, + Reviews, + Shouts, +} + +#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Default, Serialize)] +#[serde(rename_all = "lowercase")] +pub enum CommentItemType { + #[default] + All, + Movies, + Shows, + Seasons, + Episodes, + Lists, +} + +#[derive(Debug, Clone, Eq, PartialEq, Hash, serde::Deserialize)] +#[serde(rename_all = "lowercase")] +#[serde(tag = "type")] +pub enum CommentWithItem { + Movie { + movie: Box<Movie>, + comment: Comment, + }, + Show { + show: Box<Show>, + comment: Comment, + }, + Season { + season: Box<Season>, + comment: Comment, + }, + Episode { + episode: Box<Episode>, + comment: Comment, + }, + List { + list: Box<List>, + comment: Comment, + }, +} |