line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Flickr::API2::People; |
2
|
4
|
|
|
4
|
|
27
|
use 5.12.0; |
|
4
|
|
|
|
|
8
|
|
3
|
4
|
|
|
4
|
|
13
|
use warnings; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
71
|
|
4
|
4
|
|
|
4
|
|
1264
|
use Flickr::API2::User; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
89
|
|
5
|
4
|
|
|
4
|
|
37
|
use Moo; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
extends 'Flickr::API2::Base'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Flickr::API2::People |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 METHODS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head2 findByEmail |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Return a user's NSID, given their email address. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
eg. $api->people->findByEmail('john.doe@example.com') |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub findByEmail { |
23
|
0
|
|
|
0
|
1
|
0
|
my ($self, $email) = @_; |
24
|
0
|
|
|
|
|
0
|
my $r = $self->api->execute_method( |
25
|
|
|
|
|
|
|
'flickr.people.findByEmail', { find_email => $email } |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
return Flickr::API2::User->new( |
28
|
|
|
|
|
|
|
api => $self->api, |
29
|
|
|
|
|
|
|
NSID => $r->{user}->{nsid}, |
30
|
|
|
|
|
|
|
username => $r->{user}->{username}->{_content}, |
31
|
0
|
|
|
|
|
0
|
); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 findByUsername |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Return a user's NSID, given their username. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
eg. $api->people->findByUsername('fakeuser') |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub findByUsername { |
43
|
1
|
|
|
1
|
1
|
14
|
my ($self, $username) = @_; |
44
|
1
|
|
|
|
|
8
|
my $r = $self->api->execute_method( |
45
|
|
|
|
|
|
|
'flickr.people.findByUsername', { username => $username } |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
return Flickr::API2::User->new( |
48
|
|
|
|
|
|
|
api => $self->api, |
49
|
|
|
|
|
|
|
NSID => $r->{user}->{nsid}, |
50
|
|
|
|
|
|
|
username => $r->{user}->{username}->{_content}, |
51
|
1
|
|
|
|
|
16
|
); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 getInfo |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Get information about a user. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
eg. $api->people->getInfo('12345678@N00'); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
or $api->people->findByUsername('fakeuser')->getInfo; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub getInfo { |
65
|
1
|
|
|
1
|
1
|
12
|
my ($self, $id) = @_; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
6
|
my $r = $self->api->execute_method( |
68
|
|
|
|
|
|
|
'flickr.people.getInfo', { user_id => $id } |
69
|
|
|
|
|
|
|
); |
70
|
1
|
|
|
|
|
7
|
return $r->{person}; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 getPublicPhotos |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Get a list of public photos for the given user. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
eg. $api->people->getPublicPhotos('12345678@N00') |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
or $api->people->findByUsername('foobar')->getPublicPhotos( per_page => 10 ) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
See http://www.flickr.com/services/api/flickr.people.getPublicPhotos.html |
82
|
|
|
|
|
|
|
for options. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub getPublicPhotos { |
87
|
1
|
|
|
1
|
1
|
14
|
my ($self, $id, %args) = @_; |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
50
|
|
|
10
|
$args{extras} ||= join(',', |
90
|
|
|
|
|
|
|
qw( |
91
|
|
|
|
|
|
|
date_upload date_taken owner_name url_s url_m url_l path_alias count_faves views |
92
|
|
|
|
|
|
|
) |
93
|
|
|
|
|
|
|
); |
94
|
|
|
|
|
|
|
|
95
|
1
|
|
|
|
|
8
|
my $r = $self->api->execute_method( |
96
|
|
|
|
|
|
|
'flickr.people.getPublicPhotos', { user_id => $id, %args } |
97
|
|
|
|
|
|
|
); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
die("Didn't understand response (or no photos)") |
100
|
1
|
50
|
|
|
|
12
|
unless exists $r->{photos}; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
return $self->_response_to_photos($r->{photos}) |
103
|
1
|
|
|
|
|
15
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |