| 1 | package WebService::Mattermost::V4::API::Resource::Bots; | ||
| 2 | |||
| 3 | # ABSTRACT: Wrapped API methods for the bots 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 | 12 | with 'WebService::Mattermost::V4::API::Resource::Role::View::Bot'; | |
| 9 | |||
| 10 | ################################################################################ | ||
| 11 | |||
| 12 | around [ qw(get) ] => sub { | ||
| 13 | 4 | ▶ | my $orig = shift; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 14 | 4 | my $self = shift; | |
| 15 | 4 | my $id = shift; | |
| 16 | |||
| 17 | 4 | return $self->validate_id($orig, $id, @_); | |
| 18 | 12 | }; | |
| 19 | |||
| 20 | sub get { | ||
| 21 | 2 | ▶ | my $self = shift; |
|
Subroutine
get: called CC=1 SCAR=0.0
Pod
documented
| |||
| 22 | 2 | my $id = shift; | |
| 23 | 2 | my $args = shift; | |
| 24 | |||
| 25 | 2 | return $self->_single_view_get({ | |
| 26 | endpoint => '%s', | ||
| 27 | ids => [ $id ], | ||
| 28 | parameters => $args, | ||
| 29 | }); | ||
| 30 | } | ||
| 31 | |||
| 32 | sub list { | ||
| 33 | 4 | ▶ | my $self = shift; |
|
Subroutine
list: called CC=1 SCAR=0.0
Pod
documented
| |||
| 34 | 4 | my $args = shift; | |
| 35 | |||
| 36 | 4 | return $self->_get({ parameters => $args }); | |
| 37 | } | ||
| 38 | |||
| 39 | ################################################################################ | ||
| 40 | |||
| 41 | 12 | 1; | |
| 42 | |||
| 43 | __END__ | ||
| 44 | |||
| 45 | =pod | ||
| 46 | |||
| 47 | =encoding UTF-8 | ||
| 48 | |||
| 49 | =head1 NAME | ||
| 50 | |||
| 51 | WebService::Mattermost::V4::API::Resource::Bots - Wrapped API methods for the bots API endpoints. | ||
| 52 | |||
| 53 | =head1 VERSION | ||
| 54 | |||
| 55 | version 0.28 | ||
| 56 | |||
| 57 | =head1 DESCRIPTION | ||
| 58 | |||
| 59 | =head2 USAGE | ||
| 60 | |||
| 61 | use WebService::Mattermost; | ||
| 62 | |||
| 63 | my $mm = WebService::Mattermost->new({ | ||
| 64 | authenticate => 1, | ||
| 65 | username => 'me@somewhere.com', | ||
| 66 | password => 'hunter2', | ||
| 67 | base_url => 'https://my.mattermost.server.com/api/v4/', | ||
| 68 | }); | ||
| 69 | |||
| 70 | my $resource = $mm->api->bots; | ||
| 71 | |||
| 72 | =head2 METHODS | ||
| 73 | |||
| 74 | =over 4 | ||
| 75 | |||
| 76 | =item * C<get()> | ||
| 77 | |||
| 78 | L<Get a bot|https://api.mattermost.com/#tag/bots/paths/~1bots~1{bot_user_id}/get> | ||
| 79 | |||
| 80 | my $response = $resource->get('ID-HERE'); | ||
| 81 | |||
| 82 | Allow the search to include a deleted bot: | ||
| 83 | |||
| 84 | my $response = $resource->get('ID-HERE', { | ||
| 85 | include_deleted => 1, | ||
| 86 | }); | ||
| 87 | |||
| 88 | =item * C<list()> | ||
| 89 | |||
| 90 | L<Get bots|https://api.mattermost.com/#tag/bots/paths/~1bots/get> | ||
| 91 | |||
| 92 | my $response = $resource->list(); | ||
| 93 | |||
| 94 | With optional parameters: | ||
| 95 | |||
| 96 | my $response = $resource->list({ | ||
| 97 | include_deleted => 1, | ||
| 98 | only_orphaned => 1, | ||
| 99 | page => 0, | ||
| 100 | per_page => 60, | ||
| 101 | }); | ||
| 102 | |||
| 103 | =back | ||
| 104 | |||
| 105 | =head1 AUTHOR | ||
| 106 | |||
| 107 | Mike Jones <mike@netsplit.org.uk> | ||
| 108 | |||
| 109 | =head1 COPYRIGHT AND LICENSE | ||
| 110 | |||
| 111 | This software is Copyright (c) 2020 by Mike Jones. | ||
| 112 | |||
| 113 | This is free software, licensed under: | ||
| 114 | |||
| 115 | The MIT (X11) License | ||
| 116 | |||
| 117 | =cut | ||