diff options
-rw-r--r-- | Cargo.toml | 3 | ||||
-rw-r--r-- | src/stream/streamitem.rs | 13 |
2 files changed, 15 insertions, 1 deletions
@@ -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); |