Mattermost/V4/API/Resource/Jobs.pm

filter: Statementstmt 31.2% 5 / 16 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 1 / 4 Podpod 100% 3 / 3 totaltotal 36.0% 9 / 25 CC 2 SCAR 12.2
CC
2
Cov
28%
get_by_type
6.0
all
2.0
create
2.0
CRAP 3.4
« Mattermost/V4/API/Resource/Users.pm ↑ Summary Mattermost/V4/API/Object/DataRetentionPolicy.pm »
1 package WebService::Mattermost::V4::API::Resource::Jobs;
2  
3 # ABSTRACT: Wrapped API methods for the jobs 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 sub all {
12 0 ▶ my $self = shift;
Subroutine all: not called CC=1 SCAR=6.9
Pod documented
13 0 my $args = shift;
14  
15 0 return $self->_single_view_get({
16 view => 'Job',
17 parameters => $args,
18 });
19 }
20  
21 sub create {
22 0 ▶ my $self = shift;
Subroutine create: not called CC=1 SCAR=6.9
Pod documented
23 0 my $args = shift;
24  
25 0 return $self->_single_view_post({
26 view => 'Job',
27 parameters => $args,
28 required => [ 'type' ],
29 });
30 }
31  
32 sub get_by_type {
33 0 ▶ my $self = shift;
Subroutine get_by_type: not called CC=2 SCAR=17.9
Pod documented
34 0 my $type = shift;
35  
36 0 ▶ unless ($type) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($type) 0 0 0
37 0 return $self->error_return('The first argument must be a job type');
38 }
39  
40 0 return $self->_get({
41 view => 'Job',
42 endpoint => 'type/%s',
43 ids => [ $type ],
44 });
45 }
46  
47 ################################################################################
48  
49 12 1;
50  
51 __END__
52  
53 =pod
54  
55 =encoding UTF-8
56  
57 =head1 NAME
58  
59 WebService::Mattermost::V4::API::Resource::Jobs - Wrapped API methods for the jobs API endpoints.
60  
61 =head1 VERSION
62  
63 version 0.28
64  
65 =head1 DESCRIPTION
66  
67 =head2 USAGE
68  
69 use WebService::Mattermost;
70  
71 my $mm = WebService::Mattermost->new({
72 authenticate => 1,
73 username => 'me@somewhere.com',
74 password => 'hunter2',
75 base_url => 'https://my.mattermost.server.com/api/v4/',
76 });
77  
78 my $resource = $mm->api->teams->jobs;
79  
80 =head2 METHODS
81  
82 =over 4
83  
84 =item C<all()>
85  
86 L<Get the jobs|https://api.mattermost.com/#tag/jobs%2Fpaths%2F~1jobs%2Fget>
87  
88 Get all the jobs.
89  
90 my $response = $resource->all({
91 # Optional arguments
92 page => 0,
93 per_page => 60,
94 });
95  
96 =item C<create()>
97  
98 L<Create a new job|https://api.mattermost.com/#tag/jobs%2Fpaths%2F~1jobs%2Fpost>
99  
100 my $response = $resource->create({
101 # Required arguments
102 type => 'JOB-TYPE',
103  
104 # Optional arguments
105 data => {},
106 });
107  
108 =item C<get_by_type()>
109  
110 L<https://api.mattermost.com/#tag/jobs%2Fpaths%2F~1jobs~1type~1%7Btype%7D%2Fget>
111  
112 my $response = $resource->get_by_type('JOB-TYPE-HERE');
113  
114 =back
115  
116 =head1 SEE ALSO
117  
118 =over 4
119  
120 =item L<Official Jobs documentation|https://api.mattermost.com/#tag/jobs>
121  
122 =back
123  
124 =head1 AUTHOR
125  
126 Mike Jones <mike@netsplit.org.uk>
127  
128 =head1 COPYRIGHT AND LICENSE
129  
130 This software is Copyright (c) 2020 by Mike Jones.
131  
132 This is free software, licensed under:
133  
134 The MIT (X11) License
135  
136 =cut
« Mattermost/V4/API/Resource/Users.pm ↑ Summary Mattermost/V4/API/Object/DataRetentionPolicy.pm »