File Coverage

blib/lib/WebService/Mattermost/V4/API/Resource/Plugins.pm
Criterion Covered Total %
statement 3 10 30.0
branch n/a
condition n/a
subroutine 1 4 25.0
pod 2 3 66.6
total 6 17 35.2


line stmt bran cond sub pod time code
1             package WebService::Mattermost::V4::API::Resource::Plugins;
2:

3: # ABSTRACT: Wrapped API methods for the plugins API endpoints. 4:
5: use Moo;
6:
7: extends 'WebService::Mattermost::V4::API::Resource';
8: with 'WebService::Mattermost::V4::API::Resource::Role::View::Plugins';
9:
10: ################################################################################
11:
12: sub upload {
13: my $self = shift;
14: my $filename = shift;
15:
16: return $self->_single_view_post({
17: required => [ qw(plugin) ],
18: override_data_type => 'form',
19: parameters => {
20: plugin => { file => $filename },
21: },
22: view => 'Status',
23: });
24: }
25:
26: sub all {
27: my $self = shift;
28:
29: return $self->_get();
30: }
31:
32: sub all_webapp {
33: my $self = shift;
34:
35: return $self->_get({ endpoint => 'webapp' });
36: }
37:
38: ################################################################################
39:
40: 1;
41:
42: __END__
43:
44: =pod
45:
46: =encoding UTF-8
47:
48: =head1 NAME
49:
50: WebService::Mattermost::V4::API::Resource::Plugins - Wrapped API methods for the plugins API endpoints.
51:
52: =head1 VERSION
53:
54: version 0.30
55:
56: =head1 DESCRIPTION
57:
58: =head2 USAGE
59:
60: use WebService::Mattermost;
61:
62: my $mm = WebService::Mattermost->new({
63: authenticate => 1,
64: username => 'me@somewhere.com',
65: password => 'hunter2',
66: base_url => 'https://my.mattermost.server.com/api/v4/',
67: });
68:
69: my $resource = $mm->api->plugins;
70:
71: =head2 METHODS
72:
73: =over 4
74:
75: =item C<upload()>
76:
77: L<Upload plugin|https://api.mattermost.com/#tag/plugins%2Fpaths%2F~1plugins%2Fpost>
78:
79: my $response = $resource->upload('/path/to/plugin.tar.gz');
80:
81: =item C<all()>
82:
83: L<Get plugins|https://api.mattermost.com/#tag/plugins%2Fpaths%2F~1plugins%2Fget>
84:
85: my $response = $resource->all();
86:
87: =item C<webapp()>
88:
89: L<Get webapp plugins|https://api.mattermost.com/#tag/plugins%2Fpaths%2F~1plugins~1webapp%2Fget>
90:
91: my $response = $resource->all_webapp();
92:
93: =back
94:
95: =head1 AUTHOR
96:
97: Mike Jones <mike@netsplit.org.uk>
98:
99: =head1 COPYRIGHT AND LICENSE
100:
101: This software is Copyright (c) 2023 by Mike Jones.
102:
103: This is free software, licensed under:
104:
105: The MIT (X11) License
106:
107: =cut
108: