MightyNetwork::DB::ActivityPub::Actor
Disclaimer: the objects that are mentionned here are objects as in Object-oriented programming, not as ActivityPub objects.
Model for ActivityPub actors
This object is federatedMightyNetwork::Doc::Glossary#Federated-non-federated-objects.
MightyNetwork::DB::ActivityPub::Actor inherits attributes from MightyNetwork::DB and adds the following attributes.
Primary key, UUID.
my $id = $object->id;
$object->id('30790b80-c7cc-480a-a502-4ca456f09a38');
Id (UUID) of the user that actor is linked to. Optional.
my $user_id = $object->user_id;
$object->user_id('e69b4429-4b6b-4e3e-bb2d-411770cd27a1');
my $url = $object->url;
$object->url(3);
my $username = $object->username;
$object->username(3);
my $host = $object->host;
$object->host(3);
my $inbox = $object->inbox;
$object->inbox(3);
my $outbox = $object->outbox;
$object->outbox(3);
my $following = $object->following;
$object->following(3);
my $followers = $object->followers;
$object->followers(3);
my $public_key = $object->public_key;
$object->public_key(3);
my $private_key = $object->private_key;
$object->private_key(3);
my $created_at = $object->created_at;
$object->created_at(3);
MightyNetwork::DB::ActivityPub::Actor inherits methods from MightyNetwork::DB and adds the following methods.
Given a MightyNetwork::DB::URL and an URL, creates a linked MightyNetwork::DB::ActivityPub::Actor. See MightyNetwork::DB::ActivityPub::Actor#generate_actor_from_user-user-url for details.
my $user = MightyNetwork::DB::User->new(…);
my $url = 'https://example.org';
my $actor = MightyNetwork::DB::ActivityPub::Actor->new(app => $c->app)
->create_from_user($user, $url);
Retrieve the MightyNetwork::DB::ActivityPub::Actor linked to the given MightyNetwork::DB::User.
my $user = MightyNetwork::DB::User->new(…);
my $actor = MightyNetwork::DB::ActivityPub::Actor->new(app => $c->app)
->get_from_user($user);
Retrieve the local MightyNetwork::DB::ActivityPub::Actor linked to the given $username
.
my $actor = MightyNetwork::DB::ActivityPub::Actor->new(app => $c->app)
->get_local_by_username('foo');
Retrieve the MightyNetwork::DB::ActivityPub::Actor linked to the given $url
.
my $actor = MightyNetwork::DB::ActivityPub::Actor->new(app => $c->app)
->get_by_url('https://example.org/@foo');
Return a Mojo::Collection of MightyNetwork::DB::ActivityPub::Follow linked to the MightyNetwork::DB::ActivityPub::Actor
my $collection = $actor->get_followers;
MightyNetwork::DB::ActivityPub::Actor also adds the following private methods.
Return a hash reference containing all needed attributes to create a MightyNetwork::DB::ActivityPub::Actor object.
MightyNetwork::DB::ActivityPub::Actor created with this hash will be linked to the MightyNetwork::DB::User passed as argument, and its differents URLs will be created from the $url
argument.
4096 bits RSA private and public keys will be created in the process and included in the resulting hash (uses Crypt::OpenSSL::RSA).
my $user = MightyNetwork::DB::User->new(…);
my $url = 'https://example.org';
my $actor = MightyNetwork::DB::ActivityPub::Actor->new(app => $c->app)
my $actor_hash = $actor->_generate_actor_from_user($user, $url);
my $actor = $actor->create($actor_hash);
MightyNetwork::DB::ActivityPub::Actor also modifies the following methods.
It adds the user_id
and private_key
attributes to the list of attributes to delete from the JSON representation of the object.
my $json = $object->to_json('foo', 'bar');
See MightyNetwork::DB#to_json-to_delete for the original method.
MightyNetwork::DB, MightyNetwork::DB::User, MightyNetwork::DB::ActivityPub::Follow, Mojo::Base, Crypt::OpenSSL::RSA, Mojo::Collection