View Source ActivityPub.Actor (Bonfire v0.9.10-classic-beta.169)
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.ULID
library) that links an Actor
to its object in the app's database.
An ActivityPub Actor.
An Actor
's user name, used as part of its ActivityPub ID.
Functions
Fetches a remote actor by username in username@domain.tld
format
Fetches an actor given its AP ID / URI, or username@domain, or by a pointer id
Tries to get a local actor by username or tries to fetch it remotely if username is provided in username@domain.tld
format.
Updates an existing actor struct by its AP 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.ULID
library) 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
Fetches a remote actor by username in username@domain.tld
format
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).
Tries to get a local actor by username or tries to fetch it remotely if username is provided in username@domain.tld
format.
Updates an existing actor struct by its AP ID.