diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2024-01-14 10:20:11 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2024-01-14 10:20:11 +0100 |
commit | 45962918683290be0a0ed9091d23f86f20a6d33e (patch) | |
tree | f7ab332265153a6f5154a7f5e3408381dd553a44 /src/stream/streamitem.rs | |
parent | 04b1504e8715ee6acf498a4261775f3b9d6d6daa (diff) | |
download | rust-zotapi-45962918683290be0a0ed9091d23f86f20a6d33e.tar.gz rust-zotapi-45962918683290be0a0ed9091d23f86f20a6d33e.tar.bz2 rust-zotapi-45962918683290be0a0ed9091d23f86f20a6d33e.zip |
Additional stream tag types and flags + optional fields.
Diffstat (limited to 'src/stream/streamitem.rs')
-rw-r--r-- | src/stream/streamitem.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/stream/streamitem.rs b/src/stream/streamitem.rs index 3040dea..51382fc 100644 --- a/src/stream/streamitem.rs +++ b/src/stream/streamitem.rs @@ -17,20 +17,23 @@ use url::Url; use uuid::Uuid; #[derive(Debug, Deserialize, PartialEq)] +#[serde(rename_all="snake_case")] pub enum StreamItemType { - #[serde(rename="activity")] Activity, } #[derive(Debug, Deserialize, PartialEq)] +#[serde(rename_all="snake_case")] pub enum StreamItemEncoding { - #[serde(rename="zot")] Zot, } #[derive(Debug, Deserialize, PartialEq)] +#[serde(rename_all="snake_case")] pub enum StreamItemFlag { - #[serde(rename="thread_parent")] + Direct, + Notshown, + Private, ThreadParent, } @@ -69,8 +72,8 @@ pub struct StreamItem { pub author: Actor, pub signature: String, - pub flags: Vec<StreamItemFlag>, - pub tags: Vec<Tag>, + pub flags: Option<Vec<StreamItemFlag>>, + pub tags: Option<Vec<Tag>>, } impl StreamItem { @@ -178,6 +181,6 @@ mod test { assert_eq!("2023-12-12 17:00:42", &item.edited.to_string()); assert_eq!("0000-00-00 00:00:00", &item.expires.to_string()); assert_eq!("2023-12-19 09:01:15", &item.commented.to_string()); - assert_eq!(StreamItemFlag::ThreadParent, item.flags[0]); + assert_eq!(StreamItemFlag::ThreadParent, item.flags.unwrap()[0]); } } |