Outbox is optional

This commit is contained in:
asonix 2020-05-21 17:24:56 -05:00
parent ffc8faf825
commit 0223878e52
3 changed files with 83 additions and 53 deletions

View file

@ -10,11 +10,11 @@
//! //!
//! let mut person = ApActor::new( //! let mut person = ApActor::new(
//! "https://example.com/actor/inbox".parse()?, //! "https://example.com/actor/inbox".parse()?,
//! "https://example.com/actor/outbox".parse()?,
//! Person::new(), //! Person::new(),
//! ); //! );
//! //!
//! person //! person
//! .set_outbox("https://example.com/actor/outbox".parse()?)
//! .set_following("https://example.com/actor/following".parse()?) //! .set_following("https://example.com/actor/following".parse()?)
//! .set_followers("https://example.com/actor/followers".parse()?); //! .set_followers("https://example.com/actor/followers".parse()?);
//! # //! #
@ -62,7 +62,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// let inbox_ref = person.inbox(); /// let inbox_ref = person.inbox();
@ -79,7 +79,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_inbox("https://example.com/inbox".parse()?); /// person.set_inbox("https://example.com/inbox".parse()?);
@ -95,16 +95,16 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// let outbox_ref = person.outbox(); /// let outbox_ref = person.outbox();
/// ``` /// ```
fn outbox<'a>(&'a self) -> &'a XsdAnyUri fn outbox<'a>(&'a self) -> Option<&'a XsdAnyUri>
where where
Inner: 'a, Inner: 'a,
{ {
&self.ap_actor_ref().outbox self.ap_actor_ref().outbox.as_ref()
} }
/// Set the outbox for the current actor /// Set the outbox for the current actor
@ -112,7 +112,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_outbox("https://example.com/outbox".parse()?); /// person.set_outbox("https://example.com/outbox".parse()?);
@ -120,7 +120,42 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// # } /// # }
/// ``` /// ```
fn set_outbox(&mut self, outbox: XsdAnyUri) -> &mut Self { fn set_outbox(&mut self, outbox: XsdAnyUri) -> &mut Self {
self.ap_actor_mut().outbox = outbox; self.ap_actor_mut().outbox = Some(outbox);
self
}
/// Take the outbox from the current actor, leaving nothing
///
/// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*;
///
/// if let Some(outbox) = person.take_outbox() {
/// println!("{:?}", outbox);
/// }
/// ```
fn take_outbox(&mut self) -> Option<XsdAnyUri> {
self.ap_actor_mut().outbox.take()
}
/// Delete the outbox from the current object
///
/// ```rust
/// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), Person::new());
/// # person.set_outbox("https://example.com/outbox".parse()?);
/// use activitystreams_new::prelude::*;
///
/// assert!(person.outbox().is_some());
/// person.delete_outbox();
/// assert!(person.outbox().is_none());
/// # Ok(())
/// # }
/// ```
fn delete_outbox(&mut self) -> &mut Self {
self.ap_actor_mut().outbox = None;
self self
} }
@ -128,7 +163,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(following) = person.following() { /// if let Some(following) = person.following() {
@ -147,7 +182,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_following("https://example.com/following".parse()?); /// person.set_following("https://example.com/following".parse()?);
@ -159,11 +194,11 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
self self
} }
/// Take the following link for the current actor, leaving nothing /// Take the following link from the current actor, leaving nothing
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(following) = person.take_following() { /// if let Some(following) = person.take_following() {
@ -179,7 +214,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// # person.set_following("https://example.com/following".parse()?); /// # person.set_following("https://example.com/following".parse()?);
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
@ -198,7 +233,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(followers) = person.take_followers() { /// if let Some(followers) = person.take_followers() {
@ -217,7 +252,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_followers("https://example.com/followers".parse()?); /// person.set_followers("https://example.com/followers".parse()?);
@ -229,11 +264,11 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
self self
} }
/// Take the followers link for the current actor, leaving nothing /// Take the followers link from the current actor, leaving nothing
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(followers) = person.take_followers() { /// if let Some(followers) = person.take_followers() {
@ -249,7 +284,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// # person.set_followers("https://example.com/followers".parse()?); /// # person.set_followers("https://example.com/followers".parse()?);
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
@ -268,7 +303,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(liked) = person.take_liked() { /// if let Some(liked) = person.take_liked() {
@ -287,7 +322,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_streams("https://example.com/liked".parse()?); /// person.set_streams("https://example.com/liked".parse()?);
@ -299,11 +334,11 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
self self
} }
/// Take the liked link for the current actor, leaving nothing /// Take the liked link from the current actor, leaving nothing
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(liked) = person.take_liked() { /// if let Some(liked) = person.take_liked() {
@ -319,7 +354,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// # person.set_liked("https://example.com/liked".parse()?); /// # person.set_liked("https://example.com/liked".parse()?);
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
@ -338,7 +373,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(streams) = person.take_streams() { /// if let Some(streams) = person.take_streams() {
@ -357,7 +392,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_streams("https://example.com/streams".parse()?); /// person.set_streams("https://example.com/streams".parse()?);
@ -374,7 +409,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_many_streams(vec![ /// person.set_many_streams(vec![
@ -398,7 +433,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person /// person
@ -419,11 +454,11 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
self self
} }
/// Take the streams links for the current actor, leaving nothing /// Take the streams links from the current actor, leaving nothing
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(streams) = person.take_streams() { /// if let Some(streams) = person.take_streams() {
@ -439,7 +474,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// # person.set_streams("https://example.com/streams".parse()?); /// # person.set_streams("https://example.com/streams".parse()?);
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
@ -458,7 +493,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(preferred_username) = person.preferred_username() { /// if let Some(preferred_username) = person.preferred_username() {
@ -477,7 +512,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_preferred_username("user123".into()); /// person.set_preferred_username("user123".into());
@ -493,7 +528,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(preferred_username) = person.take_preferred_username() { /// if let Some(preferred_username) = person.take_preferred_username() {
@ -508,7 +543,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// # person.set_preferred_username("hey".into()); /// # person.set_preferred_username("hey".into());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
@ -525,7 +560,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(endpoints) = person.endpoints() { /// if let Some(endpoints) = person.endpoints() {
@ -544,7 +579,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ```rust /// ```rust
/// # fn main() -> Result<(), anyhow::Error> { /// # fn main() -> Result<(), anyhow::Error> {
/// # use activitystreams_new::{actor::{ApActor, Endpoints, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Endpoints, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// person.set_endpoints(Endpoints { /// person.set_endpoints(Endpoints {
@ -563,7 +598,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
/// if let Some(endpoints) = person.endpoints() { /// if let Some(endpoints) = person.endpoints() {
@ -578,7 +613,7 @@ pub trait ApActorExt<Inner>: AsApActor<Inner> {
/// ///
/// ```rust /// ```rust
/// # use activitystreams_new::{actor::{ApActor, Person}, context}; /// # use activitystreams_new::{actor::{ApActor, Person}, context};
/// # let mut person = ApActor::new(context(), context(), Person::new()); /// # let mut person = ApActor::new(context(), Person::new());
/// # person.set_endpoints(Default::default()); /// # person.set_endpoints(Default::default());
/// use activitystreams_new::prelude::*; /// use activitystreams_new::prelude::*;
/// ///
@ -653,7 +688,9 @@ pub struct ApActor<Inner> {
/// ///
/// - Range: xsd:anyUri /// - Range: xsd:anyUri
/// - Functional: true /// - Functional: true
pub outbox: XsdAnyUri, #[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub outbox: Option<XsdAnyUri>,
/// A link to an [ActivityStreams] collection of the actors that this actor is following. /// A link to an [ActivityStreams] collection of the actors that this actor is following.
/// ///
@ -826,21 +863,16 @@ impl<Inner> ApActor<Inner> {
/// ///
/// let actor = ApActor::new( /// let actor = ApActor::new(
/// "https://example.com/inbox".parse()?, /// "https://example.com/inbox".parse()?,
/// "https://example.com/outbox".parse()?,
/// Person::new(), /// Person::new(),
/// ); /// );
/// # Ok(()) /// # Ok(())
/// # } /// # }
/// ``` /// ```
pub fn new(inbox: XsdAnyUri, outbox: XsdAnyUri, inner: Inner) -> Self pub fn new(inbox: XsdAnyUri, inner: Inner) -> Self
where where
Inner: markers::Actor, Inner: markers::Actor,
{ {
Self::builder() Self::builder().inbox(inbox).inner(inner).build()
.inbox(inbox)
.outbox(outbox)
.inner(inner)
.build()
} }
fn extending(mut inner: Inner) -> Result<Self, serde_json::Error> fn extending(mut inner: Inner) -> Result<Self, serde_json::Error>

View file

@ -342,10 +342,10 @@ pub mod prelude {
//! //!
//! let mut person = ApActor::new( //! let mut person = ApActor::new(
//! "http://localhost:8080/inbox".parse()?, //! "http://localhost:8080/inbox".parse()?,
//! "http:/localhost:8080/outbox".parse()?,
//! Person::new(), //! Person::new(),
//! ); //! );
//! person //! person
//! .set_outbox("http:/localhost:8080/outbox".parse()?)
//! .set_name(XsdString::from("Demo Account")) //! .set_name(XsdString::from("Demo Account"))
//! .set_preferred_username(XsdString::from("demo")) //! .set_preferred_username(XsdString::from("demo"))
//! .set_id("https://localhost:8080/actor".parse()?) //! .set_id("https://localhost:8080/actor".parse()?)

View file

@ -222,25 +222,23 @@
//! pub type ExtendedPerson = PublicKey<ApActor<Person>>; //! pub type ExtendedPerson = PublicKey<ApActor<Person>>;
//! //!
//! impl ExtendedPerson { //! impl ExtendedPerson {
//! pub fn new(inbox: XsdAnyUri, outbox: XsdAnyUri) -> Self { //! pub fn new(inbox: XsdAnyUri) -> Self {
//! PublicKey { //! PublicKey {
//! public_key: Default::default(), //! public_key: Default::default(),
//! inner: ApActor::new(inbox, outbox, Person::new()), //! inner: ApActor::new(inbox, Person::new()),
//! } //! }
//! } //! }
//! } //! }
//! //!
//! fn main() -> Result<(), anyhow::Error> { //! fn main() -> Result<(), anyhow::Error> {
//! let mut extended_person = ExtendedPerson::new( //! let mut extended_person = ExtendedPerson::new("https://example.com/user/inbox".parse()?);
//! "https://example.com/user/inbox".parse()?,
//! "https://example.com/user/outbox".parse()?,
//! );
//! //!
//! extended_person //! extended_person
//! .set_kind(PersonType) //! .set_kind(PersonType)
//! .set_id("https://example.com/user".parse()?) //! .set_id("https://example.com/user".parse()?)
//! .set_name(XsdString::from("Demo User")) //! .set_name(XsdString::from("Demo User"))
//! .set_preferred_username(XsdString::from("user")) //! .set_preferred_username(XsdString::from("user"))
//! .set_outbox("https://example.com/user/outbox".parse()?)
//! .set_key_pem(XsdString::from( //! .set_key_pem(XsdString::from(
//! "------ BEGIN PUBLIC KEY ------\nasdfasdfasdfasdfasdfasdf..." //! "------ BEGIN PUBLIC KEY ------\nasdfasdfasdfasdfasdfasdf..."
//! )) //! ))