From bad86f5bcff71b434ffc30f0b7e42dd4ff52f82b Mon Sep 17 00:00:00 2001 From: alemi Date: Mon, 15 Jul 2024 21:54:19 +0200 Subject: [PATCH] feat(apb): .value() but its not really from did-core --- apb/src/types/object/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/apb/src/types/object/mod.rs b/apb/src/types/object/mod.rs index 0a57206..f1bc20e 100644 --- a/apb/src/types/object/mod.rs +++ b/apb/src/types/object/mod.rs @@ -127,6 +127,9 @@ pub trait Object : Base { fn as_actor(&self) -> Result<&Self::Actor, FieldErr> { Err(FieldErr("type")) } fn as_collection(&self) -> Result<&Self::Collection, FieldErr> { Err(FieldErr("type")) } fn as_document(&self) -> Result<&Self::Document, FieldErr> { Err(FieldErr("type")) } + + #[cfg(feature = "did-core")] // TODO this isn't from did-core actually!?!?!?!?! + fn value(&self) -> Field<&str> { Err(FieldErr("value")) } } pub trait ObjectMut : BaseMut { @@ -176,6 +179,9 @@ pub trait ObjectMut : BaseMut { #[cfg(feature = "ostatus")] fn set_conversation(self, val: Node) -> Self; + + #[cfg(feature = "did-core")] // TODO this isn't from did-core actually!?!?!?!?! + fn set_value(self, val: Option<&str>) -> Self; } #[cfg(feature = "unstructured")] @@ -228,6 +234,9 @@ impl Object for serde_json::Value { #[cfg(feature = "ostatus")] crate::getter! { conversation -> node ::Object } + #[cfg(feature = "did-core")] // TODO this isn't from did-core actually!?!?!?!?! + crate::getter! { value -> &str } + fn as_activity(&self) -> Result<&Self::Activity, FieldErr> { match self.object_type()? { ObjectType::Activity(_) => Ok(self), @@ -305,4 +314,7 @@ impl ObjectMut for serde_json::Value { #[cfg(feature = "ostatus")] crate::setter! { conversation -> node ::Object } + + #[cfg(feature = "did-core")] // TODO this isn't from did-core actually!?!?!?!?! + crate::setter! { value -> &str } }