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