View Source ActivityPub.Actor (Bonfire v0.9.11-social-beta.6)

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

ap_id()

@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"

id()

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

Your app's internal ID for an Actor.

Examples

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

"1234"

pointer()

@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.

pointer_id()

@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.

t()

@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.

username()

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

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

Examples

"alyssa"

"ben"

Functions

actor?(arg1)

actor_url(username)

also_known_as?(ap_id, actor)

check_actor_is_active(actor)

deactivate(actor)

delete(actor, is_local?)

fetch_by_username(username, opts \\ [])

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

format_remote_actor(object)

format_username(ap_id)

format_username(ap_id, nick)

get_cached(id)

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).

get_cached!(opts)

get_cached_or_fetch(username_or_uri)

Tries to get a local or cache actor, or fetches it given its AP ID / URI, or username@domain, or by a pointer id.

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

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

get_external_followers(actor)

get_followers(actor)

get_followings(actor)

get_non_cached(opts)

invalidate_cache(actor)

maybe_create_actor_from_object(actor)

reactivate(actor)

save_actor_tombstone(actor, tombstone)

set_cache(actor)

swap_or_create_actor_tombstone(actor)

update_actor(actor_id)

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

Updates an existing actor struct by its AP ID.

update_actor(actor_id, data)