1
0
Fork 0
forked from alemi/upub

feat(apb): likes and shares optional collections

This commit is contained in:
əlemi 2024-05-02 00:25:26 +02:00
parent b1e4c4e79b
commit bdf48bb7cb
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -56,6 +56,8 @@ pub trait Object : Base {
fn preview(&self) -> Node<Self::Object> { Node::Empty } // also in link
fn published(&self) -> Option<chrono::DateTime<chrono::Utc>> { None }
fn replies(&self) -> Node<Self::Collection> { Node::Empty }
fn likes(&self) -> Node<Self::Collection> { Node::Empty }
fn shares(&self) -> Node<Self::Collection> { Node::Empty }
fn start_time(&self) -> Option<chrono::DateTime<chrono::Utc>> { None }
fn summary(&self) -> Option<&str> { None }
fn tag(&self) -> Node<Self::Object> { Node::Empty }
@ -100,6 +102,8 @@ pub trait ObjectMut : BaseMut {
fn set_preview(self, val: Node<Self::Object>) -> Self; // also in link
fn set_published(self, val: Option<chrono::DateTime<chrono::Utc>>) -> Self;
fn set_replies(self, val: Node<Self::Collection>) -> Self;
fn set_likes(self, val: Node<Self::Collection>) -> Self;
fn set_shares(self, val: Node<Self::Collection>) -> Self;
fn set_start_time(self, val: Option<chrono::DateTime<chrono::Utc>>) -> Self;
fn set_summary(self, val: Option<&str>) -> Self;
fn set_tag(self, val: Node<Self::Object>) -> Self;
@ -140,6 +144,8 @@ impl Object for serde_json::Value {
crate::getter! { preview -> node <Self as Object>::Object }
crate::getter! { published -> chrono::DateTime<chrono::Utc> }
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<chrono::Utc> }
crate::getter! { summary -> &str }
crate::getter! { tag -> node <Self as Object>::Object }
@ -218,6 +224,8 @@ impl ObjectMut for serde_json::Value {
crate::setter! { preview -> node <Self as Object>::Object }
crate::setter! { published -> chrono::DateTime<chrono::Utc> }
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<chrono::Utc> }
crate::setter! { summary -> &str }
crate::setter! { tag -> node <Self as Object>::Object }