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

ActivityPub API

In general, the functions in this module take object-like formatted struct as the input for actor parameters. Use the functions in the ActivityPub.Actor module (ActivityPub.Actor.get_by_ap_id/1 for example) to retrieve those.

Link to this section Summary

Link to this section Functions

@spec accept(%{
  :to => [any()],
  :actor => ActivityPub.Actor.t(),
  :object => map() | binary(),
  optional(atom()) => any()
}) :: {:ok, ActivityPub.Object.t()} | {:error, any()}

Generates and federates an Accept activity via the data passed through params.

Link to this function

announce(actor, object, activity_id \\ nil, local \\ true, public \\ true, summary \\ nil)

View Source
@spec announce(
  ActivityPub.Actor.t(),
  ActivityPub.Object.t(),
  activity_id :: binary() | nil,
  local :: boolean(),
  public :: boolean(),
  summary :: binary() | nil
) ::
  {:ok, activity :: ActivityPub.Object.t(), object :: ActivityPub.Object.t()}
  | {:error, any()}
Link to this function

block(blocker, blocked, activity_id \\ nil, local \\ true)

View Source
@spec block(
  blocker :: ActivityPub.Actor.t(),
  blocked :: ActivityPub.Actor.t(),
  activity_id :: binary() | nil,
  local :: boolean()
) :: {:ok, ActivityPub.Object.t()} | {:error, any()}
Link to this function

create(params, pointer \\ nil)

View Source

Generates and federates a Create activity via the data passed through params.

Link to this function

delete(object, local \\ true, delete_actor \\ nil)

View Source
@spec delete(
  ActivityPub.Actor.t(),
  local :: boolean(),
  delete_actor :: binary() | nil
) ::
  {:ok, ActivityPub.Object.t()} | {:error, any()}
@spec delete(ActivityPub.Object.t(), local :: boolean(), delete_actor :: binary()) ::
  {:ok, ActivityPub.Object.t()} | {:error, any()}
Link to this function

flag(params, pointer \\ nil)

View Source
Link to this function

follow(follower, followed, activity_id \\ nil, local \\ true)

View Source
@spec follow(
  follower :: ActivityPub.Actor.t(),
  follower :: ActivityPub.Actor.t(),
  activity_id :: binary() | nil,
  local :: boolean()
) :: {:ok, ActivityPub.Object.t()} | {:error, any()}

Generates and federates a Follow activity.

Note: the follow should be reflected on the host database side only after receiving an Accept activity in response!

Link to this function

like(actor, object, activity_id \\ nil, local \\ true)

View Source
@spec like(
  ActivityPub.Actor.t(),
  ActivityPub.Object.t(),
  activity_id :: binary() | nil,
  local :: boolean()
) ::
  {:ok, activity :: ActivityPub.Object.t(), object :: ActivityPub.Object.t()}
  | {:error, any()}
@spec reject(%{to: [any()], actor: ActivityPub.Actor.t(), object: binary()}) ::
  {:ok, ActivityPub.Object.t()} | {:error, any()}

Generates and federates a Reject activity via the data passed through params.

Link to this function

unannounce(actor, object, activity_id \\ nil, local \\ true)

View Source
@spec unannounce(
  ActivityPub.Actor.t(),
  ActivityPub.Object.t(),
  activity_id :: binary() | nil,
  local :: boolean()
) ::
  {:ok, unannounce_activity :: ActivityPub.Object.t(),
   object :: ActivityPub.Object.t()}
  | {:error, any()}
Link to this function

unblock(blocker, blocked, activity_id \\ nil, local \\ true)

View Source
@spec unblock(
  blocker :: ActivityPub.Actor.t(),
  blocked :: ActivityPub.Actor.t(),
  activity_id :: binary() | nil,
  local :: boolean()
) :: {:ok, ActivityPub.Object.t()} | {:error, any()}
Link to this function

unfollow(follower, followed, activity_id \\ nil, local \\ true)

View Source
@spec unfollow(
  follower :: ActivityPub.Actor.t(),
  follower :: ActivityPub.Actor.t(),
  activity_id :: binary() | nil,
  local :: boolean()
) :: {:ok, ActivityPub.Object.t()} | {:error, any()}

Generates and federates an Unfollow activity.

Link to this function

unlike(actor, object, activity_id \\ nil, local \\ true)

View Source
@spec unlike(
  ActivityPub.Actor.t(),
  ActivityPub.Object.t(),
  activity_id :: binary() | nil,
  local :: boolean()
) ::
  {:ok, unlike_activity :: ActivityPub.Object.t(),
   like_activity :: ActivityPub.Object.t(), object :: ActivityPub.Object.t()}
  | {:error, any()}
@spec update(%{
  :to => [any()],
  :cc => [any()],
  :actor => ActivityPub.Actor.t(),
  :object => map(),
  optional(atom()) => any()
}) :: {:ok, ActivityPub.Object.t()} | {:error, any()}