line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package AnyEvent::HTTP::Spark; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
903
|
use Modern::Perl; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
44
|
|
4
|
3
|
|
|
3
|
|
1086
|
use Moo; |
|
3
|
|
|
|
|
2805
|
|
|
3
|
|
|
|
|
18
|
|
5
|
3
|
|
|
3
|
|
1609
|
use MooX::Types::MooseLike::Base qw(:all); |
|
3
|
|
|
|
|
6791
|
|
|
3
|
|
|
|
|
1100
|
|
6
|
3
|
|
|
3
|
|
26
|
use Data::Dumper; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
191
|
|
7
|
3
|
|
|
3
|
|
143
|
use JSON qw(to_json from_json); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
20
|
|
8
|
3
|
|
|
3
|
|
1970
|
use HTTP::Request::Common qw(POST); |
|
3
|
|
|
|
|
27474
|
|
|
3
|
|
|
|
|
201
|
|
9
|
3
|
|
|
3
|
|
23
|
use Ref::Util qw(is_plain_arrayref is_plain_hashref); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
170
|
|
10
|
3
|
|
|
3
|
|
20
|
use URI::Escape qw(uri_escape_utf8); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
213
|
|
11
|
3
|
|
|
3
|
|
23
|
use namespace::clean; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
33
|
|
12
|
3
|
|
|
3
|
|
2579
|
use Scalar::Util qw(looks_like_number); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
144
|
|
13
|
3
|
|
|
3
|
|
1067
|
use AnyEvent; |
|
3
|
|
|
|
|
5699
|
|
|
3
|
|
|
|
|
104
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
BEGIN { |
16
|
3
|
|
|
3
|
|
17
|
no namespace::clean; |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
18
|
|
17
|
3
|
|
|
3
|
|
1488
|
with 'HTTP::MultiGet::Role','Log::LogMethods','AnyEvent::SparkBot::SharedRole'; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has api_url=>( |
21
|
|
|
|
|
|
|
isa=>Str, |
22
|
|
|
|
|
|
|
is=>'ro', |
23
|
|
|
|
|
|
|
lazy=>1, |
24
|
|
|
|
|
|
|
default=>'https://api.ciscospark.com/v1/', |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has retryCount=>( |
28
|
|
|
|
|
|
|
isa=>Int, |
29
|
|
|
|
|
|
|
is=>'ro', |
30
|
|
|
|
|
|
|
default=>1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
has retryAfter=>( |
34
|
|
|
|
|
|
|
isa=>Int, |
35
|
|
|
|
|
|
|
is=>'ro', |
36
|
|
|
|
|
|
|
default=>10, |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
has retries=>( |
40
|
|
|
|
|
|
|
isa=>HashRef, |
41
|
|
|
|
|
|
|
is=>'ro', |
42
|
|
|
|
|
|
|
default=>sub { return {} }, |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
AnyEvent::HTTP::Spark - Syncrnous/Asyncrnous HTTP Rest Client for Cisco Spark |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use AnyEvent::HTTP::Spark; |
52
|
|
|
|
|
|
|
my $obj=new AnyEvent::HTTP::Spark(token=>$ENV{SPARK_TOKEN}); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Dual Nature Syncrnous/Asyncrnous AnyEvent friendly Spark v1 HTTP Client library. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 Moo Roles Used |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
This class uses the following Moo Roles |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
HTTP::MultiGet::Role |
63
|
|
|
|
|
|
|
Log::LogMethods |
64
|
|
|
|
|
|
|
Data::Result::Moo |
65
|
|
|
|
|
|
|
AnyEvent::SpakBot::SharedRole |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 OO Arguments and accessors |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Required OO Arguments |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
token: required for spark authentication |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Optional OO Arguments |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
logger: sets the logging object |
76
|
|
|
|
|
|
|
agent: AnyEvent::HTTP::MultiGet object |
77
|
|
|
|
|
|
|
api_url: https://api.ciscospark.com/v1/ |
78
|
|
|
|
|
|
|
# sets the web service the requests point to |
79
|
|
|
|
|
|
|
retryCount: 1, how many retries to attempt when getting a 429 error |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Options set at runtime |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
retries: anymous hash, used to trak AnyEvent->timer objects |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
# This method runs after the new constructor |
88
|
|
|
|
|
|
|
sub BUILD { |
89
|
3
|
|
|
3
|
0
|
421
|
my ($self)=@_; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# this method runs before the new constructor, and can be used to change the arguments passed to the module |
93
|
|
|
|
|
|
|
around BUILDARGS => sub { |
94
|
|
|
|
|
|
|
my ($org,$class,@args)=@_; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
return $class->$org(@args); |
97
|
|
|
|
|
|
|
}; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 OO Web Methods and special Handlers |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Each web method has a blocking and a non blocking context. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Any Method with a prefix of que_ can be called in either a blocking or a non blocking context. Most people will use the blocking interface of the client. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Non Blocking context for use with AnyEvent Loops |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
my $cb=sub { |
108
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response)=@_; |
109
|
|
|
|
|
|
|
if($result) { |
110
|
|
|
|
|
|
|
print Dumper($result->get_data); |
111
|
|
|
|
|
|
|
} else { |
112
|
|
|
|
|
|
|
... |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
}; |
115
|
|
|
|
|
|
|
my $id=$self->que_listPeople($cb,$args); |
116
|
|
|
|
|
|
|
$self->agent->run_next; |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Blocking Context |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
my $result=$self->listPeople($args); |
121
|
|
|
|
|
|
|
if($result) { |
122
|
|
|
|
|
|
|
print Dumper($result->get_data); |
123
|
|
|
|
|
|
|
} else { |
124
|
|
|
|
|
|
|
die $result; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 People |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head2 Get Me |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=over 4 |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getMe() |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getMe($cb) |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
Example Callback |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
$cb=sub { |
143
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
144
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
145
|
|
|
|
|
|
|
# 1: $id the id of the http request |
146
|
|
|
|
|
|
|
# 2: Data::Result Object |
147
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
148
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
149
|
|
|
|
|
|
|
}; |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
sub que_getMe { |
155
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb)=@_; |
156
|
0
|
|
|
|
|
0
|
return $self->que_get($cb,"people/me"); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head2 List People |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=over 4 |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listPeople($hashRef) |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listPeople($cb,$hashRef) |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Example Callback |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
$cb=sub { |
174
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
175
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
176
|
|
|
|
|
|
|
# 1: $id the id of the http request |
177
|
|
|
|
|
|
|
# 2: Data::Result Object |
178
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
179
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
180
|
|
|
|
|
|
|
}; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=back |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head2 Get Person |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=over 4 |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getPerson($personId) |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getPerson($cb,$personId) |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Example Callback |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
$cb=sub { |
198
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$personId)=@_; |
199
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
200
|
|
|
|
|
|
|
# 1: $id the id of the http request |
201
|
|
|
|
|
|
|
# 2: Data::Result Object |
202
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
203
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
204
|
|
|
|
|
|
|
}; |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=back |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head2 Create Person |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=over 4 |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item * Blocking my $result=$self->createPerson($hashRef) |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_createPerson($cb,$hashRef) |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
Example Callback |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
$cb=sub { |
222
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
223
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
224
|
|
|
|
|
|
|
# 1: $id the id of the http request |
225
|
|
|
|
|
|
|
# 2: Data::Result Object |
226
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
227
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
228
|
|
|
|
|
|
|
}; |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=back |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head2 Delete Person |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=over 4 |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=item * Blocking my $result=$self->deletePerson($personId) |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_deletePerson($cb,$personId) |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
Example Callback |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
$cb=sub { |
246
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$personId)=@_; |
247
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
248
|
|
|
|
|
|
|
# 1: $id the id of the http request |
249
|
|
|
|
|
|
|
# 2: Data::Result Object |
250
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
251
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
252
|
|
|
|
|
|
|
}; |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=back |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=head2 Update Person |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=over 4 |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
=item * Blocking my $result=$self->updatePerson($personId,$hashRef) |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_updatePerson($cb,$personId,$hashRef) |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
Example Callback |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
$cb=sub { |
270
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$personId,$hashRef)=@_; |
271
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
272
|
|
|
|
|
|
|
# 1: $id the id of the http request |
273
|
|
|
|
|
|
|
# 2: Data::Result Object |
274
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
275
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
276
|
|
|
|
|
|
|
}; |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=back |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head1 Rooms |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=head2 List Rooms |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=over 4 |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listRooms($hashRef) |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listRooms($cb,$hashRef) |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Example Callback |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
$cb=sub { |
296
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
297
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
298
|
|
|
|
|
|
|
# 1: $id the id of the http request |
299
|
|
|
|
|
|
|
# 2: Data::Result Object |
300
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
301
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
302
|
|
|
|
|
|
|
}; |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=back |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
=head2 Get Room |
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
=over 4 |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getRoom($roomId) |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
314
|
|
|
|
|
|
|
|
315
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getRoom($cb,$roomId) |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
Example Callback |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
$cb=sub { |
320
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$roomId)=@_; |
321
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
322
|
|
|
|
|
|
|
# 1: $id the id of the http request |
323
|
|
|
|
|
|
|
# 2: Data::Result Object |
324
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
325
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
326
|
|
|
|
|
|
|
}; |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
=back |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
=head2 Create Room |
332
|
|
|
|
|
|
|
|
333
|
|
|
|
|
|
|
=over 4 |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
=item * Blocking my $result=$self->createRoom($hashRef) |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_createRoom($cb,$hashRef) |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
Example Callback |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
$cb=sub { |
344
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
345
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
346
|
|
|
|
|
|
|
# 1: $id the id of the http request |
347
|
|
|
|
|
|
|
# 2: Data::Result Object |
348
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
349
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
350
|
|
|
|
|
|
|
}; |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
=back |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
=head2 Delete Room |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=over 4 |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=item * Blocking my $result=$self->deleteRoom($roomId) |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_deleteRoom($cb,$roomId) |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
Example Callback |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
$cb=sub { |
368
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$roomId)=@_; |
369
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
370
|
|
|
|
|
|
|
# 1: $id the id of the http request |
371
|
|
|
|
|
|
|
# 2: Data::Result Object |
372
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
373
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
374
|
|
|
|
|
|
|
}; |
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=back |
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=head2 Update Room |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=over 4 |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=item * Blocking my $result=$self->updateRoom($roomId,$hashRef) |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_updateRoom($cb,$roomId,$hashRef) |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
Example Callback |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
$cb=sub { |
392
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$roomId,$hashRef)=@_; |
393
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
394
|
|
|
|
|
|
|
# 1: $id the id of the http request |
395
|
|
|
|
|
|
|
# 2: Data::Result Object |
396
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
397
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
398
|
|
|
|
|
|
|
}; |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
=back |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
=head1 Memberships |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=head2 List Memberships |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=over 4 |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listMemberships($hashRef) |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listMemberships($cb,$hashRef) |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
Example Callback |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
$cb=sub { |
418
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
419
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
420
|
|
|
|
|
|
|
# 1: $id the id of the http request |
421
|
|
|
|
|
|
|
# 2: Data::Result Object |
422
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
423
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
424
|
|
|
|
|
|
|
}; |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=back |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
=head2 Get Membership |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=over 4 |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getMembership($membershipId) |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getMembership($cb,$membershipId) |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
Example Callback |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
$cb=sub { |
442
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$membershipId)=@_; |
443
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
444
|
|
|
|
|
|
|
# 1: $id the id of the http request |
445
|
|
|
|
|
|
|
# 2: Data::Result Object |
446
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
447
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
448
|
|
|
|
|
|
|
}; |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=back |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
=head2 Create Membership |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=over 4 |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
=item * Blocking my $result=$self->createMembership($hashRef) |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_createMembership($cb,$hashRef) |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
Example Callback |
464
|
|
|
|
|
|
|
|
465
|
|
|
|
|
|
|
$cb=sub { |
466
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
467
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
468
|
|
|
|
|
|
|
# 1: $id the id of the http request |
469
|
|
|
|
|
|
|
# 2: Data::Result Object |
470
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
471
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
472
|
|
|
|
|
|
|
}; |
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
=back |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
=head2 Delete Membership |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
=over 4 |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
=item * Blocking my $result=$self->deleteMembership($membershipId) |
482
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_deleteMembership($cb,$membershipId) |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
Example Callback |
488
|
|
|
|
|
|
|
|
489
|
|
|
|
|
|
|
$cb=sub { |
490
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$membershipId)=@_; |
491
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
492
|
|
|
|
|
|
|
# 1: $id the id of the http request |
493
|
|
|
|
|
|
|
# 2: Data::Result Object |
494
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
495
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
496
|
|
|
|
|
|
|
}; |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
=back |
500
|
|
|
|
|
|
|
|
501
|
|
|
|
|
|
|
=head2 Update Membership |
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=over 4 |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=item * Blocking my $result=$self->updateMembership($membershipId,$hashRef) |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_updateMembership($cb,$membershipId,$hashRef) |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
Example Callback |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
$cb=sub { |
514
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$membershipId,$hashRef)=@_; |
515
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
516
|
|
|
|
|
|
|
# 1: $id the id of the http request |
517
|
|
|
|
|
|
|
# 2: Data::Result Object |
518
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
519
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
520
|
|
|
|
|
|
|
}; |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=back |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
=head1 Messages |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=head2 List Messages |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
Special Notes on bots for this method, bots can only list messages refering to the bot itself. This means there are 2 manditory arguments when using a bot. If mentionedPeople is not set to the litteral string 'me' a bot will encounter a 403 error. |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
$hashRef Required options |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
roomId: the id for the room |
534
|
|
|
|
|
|
|
mentionedPeople: me |
535
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=over 4 |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listMessages($hashRef) |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listMessages($cb,$hashRef) |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
Example Callback |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
$cb=sub { |
547
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
548
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
549
|
|
|
|
|
|
|
# 1: $id the id of the http request |
550
|
|
|
|
|
|
|
# 2: Data::Result Object |
551
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
552
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
553
|
|
|
|
|
|
|
}; |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
=back |
557
|
|
|
|
|
|
|
|
558
|
|
|
|
|
|
|
=head2 Get Message |
559
|
|
|
|
|
|
|
|
560
|
|
|
|
|
|
|
=over 4 |
561
|
|
|
|
|
|
|
|
562
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getMessage($messageId) |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
565
|
|
|
|
|
|
|
|
566
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getMessage($cb,$messageId) |
567
|
|
|
|
|
|
|
|
568
|
|
|
|
|
|
|
Example Callback |
569
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
$cb=sub { |
571
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$messageId)=@_; |
572
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
573
|
|
|
|
|
|
|
# 1: $id the id of the http request |
574
|
|
|
|
|
|
|
# 2: Data::Result Object |
575
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
576
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
577
|
|
|
|
|
|
|
}; |
578
|
|
|
|
|
|
|
|
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
=back |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=head2 Create Message |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
=over 4 |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=item * Blocking my $result=$self->createMessage($hashRef) |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
589
|
|
|
|
|
|
|
|
590
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_createMessage($cb,$hashRef) |
591
|
|
|
|
|
|
|
|
592
|
|
|
|
|
|
|
Example Callback |
593
|
|
|
|
|
|
|
|
594
|
|
|
|
|
|
|
$cb=sub { |
595
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
596
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
597
|
|
|
|
|
|
|
# 1: $id the id of the http request |
598
|
|
|
|
|
|
|
# 2: Data::Result Object |
599
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
600
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
601
|
|
|
|
|
|
|
}; |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
=back |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
=head2 Delete Message |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
=over 4 |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
=item * Blocking my $result=$self->deleteMessage($messageId) |
611
|
|
|
|
|
|
|
|
612
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_deleteMessage($cb,$messageId) |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
Example Callback |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
$cb=sub { |
619
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$messageId)=@_; |
620
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
621
|
|
|
|
|
|
|
# 1: $id the id of the http request |
622
|
|
|
|
|
|
|
# 2: Data::Result Object |
623
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
624
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
625
|
|
|
|
|
|
|
}; |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
=back |
629
|
|
|
|
|
|
|
|
630
|
|
|
|
|
|
|
=head1 Teams |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
=head2 List Teams |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
=over 4 |
635
|
|
|
|
|
|
|
|
636
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listTeams($hashRef) |
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listTeams($cb,$hashRef) |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
Example Callback |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
$cb=sub { |
645
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
646
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
647
|
|
|
|
|
|
|
# 1: $id the id of the http request |
648
|
|
|
|
|
|
|
# 2: Data::Result Object |
649
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
650
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
651
|
|
|
|
|
|
|
}; |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=back |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
=head2 Get Team |
657
|
|
|
|
|
|
|
|
658
|
|
|
|
|
|
|
=over 4 |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getTeam($teamId) |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getTeam($cb,$teamId) |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
Example Callback |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
$cb=sub { |
669
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$teamId)=@_; |
670
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
671
|
|
|
|
|
|
|
# 1: $id the id of the http request |
672
|
|
|
|
|
|
|
# 2: Data::Result Object |
673
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
674
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
675
|
|
|
|
|
|
|
}; |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
|
678
|
|
|
|
|
|
|
=back |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
=head2 Create Team |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
=over 4 |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
=item * Blocking my $result=$self->createTeam($hashRef) |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_createTeam($cb,$hashRef) |
689
|
|
|
|
|
|
|
|
690
|
|
|
|
|
|
|
Example Callback |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
$cb=sub { |
693
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
694
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
695
|
|
|
|
|
|
|
# 1: $id the id of the http request |
696
|
|
|
|
|
|
|
# 2: Data::Result Object |
697
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
698
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
699
|
|
|
|
|
|
|
}; |
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
=back |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
=head2 Delete Team |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
=over 4 |
707
|
|
|
|
|
|
|
|
708
|
|
|
|
|
|
|
=item * Blocking my $result=$self->deleteTeam($teamId) |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
711
|
|
|
|
|
|
|
|
712
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_deleteTeam($cb,$teamId) |
713
|
|
|
|
|
|
|
|
714
|
|
|
|
|
|
|
Example Callback |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
$cb=sub { |
717
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$teamId)=@_; |
718
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
719
|
|
|
|
|
|
|
# 1: $id the id of the http request |
720
|
|
|
|
|
|
|
# 2: Data::Result Object |
721
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
722
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
723
|
|
|
|
|
|
|
}; |
724
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
=back |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=head2 Update Team |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
=over 4 |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
=item * Blocking my $result=$self->updateTeam($teamId,$hashRef) |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_updateTeam($cb,$teamId,$hashRef) |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
Example Callback |
739
|
|
|
|
|
|
|
|
740
|
|
|
|
|
|
|
$cb=sub { |
741
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$teamId,$hashRef)=@_; |
742
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
743
|
|
|
|
|
|
|
# 1: $id the id of the http request |
744
|
|
|
|
|
|
|
# 2: Data::Result Object |
745
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
746
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
747
|
|
|
|
|
|
|
}; |
748
|
|
|
|
|
|
|
|
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
=back |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=head1 Team Memberships |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=head2 List Team Memberships |
755
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
=over 4 |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listTeamMemberships($hashRef) |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listTeamMemberships($cb,$hashRef) |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
Example Callback |
765
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
$cb=sub { |
767
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
768
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
769
|
|
|
|
|
|
|
# 1: $id the id of the http request |
770
|
|
|
|
|
|
|
# 2: Data::Result Object |
771
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
772
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
773
|
|
|
|
|
|
|
}; |
774
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
=back |
777
|
|
|
|
|
|
|
|
778
|
|
|
|
|
|
|
=head2 Get Team Membership |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
=over 4 |
781
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getTeamMembership($teamMembershipId) |
783
|
|
|
|
|
|
|
|
784
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
785
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getTeamMembership($cb,$teamMembershipId) |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
Example Callback |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
$cb=sub { |
791
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$teamMembershipId)=@_; |
792
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
793
|
|
|
|
|
|
|
# 1: $id the id of the http request |
794
|
|
|
|
|
|
|
# 2: Data::Result Object |
795
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
796
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
797
|
|
|
|
|
|
|
}; |
798
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
|
800
|
|
|
|
|
|
|
=back |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
=head2 Create Team Membership |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
=over 4 |
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
=item * Blocking my $result=$self->createTeamMembership($hashRef) |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
809
|
|
|
|
|
|
|
|
810
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_createTeamMembership($cb,$hashRef) |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
Example Callback |
813
|
|
|
|
|
|
|
|
814
|
|
|
|
|
|
|
$cb=sub { |
815
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
816
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
817
|
|
|
|
|
|
|
# 1: $id the id of the http request |
818
|
|
|
|
|
|
|
# 2: Data::Result Object |
819
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
820
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
821
|
|
|
|
|
|
|
}; |
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
=back |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
=head2 Delete Team Membership |
827
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
=over 4 |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
=item * Blocking my $result=$self->deleteTeamMembership($teamMembershipId) |
831
|
|
|
|
|
|
|
|
832
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_deleteTeamMembership($cb,$teamMembershipId) |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
Example Callback |
837
|
|
|
|
|
|
|
|
838
|
|
|
|
|
|
|
$cb=sub { |
839
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$teamMembershipId)=@_; |
840
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
841
|
|
|
|
|
|
|
# 1: $id the id of the http request |
842
|
|
|
|
|
|
|
# 2: Data::Result Object |
843
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
844
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
845
|
|
|
|
|
|
|
}; |
846
|
|
|
|
|
|
|
|
847
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
=back |
849
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
=head2 Update Team Membership |
851
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
=over 4 |
853
|
|
|
|
|
|
|
|
854
|
|
|
|
|
|
|
=item * Blocking my $result=$self->updateTeamMembership($teamMembershipId,$hashRef) |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
857
|
|
|
|
|
|
|
|
858
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_updateTeamMembership($cb,$teamMembershipId,$hashRef) |
859
|
|
|
|
|
|
|
|
860
|
|
|
|
|
|
|
Example Callback |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
$cb=sub { |
863
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$teamMembershipId,$hashRef)=@_; |
864
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
865
|
|
|
|
|
|
|
# 1: $id the id of the http request |
866
|
|
|
|
|
|
|
# 2: Data::Result Object |
867
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
868
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
869
|
|
|
|
|
|
|
}; |
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
=back |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
=head1 Webhooks |
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
=head2 List Webhooks |
877
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
=over 4 |
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listWebhooks($hashRef) |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
883
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listWebhooks($cb,$hashRef) |
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
Example Callback |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
$cb=sub { |
889
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
890
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
891
|
|
|
|
|
|
|
# 1: $id the id of the http request |
892
|
|
|
|
|
|
|
# 2: Data::Result Object |
893
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
894
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
895
|
|
|
|
|
|
|
}; |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
|
898
|
|
|
|
|
|
|
=back |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
=head2 Get Webhook |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
=over 4 |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getWebhook($webhookId) |
905
|
|
|
|
|
|
|
|
906
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
907
|
|
|
|
|
|
|
|
908
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getWebhook($cb,$webhookId) |
909
|
|
|
|
|
|
|
|
910
|
|
|
|
|
|
|
Example Callback |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
$cb=sub { |
913
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$webhookId)=@_; |
914
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
915
|
|
|
|
|
|
|
# 1: $id the id of the http request |
916
|
|
|
|
|
|
|
# 2: Data::Result Object |
917
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
918
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
919
|
|
|
|
|
|
|
}; |
920
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
=back |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
=head2 Create Webhook |
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
=over 4 |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
=item * Blocking my $result=$self->createWebhook($hashRef) |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_createWebhook($cb,$hashRef) |
933
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
Example Callback |
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
$cb=sub { |
937
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
938
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
939
|
|
|
|
|
|
|
# 1: $id the id of the http request |
940
|
|
|
|
|
|
|
# 2: Data::Result Object |
941
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
942
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
943
|
|
|
|
|
|
|
}; |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
=back |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
=head2 Delete Webhook |
949
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
=over 4 |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
=item * Blocking my $result=$self->deleteWebhook($webhookId) |
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_deleteWebhook($cb,$webhookId) |
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
Example Callback |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
$cb=sub { |
961
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$webhookId)=@_; |
962
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
963
|
|
|
|
|
|
|
# 1: $id the id of the http request |
964
|
|
|
|
|
|
|
# 2: Data::Result Object |
965
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
966
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
967
|
|
|
|
|
|
|
}; |
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
|
970
|
|
|
|
|
|
|
=back |
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
=head2 Update Webhook |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
=over 4 |
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
=item * Blocking my $result=$self->updateWebhook($webhookId,$hashRef) |
977
|
|
|
|
|
|
|
|
978
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_updateWebhook($cb,$webhookId,$hashRef) |
981
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
Example Callback |
983
|
|
|
|
|
|
|
|
984
|
|
|
|
|
|
|
$cb=sub { |
985
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$webhookId,$hashRef)=@_; |
986
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
987
|
|
|
|
|
|
|
# 1: $id the id of the http request |
988
|
|
|
|
|
|
|
# 2: Data::Result Object |
989
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
990
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
991
|
|
|
|
|
|
|
}; |
992
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
=back |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
=head1 Organizations |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
=head2 List Organizations |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
=over 4 |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listOrganizations($hashRef) |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listOrganizations($cb,$hashRef) |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
Example Callback |
1009
|
|
|
|
|
|
|
|
1010
|
|
|
|
|
|
|
$cb=sub { |
1011
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
1012
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1013
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1014
|
|
|
|
|
|
|
# 2: Data::Result Object |
1015
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1016
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1017
|
|
|
|
|
|
|
}; |
1018
|
|
|
|
|
|
|
|
1019
|
|
|
|
|
|
|
|
1020
|
|
|
|
|
|
|
=back |
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
=head2 Get Organization |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
=over 4 |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getOrganization($organizationId) |
1027
|
|
|
|
|
|
|
|
1028
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getOrganization($cb,$organizationId) |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
Example Callback |
1033
|
|
|
|
|
|
|
|
1034
|
|
|
|
|
|
|
$cb=sub { |
1035
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$organizationId)=@_; |
1036
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1037
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1038
|
|
|
|
|
|
|
# 2: Data::Result Object |
1039
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1040
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1041
|
|
|
|
|
|
|
}; |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
|
1044
|
|
|
|
|
|
|
=back |
1045
|
|
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
=head1 Licenses |
1047
|
|
|
|
|
|
|
|
1048
|
|
|
|
|
|
|
=head2 List Licenses |
1049
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
=over 4 |
1051
|
|
|
|
|
|
|
|
1052
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listLicenses($hashRef) |
1053
|
|
|
|
|
|
|
|
1054
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1055
|
|
|
|
|
|
|
|
1056
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listLicenses($cb,$hashRef) |
1057
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
Example Callback |
1059
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
$cb=sub { |
1061
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
1062
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1063
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1064
|
|
|
|
|
|
|
# 2: Data::Result Object |
1065
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1066
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1067
|
|
|
|
|
|
|
}; |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
|
1070
|
|
|
|
|
|
|
=back |
1071
|
|
|
|
|
|
|
|
1072
|
|
|
|
|
|
|
=head2 Get License |
1073
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
=over 4 |
1075
|
|
|
|
|
|
|
|
1076
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getLicense($licenseId) |
1077
|
|
|
|
|
|
|
|
1078
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1079
|
|
|
|
|
|
|
|
1080
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getLicense($cb,$licenseId) |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
Example Callback |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
$cb=sub { |
1085
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$licenseId)=@_; |
1086
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1087
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1088
|
|
|
|
|
|
|
# 2: Data::Result Object |
1089
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1090
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1091
|
|
|
|
|
|
|
}; |
1092
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
=back |
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
=head1 Roles |
1097
|
|
|
|
|
|
|
|
1098
|
|
|
|
|
|
|
=head2 List Roles |
1099
|
|
|
|
|
|
|
|
1100
|
|
|
|
|
|
|
=over 4 |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listRoles($hashRef) |
1103
|
|
|
|
|
|
|
|
1104
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1105
|
|
|
|
|
|
|
|
1106
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listRoles($cb,$hashRef) |
1107
|
|
|
|
|
|
|
|
1108
|
|
|
|
|
|
|
Example Callback |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
$cb=sub { |
1111
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
1112
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1113
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1114
|
|
|
|
|
|
|
# 2: Data::Result Object |
1115
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1116
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1117
|
|
|
|
|
|
|
}; |
1118
|
|
|
|
|
|
|
|
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
=back |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
=head2 Get Role |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
=over 4 |
1125
|
|
|
|
|
|
|
|
1126
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getRole($roleId) |
1127
|
|
|
|
|
|
|
|
1128
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1129
|
|
|
|
|
|
|
|
1130
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getRole($cb,$roleId) |
1131
|
|
|
|
|
|
|
|
1132
|
|
|
|
|
|
|
Example Callback |
1133
|
|
|
|
|
|
|
|
1134
|
|
|
|
|
|
|
$cb=sub { |
1135
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$roleId)=@_; |
1136
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1137
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1138
|
|
|
|
|
|
|
# 2: Data::Result Object |
1139
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1140
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1141
|
|
|
|
|
|
|
}; |
1142
|
|
|
|
|
|
|
|
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
=back |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
=head1 Events |
1147
|
|
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
=head2 List Events |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
=over 4 |
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listEvents($hashRef) |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1155
|
|
|
|
|
|
|
|
1156
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listEvents($cb,$hashRef) |
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
Example Callback |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
$cb=sub { |
1161
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
1162
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1163
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1164
|
|
|
|
|
|
|
# 2: Data::Result Object |
1165
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1166
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1167
|
|
|
|
|
|
|
}; |
1168
|
|
|
|
|
|
|
|
1169
|
|
|
|
|
|
|
|
1170
|
|
|
|
|
|
|
=back |
1171
|
|
|
|
|
|
|
|
1172
|
|
|
|
|
|
|
=head2 Get Event |
1173
|
|
|
|
|
|
|
|
1174
|
|
|
|
|
|
|
=over 4 |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getEvent($eventId) |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getEvent($cb,$eventId) |
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
Example Callback |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
$cb=sub { |
1185
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$eventId)=@_; |
1186
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1187
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1188
|
|
|
|
|
|
|
# 2: Data::Result Object |
1189
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1190
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1191
|
|
|
|
|
|
|
}; |
1192
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
=back |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
=cut |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
__PACKAGE__->_build_common("people",qw(list get create delete update)); |
1199
|
|
|
|
|
|
|
__PACKAGE__->_build_common("rooms",qw(list get create delete update)); |
1200
|
|
|
|
|
|
|
__PACKAGE__->_build_common("meetings",qw(list get create delete update)); |
1201
|
|
|
|
|
|
|
__PACKAGE__->_build_common("memberships",qw(list get create delete update)); |
1202
|
|
|
|
|
|
|
__PACKAGE__->_build_common("messages",qw(list get create delete)); |
1203
|
|
|
|
|
|
|
__PACKAGE__->_build_common("teams",qw(list get create delete update)); |
1204
|
|
|
|
|
|
|
__PACKAGE__->_build_common("team/memberships",qw(list get create delete update)); |
1205
|
|
|
|
|
|
|
__PACKAGE__->_build_common("webhooks",qw(list get create delete update)); |
1206
|
|
|
|
|
|
|
__PACKAGE__->_build_common("organizations",qw(list get)); |
1207
|
|
|
|
|
|
|
__PACKAGE__->_build_common("licenses",qw(list get)); |
1208
|
|
|
|
|
|
|
__PACKAGE__->_build_common("roles",qw(list get)); |
1209
|
|
|
|
|
|
|
__PACKAGE__->_build_common("events",qw(list get)); |
1210
|
|
|
|
|
|
|
|
1211
|
|
|
|
|
|
|
sub _build_common { |
1212
|
36
|
|
|
36
|
|
98
|
my ($class,$path,@todo)=@_; |
1213
|
36
|
|
|
|
|
72
|
foreach my $method (@todo) { |
1214
|
141
|
|
|
|
|
226
|
my $label=$path; |
1215
|
141
|
|
|
|
|
462
|
$label=~ s/^(.)/uc($1)/se; |
|
141
|
|
|
|
|
382
|
|
1216
|
141
|
|
|
|
|
329
|
$label="que_".$method.$label; |
1217
|
141
|
|
|
|
|
184
|
my $code; |
1218
|
141
|
100
|
|
|
|
297
|
if($method ne 'list') { |
1219
|
105
|
|
|
|
|
287
|
$label=~ s/s$//s ; |
1220
|
105
|
|
|
|
|
196
|
$label=~ s/People/Person/s; |
1221
|
|
|
|
|
|
|
} |
1222
|
141
|
|
|
|
|
263
|
$label=~ s#/(.)#uc($1)#se; |
|
15
|
|
|
|
|
43
|
|
1223
|
|
|
|
|
|
|
|
1224
|
141
|
100
|
|
|
|
345
|
if($method eq 'list') { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
1225
|
|
|
|
|
|
|
$code=sub { |
1226
|
0
|
|
|
0
|
|
0
|
my ($self,$cb,$args)=@_; |
1227
|
0
|
|
|
|
|
0
|
my $url=$path; |
1228
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
my $run=sub { |
1230
|
0
|
|
|
0
|
|
0
|
my ($self,$id,$result,$request,$response)=@_; |
1231
|
0
|
|
|
|
|
0
|
$self->handle_paginate($id,$result,$request,$response,$cb); |
1232
|
0
|
|
|
|
|
0
|
}; |
1233
|
0
|
|
|
|
|
0
|
return $self->que_get($run,$url,$args); |
1234
|
36
|
|
|
|
|
171
|
}; |
1235
|
|
|
|
|
|
|
} elsif($method eq 'update') { |
1236
|
|
|
|
|
|
|
$code=sub { |
1237
|
0
|
|
|
0
|
|
0
|
my ($self,$cb,$targetId,$data)=@_; |
1238
|
0
|
0
|
|
|
|
0
|
return $self->queue_result($cb,$self->new_false("${method}Id is a requried argument")) unless defined($targetId); |
1239
|
0
|
|
|
|
|
0
|
return $self->que_put_json($cb,"$path/$targetId",$data); |
1240
|
21
|
|
|
|
|
127
|
}; |
1241
|
|
|
|
|
|
|
} elsif($method eq 'get') { |
1242
|
|
|
|
|
|
|
$code=sub { |
1243
|
0
|
|
|
0
|
|
0
|
my ($self,$cb,$targetId,$data)=@_; |
1244
|
0
|
0
|
|
|
|
0
|
return $self->queue_result($cb,$self->new_false("${method}Id is a requried argument")) unless defined($targetId); |
1245
|
0
|
|
|
|
|
0
|
return $self->que_get($cb,"$path/$targetId",$data); |
1246
|
36
|
|
|
|
|
151
|
}; |
1247
|
|
|
|
|
|
|
} elsif($method eq 'delete') { |
1248
|
|
|
|
|
|
|
$code=sub { |
1249
|
0
|
|
|
0
|
|
0
|
my ($self,$cb,$targetId,$data)=@_; |
1250
|
0
|
0
|
|
|
|
0
|
return $self->queue_result($cb,$self->new_false("${method}Id is a requried argument")) unless defined($targetId); |
1251
|
0
|
|
|
|
|
0
|
return $self->que_delete($cb,"$path/$targetId",$data); |
1252
|
24
|
|
|
|
|
164
|
}; |
1253
|
|
|
|
|
|
|
} elsif($method eq 'create') { |
1254
|
|
|
|
|
|
|
$code=sub { |
1255
|
0
|
|
|
0
|
|
0
|
my ($self,$cb,$data)=@_; |
1256
|
0
|
|
|
|
|
0
|
return $self->que_post_json($cb,"$path",$data); |
1257
|
24
|
|
|
|
|
123
|
}; |
1258
|
|
|
|
|
|
|
} else { |
1259
|
0
|
|
|
|
|
0
|
die "Er um.. $method isn't supported yet"; |
1260
|
|
|
|
|
|
|
} |
1261
|
3
|
|
|
3
|
|
16876
|
no strict 'refs'; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
8933
|
|
1262
|
141
|
|
|
|
|
236
|
*{$label}=$code; |
|
141
|
|
|
|
|
668
|
|
1263
|
|
|
|
|
|
|
} |
1264
|
|
|
|
|
|
|
} |
1265
|
|
|
|
|
|
|
|
1266
|
|
|
|
|
|
|
=head1 Meetingss |
1267
|
|
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
=head2 List Meetingss |
1269
|
|
|
|
|
|
|
|
1270
|
|
|
|
|
|
|
=over 4 |
1271
|
|
|
|
|
|
|
|
1272
|
|
|
|
|
|
|
=item * Blocking my $result=$self->listMeetingss($hashRef) |
1273
|
|
|
|
|
|
|
|
1274
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1275
|
|
|
|
|
|
|
|
1276
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_listMeetingss($cb,$hashRef) |
1277
|
|
|
|
|
|
|
|
1278
|
|
|
|
|
|
|
Example Callback |
1279
|
|
|
|
|
|
|
|
1280
|
|
|
|
|
|
|
$cb=sub { |
1281
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
1282
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1283
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1284
|
|
|
|
|
|
|
# 2: Data::Result Object |
1285
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1286
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1287
|
|
|
|
|
|
|
}; |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
=back |
1291
|
|
|
|
|
|
|
|
1292
|
|
|
|
|
|
|
=head2 Get Meetings |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
=over 4 |
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
=item * Blocking my $result=$self->getMeetings($roomId) |
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1299
|
|
|
|
|
|
|
|
1300
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_getMeetings($cb,$roomId) |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
Example Callback |
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
$cb=sub { |
1305
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$roomId)=@_; |
1306
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1307
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1308
|
|
|
|
|
|
|
# 2: Data::Result Object |
1309
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1310
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1311
|
|
|
|
|
|
|
}; |
1312
|
|
|
|
|
|
|
|
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
=back |
1315
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
=head2 Create Meetings |
1317
|
|
|
|
|
|
|
|
1318
|
|
|
|
|
|
|
=over 4 |
1319
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
=item * Blocking my $result=$self->createMeetings($hashRef) |
1321
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1323
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_createMeetings($cb,$hashRef) |
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
Example Callback |
1327
|
|
|
|
|
|
|
|
1328
|
|
|
|
|
|
|
$cb=sub { |
1329
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$hashRef)=@_; |
1330
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1331
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1332
|
|
|
|
|
|
|
# 2: Data::Result Object |
1333
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1334
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1335
|
|
|
|
|
|
|
}; |
1336
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
=back |
1339
|
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
|
=head2 Delete Meetings |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
=over 4 |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
=item * Blocking my $result=$self->deleteMeetings($roomId) |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1347
|
|
|
|
|
|
|
|
1348
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_deleteMeetings($cb,$roomId) |
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
Example Callback |
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
$cb=sub { |
1353
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$roomId)=@_; |
1354
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1355
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1356
|
|
|
|
|
|
|
# 2: Data::Result Object |
1357
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1358
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1359
|
|
|
|
|
|
|
}; |
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
=back |
1363
|
|
|
|
|
|
|
|
1364
|
|
|
|
|
|
|
=head2 Update Meetings |
1365
|
|
|
|
|
|
|
|
1366
|
|
|
|
|
|
|
=over 4 |
1367
|
|
|
|
|
|
|
|
1368
|
|
|
|
|
|
|
=item * Blocking my $result=$self->updateMeetings($roomId,$hashRef) |
1369
|
|
|
|
|
|
|
|
1370
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1371
|
|
|
|
|
|
|
|
1372
|
|
|
|
|
|
|
=item * Non-Blocking my $id=$self->que_updateMeetings($cb,$roomId,$hashRef) |
1373
|
|
|
|
|
|
|
|
1374
|
|
|
|
|
|
|
Example Callback |
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
$cb=sub { |
1377
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$roomId,$hashRef)=@_; |
1378
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1379
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1380
|
|
|
|
|
|
|
# 2: Data::Result Object |
1381
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1382
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1383
|
|
|
|
|
|
|
}; |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
|
1386
|
|
|
|
|
|
|
=back |
1387
|
|
|
|
|
|
|
|
1388
|
|
|
|
|
|
|
=head1 Attaching files to messages |
1389
|
|
|
|
|
|
|
|
1390
|
|
|
|
|
|
|
Posting files to channel steps outside of the traditional json data format. |
1391
|
|
|
|
|
|
|
|
1392
|
|
|
|
|
|
|
=over 4 |
1393
|
|
|
|
|
|
|
|
1394
|
|
|
|
|
|
|
=item * Blocking my $result=$self->uploadFile('/path/to/file',%args); |
1395
|
|
|
|
|
|
|
|
1396
|
|
|
|
|
|
|
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed. |
1397
|
|
|
|
|
|
|
|
1398
|
|
|
|
|
|
|
=item * Non-Blocking my $result=$self->que_uploadFile($cb,'/path/to/file',%args); |
1399
|
|
|
|
|
|
|
|
1400
|
|
|
|
|
|
|
Example Callback |
1401
|
|
|
|
|
|
|
|
1402
|
|
|
|
|
|
|
$cb=sub { |
1403
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response,$roomId,$hashRef)=@_; |
1404
|
|
|
|
|
|
|
# 0: $self The current AnyEvent::HTTP::Slack object |
1405
|
|
|
|
|
|
|
# 1: $id the id of the http request |
1406
|
|
|
|
|
|
|
# 2: Data::Result Object |
1407
|
|
|
|
|
|
|
# 3: HTTP::Request Object |
1408
|
|
|
|
|
|
|
# 4: HTTP::Result Object |
1409
|
|
|
|
|
|
|
}; |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
=back |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
=cut |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
sub que_uploadFile { |
1416
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$file,%args)=@_; |
1417
|
|
|
|
|
|
|
|
1418
|
0
|
|
|
|
|
0
|
my $post=[ |
1419
|
|
|
|
|
|
|
%args, |
1420
|
|
|
|
|
|
|
files=>[$file], |
1421
|
|
|
|
|
|
|
]; |
1422
|
|
|
|
|
|
|
|
1423
|
0
|
|
|
|
|
0
|
my $url=$self->api_url.'messages'; |
1424
|
0
|
|
|
|
|
0
|
my $request=POST($url,Content_type=>'form-data',Content=>$post); |
1425
|
0
|
|
|
|
|
0
|
$request->header(Authorization=>"Bearer ".$self->token); |
1426
|
0
|
|
|
|
|
0
|
return $self->queue_request($request,$cb); |
1427
|
|
|
|
|
|
|
} |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
=head1 Low Level Request functions |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
This section documents low level request functions. |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
=over 4 |
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
=cut |
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
=item * $self->handle_paginate($id,$result,$request,$response,$cb) |
1438
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
Internal Method wrapper for parsing pagination headers. |
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
Example: |
1442
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
my $code=sub { |
1444
|
|
|
|
|
|
|
my ($self,$id,$result,$request,$response)=@_; |
1445
|
|
|
|
|
|
|
$self->handle_paginate($id,$result,$request,$response,$cb); |
1446
|
|
|
|
|
|
|
}; |
1447
|
|
|
|
|
|
|
return $self->que_get($code,$url,$args); |
1448
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
Pagination information can be found in the following result fields. |
1450
|
|
|
|
|
|
|
|
1451
|
|
|
|
|
|
|
cursorPosition: last|next|prev|first |
1452
|
|
|
|
|
|
|
pageLink: (undef when cursorPosition eq 'last') Url to the next page |
1453
|
|
|
|
|
|
|
|
1454
|
|
|
|
|
|
|
=cut |
1455
|
|
|
|
|
|
|
|
1456
|
|
|
|
|
|
|
sub handle_paginate { |
1457
|
0
|
|
|
0
|
1
|
0
|
my ($self,$id,$result,$request,$response,$cb)=@_; |
1458
|
0
|
0
|
|
|
|
0
|
if($result) { |
1459
|
0
|
|
|
|
|
0
|
my $headers={$response->headers->flatten}; |
1460
|
0
|
|
|
|
|
0
|
my $data=$result->get_data; |
1461
|
0
|
|
|
|
|
0
|
$data->{cursorPosition}='last'; |
1462
|
0
|
|
|
|
|
0
|
$data->{pageLink}=''; |
1463
|
0
|
0
|
|
|
|
0
|
if(exists $headers->{Link}) { |
1464
|
0
|
|
|
|
|
0
|
my $link=$headers->{Link}; |
1465
|
0
|
0
|
|
|
|
0
|
if($link=~ /^<([^>]+)>;\s+rel="(\w+)"\s*$/s) { |
1466
|
0
|
|
|
|
|
0
|
$data->{pageLink}=$1; |
1467
|
0
|
|
|
|
|
0
|
$data->{cursorPosition}=$2; |
1468
|
|
|
|
|
|
|
} |
1469
|
|
|
|
|
|
|
} |
1470
|
|
|
|
|
|
|
} |
1471
|
|
|
|
|
|
|
|
1472
|
0
|
|
|
|
|
0
|
$cb->(@_); |
1473
|
|
|
|
|
|
|
} |
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
=item * my $result=$self->build_post_json($url,$data); |
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
Returns a Data::Result object; When true it contains an HTTP::Request Object For $url, the body will consist of $data converted to json. When false it contains why it failed. |
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
=cut |
1480
|
|
|
|
|
|
|
|
1481
|
|
|
|
|
|
|
sub build_post_json { |
1482
|
1
|
|
|
1
|
1
|
454
|
my ($self,$url,$data)=@_; |
1483
|
|
|
|
|
|
|
|
1484
|
1
|
|
|
|
|
26
|
my $uri=$self->api_url.$url; |
1485
|
1
|
|
|
|
|
46
|
my $json=eval {to_json($data)}; |
|
1
|
|
|
|
|
5
|
|
1486
|
1
|
50
|
|
|
|
44
|
return $self->new_false("Failed to convert \$data to json, error was $@") if $@; |
1487
|
|
|
|
|
|
|
|
1488
|
1
|
|
|
|
|
5
|
my $request=new HTTP::Request(POST=>$uri,$self->default_headers,$json); |
1489
|
1
|
|
|
|
|
8327
|
return $self->new_true($request); |
1490
|
|
|
|
|
|
|
} |
1491
|
|
|
|
|
|
|
|
1492
|
|
|
|
|
|
|
=item * my $id=$self->queue_builder($cb,$method,$url,$data); |
1493
|
|
|
|
|
|
|
|
1494
|
|
|
|
|
|
|
Returns the ID of the object in the request for $method. |
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
=cut |
1497
|
|
|
|
|
|
|
|
1498
|
|
|
|
|
|
|
sub queue_builder { |
1499
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$method,$url,$data)=@_; |
1500
|
|
|
|
|
|
|
|
1501
|
0
|
|
|
|
|
0
|
my $result=$self->$method($url,$data); |
1502
|
0
|
0
|
|
|
|
0
|
return $self->queue_result($cb,$result) unless $result; |
1503
|
0
|
|
|
|
|
0
|
my $request=$result->get_data; |
1504
|
|
|
|
|
|
|
|
1505
|
0
|
|
|
|
|
0
|
my $wrap; |
1506
|
0
|
|
|
|
|
0
|
my $count=$self->retryCount; |
1507
|
0
|
0
|
|
|
|
0
|
if($self->is_blocking) { |
1508
|
|
|
|
|
|
|
$wrap=sub { |
1509
|
0
|
|
|
0
|
|
0
|
my ($self,$id,$result,undef,$response)=@_; |
1510
|
|
|
|
|
|
|
|
1511
|
0
|
0
|
0
|
|
|
0
|
return $cb->(@_) if $result or !($response->code==429 and $count-- >0); |
|
|
|
0
|
|
|
|
|
1512
|
0
|
0
|
|
|
|
0
|
my $timeout=looks_like_number($response->header('Retry-After')) ? $response->header('Retry-After') : $self->retryTimeout; |
1513
|
0
|
|
|
|
|
0
|
$self->log_warn("Request: $id recived a 429 response, will retry in $timeout seconds"); |
1514
|
|
|
|
|
|
|
|
1515
|
|
|
|
|
|
|
|
1516
|
0
|
0
|
|
|
|
0
|
if($count>0) { |
1517
|
|
|
|
|
|
|
my $next_id=$self->queue_request($request,sub { |
1518
|
0
|
|
|
|
|
0
|
my ($self,undef,$result,undef,$response)=@_; |
1519
|
0
|
|
|
|
|
0
|
$wrap->($self,$id,$result,$request,$response); |
1520
|
0
|
|
|
|
|
0
|
}); |
1521
|
0
|
|
|
|
|
0
|
$self->add_ids_for_blocking($next_id); |
1522
|
0
|
|
|
|
|
0
|
return $self->agent->run_next; |
1523
|
|
|
|
|
|
|
} |
1524
|
|
|
|
|
|
|
|
1525
|
0
|
|
|
|
|
0
|
sleep $timeout; |
1526
|
|
|
|
|
|
|
my $code=sub { |
1527
|
0
|
|
|
|
|
0
|
my ($self,undef,$result,undef,$response)=@_; |
1528
|
0
|
|
|
|
|
0
|
$cb->($self,$id,$result,$request,$response); |
1529
|
0
|
|
|
|
|
0
|
}; |
1530
|
|
|
|
|
|
|
|
1531
|
0
|
|
|
|
|
0
|
my $next_id=$self->queue_request($request,$code); |
1532
|
0
|
|
|
|
|
0
|
$self->add_ids_for_blocking($next_id); |
1533
|
0
|
|
|
|
|
0
|
$self->agent->run_next; |
1534
|
0
|
|
|
|
|
0
|
}; |
1535
|
|
|
|
|
|
|
} else { |
1536
|
|
|
|
|
|
|
$wrap=sub { |
1537
|
0
|
|
|
0
|
|
0
|
my ($self,$id,$result,undef,$response)=@_; |
1538
|
0
|
0
|
0
|
|
|
0
|
return $cb->(@_) if $result or !($response->code==429 and $count-- >0); |
|
|
|
0
|
|
|
|
|
1539
|
0
|
0
|
|
|
|
0
|
my $timeout=looks_like_number($response->header('Retry-After')) ? $response->header('Retry-After') : $self->retryTimeout; |
1540
|
0
|
|
|
|
|
0
|
$self->log_warn("Request: $id recived a 429 response, will retry in $timeout seconds"); |
1541
|
|
|
|
|
|
|
|
1542
|
0
|
0
|
|
|
|
0
|
if($count>0) { |
1543
|
0
|
|
|
|
|
0
|
my $ae; |
1544
|
|
|
|
|
|
|
$ae=AnyEvent->timer(after=>$timeout,cb=>sub { |
1545
|
|
|
|
|
|
|
my $next_id=$self->queue_request($request,sub { |
1546
|
0
|
|
|
|
|
0
|
my ($self,undef,$result,undef,$response)=@_; |
1547
|
0
|
|
|
|
|
0
|
$wrap->($self,$id,$result,$request,$response); |
1548
|
0
|
|
|
|
|
0
|
}); |
1549
|
0
|
|
|
|
|
0
|
$self->add_ids_for_blocking($next_id); |
1550
|
0
|
|
|
|
|
0
|
$self->agent->run_next; |
1551
|
0
|
|
|
|
|
0
|
delete $self->retries->{$ae}; |
1552
|
0
|
|
|
|
|
0
|
undef $ae; |
1553
|
0
|
|
|
|
|
0
|
}); |
1554
|
0
|
|
|
|
|
0
|
return $self->retries->{$ae}=$ae; |
1555
|
|
|
|
|
|
|
} |
1556
|
|
|
|
|
|
|
my $code=sub { |
1557
|
0
|
|
|
|
|
0
|
my ($self,undef,$result,undef,$response)=@_; |
1558
|
0
|
|
|
|
|
0
|
$cb->($self,$id,$result,$request,$response); |
1559
|
0
|
|
|
|
|
0
|
}; |
1560
|
|
|
|
|
|
|
|
1561
|
0
|
|
|
|
|
0
|
my $ae; |
1562
|
|
|
|
|
|
|
$ae=AnyEvent->timer(after=>$timeout,cb=>sub { |
1563
|
0
|
|
|
|
|
0
|
my $next_id=$self->queue_request($request,$code); |
1564
|
0
|
|
|
|
|
0
|
$self->add_ids_for_blocking($next_id); |
1565
|
0
|
|
|
|
|
0
|
$self->agent->run_next; |
1566
|
0
|
|
|
|
|
0
|
delete $self->retries->{$ae}; |
1567
|
0
|
|
|
|
|
0
|
undef $ae; |
1568
|
0
|
|
|
|
|
0
|
}); |
1569
|
0
|
|
|
|
|
0
|
return $self->retries->{$ae}=$ae; |
1570
|
|
|
|
|
|
|
|
1571
|
0
|
|
|
|
|
0
|
}; |
1572
|
|
|
|
|
|
|
} |
1573
|
|
|
|
|
|
|
|
1574
|
|
|
|
|
|
|
|
1575
|
|
|
|
|
|
|
|
1576
|
0
|
|
|
|
|
0
|
return $self->queue_request($request,$wrap); |
1577
|
|
|
|
|
|
|
} |
1578
|
|
|
|
|
|
|
|
1579
|
|
|
|
|
|
|
|
1580
|
|
|
|
|
|
|
=item * my $id=$self->que_post_json($cb,$url,$data); |
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
Queue's a json post and returns the id |
1583
|
|
|
|
|
|
|
|
1584
|
|
|
|
|
|
|
=cut |
1585
|
|
|
|
|
|
|
|
1586
|
|
|
|
|
|
|
sub que_post_json { |
1587
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$url,$data)=@_; |
1588
|
0
|
|
|
|
|
0
|
return $self->queue_builder($cb,'build_post_json',$url,$data); |
1589
|
|
|
|
|
|
|
} |
1590
|
|
|
|
|
|
|
|
1591
|
|
|
|
|
|
|
=item * my $result=$self->build_put_json($url,$data); |
1592
|
|
|
|
|
|
|
|
1593
|
|
|
|
|
|
|
Returns a Data::Result object; When true it contains an HTTP::Request Object For $url, the body will consist of $data converted to json. When false it contains why it failed. |
1594
|
|
|
|
|
|
|
|
1595
|
|
|
|
|
|
|
=cut |
1596
|
|
|
|
|
|
|
|
1597
|
|
|
|
|
|
|
sub build_put_json { |
1598
|
1
|
|
|
1
|
1
|
5994
|
my ($self,$url,$data)=@_; |
1599
|
|
|
|
|
|
|
|
1600
|
1
|
|
|
|
|
18
|
my $uri=$self->api_url.$url; |
1601
|
1
|
|
|
|
|
10
|
my $json=eval {to_json($data)}; |
|
1
|
|
|
|
|
6
|
|
1602
|
1
|
50
|
|
|
|
18
|
return $self->new_false("Failed to convert \$data to json, error was $@") if $@; |
1603
|
|
|
|
|
|
|
|
1604
|
1
|
|
|
|
|
5
|
my $request=new HTTP::Request(PUT=>$uri,$self->default_headers,$json); |
1605
|
1
|
|
|
|
|
148
|
return $self->new_true($request); |
1606
|
|
|
|
|
|
|
} |
1607
|
|
|
|
|
|
|
|
1608
|
|
|
|
|
|
|
=item * my $id=$self->que_put_json($cb,$url,$data); |
1609
|
|
|
|
|
|
|
|
1610
|
|
|
|
|
|
|
Queue's a json put and returns the id |
1611
|
|
|
|
|
|
|
|
1612
|
|
|
|
|
|
|
=cut |
1613
|
|
|
|
|
|
|
|
1614
|
|
|
|
|
|
|
sub que_put_json { |
1615
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$url,$data)=@_; |
1616
|
0
|
|
|
|
|
0
|
return $self->queue_builder($cb,'build_put_json',$url,$data); |
1617
|
|
|
|
|
|
|
} |
1618
|
|
|
|
|
|
|
|
1619
|
|
|
|
|
|
|
=item * my $result=$self->build_post_form($url,$data); |
1620
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed. |
1622
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
=cut |
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
sub build_post_form { |
1626
|
1
|
|
|
1
|
1
|
2281
|
my ($self,$url,$data)=@_; |
1627
|
|
|
|
|
|
|
|
1628
|
1
|
|
|
|
|
18
|
my $uri=$self->api_url.$url; |
1629
|
1
|
|
|
|
|
16
|
my $form_ref; |
1630
|
1
|
50
|
|
|
|
7
|
if(is_plain_arrayref($data)) { |
|
|
50
|
|
|
|
|
|
1631
|
0
|
|
|
|
|
0
|
$form_ref=$data; |
1632
|
|
|
|
|
|
|
} elsif(is_plain_hashref($data)) { |
1633
|
1
|
|
|
|
|
2
|
$form_ref=[%{$data}]; |
|
1
|
|
|
|
|
5
|
|
1634
|
|
|
|
|
|
|
} else { |
1635
|
0
|
|
|
|
|
0
|
$self->new_failse('Failed to create form post, error was: $data is not a hash or array ref'); |
1636
|
|
|
|
|
|
|
} |
1637
|
|
|
|
|
|
|
|
1638
|
1
|
|
|
|
|
5
|
my $headers=$self->default_headers; |
1639
|
1
|
|
|
|
|
5
|
$headers->header('Content-Type', 'multipart/form-data'); |
1640
|
|
|
|
|
|
|
|
1641
|
1
|
|
|
|
|
43
|
my $post=POST $uri,$data; |
1642
|
1
|
|
|
|
|
660
|
my @list=$headers->flatten; |
1643
|
|
|
|
|
|
|
|
1644
|
1
|
|
|
|
|
112
|
while(my ($key,$value)=splice @list,0,2) { |
1645
|
2
|
|
|
|
|
52
|
$post->header($key,$value); |
1646
|
|
|
|
|
|
|
} |
1647
|
|
|
|
|
|
|
|
1648
|
1
|
|
|
|
|
50
|
return $self->new_true($post); |
1649
|
|
|
|
|
|
|
} |
1650
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
=item * my $id=$self->que_post_form($cb,$url,$data); |
1652
|
|
|
|
|
|
|
|
1653
|
|
|
|
|
|
|
Queue's a form post and returns the id |
1654
|
|
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
=cut |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
sub que_post_form { |
1658
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$url,$data)=@_; |
1659
|
0
|
|
|
|
|
0
|
return $self->queue_builder($cb,'build_post_form',$url,$data); |
1660
|
|
|
|
|
|
|
} |
1661
|
|
|
|
|
|
|
|
1662
|
|
|
|
|
|
|
=item * my $result=$self->build_get($url,$data); |
1663
|
|
|
|
|
|
|
|
1664
|
|
|
|
|
|
|
Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed. |
1665
|
|
|
|
|
|
|
|
1666
|
|
|
|
|
|
|
=cut |
1667
|
|
|
|
|
|
|
|
1668
|
|
|
|
|
|
|
sub build_get { |
1669
|
1
|
|
|
1
|
1
|
3093
|
my ($self,$url,$data)=@_; |
1670
|
|
|
|
|
|
|
|
1671
|
1
|
|
|
|
|
18
|
my $uri=$self->api_url.$url.'?'; |
1672
|
1
|
|
|
|
|
10
|
my @list; |
1673
|
1
|
50
|
|
|
|
6
|
if(is_plain_arrayref($data)) { |
|
|
50
|
|
|
|
|
|
1674
|
0
|
|
|
|
|
0
|
@list=@{$data}; |
|
0
|
|
|
|
|
0
|
|
1675
|
|
|
|
|
|
|
} elsif(is_plain_hashref($data)) { |
1676
|
1
|
|
|
|
|
3
|
@list=%{$data}; |
|
1
|
|
|
|
|
3
|
|
1677
|
|
|
|
|
|
|
} |
1678
|
|
|
|
|
|
|
|
1679
|
1
|
|
|
|
|
5
|
my $headers=$self->default_headers; |
1680
|
|
|
|
|
|
|
|
1681
|
1
|
|
|
|
|
8
|
my @args; |
1682
|
1
|
|
|
|
|
5
|
while(my ($key,$value)=splice @list,0,2) { |
1683
|
1
|
|
|
|
|
7
|
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value); |
1684
|
|
|
|
|
|
|
} |
1685
|
1
|
|
|
|
|
62
|
my $args=join '&',@args; |
1686
|
1
|
|
|
|
|
3
|
$uri .=$args; |
1687
|
|
|
|
|
|
|
|
1688
|
1
|
|
|
|
|
4
|
my $get=new HTTP::Request(GET=>$uri,$self->default_headers); |
1689
|
|
|
|
|
|
|
|
1690
|
1
|
|
|
|
|
145
|
return $self->new_true($get); |
1691
|
|
|
|
|
|
|
} |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
=item * my $self->que_getRaw($cb,$raw_url) |
1694
|
|
|
|
|
|
|
|
1695
|
|
|
|
|
|
|
Que's a diy get request |
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
=cut |
1698
|
|
|
|
|
|
|
|
1699
|
|
|
|
|
|
|
sub que_getRaw { |
1700
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$url)=@_; |
1701
|
0
|
|
|
|
|
0
|
my $req=HTTP::Request->new(GET=>$url,$self->default_headers); |
1702
|
0
|
|
|
|
|
0
|
return $self->queue_request($req,$cb); |
1703
|
|
|
|
|
|
|
} |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
=item * my $id=$self->que_get($cb,$url,$data); |
1706
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
Queue's a form post and returns the id |
1708
|
|
|
|
|
|
|
|
1709
|
|
|
|
|
|
|
=cut |
1710
|
|
|
|
|
|
|
|
1711
|
|
|
|
|
|
|
sub que_get { |
1712
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$url,$data)=@_; |
1713
|
0
|
|
|
|
|
0
|
return $self->queue_builder($cb,'build_get',$url,$data); |
1714
|
|
|
|
|
|
|
} |
1715
|
|
|
|
|
|
|
|
1716
|
|
|
|
|
|
|
=item * my $result=$self->build_head($url,$data); |
1717
|
|
|
|
|
|
|
|
1718
|
|
|
|
|
|
|
Returns a Data::Result Object, when true it contains the correctly fromatted HTTP::Request Object, when false it contains why it failed. |
1719
|
|
|
|
|
|
|
|
1720
|
|
|
|
|
|
|
=cut |
1721
|
|
|
|
|
|
|
|
1722
|
|
|
|
|
|
|
sub build_head { |
1723
|
1
|
|
|
1
|
1
|
2383
|
my ($self,$url,$data)=@_; |
1724
|
|
|
|
|
|
|
|
1725
|
1
|
|
|
|
|
16
|
my $uri=$self->api_url.$url.'?'; |
1726
|
1
|
|
|
|
|
10
|
my @list; |
1727
|
1
|
50
|
|
|
|
11
|
if(is_plain_arrayref($data)) { |
|
|
50
|
|
|
|
|
|
1728
|
0
|
|
|
|
|
0
|
@list=@{$data}; |
|
0
|
|
|
|
|
0
|
|
1729
|
|
|
|
|
|
|
} elsif(is_plain_hashref($data)) { |
1730
|
1
|
|
|
|
|
2
|
@list=%{$data}; |
|
1
|
|
|
|
|
4
|
|
1731
|
|
|
|
|
|
|
} |
1732
|
|
|
|
|
|
|
|
1733
|
1
|
|
|
|
|
5
|
my $headers=$self->default_headers; |
1734
|
|
|
|
|
|
|
|
1735
|
|
|
|
|
|
|
|
1736
|
1
|
|
|
|
|
3
|
my @args; |
1737
|
1
|
|
|
|
|
4
|
while(my ($key,$value)=splice @list,0,2) { |
1738
|
1
|
|
|
|
|
4
|
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value); |
1739
|
|
|
|
|
|
|
} |
1740
|
1
|
|
|
|
|
51
|
my $args=join '&',@args; |
1741
|
1
|
|
|
|
|
4
|
$uri .=$args; |
1742
|
|
|
|
|
|
|
|
1743
|
1
|
|
|
|
|
3
|
my $get=new HTTP::Request(HEAD=>$uri,$self->default_headers); |
1744
|
|
|
|
|
|
|
|
1745
|
1
|
|
|
|
|
123
|
return $self->new_true($get); |
1746
|
|
|
|
|
|
|
} |
1747
|
|
|
|
|
|
|
|
1748
|
|
|
|
|
|
|
=item * my $id=$self->que_head($cb,$url,$data); |
1749
|
|
|
|
|
|
|
|
1750
|
|
|
|
|
|
|
Queue's a form post and returns the id |
1751
|
|
|
|
|
|
|
|
1752
|
|
|
|
|
|
|
=cut |
1753
|
|
|
|
|
|
|
|
1754
|
|
|
|
|
|
|
sub que_head{ |
1755
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$url,$data)=@_; |
1756
|
0
|
|
|
|
|
0
|
return $self->queue_builder($cb,'build_head',$url,$data); |
1757
|
|
|
|
|
|
|
} |
1758
|
|
|
|
|
|
|
|
1759
|
|
|
|
|
|
|
=item * my $result=$self->build_delete($url,$data); |
1760
|
|
|
|
|
|
|
|
1761
|
|
|
|
|
|
|
Returns a Data::Result Object, when true it contains the delete request, when false it contains why it failed. |
1762
|
|
|
|
|
|
|
|
1763
|
|
|
|
|
|
|
=cut |
1764
|
|
|
|
|
|
|
|
1765
|
|
|
|
|
|
|
sub build_delete { |
1766
|
1
|
|
|
1
|
1
|
2386
|
my ($self,$url,$data)=@_; |
1767
|
|
|
|
|
|
|
|
1768
|
1
|
|
|
|
|
18
|
my $uri=$self->api_url.$url.'?'; |
1769
|
1
|
|
|
|
|
10
|
my @list; |
1770
|
1
|
50
|
|
|
|
6
|
if(is_plain_arrayref($data)) { |
|
|
50
|
|
|
|
|
|
1771
|
0
|
|
|
|
|
0
|
@list=@{$data}; |
|
0
|
|
|
|
|
0
|
|
1772
|
|
|
|
|
|
|
} elsif(is_plain_hashref($data)) { |
1773
|
1
|
|
|
|
|
2
|
@list=%{$data}; |
|
1
|
|
|
|
|
4
|
|
1774
|
|
|
|
|
|
|
} |
1775
|
|
|
|
|
|
|
|
1776
|
1
|
|
|
|
|
5
|
my $headers=$self->default_headers; |
1777
|
|
|
|
|
|
|
|
1778
|
1
|
|
|
|
|
2
|
my @args; |
1779
|
1
|
|
|
|
|
5
|
while(my ($key,$value)=splice @list,0,2) { |
1780
|
1
|
|
|
|
|
4
|
push @args,uri_escape_utf8($key).'='.uri_escape_utf8($value); |
1781
|
|
|
|
|
|
|
} |
1782
|
1
|
|
|
|
|
36
|
my $args=join '&',@args; |
1783
|
1
|
|
|
|
|
2
|
$uri .=$args; |
1784
|
|
|
|
|
|
|
|
1785
|
1
|
|
|
|
|
4
|
my $get=new HTTP::Request(DELETE=>$uri,$self->default_headers); |
1786
|
|
|
|
|
|
|
|
1787
|
1
|
|
|
|
|
121
|
return $self->new_true($get); |
1788
|
|
|
|
|
|
|
} |
1789
|
|
|
|
|
|
|
|
1790
|
|
|
|
|
|
|
=item * my $id=$self->que_delete($cb,$url,$data); |
1791
|
|
|
|
|
|
|
|
1792
|
|
|
|
|
|
|
Ques a delete to run. |
1793
|
|
|
|
|
|
|
|
1794
|
|
|
|
|
|
|
=cut |
1795
|
|
|
|
|
|
|
|
1796
|
|
|
|
|
|
|
sub que_delete { |
1797
|
0
|
|
|
0
|
1
|
0
|
my ($self,$cb,$url,$data)=@_; |
1798
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
my $code=sub { |
1800
|
0
|
|
|
0
|
|
0
|
my ($self,$id,$result,$request,$response)=@_; |
1801
|
0
|
|
|
|
|
0
|
$self->handle_delete($cb,$id,$result,$request,$response); |
1802
|
0
|
|
|
|
|
0
|
}; |
1803
|
0
|
|
|
|
|
0
|
return $self->queue_builder($code,'build_delete',$url,$data); |
1804
|
|
|
|
|
|
|
} |
1805
|
|
|
|
|
|
|
|
1806
|
|
|
|
|
|
|
=item * $self->handle_delete($cb,$id,$result,$result) |
1807
|
|
|
|
|
|
|
|
1808
|
|
|
|
|
|
|
Internal handler for delete results |
1809
|
|
|
|
|
|
|
|
1810
|
|
|
|
|
|
|
=cut |
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
sub handle_delete { |
1813
|
2
|
|
|
2
|
1
|
3727
|
my ($self,$cb,$id,undef,$request,$response)=@_; |
1814
|
2
|
100
|
|
|
|
5
|
if($response->code==204) { |
1815
|
1
|
|
|
|
|
17
|
my $result=$self->new_true({message=>'Deleted'}); |
1816
|
1
|
|
|
|
|
181
|
$cb->($self,$id,$result,$request,$response); |
1817
|
|
|
|
|
|
|
} else { |
1818
|
1
|
|
|
|
|
19
|
my $result=$self->new_false("Delete Failed, error was: ".$response->status_line); |
1819
|
1
|
|
|
|
|
225
|
$cb->($self,$id,$result,$request,$response); |
1820
|
|
|
|
|
|
|
} |
1821
|
|
|
|
|
|
|
} |
1822
|
|
|
|
|
|
|
|
1823
|
|
|
|
|
|
|
=back |
1824
|
|
|
|
|
|
|
|
1825
|
|
|
|
|
|
|
=head1 AUTHOR |
1826
|
|
|
|
|
|
|
|
1827
|
|
|
|
|
|
|
Michael Shipper <AKALINUX@CPAN.ORG> |
1828
|
|
|
|
|
|
|
|
1829
|
|
|
|
|
|
|
=cut |
1830
|
|
|
|
|
|
|
|
1831
|
|
|
|
|
|
|
1; |