aboutsummaryrefslogtreecommitdiff
path: root/trakt-rs/src/smo.rs
diff options
context:
space:
mode:
authorGravatar Anshul Gupta <ansg191@anshulg.com> 2024-02-18 23:31:24 -0800
committerGravatar Anshul Gupta <ansg191@anshulg.com> 2024-02-18 23:33:06 -0800
commitf1165ab23eda6f5a4afe6a703333025ba68f3b11 (patch)
tree6180df1fa1a7779d7b6181b9ab583c5ff2320217 /trakt-rs/src/smo.rs
parentf41b46d02ecd9234f16c35c652b01fdd170b9944 (diff)
downloadtrakt-f1165ab23eda6f5a4afe6a703333025ba68f3b11.tar.gz
trakt-f1165ab23eda6f5a4afe6a703333025ba68f3b11.tar.zst
trakt-f1165ab23eda6f5a4afe6a703333025ba68f3b11.zip
Finishes comment endpoints
Diffstat (limited to 'trakt-rs/src/smo.rs')
-rw-r--r--trakt-rs/src/smo.rs87
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,
+ },
+}