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