fix(apb): add setters/getters for all fields

This commit is contained in:
əlemi 2024-05-02 00:28:54 +02:00
parent 05bce0c486
commit a1d1ba3744
Signed by: alemi
GPG key ID: A4895B84D311642C
2 changed files with 16 additions and 1 deletions

View file

@ -26,7 +26,7 @@ reqwest = { version = "0.12", features = ["json"], optional = true }
[features]
default = ["activitypub-miscellaneous-terms"]
# extensions
activitypub-miscellaneous-terms = []
activitypub-miscellaneous-terms = [] # https://swicg.github.io/miscellany/
activitypub-counters = [] # https://ns.alemi.dev/as/counters/#
# builtin utils
orm = ["dep:sea-orm"]

View file

@ -52,6 +52,12 @@ pub trait ActorMut : ObjectMut {
fn set_streams(self, val: Node<Self::Collection>) -> Self;
fn set_endpoints(self, val: Node<Self::Object>) -> Self; // TODO it's more complex than this!
fn set_public_key(self, val: Node<Self::PublicKey>) -> Self;
#[cfg(feature = "activitypub-miscellaneous-terms")]
fn set_moved_to(self, val: Node<Self::Actor>) -> Self;
#[cfg(feature = "activitypub-miscellaneous-terms")]
fn set_manually_approves_followers(self, val: Option<bool>) -> Self;
#[cfg(feature = "activitypub-fe")]
fn set_following_me(self, val: Option<bool>) -> Self;
#[cfg(feature = "activitypub-fe")]
@ -74,6 +80,11 @@ impl Actor for serde_json::Value {
crate::getter! { streams -> node Self::Collection }
crate::getter! { public_key::publicKey -> node Self::PublicKey }
#[cfg(feature = "activitypub-miscellaneous-terms")]
crate::getter! { moved_to::movedTo -> node Self::Actor }
#[cfg(feature = "activitypub-miscellaneous-terms")]
crate::getter! { manually_approves_followers::manuallyApprovedFollowers -> bool }
#[cfg(feature = "activitypub-fe")]
crate::getter! { following_me::followingMe -> bool }
#[cfg(feature = "activitypub-fe")]
@ -101,6 +112,10 @@ impl ActorMut for serde_json::Value {
crate::setter! { public_key::publicKey -> node Self::PublicKey }
crate::setter! { discoverable -> bool }
#[cfg(feature = "activitypub-miscellaneous-terms")]
crate::setter! { moved_to::movedTo -> node Self::Actor }
#[cfg(feature = "activitypub-miscellaneous-terms")]
crate::setter! { manually_approves_followers::manuallyApprovedFollowers -> bool }
#[cfg(feature = "activitypub-fe")]
crate::setter! { following_me::followingMe -> bool }