| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::Mattermost::V4::API::Resource::File; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
47
|
use Moo; |
|
|
7
|
|
|
|
|
17
|
|
|
|
7
|
|
|
|
|
42
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'WebService::Mattermost::V4::API::Resource'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub get { |
|
12
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
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
|
|
|
0
|
1
|
|
my $self = shift; |
|
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
|
|
|
0
|
1
|
|
my $self = shift; |
|
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
|
|
|
0
|
1
|
|
my $self = shift; |
|
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
|
|
|
0
|
1
|
|
my $self = shift; |
|
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
|
|
|
|
|
|
|
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.26 |
|
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 |
|
152
|
|
|
|
|
|
|
|