View Source ActivityPub.Actor (bonfire_umbrella v0.9.10-cooperation-beta.62)

An ActivityPub Actor type and functions for dealing with actors.

See 4. Actors in the ActivityPub specification for more information on Actors.

Summary

Types

The ActivityPub ID of an object, which must be a publicly-dereferencable URI, or nil if the object is anonymous.

Your app's internal ID for an Actor.

An association (by default a Needle.Pointer) that references an Actor.

A ULID ID (eg. using the Needle.ULIDlibrary) that links an Actor to its object in the app's database.

t()

An ActivityPub Actor.

An Actor's user name, used as part of its ActivityPub ID.

Types

@type ap_id() :: String.t()

The ActivityPub ID of an object, which must be a publicly-dereferencable URI, or nil if the object is anonymous.

Note that since the URI must be publicly-dereferencable, you should set this value to ActivityPub.Federator.Adapter.base_url() <> ~p"/pub/actors/#{username}". This path is defined in ActivityPub.Web.Endpoint and serves data provided by the functions in ActivityPub.Federator.Adapter.

See section 3.1 Object Identifiers in the ActivityPub spec for more information on the format.

Examples

"https://kenzoishii.example.com/"

"http://localhost:4000/pub/actors/rosa"
@type id() :: String.t()

Your app's internal ID for an Actor.

Examples

"c1688a22-4e9c-42d7-935b-1f17e1d0cf58"

"1234"
@type pointer() :: String.t()

An association (by default a Needle.Pointer) that references an Actor.

Pointers consist of a table ID, referencing a database table, and a pointer ID, referencing a row in that table. Table and pointer IDs are both Pointers.ULID strings, which is UUID-like.

@type pointer_id() :: String.t()

A ULID ID (eg. using the Needle.ULIDlibrary) that links an Actor to its object in the app's database.

@type t() :: %ActivityPub.Actor{
  ap_id: ap_id() | nil,
  data: map(),
  deactivated: boolean() | nil,
  id: id() | nil,
  keys: binary() | nil,
  local: boolean() | nil,
  pointer: pointer() | nil,
  pointer_id: pointer_id() | nil,
  updated_at: DateTime.t() | NaiveDateTime.t() | nil,
  username: username() | nil
}

An ActivityPub Actor.

@type username() :: String.t()

An Actor's user name, used as part of its ActivityPub ID.

Examples

"alyssa"

"ben"

Functions

Link to this function

also_known_as?(ap_id, actor)

View Source
Link to this function

check_actor_is_active(actor)

View Source
Link to this function

delete(actor, is_local?)

View Source
Link to this function

fetch_by_username(username, opts \\ [])

View Source

Fetches a remote actor by username in username@domain.tld format

Link to this function

format_remote_actor(object)

View Source
Link to this function

format_username(ap_id, nick)

View Source

Fetches an actor given its AP ID / URI, or username@domain, or by a pointer id

Remote actors are just checked if they exist in AP or adapter's database and are NOT fetched remotely if they don't.

Remote actors are also automatically updated every X hours (defaults to 24h).

Link to this function

get_cached_or_fetch(username_or_uri)

View Source

Tries to get a local actor by username or tries to fetch it remotely if username is provided in username@domain.tld format.

Link to this function

get_external_followers(actor)

View Source
Link to this function

maybe_create_actor_from_object(actor)

View Source
Link to this function

save_actor_tombstone(actor, tombstone)

View Source
Link to this function

swap_or_create_actor_tombstone(actor)

View Source
@spec update_actor(String.t()) :: {:ok, t()} | {:error, any()}

Updates an existing actor struct by its AP ID.

Link to this function

update_actor(actor_id, data)

View Source