example-types: implement activitypub traits
This commit is contained in:
parent
39fd2c715b
commit
cebed39f24
|
@ -1,5 +1,6 @@
|
|||
use apub::{
|
||||
deliver::Activity,
|
||||
activitypub::{Activity, DeliverableObject, Object},
|
||||
deliver::Deliverable,
|
||||
repo::{Dereference, Repo},
|
||||
session::Session,
|
||||
};
|
||||
|
@ -26,6 +27,46 @@ pub struct AcceptedActivity {
|
|||
|
||||
#[serde(rename = "type")]
|
||||
kind: ActivityType,
|
||||
|
||||
to: Vec<Url>,
|
||||
|
||||
cc: Vec<Url>,
|
||||
|
||||
actor: Url,
|
||||
|
||||
object: Url,
|
||||
}
|
||||
|
||||
impl Object for AcceptedActivity {
|
||||
type Kind = ActivityType;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
&self.id
|
||||
}
|
||||
|
||||
fn kind(&self) -> &Self::Kind {
|
||||
&self.kind
|
||||
}
|
||||
}
|
||||
|
||||
impl DeliverableObject for AcceptedActivity {
|
||||
fn to(&self) -> &[Url] {
|
||||
&self.to
|
||||
}
|
||||
|
||||
fn cc(&self) -> &[Url] {
|
||||
&self.cc
|
||||
}
|
||||
}
|
||||
|
||||
impl Activity for AcceptedActivity {
|
||||
fn actor_id(&self) -> &Url {
|
||||
&self.actor
|
||||
}
|
||||
|
||||
fn object_id(&self) -> &Url {
|
||||
&self.object
|
||||
}
|
||||
}
|
||||
|
||||
impl AcceptedActivity {
|
||||
|
@ -101,7 +142,7 @@ impl Dereference for ObjectId<NoteType> {
|
|||
type Output = Note;
|
||||
|
||||
fn url(&self) -> &Url {
|
||||
&self
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,4 +164,4 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl Activity for Note {}
|
||||
impl Deliverable for Note {}
|
||||
|
|
Loading…
Reference in a new issue