aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream/streamitem.rs
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-01-13 20:35:13 +0100
committerHarald Eilertsen <haraldei@anduin.net>2024-01-13 20:35:13 +0100
commit04b1504e8715ee6acf498a4261775f3b9d6d6daa (patch)
treed49610047948765a0f08ddfb1a83531599e2d06f /src/stream/streamitem.rs
parent1c4839d7449fd85734bb1335a303fc377cab1a04 (diff)
downloadrust-zotapi-04b1504e8715ee6acf498a4261775f3b9d6d6daa.tar.gz
rust-zotapi-04b1504e8715ee6acf498a4261775f3b9d6d6daa.tar.bz2
rust-zotapi-04b1504e8715ee6acf498a4261775f3b9d6d6daa.zip
Add stream Actor and Tag structs and complete StreamItem.
Diffstat (limited to 'src/stream/streamitem.rs')
-rw-r--r--src/stream/streamitem.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/stream/streamitem.rs b/src/stream/streamitem.rs
index d30be9e..3040dea 100644
--- a/src/stream/streamitem.rs
+++ b/src/stream/streamitem.rs
@@ -7,7 +7,9 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
+use super::actor::Actor;
use super::datetime::DateTime;
+use super::Tag;
use super::verb::Verb;
use serde::Deserialize;
@@ -26,6 +28,12 @@ pub enum StreamItemEncoding {
Zot,
}
+#[derive(Debug, Deserialize, PartialEq)]
+pub enum StreamItemFlag {
+ #[serde(rename="thread_parent")]
+ ThreadParent,
+}
+
/**
* Represents an item as returned by the stream API's.
*/
@@ -56,6 +64,13 @@ pub struct StreamItem {
pub title: String,
pub summary: String,
pub body: String,
+
+ pub owner: Actor,
+ pub author: Actor,
+
+ pub signature: String,
+ pub flags: Vec<StreamItemFlag>,
+ pub tags: Vec<Tag>,
}
impl StreamItem {
@@ -163,5 +178,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]);
}
}