line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Digg; |
2
|
|
|
|
|
|
|
$AUTHOR = 'Kurt Wilms '; |
3
|
|
|
|
|
|
|
$VERSION = 0.11; |
4
|
30
|
|
|
30
|
|
501021
|
use warnings; |
|
30
|
|
|
|
|
65
|
|
|
30
|
|
|
|
|
976
|
|
5
|
30
|
|
|
30
|
|
141
|
use strict; |
|
30
|
|
|
|
|
52
|
|
|
30
|
|
|
|
|
894
|
|
6
|
|
|
|
|
|
|
|
7
|
30
|
|
|
30
|
|
29329
|
use LWP::UserAgent; |
|
30
|
|
|
|
|
1471259
|
|
|
30
|
|
|
|
|
1026
|
|
8
|
30
|
|
|
30
|
|
27202
|
use JSON::Any; |
|
30
|
|
|
|
|
697844
|
|
|
30
|
|
|
|
|
186
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Net::Digg - Quickly consume and interface with the Digg API. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Net::Digg; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $digg = Net::Digg->new(); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Print the user that submitted the latest upcoming story. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $result = $digg->get_upcoming_stories(); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
print $result->{ 'stories' }[0]->{'title'}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Print the titles of the twenty latest popular stories |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my %params = ('count' => 20); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$result = $digg->get_popular_stories(\%params); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $stories = $result->{'stories'}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
foreach $story (@$stories) { |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
print $story->{'title'} . "\n"; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
See also FUNCTIONS, DESCRIPTION, and EXAMPLES below. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 INSTALLATION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
The typical: |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=over |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item 0 perl Makefile.PL |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item 0 make test |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item 0 make install |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=back |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 FUNCTIONS |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=pod |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 new() |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Creates the Digg object. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub new { |
70
|
30
|
|
|
30
|
1
|
421
|
my $class = shift; |
71
|
30
|
|
|
|
|
99
|
my %conf = @_; |
72
|
|
|
|
|
|
|
|
73
|
30
|
50
|
|
|
|
199
|
$conf{apiurl} = 'http://services.digg.com' unless defined $conf{apiurl}; |
74
|
30
|
50
|
|
|
|
586
|
$conf{useragent} = "Net::Digg/$Net::Digg::VERSION (PERL)" unless defined $conf{useragent}; |
75
|
30
|
50
|
|
|
|
204
|
$conf{appkey} = 'http%3A%2F%2Fsearch.cpan.org%2Fdist%2FNet-Digg' unless defined $conf{appkey}; |
76
|
30
|
50
|
|
|
|
158
|
$conf{type} = 'json' unless defined $conf{type}; |
77
|
30
|
|
|
|
|
307
|
$conf{ua} = LWP::UserAgent->new(); |
78
|
30
|
|
|
|
|
93813
|
$conf{ua}->agent($conf{useragent}); |
79
|
30
|
|
|
|
|
1719
|
$conf{ua}->env_proxy(); |
80
|
|
|
|
|
|
|
|
81
|
30
|
|
|
|
|
457236
|
return bless {%conf}, $class; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=pod |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 get_stories (\%params) |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Given |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=over |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=back |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Get all stories. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub get_stories { |
101
|
1
|
|
|
1
|
1
|
10
|
my $self = shift; |
102
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
103
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "stories"; |
104
|
1
|
|
|
|
|
6
|
$url .= $self->handle_args($queryargs); |
105
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
106
|
1
|
50
|
|
|
|
433100
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=pod |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 get_popular_stories (\%params) |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Given |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=back |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Get all popular stories. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub get_popular_stories { |
126
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
127
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
128
|
1
|
|
|
|
|
5
|
my $url = $self->{apiurl} . "/" . "stories/popular"; |
129
|
1
|
|
|
|
|
6
|
$url .= $self->handle_args($queryargs); |
130
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
131
|
1
|
50
|
|
|
|
440777
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=pod |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 get_upcoming_stories (\%params) |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Given |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=over |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=back |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Get all popular stories. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub get_upcoming_stories { |
151
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
152
|
1
|
|
|
|
|
3
|
my $queryargs = shift; |
153
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "stories/upcoming"; |
154
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
155
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
156
|
1
|
50
|
|
|
|
448904
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=pod |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 get_top_stories (\%params) |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Given |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=back |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Get top stories. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=cut |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub get_top_stories { |
176
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
177
|
1
|
|
|
|
|
3
|
my $queryargs = shift; |
178
|
1
|
|
|
|
|
9
|
my $url = $self->{apiurl} . "/" . "stories/top"; |
179
|
1
|
|
|
|
|
7
|
$url .= $self->handle_args($queryargs); |
180
|
1
|
|
|
|
|
8
|
my $req = $self->{ua}->get($url); |
181
|
1
|
50
|
|
|
|
462164
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=pod |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 get_hot_stories (\%params) |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Given |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=over |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=back |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
Get hot stories. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub get_hot_stories { |
201
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
202
|
1
|
|
|
|
|
3
|
my $queryargs = shift; |
203
|
1
|
|
|
|
|
6
|
my $url = $self->{apiurl} . "/" . "stories/hot"; |
204
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
205
|
1
|
|
|
|
|
8
|
my $req = $self->{ua}->get($url); |
206
|
1
|
50
|
|
|
|
430068
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=pod |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 get_stories_by_container ($container, \%params) |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
Given |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=over |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item 0 the desired container |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Get all stories from a given container. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=cut |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
sub get_stories_by_container { |
228
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
229
|
1
|
|
|
|
|
2
|
my $container = shift; |
230
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
231
|
1
|
|
|
|
|
10
|
my $url = $self->{apiurl} . "/" . "stories/container" . "/" . $container; |
232
|
1
|
|
|
|
|
6
|
$url .= $self->handle_args($queryargs); |
233
|
1
|
|
|
|
|
8
|
my $req = $self->{ua}->get($url); |
234
|
1
|
50
|
|
|
|
451569
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=pod |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=head2 get_popular_stories_by_container ($container, \%params) |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
Given |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=over |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=item 0 the desired container |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
=back |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
Get all popular stories from a given container. |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=cut |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
sub get_popular_stories_by_container { |
256
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
257
|
1
|
|
|
|
|
2
|
my $container = shift; |
258
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
259
|
1
|
|
|
|
|
8
|
my $url = $self->{apiurl} . "/" . "stories/container" . "/" . $container . "/popular"; |
260
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
261
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
262
|
1
|
50
|
|
|
|
441183
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
263
|
|
|
|
|
|
|
} |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=pod |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=head2 get_upcoming_stories_by_container ($container, \%params) |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
Given |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=over |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=item 0 the desired container |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=back |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
Get all upcoming stories from a given container. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=cut |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub get_upcoming_stories_by_container { |
284
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
285
|
1
|
|
|
|
|
2
|
my $container = shift; |
286
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
287
|
1
|
|
|
|
|
8
|
my $url = $self->{apiurl} . "/" . "stories/container" . "/" . $container . "/upcoming"; |
288
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
289
|
1
|
|
|
|
|
8
|
my $req = $self->{ua}->get($url); |
290
|
1
|
50
|
|
|
|
432860
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=pod |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
=head2 get_top_stories_by_container ($container, \%params) |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
Given |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=over |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=item 0 the desired container |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=back |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
Get top stories from a given container. |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=cut |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub get_top_stories_by_container { |
312
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
313
|
0
|
|
|
|
|
0
|
my $container = shift; |
314
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
315
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "stories/container" . "/" . $container . "/top"; |
316
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
317
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
318
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
=pod |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=head2 get_hot_stories_by_container ($container, \%params) |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
Given |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
=over |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=item 0 the desired container |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=back |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
Get hot stories from a given container. |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
=cut |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
sub get_hot_stories_by_container { |
340
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
341
|
0
|
|
|
|
|
0
|
my $container = shift; |
342
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
343
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "stories/container" . "/" . $container . "/hot"; |
344
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
345
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
346
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=pod |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
=head2 get_stories_by_topic ($topic, \%params) |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
Given |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=over |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=item 0 the desired topic |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
=back |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
Get all stories from a given topic. |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
=cut |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
sub get_stories_by_topic { |
368
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
369
|
1
|
|
|
|
|
1
|
my $topic = shift; |
370
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
371
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "stories/topic" . "/" . $topic; |
372
|
1
|
|
|
|
|
6
|
$url .= $self->handle_args($queryargs); |
373
|
1
|
|
|
|
|
6
|
my $req = $self->{ua}->get($url); |
374
|
1
|
50
|
|
|
|
447857
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=pod |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=head2 get_popular_stories_by_topic ($topic, \%params) |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
Given |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=over |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=item 0 the desired topic |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=back |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
Get all popular stories from a given topic. |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
=cut |
394
|
|
|
|
|
|
|
|
395
|
|
|
|
|
|
|
sub get_popular_stories_by_topic { |
396
|
1
|
|
|
1
|
1
|
12
|
my $self = shift; |
397
|
1
|
|
|
|
|
3
|
my $topic = shift; |
398
|
1
|
|
|
|
|
1
|
my $queryargs = shift; |
399
|
1
|
|
|
|
|
8
|
my $url = $self->{apiurl} . "/" . "stories/topic" . "/" . $topic ."/popular"; |
400
|
1
|
|
|
|
|
4
|
$url .= $self->handle_args($queryargs); |
401
|
1
|
|
|
|
|
9
|
my $req = $self->{ua}->get($url); |
402
|
1
|
50
|
|
|
|
445061
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
403
|
|
|
|
|
|
|
} |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=pod |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=head2 get_upcoming_stories_by_topic ($topic, \%params) |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
Given |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
=over |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=item 0 the desired topic |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
=back |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
Get all upcoming stories from a given topic. |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=cut |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
sub get_upcoming_stories_by_topic { |
424
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
425
|
1
|
|
|
|
|
2
|
my $topic = shift; |
426
|
1
|
|
|
|
|
4
|
my $queryargs = shift; |
427
|
1
|
|
|
|
|
8
|
my $url = $self->{apiurl} . "/" . "stories/topic" . "/" . $topic ."/upcoming"; |
428
|
1
|
|
|
|
|
7
|
$url .= $self->handle_args($queryargs); |
429
|
1
|
|
|
|
|
8
|
my $req = $self->{ua}->get($url); |
430
|
1
|
50
|
|
|
|
442144
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=pod |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=head2 get_top_stories_by_topic ($topic, \%params) |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
Given |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=over |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
=item 0 the desired topic |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
=back |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
Get top stories from a given topic. |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
=cut |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
sub get_top_stories_by_topic { |
452
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
453
|
0
|
|
|
|
|
0
|
my $topic = shift; |
454
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
455
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "stories/topic" . "/" . $topic ."/top"; |
456
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
457
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
458
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
459
|
|
|
|
|
|
|
} |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=pod |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
=head2 get_hot_stories_by_topic ($topic, \%params) |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
Given |
466
|
|
|
|
|
|
|
|
467
|
|
|
|
|
|
|
=over |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=item 0 the desired topic |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=back |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
Get hot stories from a given topic. |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=cut |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
sub get_hot_stories_by_topic { |
480
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
481
|
0
|
|
|
|
|
0
|
my $topic = shift; |
482
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
483
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "stories/topic" . "/" . $topic ."/hot"; |
484
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
485
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
486
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
487
|
|
|
|
|
|
|
} |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
=pod |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
=head2 get_story_by_id ($id, \%params) |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
Given |
494
|
|
|
|
|
|
|
|
495
|
|
|
|
|
|
|
=over |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
=item 0 the story id |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=back |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
Get identified story. |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=cut |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
sub get_story_by_id { |
508
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
509
|
0
|
|
|
|
|
0
|
my $id = shift; |
510
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
511
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "story" . "/" . $id; |
512
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
513
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
514
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=pod |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=head2 get_stories_by_ids (@ids, \%params) |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
Given |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=over |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=item 0 list of ids |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
=back |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
Get a list of stories with the given ids. |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
=cut |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
sub get_stories_by_ids { |
536
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
537
|
0
|
|
|
|
|
0
|
my @ids = shift; |
538
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
539
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "stories"; |
540
|
0
|
|
|
|
|
0
|
$url .= '/' . join(',', @ids); |
541
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
542
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
543
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
544
|
|
|
|
|
|
|
} |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
=pod |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
=head2 get_story_by_title ($title, \%params) |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
Given |
551
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
=over |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
=item 0 story clean title |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
=back |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
Get identified story. |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
=cut |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
sub get_story_by_title { |
565
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
566
|
0
|
|
|
|
|
0
|
my $title = shift; |
567
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
568
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "story" . "/" . $title; |
569
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
570
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
571
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
=pod |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=head2 get_stories_by_user ($user, \%params) |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
Given |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
=over |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=item 0 user name |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=back |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
Get stories submitted by given user. |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
=cut |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
sub get_stories_by_user { |
593
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
594
|
0
|
|
|
|
|
0
|
my $user = shift; |
595
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
596
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/submissions"; |
597
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
598
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
599
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
600
|
|
|
|
|
|
|
} |
601
|
|
|
|
|
|
|
|
602
|
|
|
|
|
|
|
=pod |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
=head2 get_popular_stories_by_user ($user, \%params) |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
Given |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
=over |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
=item 0 user name |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=back |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
Get popular stories submitted by given user. |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
=cut |
619
|
|
|
|
|
|
|
|
620
|
|
|
|
|
|
|
sub get_popular_stories_by_user { |
621
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
622
|
0
|
|
|
|
|
0
|
my $user = shift; |
623
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
624
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/popular"; |
625
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
626
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
627
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
628
|
|
|
|
|
|
|
} |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=pod |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
=head2 get_upcoming_stories_by_user ($user, \%params) |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
Given |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
=over |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
=item 0 user name |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
=back |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
Get upcoming stories submitted by given user. |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
=cut |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
sub get_upcoming_stories_by_user { |
649
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
650
|
0
|
|
|
|
|
0
|
my $user = shift; |
651
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
652
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/upcoming"; |
653
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
654
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
655
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
656
|
|
|
|
|
|
|
} |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
=pod |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
=head2 get_stories_dugg_by_user ($user, \%params) |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
Given |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=over |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
=item 0 user name |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
669
|
|
|
|
|
|
|
|
670
|
|
|
|
|
|
|
=back |
671
|
|
|
|
|
|
|
|
672
|
|
|
|
|
|
|
Get stories dugg by given user. |
673
|
|
|
|
|
|
|
|
674
|
|
|
|
|
|
|
=cut |
675
|
|
|
|
|
|
|
|
676
|
|
|
|
|
|
|
sub get_stories_dugg_by_user { |
677
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
678
|
0
|
|
|
|
|
0
|
my $user = shift; |
679
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
680
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/dugg"; |
681
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
682
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
683
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
684
|
|
|
|
|
|
|
} |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
=pod |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=head2 get_stories_commented_by_user ($user, \%params) |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
Given |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
=over |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=item 0 user name |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
=back |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
Get stories commented by given user. |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
=cut |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
sub get_stories_commented_by_user { |
705
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
706
|
0
|
|
|
|
|
0
|
my $user = shift; |
707
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
708
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/commented"; |
709
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
710
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
711
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
712
|
|
|
|
|
|
|
} |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
=pod |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
=head2 get_stories_by_friends ($user, \%params) |
717
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
Given |
719
|
|
|
|
|
|
|
|
720
|
|
|
|
|
|
|
=over |
721
|
|
|
|
|
|
|
|
722
|
|
|
|
|
|
|
=item 0 user name |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
=back |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
Get stories submitted by given user friends. |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
=cut |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
sub get_stories_by_friends { |
733
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
734
|
0
|
|
|
|
|
0
|
my $user = shift; |
735
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
736
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/friends/submissions"; |
737
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
738
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
739
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
740
|
|
|
|
|
|
|
} |
741
|
|
|
|
|
|
|
|
742
|
|
|
|
|
|
|
=pod |
743
|
|
|
|
|
|
|
|
744
|
|
|
|
|
|
|
=head2 get_popular_stories_by_friends ($user, \%params) |
745
|
|
|
|
|
|
|
|
746
|
|
|
|
|
|
|
Given |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=over |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=item 0 user name |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=back |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
Get popular stories submitted by given user friends. |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
=cut |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
sub get_popular_stories_by_friends { |
761
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
762
|
0
|
|
|
|
|
0
|
my $user = shift; |
763
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
764
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/friends/popular"; |
765
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
766
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
767
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
768
|
|
|
|
|
|
|
} |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
=pod |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
=head2 get_upcoming_stories_by_friends ($user, \%params) |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
Given |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=over |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=item 0 user name |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
=back |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
Get upcoming stories submitted by given user friends. |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
=cut |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
sub get_upcoming_stories_by_friends { |
789
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
790
|
0
|
|
|
|
|
0
|
my $user = shift; |
791
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
792
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/friends/upcoming"; |
793
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
794
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
795
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
796
|
|
|
|
|
|
|
} |
797
|
|
|
|
|
|
|
|
798
|
|
|
|
|
|
|
=pod |
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
=head2 get_stories_dugg_by_friends ($user, \%params) |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
Given |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
=over |
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
=item 0 user name |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
=back |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
Get stories dugg by given user friends. |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
=cut |
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
sub get_stories_dugg_by_friends { |
817
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
818
|
0
|
|
|
|
|
0
|
my $user = shift; |
819
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
820
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/friends/dugg"; |
821
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
822
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
823
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
824
|
|
|
|
|
|
|
} |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
=pod |
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
=head2 get_stories_commented_by_friends ($user, \%params) |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
Given |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
=over |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
=item 0 user name |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
=back |
839
|
|
|
|
|
|
|
|
840
|
|
|
|
|
|
|
Get stories commented by given user friends. |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
=cut |
843
|
|
|
|
|
|
|
|
844
|
|
|
|
|
|
|
sub get_stories_commented_by_friends { |
845
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
846
|
0
|
|
|
|
|
0
|
my $user = shift; |
847
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
848
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/friends/commented"; |
849
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
850
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
851
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
=pod |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
=head2 get_diggs (\%params) |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
Given |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
=over |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
863
|
|
|
|
|
|
|
|
864
|
|
|
|
|
|
|
=back |
865
|
|
|
|
|
|
|
|
866
|
|
|
|
|
|
|
Get all diggs. |
867
|
|
|
|
|
|
|
|
868
|
|
|
|
|
|
|
=cut |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
sub get_diggs { |
871
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
872
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
873
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "stories/diggs"; |
874
|
1
|
|
|
|
|
7
|
$url .= $self->handle_args($queryargs); |
875
|
1
|
|
|
|
|
8
|
my $req = $self->{ua}->get($url); |
876
|
1
|
50
|
|
|
|
431598
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
877
|
|
|
|
|
|
|
} |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
=pod |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
=head2 get_popular_diggs (\%params) |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
Given |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
=over |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
=back |
890
|
|
|
|
|
|
|
|
891
|
|
|
|
|
|
|
Get all popular diggs. |
892
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
=cut |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
sub get_popular_diggs { |
896
|
1
|
|
|
1
|
1
|
10
|
my $self = shift; |
897
|
1
|
|
|
|
|
1
|
my $queryargs = shift; |
898
|
1
|
|
|
|
|
8
|
my $url = $self->{apiurl} . "/" . "stories/popular/diggs"; |
899
|
1
|
|
|
|
|
7
|
$url .= $self->handle_args($queryargs); |
900
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
901
|
1
|
50
|
|
|
|
445907
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
902
|
|
|
|
|
|
|
} |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
=pod |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
=head2 get_upcoming_diggs (\%params) |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
Given |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
=over |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
=back |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
Get all upcoming diggs. |
917
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
=cut |
919
|
|
|
|
|
|
|
|
920
|
|
|
|
|
|
|
sub get_upcoming_diggs { |
921
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
922
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
923
|
1
|
|
|
|
|
8
|
my $url = $self->{apiurl} . "/" . "stories/upcoming/diggs"; |
924
|
1
|
|
|
|
|
6
|
$url .= $self->handle_args($queryargs); |
925
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
926
|
1
|
50
|
|
|
|
453032
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
927
|
|
|
|
|
|
|
} |
928
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
=pod |
930
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
=head2 get_diggs_by_storyid ($storyid, \%params) |
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
Given |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
=over |
936
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
=item 0 story id |
938
|
|
|
|
|
|
|
|
939
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
=back |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
Get all diggs for a given story. |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
=cut |
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
sub get_diggs_by_storyid { |
948
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
949
|
0
|
|
|
|
|
0
|
my $id = shift; |
950
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
951
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "story" . $id . "/diggs"; |
952
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
953
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
954
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
955
|
|
|
|
|
|
|
} |
956
|
|
|
|
|
|
|
|
957
|
|
|
|
|
|
|
=pod |
958
|
|
|
|
|
|
|
|
959
|
|
|
|
|
|
|
=head2 get_diggs_by_storyids (@storyids, \%params) |
960
|
|
|
|
|
|
|
|
961
|
|
|
|
|
|
|
Given |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
=over |
964
|
|
|
|
|
|
|
|
965
|
|
|
|
|
|
|
=item 0 story ids |
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
=back |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
Get all diggs for a list of stories with the given ids. |
972
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
=cut |
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
sub get_diggs_by_storyids { |
976
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
977
|
0
|
|
|
|
|
0
|
my @ids = shift; |
978
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
979
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/stories"; |
980
|
0
|
|
|
|
|
0
|
$url .= '/' . join(',', @ids) . "/diggs"; |
981
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
982
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
983
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
984
|
|
|
|
|
|
|
} |
985
|
|
|
|
|
|
|
|
986
|
|
|
|
|
|
|
=pod |
987
|
|
|
|
|
|
|
|
988
|
|
|
|
|
|
|
=head2 get_diggs_by_user ($user, \%params) |
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
Given |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
=over |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
=item 0 user name |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
=back |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
Get one user's diggs for all stories. |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
=cut |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
sub get_diggs_by_user { |
1005
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
1006
|
1
|
|
|
|
|
2
|
my $user = shift; |
1007
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1008
|
1
|
|
|
|
|
6
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $user . "/diggs"; |
1009
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1010
|
1
|
|
|
|
|
6
|
my $req = $self->{ua}->get($url); |
1011
|
1
|
50
|
|
|
|
459259
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1012
|
|
|
|
|
|
|
} |
1013
|
|
|
|
|
|
|
|
1014
|
|
|
|
|
|
|
=pod |
1015
|
|
|
|
|
|
|
|
1016
|
|
|
|
|
|
|
=head2 get_diggs_by_userids (@ids, \%params) |
1017
|
|
|
|
|
|
|
|
1018
|
|
|
|
|
|
|
Given |
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
=over |
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
=item 0 user names |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
=back |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
Get several users' diggs for all stories |
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
=cut |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
sub get_diggs_by_userids { |
1033
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1034
|
0
|
|
|
|
|
0
|
my @ids = shift; |
1035
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1036
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "users"; |
1037
|
0
|
|
|
|
|
0
|
$url .= '/' . join(',', @ids) . "/diggs"; |
1038
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1039
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1040
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1041
|
|
|
|
|
|
|
} |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
=pod |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
=head2 get_user_digg_by_storyid ($id, $user, \%params) |
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
Given |
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
=over |
1050
|
|
|
|
|
|
|
|
1051
|
|
|
|
|
|
|
=item 0 story id |
1052
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
=item 0 user name |
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
=back |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
Get one user digg for a given story. |
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
=cut |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
sub get_user_digg_by_storyid { |
1064
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1065
|
0
|
|
|
|
|
0
|
my $id = shift; |
1066
|
0
|
|
|
|
|
0
|
my $user = shift; |
1067
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1068
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "story" . "/" . $id . "/" . $user . "/digg"; |
1069
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1070
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1071
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1072
|
|
|
|
|
|
|
} |
1073
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
=pod |
1075
|
|
|
|
|
|
|
|
1076
|
|
|
|
|
|
|
=head2 get_comments (\%params) |
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
Given |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
=over |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
=back |
1085
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
Get all comments. |
1087
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
=cut |
1089
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
sub get_comments { |
1091
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
1092
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1093
|
1
|
|
|
|
|
8
|
my $url = $self->{apiurl} . "/" . "stories/comments"; |
1094
|
1
|
|
|
|
|
6
|
$url .= $self->handle_args($queryargs); |
1095
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
1096
|
1
|
50
|
|
|
|
440644
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1097
|
|
|
|
|
|
|
} |
1098
|
|
|
|
|
|
|
|
1099
|
|
|
|
|
|
|
=pod |
1100
|
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
|
=head2 get_popular_comments (\%params) |
1102
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
Given |
1104
|
|
|
|
|
|
|
|
1105
|
|
|
|
|
|
|
=over |
1106
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
=back |
1110
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
Get all comments on popular stories. |
1112
|
|
|
|
|
|
|
|
1113
|
|
|
|
|
|
|
=cut |
1114
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
sub get_popular_comments { |
1116
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
1117
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1118
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "stories/popular/comments"; |
1119
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1120
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
1121
|
1
|
50
|
|
|
|
439720
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1122
|
|
|
|
|
|
|
} |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
=pod |
1125
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
=head2 get_upcoming_comments (\%params) |
1127
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
Given |
1129
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
=over |
1131
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
=back |
1135
|
|
|
|
|
|
|
|
1136
|
|
|
|
|
|
|
Get all comments on upcoming stories. |
1137
|
|
|
|
|
|
|
|
1138
|
|
|
|
|
|
|
=cut |
1139
|
|
|
|
|
|
|
|
1140
|
|
|
|
|
|
|
sub get_upcoming_comments { |
1141
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
1142
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1143
|
1
|
|
|
|
|
5
|
my $url = $self->{apiurl} . "/" . "stories/upcoming/comments"; |
1144
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1145
|
1
|
|
|
|
|
6
|
my $req = $self->{ua}->get($url); |
1146
|
1
|
50
|
|
|
|
433489
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1147
|
|
|
|
|
|
|
} |
1148
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
=pod |
1150
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
=head2 get_comments_by_ids (@ids, \%params) |
1152
|
|
|
|
|
|
|
|
1153
|
|
|
|
|
|
|
Given |
1154
|
|
|
|
|
|
|
|
1155
|
|
|
|
|
|
|
=over |
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
=item 0 a list of story ids |
1158
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
=back |
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
Get all comments for a list of stories with the given ids. |
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
=cut |
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
sub get_comments_by_ids { |
1168
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1169
|
0
|
|
|
|
|
0
|
my @ids = shift; |
1170
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1171
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "stories"; |
1172
|
0
|
|
|
|
|
0
|
$url .= '/' . join(',', @ids) . "/comments"; |
1173
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1174
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1175
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1176
|
|
|
|
|
|
|
} |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
=pod |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=head2 get_comments_by_id ($id, \%params) |
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
Given |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
=over |
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
=item 0 a story id |
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1189
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
=back |
1191
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
Get top-level comments for a given story. |
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
=cut |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
sub get_comments_by_id { |
1197
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1198
|
0
|
|
|
|
|
0
|
my $id = shift; |
1199
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1200
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "story/" . $id . "/comments"; |
1201
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1202
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1203
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1204
|
|
|
|
|
|
|
} |
1205
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
=pod |
1207
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
=head2 ($user, \%params) |
1209
|
|
|
|
|
|
|
|
1210
|
|
|
|
|
|
|
Given |
1211
|
|
|
|
|
|
|
|
1212
|
|
|
|
|
|
|
=over |
1213
|
|
|
|
|
|
|
|
1214
|
|
|
|
|
|
|
=item 0 user name |
1215
|
|
|
|
|
|
|
|
1216
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1217
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
=back |
1219
|
|
|
|
|
|
|
|
1220
|
|
|
|
|
|
|
Get one user's comments for all stories. |
1221
|
|
|
|
|
|
|
|
1222
|
|
|
|
|
|
|
=cut |
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
sub get_comments_by_user { |
1225
|
1
|
|
|
1
|
0
|
7
|
my $self = shift; |
1226
|
1
|
|
|
|
|
3
|
my $user= shift; |
1227
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1228
|
1
|
|
|
|
|
9
|
my $url = $self->{apiurl} . "/" . "user/" . $user . "/comments"; |
1229
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1230
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
1231
|
1
|
50
|
|
|
|
1446574
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1232
|
|
|
|
|
|
|
} |
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
=pod |
1235
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
=head2 get_comments_by_users (@users, \%params) |
1237
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
Given |
1239
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
=over |
1241
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
=item 0 user names |
1243
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1245
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
=back |
1247
|
|
|
|
|
|
|
|
1248
|
|
|
|
|
|
|
Get several users' comments for all stories. |
1249
|
|
|
|
|
|
|
|
1250
|
|
|
|
|
|
|
=cut |
1251
|
|
|
|
|
|
|
|
1252
|
|
|
|
|
|
|
sub get_comments_by_users { |
1253
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1254
|
0
|
|
|
|
|
0
|
my @users= shift; |
1255
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1256
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "users"; |
1257
|
0
|
|
|
|
|
0
|
$url .= '/' . join(',', @users) . "/comments"; |
1258
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1259
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1260
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1261
|
|
|
|
|
|
|
} |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
=pod |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
=head2 get_comment_by_storyid_commentid ($storyid, $commentid, \%params) |
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
Given |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
=over |
1270
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
=item 0 storyid |
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
=item 0 commentid |
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1276
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
=back |
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
Get one comment for a given story. |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
=cut |
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
sub get_comment_by_storyid_commentid { |
1284
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1285
|
0
|
|
|
|
|
0
|
my $storyid= shift; |
1286
|
0
|
|
|
|
|
0
|
my $commentid= shift; |
1287
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1288
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "story/" . $storyid . "/comment/" . $commentid; |
1289
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1290
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1291
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1292
|
|
|
|
|
|
|
} |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
=pod |
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
=head2 get_comment_by_storyid_commentid ($storyid, $commentid, \%params) |
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
Given |
1299
|
|
|
|
|
|
|
|
1300
|
|
|
|
|
|
|
=over |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
=item 0 storyid |
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
=item 0 commentid |
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1307
|
|
|
|
|
|
|
|
1308
|
|
|
|
|
|
|
=back |
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
Get one level of replies to one comment for a given story. |
1311
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
=cut |
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
sub get_comment_replies { |
1315
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
1316
|
0
|
|
|
|
|
0
|
my $storyid= shift; |
1317
|
0
|
|
|
|
|
0
|
my $commentid= shift; |
1318
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1319
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "story/" . $storyid . "/comment/" . $commentid . "/replies"; |
1320
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1321
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1322
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1323
|
|
|
|
|
|
|
} |
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
=pod |
1326
|
|
|
|
|
|
|
|
1327
|
|
|
|
|
|
|
=head2 get_errors (\%params) |
1328
|
|
|
|
|
|
|
|
1329
|
|
|
|
|
|
|
Given |
1330
|
|
|
|
|
|
|
|
1331
|
|
|
|
|
|
|
=over |
1332
|
|
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1334
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
=back |
1336
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
Get a list of all error codes and messages. |
1338
|
|
|
|
|
|
|
|
1339
|
|
|
|
|
|
|
=cut |
1340
|
|
|
|
|
|
|
|
1341
|
|
|
|
|
|
|
sub get_errors { |
1342
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
1343
|
1
|
|
|
|
|
1
|
my $queryargs = shift; |
1344
|
1
|
|
|
|
|
6
|
my $url = $self->{apiurl} . "/" . "errors"; |
1345
|
1
|
|
|
|
|
6
|
$url .= $self->handle_args($queryargs); |
1346
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
1347
|
1
|
50
|
|
|
|
427909
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1348
|
|
|
|
|
|
|
} |
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
=pod |
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
=head2 get_error_code ($code, \%params) |
1353
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
Given |
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
=over |
1357
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
=item 0 error code |
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
=back |
1363
|
|
|
|
|
|
|
|
1364
|
|
|
|
|
|
|
Get the message for a specific error code. |
1365
|
|
|
|
|
|
|
|
1366
|
|
|
|
|
|
|
=cut |
1367
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
sub get_error_code { |
1369
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1370
|
0
|
|
|
|
|
0
|
my $code = shift; |
1371
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1372
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "error" . "/" . $code; |
1373
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1374
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1375
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1376
|
|
|
|
|
|
|
} |
1377
|
|
|
|
|
|
|
|
1378
|
|
|
|
|
|
|
=pod |
1379
|
|
|
|
|
|
|
|
1380
|
|
|
|
|
|
|
=head2 get_topics (\%params) |
1381
|
|
|
|
|
|
|
|
1382
|
|
|
|
|
|
|
Given |
1383
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
=over |
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1387
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
=back |
1389
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
Get a list of all topics. |
1391
|
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
|
=cut |
1393
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
sub get_topics { |
1395
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
1396
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1397
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "topics"; |
1398
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1399
|
1
|
|
|
|
|
9
|
my $req = $self->{ua}->get($url); |
1400
|
1
|
50
|
|
|
|
439873
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1401
|
|
|
|
|
|
|
} |
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
=pod |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
=head2 get_topic_by_name ($topic, \%params) |
1406
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
Given |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
=over |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
=back |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
Get the specified topic. |
1416
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
=cut |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
sub get_topic_by_name { |
1420
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1421
|
0
|
|
|
|
|
0
|
my $topic = shift; |
1422
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1423
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "topic" . "/" . $topic; |
1424
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1425
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1426
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1427
|
|
|
|
|
|
|
} |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
=pod |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
=head2 get_users (\%params) |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
Given |
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
=over |
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1438
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
=back |
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
Get all users. |
1442
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
=cut |
1444
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
sub get_users { |
1446
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
1447
|
1
|
|
|
|
|
1
|
my $queryargs = shift; |
1448
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "users"; |
1449
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1450
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
1451
|
1
|
50
|
|
|
|
456937
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1452
|
|
|
|
|
|
|
} |
1453
|
|
|
|
|
|
|
|
1454
|
|
|
|
|
|
|
=pod |
1455
|
|
|
|
|
|
|
|
1456
|
|
|
|
|
|
|
=head2 get_user_by_name ($name, \%params) |
1457
|
|
|
|
|
|
|
|
1458
|
|
|
|
|
|
|
Given |
1459
|
|
|
|
|
|
|
|
1460
|
|
|
|
|
|
|
=over |
1461
|
|
|
|
|
|
|
|
1462
|
|
|
|
|
|
|
=item 0 user name |
1463
|
|
|
|
|
|
|
|
1464
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1465
|
|
|
|
|
|
|
|
1466
|
|
|
|
|
|
|
=back |
1467
|
|
|
|
|
|
|
|
1468
|
|
|
|
|
|
|
Get named user. |
1469
|
|
|
|
|
|
|
|
1470
|
|
|
|
|
|
|
=cut |
1471
|
|
|
|
|
|
|
|
1472
|
|
|
|
|
|
|
sub get_user_by_name { |
1473
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
1474
|
1
|
|
|
|
|
2
|
my $name = shift; |
1475
|
1
|
|
|
|
|
1
|
my $queryargs = shift; |
1476
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $name; |
1477
|
1
|
|
|
|
|
4
|
$url .= $self->handle_args($queryargs); |
1478
|
1
|
|
|
|
|
6
|
my $req = $self->{ua}->get($url); |
1479
|
1
|
50
|
|
|
|
447652
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1480
|
|
|
|
|
|
|
} |
1481
|
|
|
|
|
|
|
|
1482
|
|
|
|
|
|
|
=pod |
1483
|
|
|
|
|
|
|
|
1484
|
|
|
|
|
|
|
=head2 get_users_friends ($name, \%params) |
1485
|
|
|
|
|
|
|
|
1486
|
|
|
|
|
|
|
Given |
1487
|
|
|
|
|
|
|
|
1488
|
|
|
|
|
|
|
=over |
1489
|
|
|
|
|
|
|
|
1490
|
|
|
|
|
|
|
=item 0 user name |
1491
|
|
|
|
|
|
|
|
1492
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1493
|
|
|
|
|
|
|
|
1494
|
|
|
|
|
|
|
=back |
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
Get named user's friends. |
1497
|
|
|
|
|
|
|
|
1498
|
|
|
|
|
|
|
=cut |
1499
|
|
|
|
|
|
|
|
1500
|
|
|
|
|
|
|
sub get_users_friends { |
1501
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
1502
|
1
|
|
|
|
|
2
|
my $name = shift; |
1503
|
1
|
|
|
|
|
3
|
my $queryargs = shift; |
1504
|
1
|
|
|
|
|
9
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $name . "/" . "friends"; |
1505
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1506
|
1
|
|
|
|
|
8
|
my $req = $self->{ua}->get($url); |
1507
|
1
|
50
|
|
|
|
453212
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1508
|
|
|
|
|
|
|
} |
1509
|
|
|
|
|
|
|
|
1510
|
|
|
|
|
|
|
=pod |
1511
|
|
|
|
|
|
|
|
1512
|
|
|
|
|
|
|
=head2 get_users_fans ($name, \%params) |
1513
|
|
|
|
|
|
|
|
1514
|
|
|
|
|
|
|
Given |
1515
|
|
|
|
|
|
|
|
1516
|
|
|
|
|
|
|
=over |
1517
|
|
|
|
|
|
|
|
1518
|
|
|
|
|
|
|
=item 0 user name |
1519
|
|
|
|
|
|
|
|
1520
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1521
|
|
|
|
|
|
|
|
1522
|
|
|
|
|
|
|
=back |
1523
|
|
|
|
|
|
|
|
1524
|
|
|
|
|
|
|
Get users who count the named user as a friend. |
1525
|
|
|
|
|
|
|
|
1526
|
|
|
|
|
|
|
=cut |
1527
|
|
|
|
|
|
|
|
1528
|
|
|
|
|
|
|
sub get_users_fans { |
1529
|
1
|
|
|
1
|
1
|
10
|
my $self = shift; |
1530
|
1
|
|
|
|
|
2
|
my $name = shift; |
1531
|
1
|
|
|
|
|
3
|
my $queryargs = shift; |
1532
|
1
|
|
|
|
|
9
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $name . "/" . "fans"; |
1533
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1534
|
1
|
|
|
|
|
8
|
my $req = $self->{ua}->get($url); |
1535
|
1
|
50
|
|
|
|
431767
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1536
|
|
|
|
|
|
|
} |
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
=pod |
1539
|
|
|
|
|
|
|
|
1540
|
|
|
|
|
|
|
=head2 get_user_by_name_fan_name ($name, $fanName, \%params) |
1541
|
|
|
|
|
|
|
|
1542
|
|
|
|
|
|
|
Given |
1543
|
|
|
|
|
|
|
|
1544
|
|
|
|
|
|
|
=over |
1545
|
|
|
|
|
|
|
|
1546
|
|
|
|
|
|
|
=item 0 user name |
1547
|
|
|
|
|
|
|
|
1548
|
|
|
|
|
|
|
=item 0 fan name |
1549
|
|
|
|
|
|
|
|
1550
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1551
|
|
|
|
|
|
|
|
1552
|
|
|
|
|
|
|
=back |
1553
|
|
|
|
|
|
|
|
1554
|
|
|
|
|
|
|
Get named user's friend. |
1555
|
|
|
|
|
|
|
|
1556
|
|
|
|
|
|
|
=cut |
1557
|
|
|
|
|
|
|
|
1558
|
|
|
|
|
|
|
sub get_user_by_name_fan_name { |
1559
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1560
|
0
|
|
|
|
|
0
|
my $name = shift; |
1561
|
0
|
|
|
|
|
0
|
my $fanName = shift; |
1562
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1563
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "user" . "/" . $name . "/" . "fan" . "/" . $fanName; |
1564
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1565
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1566
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1567
|
|
|
|
|
|
|
} |
1568
|
|
|
|
|
|
|
|
1569
|
|
|
|
|
|
|
=pod |
1570
|
|
|
|
|
|
|
|
1571
|
|
|
|
|
|
|
=head2 get_galleryphotos (\%params) |
1572
|
|
|
|
|
|
|
|
1573
|
|
|
|
|
|
|
Given |
1574
|
|
|
|
|
|
|
|
1575
|
|
|
|
|
|
|
=over |
1576
|
|
|
|
|
|
|
|
1577
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1578
|
|
|
|
|
|
|
|
1579
|
|
|
|
|
|
|
=back |
1580
|
|
|
|
|
|
|
|
1581
|
|
|
|
|
|
|
Get all gallery photos. |
1582
|
|
|
|
|
|
|
|
1583
|
|
|
|
|
|
|
=cut |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
sub get_galleryphotos { |
1586
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
1587
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1588
|
1
|
|
|
|
|
6
|
my $url = $self->{apiurl} . "/" . "galleryphotos"; |
1589
|
1
|
|
|
|
|
4
|
$url .= $self->handle_args($queryargs); |
1590
|
1
|
|
|
|
|
6
|
my $req = $self->{ua}->get($url); |
1591
|
1
|
50
|
|
|
|
433475
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1592
|
|
|
|
|
|
|
} |
1593
|
|
|
|
|
|
|
|
1594
|
|
|
|
|
|
|
=pod |
1595
|
|
|
|
|
|
|
|
1596
|
|
|
|
|
|
|
=head2 get_galleryphotos_by_ids (@ids, \%params) |
1597
|
|
|
|
|
|
|
|
1598
|
|
|
|
|
|
|
Given |
1599
|
|
|
|
|
|
|
|
1600
|
|
|
|
|
|
|
=over |
1601
|
|
|
|
|
|
|
|
1602
|
|
|
|
|
|
|
=item 0 gallery photo ids |
1603
|
|
|
|
|
|
|
|
1604
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1605
|
|
|
|
|
|
|
|
1606
|
|
|
|
|
|
|
=back |
1607
|
|
|
|
|
|
|
|
1608
|
|
|
|
|
|
|
Get a list of galleryphotos with the given ids |
1609
|
|
|
|
|
|
|
|
1610
|
|
|
|
|
|
|
=cut |
1611
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
sub get_galleryphotos_by_ids { |
1613
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1614
|
0
|
|
|
|
|
0
|
my @ids = shift; |
1615
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1616
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "galleryphotos"; |
1617
|
0
|
|
|
|
|
0
|
$url .= '/' . join(',', @ids); |
1618
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1619
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1620
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1621
|
|
|
|
|
|
|
} |
1622
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
=pod |
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
=head2 get_galleryphotos_by_id ($id, \%params) |
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
Given |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
=over |
1630
|
|
|
|
|
|
|
|
1631
|
|
|
|
|
|
|
=item 0 gallery photo id |
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1634
|
|
|
|
|
|
|
|
1635
|
|
|
|
|
|
|
=back |
1636
|
|
|
|
|
|
|
|
1637
|
|
|
|
|
|
|
Get a list of galleryphotos with the given ids |
1638
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
=cut |
1640
|
|
|
|
|
|
|
|
1641
|
|
|
|
|
|
|
sub get_galleryphotos_by_id { |
1642
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1643
|
0
|
|
|
|
|
0
|
my $id = shift; |
1644
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1645
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "galleryphoto" . "/" . $id; |
1646
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1647
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1648
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1649
|
|
|
|
|
|
|
} |
1650
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
=pod |
1652
|
|
|
|
|
|
|
|
1653
|
|
|
|
|
|
|
=head2 get_galleryphotos_comments ($id, \%params) |
1654
|
|
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
Given |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
=over |
1658
|
|
|
|
|
|
|
|
1659
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1660
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
=back |
1662
|
|
|
|
|
|
|
|
1663
|
|
|
|
|
|
|
Get all gallery photo comments. |
1664
|
|
|
|
|
|
|
|
1665
|
|
|
|
|
|
|
=cut |
1666
|
|
|
|
|
|
|
|
1667
|
|
|
|
|
|
|
sub get_galleryphotos_comments { |
1668
|
1
|
|
|
1
|
1
|
8
|
my $self = shift; |
1669
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1670
|
1
|
|
|
|
|
8
|
my $url = $self->{apiurl} . "/" . "galleryphotos/comments"; |
1671
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1672
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
1673
|
1
|
50
|
|
|
|
461432
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1674
|
|
|
|
|
|
|
} |
1675
|
|
|
|
|
|
|
|
1676
|
|
|
|
|
|
|
=pod |
1677
|
|
|
|
|
|
|
|
1678
|
|
|
|
|
|
|
=head2 get_galleryphotos_comments_by_ids (@ids, \%params) |
1679
|
|
|
|
|
|
|
|
1680
|
|
|
|
|
|
|
Given |
1681
|
|
|
|
|
|
|
|
1682
|
|
|
|
|
|
|
=over |
1683
|
|
|
|
|
|
|
|
1684
|
|
|
|
|
|
|
=item 0 gallery photo ids |
1685
|
|
|
|
|
|
|
|
1686
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1687
|
|
|
|
|
|
|
|
1688
|
|
|
|
|
|
|
=back |
1689
|
|
|
|
|
|
|
|
1690
|
|
|
|
|
|
|
Get all gallery photo comments for given ids. |
1691
|
|
|
|
|
|
|
|
1692
|
|
|
|
|
|
|
=cut |
1693
|
|
|
|
|
|
|
|
1694
|
|
|
|
|
|
|
sub get_galleryphotos_comments_by_ids { |
1695
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1696
|
0
|
|
|
|
|
0
|
my @ids = shift; |
1697
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1698
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "galleryphotos"; |
1699
|
0
|
|
|
|
|
0
|
$url .= '/' . join(',', @ids) . "/comments"; |
1700
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1701
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1702
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1703
|
|
|
|
|
|
|
} |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
=pod |
1706
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
=head2 get_galleryphoto_comments_by_id ($id, \%params) |
1708
|
|
|
|
|
|
|
|
1709
|
|
|
|
|
|
|
Given |
1710
|
|
|
|
|
|
|
|
1711
|
|
|
|
|
|
|
=over |
1712
|
|
|
|
|
|
|
|
1713
|
|
|
|
|
|
|
=item 0 gallery photo id |
1714
|
|
|
|
|
|
|
|
1715
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1716
|
|
|
|
|
|
|
|
1717
|
|
|
|
|
|
|
=back |
1718
|
|
|
|
|
|
|
|
1719
|
|
|
|
|
|
|
Get top-level comments for a given gallery photo. |
1720
|
|
|
|
|
|
|
|
1721
|
|
|
|
|
|
|
=cut |
1722
|
|
|
|
|
|
|
|
1723
|
|
|
|
|
|
|
sub get_galleryphoto_comments_by_id { |
1724
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1725
|
0
|
|
|
|
|
0
|
my $id = shift; |
1726
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1727
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "galleryphoto" . "/" . $id . "/comments"; |
1728
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1729
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1730
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1731
|
|
|
|
|
|
|
} |
1732
|
|
|
|
|
|
|
|
1733
|
|
|
|
|
|
|
=pod |
1734
|
|
|
|
|
|
|
|
1735
|
|
|
|
|
|
|
=head2 get_galleryphoto_comment_by_photoid_commentid ($photoid, $commentid, \%params) |
1736
|
|
|
|
|
|
|
|
1737
|
|
|
|
|
|
|
Given |
1738
|
|
|
|
|
|
|
|
1739
|
|
|
|
|
|
|
=over |
1740
|
|
|
|
|
|
|
|
1741
|
|
|
|
|
|
|
=item 0 gallery photo id |
1742
|
|
|
|
|
|
|
|
1743
|
|
|
|
|
|
|
=item 0 comment id |
1744
|
|
|
|
|
|
|
|
1745
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1746
|
|
|
|
|
|
|
|
1747
|
|
|
|
|
|
|
=back |
1748
|
|
|
|
|
|
|
|
1749
|
|
|
|
|
|
|
Get one comment for a given gallery photo. |
1750
|
|
|
|
|
|
|
|
1751
|
|
|
|
|
|
|
=cut |
1752
|
|
|
|
|
|
|
|
1753
|
|
|
|
|
|
|
sub get_galleryphoto_comment_by_photoid_commentid { |
1754
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1755
|
0
|
|
|
|
|
0
|
my $photoid = shift; |
1756
|
0
|
|
|
|
|
0
|
my $commentid = shift; |
1757
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1758
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "galleryphoto" . "/" . $photoid . "/comment" . "/" .$commentid; |
1759
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1760
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1761
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1762
|
|
|
|
|
|
|
} |
1763
|
|
|
|
|
|
|
|
1764
|
|
|
|
|
|
|
=pod |
1765
|
|
|
|
|
|
|
|
1766
|
|
|
|
|
|
|
=head2 get_galleryphoto_comment_replies_by_photoid_commentid ($photoid, $commentid, \%params) |
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
Given |
1769
|
|
|
|
|
|
|
|
1770
|
|
|
|
|
|
|
=over |
1771
|
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
=item 0 gallery photo id |
1773
|
|
|
|
|
|
|
|
1774
|
|
|
|
|
|
|
=item 0 comment id |
1775
|
|
|
|
|
|
|
|
1776
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1777
|
|
|
|
|
|
|
|
1778
|
|
|
|
|
|
|
=back |
1779
|
|
|
|
|
|
|
|
1780
|
|
|
|
|
|
|
Get one level of replies to one comment for a given gallery photo. |
1781
|
|
|
|
|
|
|
|
1782
|
|
|
|
|
|
|
=cut |
1783
|
|
|
|
|
|
|
|
1784
|
|
|
|
|
|
|
sub get_galleryphoto_comment_replies_by_photoid_commentid { |
1785
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1786
|
0
|
|
|
|
|
0
|
my $photoid = shift; |
1787
|
0
|
|
|
|
|
0
|
my $commentid = shift; |
1788
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1789
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "galleryphoto" . "/" . $photoid . "/comment" . "/" .$commentid . "/replies"; |
1790
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1791
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1792
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1793
|
|
|
|
|
|
|
} |
1794
|
|
|
|
|
|
|
|
1795
|
|
|
|
|
|
|
=pod |
1796
|
|
|
|
|
|
|
|
1797
|
|
|
|
|
|
|
=head2 get_media (\%params) |
1798
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
Given |
1800
|
|
|
|
|
|
|
|
1801
|
|
|
|
|
|
|
=over |
1802
|
|
|
|
|
|
|
|
1803
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1804
|
|
|
|
|
|
|
|
1805
|
|
|
|
|
|
|
=back |
1806
|
|
|
|
|
|
|
|
1807
|
|
|
|
|
|
|
Get a list of all media. |
1808
|
|
|
|
|
|
|
|
1809
|
|
|
|
|
|
|
=cut |
1810
|
|
|
|
|
|
|
|
1811
|
|
|
|
|
|
|
sub get_media { |
1812
|
1
|
|
|
1
|
1
|
7
|
my $self = shift; |
1813
|
1
|
|
|
|
|
3
|
my $queryargs = shift; |
1814
|
1
|
|
|
|
|
7
|
my $url = $self->{apiurl} . "/" . "media"; |
1815
|
1
|
|
|
|
|
6
|
$url .= $self->handle_args($queryargs); |
1816
|
1
|
|
|
|
|
6
|
my $req = $self->{ua}->get($url); |
1817
|
1
|
50
|
|
|
|
437903
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1818
|
|
|
|
|
|
|
} |
1819
|
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
=pod |
1821
|
|
|
|
|
|
|
|
1822
|
|
|
|
|
|
|
=head2 get_media_by_name ($short_name, \%params) |
1823
|
|
|
|
|
|
|
|
1824
|
|
|
|
|
|
|
Given |
1825
|
|
|
|
|
|
|
|
1826
|
|
|
|
|
|
|
=over |
1827
|
|
|
|
|
|
|
|
1828
|
|
|
|
|
|
|
=item 0 the medium short_name |
1829
|
|
|
|
|
|
|
|
1830
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1831
|
|
|
|
|
|
|
|
1832
|
|
|
|
|
|
|
=back |
1833
|
|
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
Get a specified medium. |
1835
|
|
|
|
|
|
|
|
1836
|
|
|
|
|
|
|
=cut |
1837
|
|
|
|
|
|
|
|
1838
|
|
|
|
|
|
|
sub get_media_by_name { |
1839
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1840
|
0
|
|
|
|
|
0
|
my $short_name = shift; |
1841
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1842
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "medium" . "/" . $short_name; |
1843
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1844
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1845
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1846
|
|
|
|
|
|
|
} |
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
=pod |
1849
|
|
|
|
|
|
|
|
1850
|
|
|
|
|
|
|
=head2 get_containers (\%params) |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
Given |
1853
|
|
|
|
|
|
|
|
1854
|
|
|
|
|
|
|
=over |
1855
|
|
|
|
|
|
|
|
1856
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1857
|
|
|
|
|
|
|
|
1858
|
|
|
|
|
|
|
=back |
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
Get a list of all containers. |
1861
|
|
|
|
|
|
|
|
1862
|
|
|
|
|
|
|
=cut |
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
sub get_containers { |
1865
|
1
|
|
|
1
|
1
|
6
|
my $self = shift; |
1866
|
1
|
|
|
|
|
2
|
my $queryargs = shift; |
1867
|
1
|
|
|
|
|
6
|
my $url = $self->{apiurl} . "/" . "containers"; |
1868
|
1
|
|
|
|
|
5
|
$url .= $self->handle_args($queryargs); |
1869
|
1
|
|
|
|
|
7
|
my $req = $self->{ua}->get($url); |
1870
|
1
|
50
|
|
|
|
436163
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1871
|
|
|
|
|
|
|
} |
1872
|
|
|
|
|
|
|
|
1873
|
|
|
|
|
|
|
=pod |
1874
|
|
|
|
|
|
|
|
1875
|
|
|
|
|
|
|
=head2 get_container_by_name ($short_name, \%params) |
1876
|
|
|
|
|
|
|
|
1877
|
|
|
|
|
|
|
Given |
1878
|
|
|
|
|
|
|
|
1879
|
|
|
|
|
|
|
=over |
1880
|
|
|
|
|
|
|
|
1881
|
|
|
|
|
|
|
=item 0 the container short_name |
1882
|
|
|
|
|
|
|
|
1883
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1884
|
|
|
|
|
|
|
|
1885
|
|
|
|
|
|
|
=back |
1886
|
|
|
|
|
|
|
|
1887
|
|
|
|
|
|
|
Get a specified container. |
1888
|
|
|
|
|
|
|
|
1889
|
|
|
|
|
|
|
=cut |
1890
|
|
|
|
|
|
|
|
1891
|
|
|
|
|
|
|
sub get_container_by_name { |
1892
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
1893
|
0
|
|
|
|
|
0
|
my $short_name = shift; |
1894
|
0
|
|
|
|
|
0
|
my $queryargs = shift; |
1895
|
0
|
|
|
|
|
0
|
my $url = $self->{apiurl} . "/" . "container" . "/" . $short_name; |
1896
|
0
|
|
|
|
|
0
|
$url .= $self->handle_args($queryargs); |
1897
|
0
|
|
|
|
|
0
|
my $req = $self->{ua}->get($url); |
1898
|
0
|
0
|
|
|
|
0
|
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef; |
1899
|
|
|
|
|
|
|
} |
1900
|
|
|
|
|
|
|
|
1901
|
|
|
|
|
|
|
=pod |
1902
|
|
|
|
|
|
|
|
1903
|
|
|
|
|
|
|
=head2 handle_args (\%params) |
1904
|
|
|
|
|
|
|
|
1905
|
|
|
|
|
|
|
Given |
1906
|
|
|
|
|
|
|
|
1907
|
|
|
|
|
|
|
=over |
1908
|
|
|
|
|
|
|
|
1909
|
|
|
|
|
|
|
=item 0 a map of optional API query arguments. |
1910
|
|
|
|
|
|
|
|
1911
|
|
|
|
|
|
|
=back |
1912
|
|
|
|
|
|
|
|
1913
|
|
|
|
|
|
|
Returns the query string for an API request. |
1914
|
|
|
|
|
|
|
|
1915
|
|
|
|
|
|
|
=cut |
1916
|
|
|
|
|
|
|
|
1917
|
|
|
|
|
|
|
sub handle_args { |
1918
|
29
|
|
|
29
|
1
|
63
|
my $self = shift; |
1919
|
29
|
|
|
|
|
57
|
my $queryargs = shift; |
1920
|
29
|
|
|
|
|
101
|
$$queryargs{'type'} = $self->{type}; |
1921
|
29
|
|
|
|
|
81
|
$$queryargs{'appkey'} = $self->{appkey}; |
1922
|
29
|
|
|
|
|
68
|
my @sets = (); |
1923
|
29
|
|
|
|
|
54
|
foreach my $k (keys (%{$queryargs})) { |
|
29
|
|
|
|
|
105
|
|
1924
|
59
|
|
|
|
|
202
|
push(@sets, '' . $k . '=' . $$queryargs{$k}); |
1925
|
|
|
|
|
|
|
} |
1926
|
29
|
|
|
|
|
233
|
my $url = '?' . join('&', @sets); |
1927
|
29
|
|
|
|
|
133
|
return $url; |
1928
|
|
|
|
|
|
|
} |
1929
|
|
|
|
|
|
|
1; |
1930
|
|
|
|
|
|
|
__END__ |