Commit 054d942f authored by Mike Jones's avatar Mike Jones 🌶

Merge branch 'dev' into 'master'

API methods for objects

See merge request !37
parents d2783942 476e5bd7
......@@ -5,6 +5,7 @@ use Types::Standard qw(HashRef InstanceOf Int Maybe Str);
extends 'WebService::Mattermost::V4::API::Object';
with qw(
WebService::Mattermost::V4::API::Object::Role::APIMethods
WebService::Mattermost::V4::API::Object::Role::Timestamps
WebService::Mattermost::V4::API::Object::Role::BelongingToUser
WebService::Mattermost::V4::API::Object::Role::BelongingToTeam
......@@ -32,6 +33,28 @@ has [ qw(
################################################################################
sub BUILD {
my $self = shift;
$self->api_resource_name('channel');
$self->set_available_api_methods([ qw(
delete
get
patch
pinned
posts
restore
set_scheme
stats
toggle_private_status
update
) ]);
return 1;
}
################################################################################
sub _build_extra_updated_at {
my $self = shift;
......@@ -81,6 +104,41 @@ WebService::Mattermost::V4::API::Object::Channel
Details a Mattermost channel object.
=head2 METHODS
See matching methods in C<WebService::Mattermost::V4::API::Resource::Channel>
for full documentation.
ID parameters are not required:
my $response = $mattermost->api->channel->get('ID-HERE')->item->delete();
Is the same as:
my $response = $mattermost->api->channel->delete('ID-HERE');
=over 4
=item C<delete()>
=item C<patch()>
=item C<pinned()>
=item C<posts()>
=item C<restore()>
=item C<set_scheme()>
=item C<stats()>
=item C<toggle_private_status()>
=item C<update()>
=back
=head2 ATTRIBUTES
=over 4
......@@ -136,6 +194,8 @@ The number of messages made in the channel.
=over 4
=item C<WebService::Mattermost::V4::API::Resource::Channel>
=item C<WebService::Mattermost::V4::API::Object::Role::Timestamps>
=item C<WebService::Mattermost::V4::API::Object::Role::BelongingToUser>
......
......@@ -7,6 +7,7 @@ use WebService::Mattermost::Helper::Alias 'view';
extends 'WebService::Mattermost::V4::API::Object';
with qw(
WebService::Mattermost::V4::API::Object::Role::APIMethods
WebService::Mattermost::V4::API::Object::Role::BelongingToChannel
WebService::Mattermost::V4::API::Object::Role::BelongingToUser
WebService::Mattermost::V4::API::Object::Role::ID
......@@ -41,6 +42,27 @@ has files => (is => 'ro', lazy => 1, builder => 1);
################################################################################
sub BUILD {
my $self = shift;
$self->api_resource_name('post');
$self->available_api_methods([ qw(
delete
update
patch
thread
files
pin
inpin
reactions
perform_action
) ]);
return 1;
}
################################################################################
sub _get_related_post {
my $self = shift;
my $id = shift;
......@@ -103,6 +125,41 @@ WebService::Mattermost::V4::API::Object::Post
Describes a Mattermost post.
=head2 METHODS
See matching methods in C<WebService::Mattermost::V4::API::Resource::Post>
for full documentation.
ID parameters are not required:
my $response = $mattermost->api->post->get('ID-HERE')->item->delete();
Is the same as:
my $response = $mattermost->api->post->delete('ID-HERE');
=over 4
=item C<delete()>
=item C<update()>
=item C<patch()>
=item C<thread()>
=item C<files()>
=item C<pin()>
=item C<inpin()>
=item C<reactions()>
=item C<perform_action()>
=back
=head2 ATTRIBUTES
=over 4
......@@ -149,6 +206,8 @@ Related root post object.
=over 4
=item C<WebService::Mattermost::V4::API::Object::Post>
=item C<WebService::Mattermost::V4::API::Object::Role::BelongingToChannel>
=item C<WebService::Mattermost::V4::API::Object::Role::BelongingToUser>
......
......@@ -44,7 +44,6 @@ sub BUILD {
$self->api_resource_name('user');
$self->set_available_api_methods([ qw(
generate_mfa_secret
get
get_profile_image
get_status
patch
......@@ -109,16 +108,44 @@ Object version of a Mattermost user.
=head2 METHODS
See matching methods in C<WebService::Mattermost::V4::API::Resource::User> for
full documentation.
ID parameters are not required:
my $response = $mattermost->api->user->get('ID-HERE')->item->get_status();
Is the same as:
my $response = $mattermost->api->user->get_status('ID-HERE');
=over 4
=item C<generate_mfa_secret()>
=item C<get_profile_image()>
=item C<get_status()>
=item C<patch()>
=item C<set_profile_image()>
=item C<set_status()>
=item C<teams()>
=item C<update()>
Update this user. Takes the same parameters as C<WebService::Mattermost::V4::API::Resource::Users>
C<update_by_id()>.
=item C<update_active_status()>
$user->update({
# ...
});
=item C<update_authentication_method()>
=item C<update_mfa()>
=item C<update_password()>
=item C<update_roles()>
=back
......@@ -126,6 +153,8 @@ C<update_by_id()>.
=over 4
=item C<WebService::Mattermost::V4::API::Resource::User>
=item C<WebService::Mattermost::V4::API::Object::Role::ID>
=item C<WebService::Mattermost::V4::API::Object::Role::Roles>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment