line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mastodon::Entity::Status; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2950
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
98
|
|
4
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
126
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.017'; |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
558
|
use Moo; |
|
3
|
|
|
|
|
7046
|
|
|
3
|
|
|
|
|
35
|
|
9
|
|
|
|
|
|
|
with 'Mastodon::Role::Entity'; |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
2255
|
use Types::Standard qw( Maybe Int Str Bool ArrayRef Enum ); |
|
3
|
|
|
|
|
14
|
|
|
3
|
|
|
|
|
38
|
|
12
|
3
|
|
|
|
|
23
|
use Mastodon::Types qw( |
13
|
|
|
|
|
|
|
URI Account Status DateTime Attachment Mention Tag Application |
14
|
3
|
|
|
3
|
|
4881
|
); |
|
3
|
|
|
|
|
7
|
|
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
|
4967
|
use Log::Any; |
|
3
|
|
|
|
|
8335
|
|
|
3
|
|
|
|
|
40
|
|
17
|
|
|
|
|
|
|
my $log = Log::Any->get_logger( category => 'Mastodon' ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has account => ( |
20
|
|
|
|
|
|
|
is => 'ro', isa => Account, coerce => 1, required => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has application => ( |
24
|
|
|
|
|
|
|
is => 'ro', isa => Maybe [Application], coerce => 1, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has content => ( |
28
|
|
|
|
|
|
|
is => 'ro', isa => Str, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has created_at => ( |
32
|
|
|
|
|
|
|
is => 'ro', isa => DateTime, coerce => 1, |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
has emojis => ( |
36
|
|
|
|
|
|
|
is => 'ro', isa => ArrayRef, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has favourited => ( |
40
|
|
|
|
|
|
|
is => 'ro', isa => Bool, coerce => 1, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has favourites_count => ( |
44
|
|
|
|
|
|
|
is => 'ro', isa => Int, required => 1, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has id => ( |
48
|
|
|
|
|
|
|
is => 'ro', isa => Int, |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
has in_reply_to_account_id => ( |
52
|
|
|
|
|
|
|
is => 'ro', isa => Maybe [Int], |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has in_reply_to_id => ( |
56
|
|
|
|
|
|
|
is => 'ro', isa => Maybe [Int], |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
has media_attachments => ( |
60
|
|
|
|
|
|
|
is => 'ro', isa => ArrayRef [Attachment], coerce => 1, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has mentions => ( |
64
|
|
|
|
|
|
|
is => 'ro', isa => ArrayRef [Mention], coerce => 1, |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has reblog => ( |
68
|
|
|
|
|
|
|
is => 'ro', isa => Maybe [Status], coerce => 1, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has reblogged => ( |
72
|
|
|
|
|
|
|
is => 'ro', isa => Bool, coerce => 1, |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
has reblogs_count => ( |
76
|
|
|
|
|
|
|
is => 'ro', isa => Int, |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
has sensitive => ( |
80
|
|
|
|
|
|
|
is => 'ro', isa => Bool, coerce => 1, |
81
|
|
|
|
|
|
|
); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
has spoiler_text => ( |
84
|
|
|
|
|
|
|
is => 'ro', isa => Str, |
85
|
|
|
|
|
|
|
); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
has tags => ( |
88
|
|
|
|
|
|
|
is => 'ro', isa => ArrayRef [Tag], coerce => 1, |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
has uri => ( |
92
|
|
|
|
|
|
|
is => 'ro', isa => Str, |
93
|
|
|
|
|
|
|
); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
has url => ( |
96
|
|
|
|
|
|
|
is => 'ro', isa => URI, coerce => 1, |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
has visibility => ( |
100
|
|
|
|
|
|
|
is => 'ro', isa => Enum[qw( |
101
|
|
|
|
|
|
|
public unlisted private direct |
102
|
|
|
|
|
|
|
)], |
103
|
|
|
|
|
|
|
required => 1, |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
foreach my $pair ( |
107
|
|
|
|
|
|
|
[ fetch => 'get_status' ], |
108
|
|
|
|
|
|
|
[ fetch_context => 'get_status_context' ], |
109
|
|
|
|
|
|
|
[ fetch_card => 'get_status_card' ], |
110
|
|
|
|
|
|
|
[ fetch_reblogs => 'get_status_reblogs' ], |
111
|
|
|
|
|
|
|
[ fetch_favourites => 'get_status_favourites' ], |
112
|
|
|
|
|
|
|
[ delete => 'delete_status' ], |
113
|
|
|
|
|
|
|
[ boost => 'reblog' ], |
114
|
|
|
|
|
|
|
[ unboost => 'unreblog' ], |
115
|
|
|
|
|
|
|
[ favourite => undef ], |
116
|
|
|
|
|
|
|
[ unfavourite => undef ], |
117
|
|
|
|
|
|
|
) { |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my ($name, $method) = @{$pair}; |
120
|
|
|
|
|
|
|
$method //= $name; |
121
|
|
|
|
|
|
|
|
122
|
3
|
|
|
3
|
|
1141
|
no strict 'refs'; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
671
|
|
123
|
|
|
|
|
|
|
*{ __PACKAGE__ . '::' . $name } = sub { |
124
|
0
|
|
|
0
|
|
|
my $self = shift; |
125
|
0
|
0
|
|
|
|
|
croak $log->fatal(qq{Cannot call '$name' without client}) |
126
|
|
|
|
|
|
|
unless $self->_client; |
127
|
0
|
|
|
|
|
|
$self->_client->$method($self->id, @_); |
128
|
|
|
|
|
|
|
}; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
1; |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=encoding utf8 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 NAME |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Mastodon::Entity::Status - A Mastodon status |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 DESCRIPTION |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This object should not be manually created. It is intended to be generated |
142
|
|
|
|
|
|
|
from the data received from a Mastodon server using the coercions in |
143
|
|
|
|
|
|
|
L<Mastodon::Types>. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
For current information, see the |
146
|
|
|
|
|
|
|
L<Mastodon API documentation|https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#status> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=over 4 |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item B<id> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
The ID of the status. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item B<uri> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
A Fediverse-unique resource ID. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=item B<url> |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
URL to the status page (can be remote). |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=item B<account> |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
The L<Mastodon::Entity::Account> which posted the status. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item B<in_reply_to_id> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
C<undef> or the ID of the status it replies to. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item B<in_reply_to_account_id> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
C<undef> or the ID of the account it replies to. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item B<reblog> |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
C<undef> or the reblogged L<Mastodon::Entity::Status>. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item B<content> |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Body of the status; this will contain HTML (remote HTML already sanitized). |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item B<created_at> |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
The time the status was created as a L<DateTime> object. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item B<reblogs_count> |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
The number of reblogs for the status. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item B<favourites_count> |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
The number of favourites for the status. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item B<reblogged> |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Whether the authenticated user has reblogged the status. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item B<favourited> |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
Whether the authenticated user has favourited the status. |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item B<sensitive> |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
Whether media attachments should be hidden by default. |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item B<spoiler_text> |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
If not empty, warning text that should be displayed before the actual content. |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item B<visibility> |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
One of: C<public>, C<unlisted>, C<private>, C<direct>. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item B<media_attachments> |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
An array of L<Mastodon::Entity::Attachment> objects. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item B<mentions> |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
An array of L<Mastodon::Entity::Mention> objects. |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=item B<tags> |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
An array of L<Mastodon::Entity::Tag> objects. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=item B<application> |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
Application from which the status was posted, as a |
231
|
|
|
|
|
|
|
L<Mastodon::Entity::Application> object. |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=back |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=head1 METHODS |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
This class provides the following convenience methods. They act as a shortcut, |
238
|
|
|
|
|
|
|
passing the appropriate identifier of the current object as the first argument |
239
|
|
|
|
|
|
|
to the corresponding methods in L<Mastodon::Client>. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=over 4 |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=item B<fetch> |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
A shortcut to C<get_status>. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item B<fetch_context> |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
A shortcut to C<get_status_context>. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=item B<fetch_card> |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
A shortcut to C<get_status_card>. |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=item B<fetch_reblogs> |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
A shortcut to C<get_status_reblogs>. |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=item B<fetch_favourites> |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
A shortcut to C<get_status_favourites>. |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=item B<delete> |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
A shortcut to C<delete_status>. |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item B<boost> |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
A shortcut to C<reblog>. |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=item B<unboost> |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
A shortcut to C<unreblog>. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=item B<favourite> |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
A shortcut to C<favourite>. |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=item B<unfavourite> |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
A shortcut to C<unfavourite>. |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=back |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head1 AUTHOR |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=over 4 |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=item * |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
José JoaquÃn Atria <jjatria@cpan.org> |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=back |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
This software is copyright (c) 2017 by José JoaquÃn Atria. |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
300
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=cut |