| 1 | package WebService::Mattermost::V4::API::Resource::Job; | ||
| 2 | |||
| 3 | # ABSTRACT: Wrapped API methods for the job 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 cancel) ] => 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 get { | ||
| 20 | my $self = shift; | ||
| 21 | my $id = shift; | ||
| 22 | |||
| 23 | return $self->_single_view_get({ | ||
| 24 | view => 'Job', | ||
| 25 | endpoint => '%s', | ||
| 26 | ids => [ $id ], | ||
| 27 | }); | ||
| 28 | } | ||
| 29 | |||
| 30 | sub cancel { | ||
| 31 | my $self = shift; | ||
| 32 | my $id = shift; | ||
| 33 | |||
| 34 | return $self->_single_view_post({ | ||
| 35 | view => 'Job', | ||
| 36 | endpoint => '%s/cancel', | ||
| 37 | ids => [ $id ], | ||
| 38 | }); | ||
| 39 | } | ||
| 40 | |||
| 41 | ################################################################################ | ||
| 42 | |||
| 43 | 12 | 1; | |
| 44 | |||
| 45 | __END__ | ||
| 46 | |||
| 47 | =pod | ||
| 48 | |||
| 49 | =encoding UTF-8 | ||
| 50 | |||
| 51 | =head1 NAME | ||
| 52 | |||
| 53 | WebService::Mattermost::V4::API::Resource::Job - Wrapped API methods for the job API endpoints. | ||
| 54 | |||
| 55 | =head1 VERSION | ||
| 56 | |||
| 57 | version 0.28 | ||
| 58 | |||
| 59 | =head1 DESCRIPTION | ||
| 60 | |||
| 61 | =head2 USAGE | ||
| 62 | |||
| 63 | use WebService::Mattermost; | ||
| 64 | |||
| 65 | my $mm = WebService::Mattermost->new({ | ||
| 66 | authenticate => 1, | ||
| 67 | username => 'me@somewhere.com', | ||
| 68 | password => 'hunter2', | ||
| 69 | base_url => 'https://my.mattermost.server.com/api/v4/', | ||
| 70 | }); | ||
| 71 | |||
| 72 | my $resource = $mm->api->teams->job; | ||
| 73 | |||
| 74 | =head2 METHODS | ||
| 75 | |||
| 76 | =over 4 | ||
| 77 | |||
| 78 | =item C<get()> | ||
| 79 | |||
| 80 | L<Get a job|https://api.mattermost.com/#tag/jobs%2Fpaths%2F~1jobs~1%7Bjob_id%7D%2Fget> | ||
| 81 | |||
| 82 | my $response = $resource->get('JOB-ID-HERE'); | ||
| 83 | |||
| 84 | =item C<cancel()> | ||
| 85 | |||
| 86 | L<Cancel a job|https://api.mattermost.com/#tag/jobs%2Fpaths%2F~1jobs~1%7Bjob_id%7D~1cancel%2Fpost> | ||
| 87 | |||
| 88 | my $response = $resource->cancel('JOB-ID-HERE'); | ||
| 89 | |||
| 90 | =back | ||
| 91 | |||
| 92 | =head1 SEE ALSO | ||
| 93 | |||
| 94 | =over 4 | ||
| 95 | |||
| 96 | =item L<Official Jobs documentation|https://api.mattermost.com/#tag/jobs> | ||
| 97 | |||
| 98 | =back | ||
| 99 | |||
| 100 | =head1 AUTHOR | ||
| 101 | |||
| 102 | Mike Jones <mike@netsplit.org.uk> | ||
| 103 | |||
| 104 | =head1 COPYRIGHT AND LICENSE | ||
| 105 | |||
| 106 | This software is Copyright (c) 2020 by Mike Jones. | ||
| 107 | |||
| 108 | This is free software, licensed under: | ||
| 109 | |||
| 110 | The MIT (X11) License | ||
| 111 | |||
| 112 | =cut | ||