File Coverage

blib/lib/WebService/Mattermost/V4/API/Resource/Bots.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod 1 1 100.0
total 9 9 100.0


line stmt bran cond sub pod time code
1             package WebService::Mattermost::V4::API::Resource::Bots;
2              
3             # ABSTRACT: Wrapped API methods for the bots API endpoints.
4              
5 7     7   103 use Moo;
  7         17  
  7         41  
6              
7             extends 'WebService::Mattermost::V4::API::Resource';
8             with    'WebService::Mattermost::V4::API::Resource::Role::View::Bot';
9              
10             ################################################################################
11              
12             around [ qw(get) ] => sub {
13                 my $orig = shift;
14                 my $self = shift;
15                 my $id = shift;
16              
17                 return $self->validate_id($orig, $id, @_);
18             };
19              
20             sub get {
21                 my $self = shift;
22                 my $id = shift;
23                 my $args = shift;
24              
25                 return $self->_single_view_get({
26                     endpoint => '%s',
27                     ids => [ $id ],
28                     parameters => $args,
29                 });
30             }
31              
32             sub list {
33 4     4 1 474     my $self = shift;
34 4         12     my $args = shift;
35              
36 4         28     return $self->_get({ parameters => $args });
37             }
38              
39             ################################################################################
40              
41             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.26
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
118