From bdf48bb7cbff43e31964bf1c3309b916f380fb58 Mon Sep 17 00:00:00 2001 From: alemi Date: Thu, 2 May 2024 00:25:26 +0200 Subject: [PATCH] feat(apb): likes and shares optional collections --- apb/src/types/object/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apb/src/types/object/mod.rs b/apb/src/types/object/mod.rs index 0670a38a..67b4fbf8 100644 --- a/apb/src/types/object/mod.rs +++ b/apb/src/types/object/mod.rs @@ -56,6 +56,8 @@ pub trait Object : Base { fn preview(&self) -> Node { Node::Empty } // also in link fn published(&self) -> Option> { None } fn replies(&self) -> Node { Node::Empty } + fn likes(&self) -> Node { Node::Empty } + fn shares(&self) -> Node { Node::Empty } fn start_time(&self) -> Option> { None } fn summary(&self) -> Option<&str> { None } fn tag(&self) -> Node { Node::Empty } @@ -100,6 +102,8 @@ pub trait ObjectMut : BaseMut { fn set_preview(self, val: Node) -> Self; // also in link fn set_published(self, val: Option>) -> Self; fn set_replies(self, val: Node) -> Self; + fn set_likes(self, val: Node) -> Self; + fn set_shares(self, val: Node) -> Self; fn set_start_time(self, val: Option>) -> Self; fn set_summary(self, val: Option<&str>) -> Self; fn set_tag(self, val: Node) -> Self; @@ -140,6 +144,8 @@ impl Object for serde_json::Value { crate::getter! { preview -> node ::Object } crate::getter! { published -> chrono::DateTime } crate::getter! { replies -> node Self::Collection } + crate::getter! { likes -> node Self::Collection } + crate::getter! { shares -> node Self::Collection } crate::getter! { start_time::startTime -> chrono::DateTime } crate::getter! { summary -> &str } crate::getter! { tag -> node ::Object } @@ -218,6 +224,8 @@ impl ObjectMut for serde_json::Value { crate::setter! { preview -> node ::Object } crate::setter! { published -> chrono::DateTime } crate::setter! { replies -> node Self::Collection } + crate::setter! { likes -> node Self::Collection } + crate::setter! { shares -> node Self::Collection } crate::setter! { start_time::startTime -> chrono::DateTime } crate::setter! { summary -> &str } crate::setter! { tag -> node ::Object }