Trait lemmy_apub_lib::traits::ApubObject[][src]

pub trait ApubObject {
    type DataType;
    type ApubType;
    type TombstoneType;
    fn last_refreshed_at(&self) -> Option<NaiveDateTime>;
fn read_from_apub_id<'life0, 'async_trait>(
        object_id: Url,
        data: &'life0 Self::DataType
    ) -> Pin<Box<dyn Future<Output = Result<Option<Self>, LemmyError>> + 'async_trait>>
    where
        Self: Sized,
        'life0: 'async_trait,
        Self: 'async_trait
;
fn delete<'life0, 'async_trait>(
        self,
        data: &'life0 Self::DataType
    ) -> Pin<Box<dyn Future<Output = Result<(), LemmyError>> + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn into_apub<'life0, 'async_trait>(
        self,
        data: &'life0 Self::DataType
    ) -> Pin<Box<dyn Future<Output = Result<Self::ApubType, LemmyError>> + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
fn to_tombstone(&self) -> Result<Self::TombstoneType, LemmyError>;
fn verify<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        apub: &'life0 Self::ApubType,
        expected_domain: &'life1 Url,
        data: &'life2 Self::DataType,
        request_counter: &'life3 mut i32
    ) -> Pin<Box<dyn Future<Output = Result<(), LemmyError>> + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        'life2: 'async_trait,
        'life3: 'async_trait,
        Self: 'async_trait
;
fn from_apub<'life0, 'life1, 'async_trait>(
        apub: Self::ApubType,
        data: &'life0 Self::DataType,
        request_counter: &'life1 mut i32
    ) -> Pin<Box<dyn Future<Output = Result<Self, LemmyError>> + 'async_trait>>
    where
        Self: Sized,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; }

Associated Types

Required methods

If this object should be refetched after a certain interval, it should return the last refresh time here. This is mainly used to update remote actors.

Try to read the object with given ID from local database. Returns Ok(None) if it doesn’t exist.

Marks the object as deleted in local db. Called when a tombstone is received.

Trait for converting an object or actor into the respective ActivityPub type.

Converts an object from ActivityPub type to Lemmy internal type.

  • apub The object to read from
  • context LemmyContext which holds DB pool, HTTP client etc
  • expected_domain Domain where the object was received from. None in case of mod action.
  • mod_action_allowed True if the object can be a mod activity, ignore expected_domain in this case

Implementors