aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2024-01-13 20:05:44 +0100
committerHarald Eilertsen <haraldei@anduin.net>2024-01-13 20:05:44 +0100
commit1c4839d7449fd85734bb1335a303fc377cab1a04 (patch)
tree850ce6c052624ec157443e0b1625e12c8ca5787c
parentd9fa0a00889e40baf5289a65e17d47727b7c506e (diff)
downloadrust-zotapi-1c4839d7449fd85734bb1335a303fc377cab1a04.tar.gz
rust-zotapi-1c4839d7449fd85734bb1335a303fc377cab1a04.tar.bz2
rust-zotapi-1c4839d7449fd85734bb1335a303fc377cab1a04.zip
Add some more fields to the StreamItem struct.
-rw-r--r--Cargo.toml3
-rw-r--r--src/stream/streamitem.rs13
2 files changed, 15 insertions, 1 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 4b76f68..25bcdee 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,7 +29,8 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_qs = "0.8"
tokio = { version = "1.27", features = ["full"] }
-url = "2.2"
+uuid = { version = "1.6.1", features = ["serde"] }
+url = { version = "2.5.0", features = ["serde"] }
#zotapi-derive = { version = "0.1.0", path = "zotapi-derive" }
[dev-dependencies]
diff --git a/src/stream/streamitem.rs b/src/stream/streamitem.rs
index 514cae3..d30be9e 100644
--- a/src/stream/streamitem.rs
+++ b/src/stream/streamitem.rs
@@ -11,6 +11,8 @@ use super::datetime::DateTime;
use super::verb::Verb;
use serde::Deserialize;
+use url::Url;
+use uuid::Uuid;
#[derive(Debug, Deserialize, PartialEq)]
pub enum StreamItemType {
@@ -33,6 +35,12 @@ pub struct StreamItem {
pub item_type: StreamItemType,
pub encoding: StreamItemEncoding,
+ pub uuid: Uuid,
+ pub message_id: Url,
+ pub message_top: Url,
+ pub message_parent: Url,
+ pub permalink: Url,
+
/*
* Date and time fields for when the item was
* created, last edited or commented, as well as
@@ -142,6 +150,11 @@ mod test {
assert_eq!(StreamItemType::Activity, item.item_type);
assert_eq!(StreamItemEncoding::Zot, item.encoding);
+ assert_eq!("2c102ec3-676b-4d84-b2b4-9141467a254f", item.uuid.to_string());
+ assert_eq!("https://example.com/item/2c102ec3-676b-4d84-b2b4-9141467a254f", item.message_id.to_string());
+ assert_eq!("https://example.com/item/2c102ec3-676b-4d84-b2b4-9141467a254f", item.message_top.to_string());
+ assert_eq!("https://example.com/item/2c102ec3-676b-4d84-b2b4-9141467a254f", item.message_parent.to_string());
+ assert_eq!("https://example.com/item/2c102ec3-676b-4d84-b2b4-9141467a254f", item.permalink.to_string());
assert_eq!(Verb::Post, item.verb);
assert_eq!("The item title", &item.title);
assert_eq!("The summary of the post", &item.summary);