line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mastodon::Entity::Account; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2428
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
108
|
|
4
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
118
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.012'; |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
492
|
use Moo; |
|
3
|
|
|
|
|
9256
|
|
|
3
|
|
|
|
|
21
|
|
9
|
|
|
|
|
|
|
with 'Mastodon::Role::Entity'; |
10
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
2263
|
use Types::Standard qw( Int Str Bool ); |
|
3
|
|
|
|
|
63796
|
|
|
3
|
|
|
|
|
32
|
|
12
|
3
|
|
|
3
|
|
3539
|
use Mastodon::Types qw( Acct URI DateTime ); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
31
|
|
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
3
|
|
2897
|
use Log::Any; |
|
3
|
|
|
|
|
6358
|
|
|
3
|
|
|
|
|
28
|
|
15
|
|
|
|
|
|
|
my $log = Log::Any->get_logger( category => 'Mastodon' ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has acct => ( is => 'ro', isa => Acct, required => 1, ); |
18
|
|
|
|
|
|
|
has avatar => ( is => 'ro', isa => URI, coerce => 1, required => 1, ); |
19
|
|
|
|
|
|
|
has avatar_static => ( is => 'ro', isa => URI, coerce => 1, ); |
20
|
|
|
|
|
|
|
has created_at => ( is => 'ro', isa => DateTime, coerce => 1, ); |
21
|
|
|
|
|
|
|
has display_name => ( is => 'ro', isa => Str, ); |
22
|
|
|
|
|
|
|
has followers_count => ( is => 'ro', isa => Int, ); |
23
|
|
|
|
|
|
|
has following_count => ( is => 'ro', isa => Int, ); |
24
|
|
|
|
|
|
|
has header => ( is => 'ro', isa => URI, coerce => 1, ); |
25
|
|
|
|
|
|
|
has header_static => ( is => 'ro', isa => URI, coerce => 1, ); |
26
|
|
|
|
|
|
|
has id => ( is => 'ro', isa => Int, ); |
27
|
|
|
|
|
|
|
has locked => ( is => 'ro', isa => Bool, ); |
28
|
|
|
|
|
|
|
has note => ( is => 'ro', isa => Str, ); |
29
|
|
|
|
|
|
|
has statuses_count => ( is => 'ro', isa => Int, ); |
30
|
|
|
|
|
|
|
has url => ( is => 'ro', isa => URI, coerce => 1, ); |
31
|
|
|
|
|
|
|
has username => ( is => 'ro', isa => Str, ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
foreach my $pair ( |
34
|
|
|
|
|
|
|
[ fetch => 'get_account' ], |
35
|
|
|
|
|
|
|
[ followers => undef ], |
36
|
|
|
|
|
|
|
[ following => undef ], |
37
|
|
|
|
|
|
|
[ statuses => undef ], |
38
|
|
|
|
|
|
|
[ follow => undef ], |
39
|
|
|
|
|
|
|
[ unfollow => undef ], |
40
|
|
|
|
|
|
|
[ block => undef ], |
41
|
|
|
|
|
|
|
[ unblock => undef ], |
42
|
|
|
|
|
|
|
[ mute => undef ], |
43
|
|
|
|
|
|
|
[ unmute => undef ], |
44
|
|
|
|
|
|
|
[ relationship => 'relationships' ], |
45
|
|
|
|
|
|
|
[ authorize => 'authorize_follow' ], |
46
|
|
|
|
|
|
|
[ reject => 'reject_follow' ], |
47
|
|
|
|
|
|
|
) { |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my ($name, $method) = @{$pair}; |
50
|
|
|
|
|
|
|
$method //= $name; |
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
3
|
|
681
|
no strict 'refs'; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
635
|
|
53
|
|
|
|
|
|
|
*{ __PACKAGE__ . '::' . $name } = sub { |
54
|
0
|
|
|
0
|
|
|
my $self = shift; |
55
|
0
|
0
|
|
|
|
|
croak $log->fatal(qq{Cannot call '$name' without client}) |
56
|
|
|
|
|
|
|
unless $self->_client; |
57
|
0
|
|
|
|
|
|
$self->_client->$method($self->id, @_); |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub remote_follow { |
62
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
63
|
0
|
0
|
|
|
|
|
croak $log->fatal(q{Cannot call 'remote_follow' without client}) |
64
|
|
|
|
|
|
|
unless $self->_client; |
65
|
0
|
|
|
|
|
|
$self->_client->remote_follow($self->acct, @_); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub report { |
69
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
70
|
0
|
0
|
|
|
|
|
croak $log->fatal(q{Cannot call 'report' without client}) |
71
|
|
|
|
|
|
|
unless $self->_client; |
72
|
|
|
|
|
|
|
$self->_client->report({ |
73
|
0
|
|
|
|
|
|
%{$params}, |
|
0
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
account_id => $self->id, |
75
|
|
|
|
|
|
|
}); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=encoding utf8 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 NAME |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Mastodon::Entity::Account - A Mastodon user account |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 DESCRIPTION |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This object should not be manually created. It is intended to be generated |
89
|
|
|
|
|
|
|
from the data received from a Mastodon server using the coercions in |
90
|
|
|
|
|
|
|
L<Mastodon::Types>. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
For current information, see the |
93
|
|
|
|
|
|
|
L<Mastodon API documentation|https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#account> |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over 4 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item B<id> |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The ID of the account |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item B<username> |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
The username of the account |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item B<acct> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Equals C<username> for local users, includes C<@domain> for remote ones |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item B<display_name> |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
The account's display name |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item B<locked> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Boolean for when the account cannot be followed without waiting for approval |
118
|
|
|
|
|
|
|
first |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item B<created_at> |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
The time the account was created |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item B<followers_count> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The number of followers for the account |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=item B<following_count> |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
The number of accounts the given account is following |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item B<statuses_count> |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The number of statuses the account has made |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=item B<note> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Biography of user |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item B<url> |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
URL of the user's profile page (can be remote) |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item B<avatar> |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
URL to the avatar image |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item B<avatar_static> |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
URL to the avatar static image (gif) |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item B<header> |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
URL to the header image |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item B<header_static> |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
URL to the header static image (gif) |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=back |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 METHODS |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
This class provides the following convenience methods. They act as a shortcut, |
165
|
|
|
|
|
|
|
passing the appropriate identifier of the current object as the first argument |
166
|
|
|
|
|
|
|
to the corresponding methods in L<Mastodon::Client>. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=over 4 |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item B<fetch> |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
A shortcut to C<get_account>. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item B<followers> |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
A shortcut to C<followers>. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=item B<following> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
A shortcut to C<following>. |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=item B<statuses> |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
A shortcut to C<statuses>. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=item B<follow> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
A shortcut to C<follow>. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item B<unfollow> |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
A shortcut to C<unfollow>. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=item B<remote_follow> |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
A shortcut to C<remote_follow>. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=item B<report> |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
A shortcut to C<report>. |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=item B<block> |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
A shortcut to C<block>. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item B<unblock> |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
A shortcut to C<unblock>. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=item B<mute> |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
A shortcut to C<mute>. |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item B<unmute> |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
A shortcut to C<unmute>. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item B<relationship> |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
A shortcut to C<relationships>. |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=item B<authorize> |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
A shortcut to C<authorize_follow>. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=item B<reject> |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
A shortcut to C<reject_follow>. |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=back |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head1 AUTHOR |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=over 4 |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
=item * |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
José JoaquÃn Atria <jjatria@cpan.org> |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=back |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
This software is copyright (c) 2017 by José JoaquÃn Atria. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
247
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=cut |