| 1 | package WebService::Mattermost::V4::API::Resource::Reactions; | ||
| 2 | |||
| 3 | # ABSTRACT: Wrapped API methods for the reactions API endpoints. | ||
| 4 | |||
| 5 | 12 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 12 | extends 'WebService::Mattermost::V4::API::Resource'; | |
| 8 | |||
| 9 | ################################################################################ | ||
| 10 | |||
| 11 | around [ qw(react) ] => sub { | ||
| 12 | 0 | ▶ | my $orig = shift; |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 13 | 0 | my $self = shift; | |
| 14 | 0 | my $id = shift; | |
| 15 | |||
| 16 | 0 | return $self->validate_id($orig, $id, @_); | |
| 17 | 12 | }; | |
| 18 | |||
| 19 | sub react { | ||
| 20 | my $self = shift; | ||
| 21 | my $post_id = shift; | ||
| 22 | my $emoji_name = shift; | ||
| 23 | my $user_id = shift; | ||
| 24 | |||
| 25 | unless ($emoji_name && $user_id) { | ||
| 26 | return $self->error_return('The second and third arguments must be an emoji name and a user ID'); | ||
| 27 | } | ||
| 28 | |||
| 29 | return $self->_post({ | ||
| 30 | parameters => { | ||
| 31 | post_id => $post_id, | ||
| 32 | emoji_name => $emoji_name, | ||
| 33 | user_id => $user_id, | ||
| 34 | }, | ||
| 35 | }); | ||
| 36 | } | ||
| 37 | |||
| 38 | ################################################################################ | ||
| 39 | |||
| 40 | 12 | 1; | |
| 41 | |||
| 42 | __END__ | ||
| 43 | |||
| 44 | =pod | ||
| 45 | |||
| 46 | =encoding UTF-8 | ||
| 47 | |||
| 48 | =head1 NAME | ||
| 49 | |||
| 50 | WebService::Mattermost::V4::API::Resource::Reactions - Wrapped API methods for the reactions API endpoints. | ||
| 51 | |||
| 52 | =head1 VERSION | ||
| 53 | |||
| 54 | version 0.28 | ||
| 55 | |||
| 56 | =head1 DESCRIPTION | ||
| 57 | |||
| 58 | =head2 USAGE | ||
| 59 | |||
| 60 | use WebService::Mattermost; | ||
| 61 | |||
| 62 | my $mm = WebService::Mattermost->new({ | ||
| 63 | authenticate => 1, | ||
| 64 | username => 'me@somewhere.com', | ||
| 65 | password => 'hunter2', | ||
| 66 | base_url => 'https://my.mattermost.server.com/api/v4/', | ||
| 67 | }); | ||
| 68 | |||
| 69 | my $resource = $mm->api->reactions; | ||
| 70 | |||
| 71 | =head2 METHODS | ||
| 72 | |||
| 73 | =over 4 | ||
| 74 | |||
| 75 | =item C<react()> | ||
| 76 | |||
| 77 | L<Create a reaction|https://api.mattermost.com/#tag/reactions%2Fpaths%2F~1reactions%2Fpost> | ||
| 78 | |||
| 79 | my $response = $resource->react('POST-ID-HERE', 'EMOJI-NAME-HERE', 'USER-ID-HERE'); | ||
| 80 | |||
| 81 | =back | ||
| 82 | |||
| 83 | =head1 AUTHOR | ||
| 84 | |||
| 85 | Mike Jones <mike@netsplit.org.uk> | ||
| 86 | |||
| 87 | =head1 COPYRIGHT AND LICENSE | ||
| 88 | |||
| 89 | This software is Copyright (c) 2020 by Mike Jones. | ||
| 90 | |||
| 91 | This is free software, licensed under: | ||
| 92 | |||
| 93 | The MIT (X11) License | ||
| 94 | |||
| 95 | =cut | ||