Mattermost/V4/API/Resource/File.pm

filter: Statementstmt 25.0% 5 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 16.6% 1 / 6 Podpod 100% 5 / 5 totaltotal 35.4% 11 / 31 CC 1 SCAR 6.1
CC
1
Cov
25%
get
2.0
get_thumbnail
2.0
get_preview
2.0
CRAP 1.8
« Mattermost/V4/API/Resource/SAML/Certificate.pm ↑ Summary Mattermost/V4/API/Object/Compliance/Report.pm »
1 package WebService::Mattermost::V4::API::Resource::File;
2  
3 # ABSTRACT: Wrapped API methods for the file 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 get {
12 0 ▶ my $self = shift;
Subroutine get: not called CC=1 SCAR=6.9
Pod documented
13 0 my $file_id = shift;
14  
15 0 return $self->_get({
16 endpoint => '%s',
17 ids => [ $file_id ],
18 view => 'Binary',
19 });
20 }
21  
22 sub get_thumbnail {
23 0 ▶ my $self = shift;
Subroutine get_thumbnail: not called CC=1 SCAR=6.9
Pod documented
24 0 my $file_id = shift;
25  
26 0 return $self->_get({
27 endpoint => '%s/thumbnail',
28 ids => [ $file_id ],
29 });
30 }
31  
32 sub get_preview {
33 0 ▶ my $self = shift;
Subroutine get_preview: not called CC=1 SCAR=6.9
Pod documented
34 0 my $file_id = shift;
35  
36 0 return $self->_get({
37 endpoint => '%s/preview',
38 ids => [ $file_id ],
39 });
40 }
41  
42 sub get_link {
43 0 ▶ my $self = shift;
Subroutine get_link: not called CC=1 SCAR=6.9
Pod documented
44 0 my $file_id = shift;
45  
46 0 return $self->_get({
47 endpoint => '%s/link',
48 ids => [ $file_id ],
49 });
50 }
51  
52 sub get_metadata {
53 0 ▶ my $self = shift;
Subroutine get_metadata: not called CC=1 SCAR=6.9
Pod documented
54 0 my $file_id = shift;
55  
56 0 return $self->_get({
57 endpoint => '%s/info',
58 ids => [ $file_id ],
59 });
60 }
61  
62 ################################################################################
63  
64 12 1;
65  
66 __END__
67  
68 =pod
69  
70 =encoding UTF-8
71  
72 =head1 NAME
73  
74 WebService::Mattermost::V4::API::Resource::File - Wrapped API methods for the file API endpoints.
75  
76 =head1 VERSION
77  
78 version 0.28
79  
80 =head1 DESCRIPTION
81  
82 =head2 USAGE
83  
84 use WebService::Mattermost;
85  
86 my $mm = WebService::Mattermost->new({
87 authenticate => 1,
88 username => 'me@somewhere.com',
89 password => 'hunter2',
90 base_url => 'https://my.mattermost.server.com/api/v4/',
91 });
92  
93 my $resource = $mm->api->file;
94  
95 =head2 METHODS
96  
97 =over 4
98  
99 =item C<get()>
100  
101 Get basic information about a file.
102  
103 $resource->get('FILE_ID_HERE');
104  
105 =item C<get_thumbnail()>
106  
107 Get a file's thumbnail
108  
109 $resource->get_thumbnail('FILE_ID_HERE');
110  
111 =item C<get_preview()>
112  
113 Get a file's preview.
114  
115 $resource->get_preview('FILE_ID_HERE');
116  
117 =item C<get_link()>
118  
119 Get a public link to a file.
120  
121 $resource->get_link('FILE_ID_HERE');
122  
123 =item C<get_metadata()>
124  
125 Get information about a file.
126  
127 $resource->get_metadata('FILE_ID_HERE');
128  
129 =back
130  
131 =head1 SEE ALSO
132  
133 =over 4
134  
135 =item L<Official Files documentation|https://api.mattermost.com/#tag/files>
136  
137 =back
138  
139 =head1 AUTHOR
140  
141 Mike Jones <mike@netsplit.org.uk>
142  
143 =head1 COPYRIGHT AND LICENSE
144  
145 This software is Copyright (c) 2020 by Mike Jones.
146  
147 This is free software, licensed under:
148  
149 The MIT (X11) License
150  
151 =cut
« Mattermost/V4/API/Resource/SAML/Certificate.pm ↑ Summary Mattermost/V4/API/Object/Compliance/Report.pm »