Mattermost/V4/API/Resource/Webhook/Incoming.pm

filter: Statementstmt 37.5% 6 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 1 / 4 Podpod 100% 2 / 2 totaltotal 40.9% 9 / 22 CC 1 SCAR 5.6
CC
1
Cov
38%
__ANON__
2.0
create
2.0
list
2.0
CRAP 1.8
« Mattermost/V4/API/Object/Channel/Member.pm ↑ Summary Mattermost/V4/API/Resource/Webhook/Outgoing.pm »
1 package WebService::Mattermost::V4::API::Resource::Webhook::Incoming;
2  
3 # ABSTRACT: Wrapped API methods for the incoming webhook 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(get_by_id update_by_id) ] => 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 create {
20 0 ▶ my $self = shift;
Subroutine create: not called CC=1 SCAR=6.9
Pod documented
21 0 my $args = shift;
22  
23 0 return $self->_post({
24 endpoint => 'incoming',
25 parameters => $args,
26 required => [ 'channel_id' ],
27 });
28 }
29  
30 sub list {
31 0 ▶ my $self = shift;
Subroutine list: not called CC=1 SCAR=6.9
Pod documented
32 0 my $args = shift;
33  
34 0 return $self->_get({
35 endpoint => 'incoming',
36 parameters => $args,
37 });
38 }
39  
40 sub get_by_id {
41 my $self = shift;
42 my $id = shift;
43  
44 return $self->_get({
45 endpoint => 'incoming/%s',
46 ids => [ $id ],
47 });
48 }
49  
50 sub update_by_id {
51 my $self = shift;
52 my $id = shift;
53 my $args = shift;
54  
55 $args->{hook_id} = $id;
56  
57 return $self->_put({
58 endpoint => 'incoming/%s',
59 ids => [ $id ],
60 parameters => $args,
61 required => [ qw(hook_id channel_id display_name description) ],
62 });
63 }
64  
65 ################################################################################
66  
67 12 1;
68  
69 __END__
70  
71 =pod
72  
73 =encoding UTF-8
74  
75 =head1 NAME
76  
77 WebService::Mattermost::V4::API::Resource::Webhook::Incoming - Wrapped API methods for the incoming webhook API endpoints.
78  
79 =head1 VERSION
80  
81 version 0.28
82  
83 =head1 DESCRIPTION
84  
85 =head2 USAGE
86  
87 use WebService::Mattermost;
88  
89 my $mm = WebService::Mattermost->new({
90 authenticate => 1,
91 username => 'me@somewhere.com',
92 password => 'hunter2',
93 base_url => 'https://my.mattermost.server.com/api/v4/',
94 });
95  
96 my $resource = $mm->api->webhooks->incoming;
97  
98 =head2 METHODS
99  
100 =over 4
101  
102 =item C<create()>
103  
104 L<Create an incoming webhook|https://api.mattermost.com/#tag/webhooks%2Fpaths%2F~1hooks~1incoming%2Fpost>
105  
106 my $response = $resource->create({
107 # Required parameters:
108 channel_id => 'CHANNEL-ID-HERE',
109  
110 # Optional parameters:
111 display_name => '...',
112 description => '...',
113 username => '...',
114 icon_url => '...',
115 });
116  
117 =item C<list()>
118  
119 L<List incoming webhooks|https://api.mattermost.com/#tag/webhooks%2Fpaths%2F~1hooks~1incoming%2Fget>
120  
121 my $response = $resource->list({
122 # Optional parameters:
123 page => 0,
124 per_page => 60,
125 team_id => 'TEAM-ID-HERE',
126 });
127  
128 =item C<get_by_id()>
129  
130 L<Get an incoming webhook|https://api.mattermost.com/#tag/webhooks%2Fpaths%2F~1hooks~1incoming~1%7Bhook_id%7D%2Fget>
131  
132 my $response = $resource->get_by_id('WEBHOOK-ID-HERE');
133  
134 =item C<update_by_id()>
135  
136 L<Update an incoming webhook|https://api.mattermost.com/#tag/webhooks%2Fpaths%2F~1hooks~1incoming~1%7Bhook_id%7D%2Fput>
137  
138 my $response = $resource->update_by_id('WEBHOOK-ID-HERE', {
139 # Required parameters:
140 channel_id => 'CHANNEL-ID-HERE',
141 display_name => '...',
142 description => '...',
143  
144 # Optional parameters:
145 username => '...',
146 icon_url => '...',
147 });
148  
149 =back
150  
151 =head1 AUTHOR
152  
153 Mike Jones <mike@netsplit.org.uk>
154  
155 =head1 COPYRIGHT AND LICENSE
156  
157 This software is Copyright (c) 2020 by Mike Jones.
158  
159 This is free software, licensed under:
160  
161 The MIT (X11) License
162  
163 =cut
« Mattermost/V4/API/Object/Channel/Member.pm ↑ Summary Mattermost/V4/API/Resource/Webhook/Outgoing.pm »