The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Convos::Core::User - A Convos user

DESCRIPTION

Convos::Core::User is a class used to model a user in Convos.

ATTRIBUTES

Convos::Core::User inherits all attributes from Mojo::Base and implements the following new ones.

core

  $obj = $self->core;

Holds a Convos::Core object.

email

  $str = $self->email;

Email address of user.

password

  $str = $self->password;

Encrypted password. See "set_password" for how to change the password and "validate_password" for password authentication.

public_id

  $str = $self->public_id;

Returns an anonymous ID for this user.

unread

  $int = $self->unread;
  $self = $self->unread(4);

Number of unread notifications for user.

uri

  $path = $self->uri;

Holds a Mojo::Path object, with the URI to where this object should be stored.

METHODS

Convos::Core::User inherits all methods from Mojo::Base and implements the following new ones.

connection

  $connection = $self->connection(\%attrs);

Returns a new Convos::Core::Connection object or updates an existing object.

connections

  $objs = $self->connections;

Returns an array-ref of of Convos::Core::Connection objects.

get_connection

  $connection = $self->connection($id);
  $connection = $self->connection(\%attrs);

Returns a Convos::Core::Connection object or undef.

get

  $self = $self->get(\%args, sub { my ($self, $err, $res) = @_; });

Used to retrive information about the current user.

id

  $str = $self->id;
  $str = $class->id(\%attr);

Returns a unique identifier for a user.

notifications

  $self = $self->notifications($query, sub { my ($self, $err, $notifications) = @_; });

Used to retrieve a list of notifications. See also "notifications" in Convos::Core::Backend.

remove_connection

  $self = $self->remove_connection($id, sub { my ($self, $err) = @_; });

Will remove a connection created by "connection". Removing a connection that does not exist is perfectly valid, and will not set $err.

save

  $self = $self->save(sub { my ($self, $err) = @_; });
  $self = $self->save;

Will save "ATTRIBUTES" to persistent storage. See "save_object" in Convos::Core::Backend for details.

set_password

  $self = $self->set_password($plain);

Will set "password" to a crypted version of $plain.

validate_password

  $bool = $self->validate_password($plain);

Will verify $plain text password against "password".

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org