View Source ActivityPub.Adapter behaviour (bonfire v0.3.0-classic-beta.4)

Contract for ActivityPub module adapters

Link to this section Summary

Callbacks

Fetch an actor given its preferred username

Gets local url of an AP object to redirect in browser. Can take pointer id or an actor username.

Passes data to be handled by the host application

Link to this section Callbacks

@callback base_url() :: String.t()
@callback get_actor_by_id(String.t()) :: {:ok, ActivityPub.Actor.t()} | {:error, any()}
Link to this callback

get_actor_by_username(t)

View Source
@callback get_actor_by_username(String.t()) ::
  {:ok, ActivityPub.Actor.t()} | {:error, any()}

Fetch an actor given its preferred username

Link to this callback

get_follower_local_ids(t)

View Source
@callback get_follower_local_ids(ActivityPub.Actor.t()) :: [String.t()]
Link to this callback

get_following_local_ids(t)

View Source
@callback get_following_local_ids(ActivityPub.Actor.t()) :: [String.t()]
@callback get_redirect_url(String.t() | Map.t()) :: String.t()

Gets local url of an AP object to redirect in browser. Can take pointer id or an actor username.

@callback handle_activity(ActivityPub.Object.t()) :: :ok | {:ok, any()} | {:error, any()}

Passes data to be handled by the host application

Link to this callback

maybe_create_remote_actor(t)

View Source
@callback maybe_create_remote_actor(ActivityPub.Actor.t()) :: :ok
@callback maybe_publish_object(String.t()) :: {:ok, any()} | {:error, any()}
Link to this callback

update_local_actor(t, t)

View Source
@callback update_local_actor(ActivityPub.Actor.t(), Map.t()) ::
  {:ok, ActivityPub.Actor.t()} | {:error, any()}
@callback update_remote_actor(ActivityPub.Object.t()) :: :ok | {:error, any()}

Link to this section Functions

Link to this function

call_or(fun, args \\ [], fallback \\ nil)

View Source

Run function from adapter if defined, otherwise return fallback value

Link to this function

get_actor_by_username(username)

View Source
Link to this function

get_follower_local_ids(actor)

View Source
Link to this function

get_following_local_ids(actor)

View Source
Link to this function

get_redirect_url(id_or_username_or_object)

View Source
Link to this function

handle_activity(activity)

View Source
Link to this function

maybe_create_remote_actor(actor)

View Source
Link to this function

maybe_handle_activity(activity)

View Source
Link to this function

maybe_publish_object(object)

View Source
Link to this function

update_local_actor(actor, params)

View Source
Link to this function

update_remote_actor(actor)

View Source