line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Mattermost::V4::API::Response; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
2089
|
use Mojo::JSON 'decode_json'; |
|
7
|
|
|
|
|
92333
|
|
|
7
|
|
|
|
|
431
|
|
6
|
7
|
|
|
7
|
|
95
|
use Moo; |
|
7
|
|
|
|
|
63
|
|
|
7
|
|
|
|
|
40
|
|
7
|
7
|
|
|
7
|
|
2589
|
use Types::Standard qw(Any ArrayRef Bool InstanceOf Int Maybe Object Str); |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
56
|
|
8
|
|
|
|
|
|
|
|
9
|
7
|
|
|
7
|
|
11767
|
use WebService::Mattermost::V4::API::Object::Analytics::Old; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
210
|
|
10
|
7
|
|
|
7
|
|
2971
|
use WebService::Mattermost::V4::API::Object::Application; |
|
7
|
|
|
|
|
182
|
|
|
7
|
|
|
|
|
219
|
|
11
|
7
|
|
|
7
|
|
3001
|
use WebService::Mattermost::V4::API::Object::Audit; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
197
|
|
12
|
7
|
|
|
7
|
|
2676
|
use WebService::Mattermost::V4::API::Object::Bot; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
199
|
|
13
|
7
|
|
|
7
|
|
3161
|
use WebService::Mattermost::V4::API::Object::Channel::Member; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
208
|
|
14
|
7
|
|
|
7
|
|
47
|
use WebService::Mattermost::V4::API::Object::Channel; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
161
|
|
15
|
7
|
|
|
7
|
|
2979
|
use WebService::Mattermost::V4::API::Object::ChannelStats; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
197
|
|
16
|
7
|
|
|
7
|
|
3091
|
use WebService::Mattermost::V4::API::Object::Compliance::Report; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
237
|
|
17
|
7
|
|
|
7
|
|
2982
|
use WebService::Mattermost::V4::API::Object::Config; |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
229
|
|
18
|
7
|
|
|
7
|
|
3148
|
use WebService::Mattermost::V4::API::Object::DataRetentionPolicy; |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
196
|
|
19
|
7
|
|
|
7
|
|
2913
|
use WebService::Mattermost::V4::API::Object::Emoji; |
|
7
|
|
|
|
|
23
|
|
|
7
|
|
|
|
|
219
|
|
20
|
7
|
|
|
7
|
|
2939
|
use WebService::Mattermost::V4::API::Object::Error; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
195
|
|
21
|
7
|
|
|
7
|
|
3006
|
use WebService::Mattermost::V4::API::Object::File; |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
235
|
|
22
|
7
|
|
|
7
|
|
50
|
use WebService::Mattermost::V4::API::Object::Icon; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
153
|
|
23
|
7
|
|
|
7
|
|
3239
|
use WebService::Mattermost::V4::API::Object::Job; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
230
|
|
24
|
7
|
|
|
7
|
|
2992
|
use WebService::Mattermost::V4::API::Object::Log; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
210
|
|
25
|
7
|
|
|
7
|
|
2986
|
use WebService::Mattermost::V4::API::Object::NewLogEntry; |
|
7
|
|
|
|
|
23
|
|
|
7
|
|
|
|
|
213
|
|
26
|
7
|
|
|
7
|
|
55
|
use WebService::Mattermost::V4::API::Object::Plugin; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
149
|
|
27
|
7
|
|
|
7
|
|
35
|
use WebService::Mattermost::V4::API::Object::Plugins; |
|
7
|
|
|
|
|
15
|
|
|
7
|
|
|
|
|
178
|
|
28
|
7
|
|
|
7
|
|
3286
|
use WebService::Mattermost::V4::API::Object::Post; |
|
7
|
|
|
|
|
25
|
|
|
7
|
|
|
|
|
226
|
|
29
|
7
|
|
|
7
|
|
3281
|
use WebService::Mattermost::V4::API::Object::Reaction; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
258
|
|
30
|
7
|
|
|
7
|
|
3184
|
use WebService::Mattermost::V4::API::Object::Response; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
233
|
|
31
|
7
|
|
|
7
|
|
52
|
use WebService::Mattermost::V4::API::Object::Status; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
168
|
|
32
|
7
|
|
|
7
|
|
37
|
use WebService::Mattermost::V4::API::Object::Team; |
|
7
|
|
|
|
|
14
|
|
|
7
|
|
|
|
|
180
|
|
33
|
7
|
|
|
7
|
|
52
|
use WebService::Mattermost::V4::API::Object::TeamStats; |
|
7
|
|
|
|
|
17
|
|
|
7
|
|
|
|
|
189
|
|
34
|
7
|
|
|
7
|
|
3016
|
use WebService::Mattermost::V4::API::Object::Thread; |
|
7
|
|
|
|
|
19
|
|
|
7
|
|
|
|
|
199
|
|
35
|
7
|
|
|
7
|
|
3390
|
use WebService::Mattermost::V4::API::Object::User::Preference; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
203
|
|
36
|
7
|
|
|
7
|
|
3164
|
use WebService::Mattermost::V4::API::Object::User::Session; |
|
7
|
|
|
|
|
33
|
|
|
7
|
|
|
|
|
216
|
|
37
|
7
|
|
|
7
|
|
3248
|
use WebService::Mattermost::V4::API::Object::User::Status; |
|
7
|
|
|
|
|
20
|
|
|
7
|
|
|
|
|
209
|
|
38
|
7
|
|
|
7
|
|
63
|
use WebService::Mattermost::V4::API::Object::User; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
153
|
|
39
|
7
|
|
|
7
|
|
3021
|
use WebService::Mattermost::V4::API::Object::WebRTCToken; |
|
7
|
|
|
|
|
21
|
|
|
7
|
|
|
|
|
219
|
|
40
|
7
|
|
|
7
|
|
59
|
use WebService::Mattermost::Helper::Alias 'view'; |
|
7
|
|
|
|
|
18
|
|
|
7
|
|
|
|
|
4854
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has base_url => (is => 'ro', isa => Str, required => 1); |
45
|
|
|
|
|
|
|
has auth_token => (is => 'ro', isa => Str, required => 1); |
46
|
|
|
|
|
|
|
has code => (is => 'ro', isa => Int, required => 1); |
47
|
|
|
|
|
|
|
has headers => (is => 'ro', isa => InstanceOf['Mojo::Headers'], required => 1); |
48
|
|
|
|
|
|
|
has message => (is => 'ro', isa => Str, required => 0); |
49
|
|
|
|
|
|
|
has prev => (is => 'ro', isa => InstanceOf['Mojo::Message::Response'], required => 1); |
50
|
|
|
|
|
|
|
has raw_content => (is => 'ro', isa => Str, required => 0); |
51
|
|
|
|
|
|
|
has item_view => (is => 'ro', isa => Maybe[Str], required => 0); |
52
|
|
|
|
|
|
|
has single_item => (is => 'ro', isa => Bool, required => 0); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has is_error => (is => 'ro', isa => Bool, default => 0); |
55
|
|
|
|
|
|
|
has is_success => (is => 'ro', isa => Bool, default => 1); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has content => (is => 'rw', isa => Any, default => sub { {} }); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has item => (is => 'ro', isa => Maybe[Object], lazy => 1, builder => 1); |
60
|
|
|
|
|
|
|
has items => (is => 'ro', isa => Maybe[ArrayRef], lazy => 1, builder => 1); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub BUILD { |
65
|
28
|
|
|
28
|
0
|
34103
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
28
|
50
|
|
|
|
162
|
if ($self->_looks_like_json($self->raw_content)) { |
68
|
0
|
|
|
|
|
0
|
$self->content(decode_json($self->raw_content)); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
28
|
|
|
|
|
374
|
return 1; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _looks_like_json { |
77
|
32
|
|
|
32
|
|
75
|
my $self = shift; |
78
|
32
|
|
|
|
|
62
|
my $inp = shift; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
32
|
50
|
66
|
|
|
203
|
return $inp && $inp =~ /^[\{\[]/ ? 1 : 0; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _build_item { |
87
|
2
|
|
|
2
|
|
25
|
my $self = shift; |
88
|
|
|
|
|
|
|
|
89
|
2
|
|
|
|
|
6
|
my $item; |
90
|
|
|
|
|
|
|
|
91
|
2
|
50
|
|
|
|
4
|
if (scalar @{$self->items}) { |
|
2
|
|
|
|
|
35
|
|
92
|
2
|
|
|
|
|
66
|
$item = $self->items->[0]; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
2
|
|
|
|
|
42
|
return $item; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub _build_items { |
99
|
4
|
|
|
4
|
|
96
|
my $self = shift; |
100
|
|
|
|
|
|
|
|
101
|
4
|
|
|
|
|
11
|
my @ret; |
102
|
|
|
|
|
|
|
|
103
|
4
|
50
|
|
|
|
20
|
if ($self->item_view) { |
104
|
4
|
50
|
|
|
|
69
|
my @init_items = ref $self->content eq 'ARRAY' ? @{$self->content} : ($self->content); |
|
0
|
|
|
|
|
0
|
|
105
|
4
|
|
|
|
|
102
|
my @items; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
|
109
|
4
|
|
|
|
|
17
|
foreach (@init_items) { |
110
|
4
|
|
|
|
|
14
|
$_ =~ s/\n//sg; |
111
|
|
|
|
|
|
|
|
112
|
4
|
50
|
|
|
|
15
|
if ($self->_looks_like_json($_)) { |
113
|
0
|
|
|
|
|
0
|
push @items, decode_json($_); |
114
|
|
|
|
|
|
|
} else { |
115
|
4
|
50
|
|
|
|
20
|
push @items, $_ if $_; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
4
|
50
|
33
|
|
|
20
|
if ($items[0]->{status_code} && $items[0]->{status_code} != 200) { |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
0
|
push @ret, view('Error')->new({ |
122
|
|
|
|
|
|
|
raw_data => $items[0], |
123
|
|
|
|
|
|
|
auth_token => $self->auth_token, |
124
|
|
|
|
|
|
|
base_url => $self->base_url, |
125
|
|
|
|
|
|
|
}); |
126
|
|
|
|
|
|
|
} else { |
127
|
|
|
|
|
|
|
@ret = map { |
128
|
4
|
|
|
|
|
12
|
view($self->item_view)->new({ |
|
4
|
|
|
|
|
25
|
|
129
|
|
|
|
|
|
|
auth_token => $self->auth_token, |
130
|
|
|
|
|
|
|
base_url => $self->base_url, |
131
|
|
|
|
|
|
|
raw_data => $_, |
132
|
|
|
|
|
|
|
}) |
133
|
|
|
|
|
|
|
} @items; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
4
|
|
|
|
|
9517
|
return \@ret; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
1; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
__END__ |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=pod |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=encoding UTF-8 |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head1 NAME |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
WebService::Mattermost::V4::API::Response - Container for API responses. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 VERSION |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
version 0.26 |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 DESCRIPTION |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
A common container for responses from the Mattermost API. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head2 ATTRIBUTES |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=over 4 |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item C<code> |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
The HTTP code returned. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item C<headers> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Headers from the C<Mojo::Message::Response> object. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item C<message> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
A message (or undef) from the API (for example if there is a C<code> of 403, |
177
|
|
|
|
|
|
|
the C<message> will be "Forbidden"). |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item C<prev> |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
The returned C<Mojo::Message::Response> object. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item C<raw_content> |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
JSON-encoded content or undef. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=item C<is_error> |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item C<is_success> |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=item C<content> |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Decoded content in ArrayRef or HashRef form. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item C<item_view> |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Whether or not the response should try to create a v4::Object object. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item C<single_item> |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Whether or not the expected v4::Object should be an ArrayRef. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item C<item> |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
The first v4::Object object. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=item C<items> |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
All view objects. |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=back |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 AUTHOR |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Mike Jones <mike@netsplit.org.uk> |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Mike Jones. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
This is free software, licensed under: |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
The MIT (X11) License |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
226
|
|
|
|
|
|
|
|