line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# vim:set sw=4 ts=4 sts=4 ft=perl expandtab: |
2
|
|
|
|
|
|
|
package Etherpad; |
3
|
|
|
|
|
|
|
# ABSTRACT: interact with Etherpad API |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
141999
|
use Mojo::Base -base; |
|
2
|
|
|
|
|
382497
|
|
|
2
|
|
|
|
|
16
|
|
6
|
2
|
|
|
2
|
|
1512
|
use Mojo::UserAgent; |
|
2
|
|
|
|
|
522582
|
|
|
2
|
|
|
|
|
18
|
|
7
|
2
|
|
|
2
|
|
92
|
use Mojo::JSON qw(decode_json); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
92
|
|
8
|
2
|
|
|
2
|
|
28
|
use Mojo::IOLoop; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
26
|
|
9
|
2
|
|
|
2
|
|
54
|
use Data::Dumper; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
141
|
|
10
|
2
|
|
|
2
|
|
15
|
use Carp qw(carp); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
12048
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has 'url'; |
13
|
|
|
|
|
|
|
has 'apikey'; |
14
|
|
|
|
|
|
|
has 'user'; |
15
|
|
|
|
|
|
|
has 'password'; |
16
|
|
|
|
|
|
|
has 'proxy'; |
17
|
|
|
|
|
|
|
has 'ua' => sub { Mojo::UserAgent->new; }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '1.2.14.0'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _execute { |
23
|
0
|
|
|
0
|
|
|
my $c = shift; |
24
|
0
|
|
|
|
|
|
my $args = shift; |
25
|
|
|
|
|
|
|
|
26
|
0
|
0
|
|
|
|
|
if (defined $c->proxy) { |
27
|
0
|
0
|
|
|
|
|
if ($c->proxy->{detect}) { |
28
|
0
|
|
|
|
|
|
$c->ua->proxy->detect; |
29
|
|
|
|
|
|
|
} else { |
30
|
0
|
0
|
|
|
|
|
$c->ua->proxy->http($c->proxy->{http}) if defined $c->proxy->{http}; |
31
|
0
|
0
|
|
|
|
|
$c->ua->proxy->http($c->proxy->{https}) if defined $c->proxy->{https}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $url = Mojo::URL->new($c->url); |
36
|
0
|
0
|
0
|
|
|
|
$url->userinfo($c->user.':'.$c->password) if defined $c->user && defined $c->password; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $path = $url->path; |
39
|
0
|
|
|
|
|
|
$path =~ s#/$##; |
40
|
0
|
|
|
|
|
|
$url->path($path.'/api/'.$args->{api}.'/'.$args->{method}); |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$args->{args}->{apikey} = $c->apikey; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $res = $c->ua->get($url => form => $args->{args})->result; |
45
|
0
|
0
|
|
|
|
|
if ($res->is_success) { |
46
|
|
|
|
|
|
|
# Can’t use $res->json when json is too large |
47
|
0
|
|
|
|
|
|
my $json = decode_json($res->body); |
48
|
0
|
0
|
|
|
|
|
if ($json->{code} == 0) { |
49
|
0
|
0
|
|
|
|
|
return 1 if $args->{boolean}; |
50
|
0
|
|
|
|
|
|
my $data; |
51
|
0
|
0
|
|
|
|
|
if (defined $args->{key}) { |
52
|
0
|
0
|
|
|
|
|
$data = (ref($json->{data}) eq 'HASH') ? $json->{data}->{$args->{key}} : $json->{data}; |
53
|
|
|
|
|
|
|
} else { |
54
|
0
|
|
|
|
|
|
$data = $json->{data}; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
return (wantarray) ? @{$data}: $data if ref($data) eq 'ARRAY'; |
|
0
|
0
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $data; |
59
|
|
|
|
|
|
|
} else { |
60
|
0
|
|
|
|
|
|
carp $json->{message}; |
61
|
0
|
|
|
|
|
|
return undef; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} else { |
64
|
0
|
|
|
|
|
|
carp Dumper $res->message; |
65
|
0
|
|
|
|
|
|
return undef; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
################################################################# |
71
|
|
|
|
|
|
|
################################################################# |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#################### subroutine header end #################### |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub create_group { |
80
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
81
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
return $c->_execute({ |
83
|
|
|
|
|
|
|
api => 1, |
84
|
|
|
|
|
|
|
method => 'createGroup', |
85
|
|
|
|
|
|
|
key => 'groupID' |
86
|
|
|
|
|
|
|
}); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
#################### subroutine header end #################### |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub create_group_if_not_exists_for { |
97
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
98
|
0
|
|
|
|
|
|
my $group_mapper = shift; |
99
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
unless (defined($group_mapper)) { |
101
|
0
|
|
|
|
|
|
carp 'Please provide a group id'; |
102
|
0
|
|
|
|
|
|
return undef; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $args = { |
106
|
|
|
|
|
|
|
groupMapper => $group_mapper |
107
|
|
|
|
|
|
|
}; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
return $c->_execute({ |
110
|
|
|
|
|
|
|
api => 1, |
111
|
|
|
|
|
|
|
method => 'createGroupIfNotExistsFor', |
112
|
|
|
|
|
|
|
key => 'groupID', |
113
|
|
|
|
|
|
|
args => $args |
114
|
|
|
|
|
|
|
}); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
#################### subroutine header end #################### |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub delete_group { |
125
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
126
|
0
|
|
|
|
|
|
my $group_id = shift; |
127
|
|
|
|
|
|
|
|
128
|
0
|
0
|
|
|
|
|
unless (defined($group_id)) { |
129
|
0
|
|
|
|
|
|
carp 'Please provide a group id'; |
130
|
0
|
|
|
|
|
|
return undef; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
|
my $args = { |
134
|
|
|
|
|
|
|
groupID => $group_id |
135
|
|
|
|
|
|
|
}; |
136
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
return $c->_execute({ |
138
|
|
|
|
|
|
|
api => 1, |
139
|
|
|
|
|
|
|
method => 'deleteGroup', |
140
|
|
|
|
|
|
|
boolean => 1, |
141
|
|
|
|
|
|
|
args => $args |
142
|
|
|
|
|
|
|
}); |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
#################### subroutine header end #################### |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub list_pads { |
153
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
154
|
0
|
|
|
|
|
|
my $group_id = shift; |
155
|
|
|
|
|
|
|
|
156
|
0
|
0
|
|
|
|
|
unless (defined($group_id)) { |
157
|
0
|
|
|
|
|
|
carp 'Please provide a group id'; |
158
|
0
|
|
|
|
|
|
return undef; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
my $args = { |
162
|
|
|
|
|
|
|
groupID => $group_id |
163
|
|
|
|
|
|
|
}; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
|
return $c->_execute({ |
166
|
|
|
|
|
|
|
api => 1, |
167
|
|
|
|
|
|
|
method => 'listPads', |
168
|
|
|
|
|
|
|
key => 'padIDs', |
169
|
|
|
|
|
|
|
args => $args |
170
|
|
|
|
|
|
|
}); |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
#################### subroutine header end #################### |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub create_group_pad { |
181
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
182
|
0
|
|
|
|
|
|
my $group_id = shift; |
183
|
0
|
|
|
|
|
|
my $pad_name = shift; |
184
|
0
|
|
|
|
|
|
my $text = shift; |
185
|
|
|
|
|
|
|
|
186
|
0
|
0
|
|
|
|
|
unless (defined($pad_name)) { |
187
|
0
|
|
|
|
|
|
carp 'Please provide at least 2 arguments : the group id and the pad name'; |
188
|
|
|
|
|
|
|
return undef |
189
|
0
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
my $args = { |
192
|
|
|
|
|
|
|
groupID => $group_id, |
193
|
|
|
|
|
|
|
padName => $pad_name |
194
|
|
|
|
|
|
|
}; |
195
|
0
|
0
|
|
|
|
|
$args->{text} = $text if defined $text; |
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
return $c->_execute({ |
198
|
|
|
|
|
|
|
api => 1, |
199
|
|
|
|
|
|
|
method => 'createGroupPad', |
200
|
|
|
|
|
|
|
boolean => 1, |
201
|
|
|
|
|
|
|
args => $args |
202
|
|
|
|
|
|
|
}); |
203
|
|
|
|
|
|
|
} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
#################### subroutine header end #################### |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub list_all_groups { |
213
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
214
|
|
|
|
|
|
|
|
215
|
0
|
|
|
|
|
|
return $c->_execute({ |
216
|
|
|
|
|
|
|
api => '1.1', |
217
|
|
|
|
|
|
|
method => 'listAllGroups', |
218
|
|
|
|
|
|
|
key => 'groupIDs' |
219
|
|
|
|
|
|
|
}); |
220
|
|
|
|
|
|
|
} |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
################################################################# |
224
|
|
|
|
|
|
|
################################################################# |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
#################### subroutine header end #################### |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
sub create_author { |
233
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
234
|
0
|
|
|
|
|
|
my $name = shift; |
235
|
|
|
|
|
|
|
|
236
|
0
|
|
|
|
|
|
my $args = {}; |
237
|
0
|
0
|
|
|
|
|
$args->{name} = $name if defined $name; |
238
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
|
return $c->_execute({ |
240
|
|
|
|
|
|
|
api => 1, |
241
|
|
|
|
|
|
|
method => 'createAuthor', |
242
|
|
|
|
|
|
|
key => 'authorID', |
243
|
|
|
|
|
|
|
args => $args |
244
|
|
|
|
|
|
|
}); |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
#################### subroutine header end #################### |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub create_author_if_not_exists_for { |
255
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
256
|
0
|
|
|
|
|
|
my $author_mapper = shift; |
257
|
0
|
|
|
|
|
|
my $name = shift; |
258
|
|
|
|
|
|
|
|
259
|
0
|
0
|
|
|
|
|
unless (defined($author_mapper)) { |
260
|
0
|
|
|
|
|
|
carp 'Please provide your application author id'; |
261
|
0
|
|
|
|
|
|
return undef; |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
my $args = { |
265
|
|
|
|
|
|
|
authorMapper => $author_mapper |
266
|
|
|
|
|
|
|
}; |
267
|
0
|
0
|
|
|
|
|
$args->{name} = $name if defined $name; |
268
|
|
|
|
|
|
|
|
269
|
0
|
|
|
|
|
|
return $c->_execute({ |
270
|
|
|
|
|
|
|
api => 1, |
271
|
|
|
|
|
|
|
method => 'createAuthorIfNotExistsFor', |
272
|
|
|
|
|
|
|
key => 'authorID', |
273
|
|
|
|
|
|
|
args => $args |
274
|
|
|
|
|
|
|
}); |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
#################### subroutine header end #################### |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
sub list_pads_of_author { |
285
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
286
|
0
|
|
|
|
|
|
my $author_id = shift; |
287
|
|
|
|
|
|
|
|
288
|
0
|
0
|
|
|
|
|
unless (defined($author_id)) { |
289
|
0
|
|
|
|
|
|
carp 'Please provide an author id'; |
290
|
0
|
|
|
|
|
|
return undef; |
291
|
|
|
|
|
|
|
} |
292
|
|
|
|
|
|
|
|
293
|
0
|
|
|
|
|
|
my $args = { |
294
|
|
|
|
|
|
|
authorID => $author_id |
295
|
|
|
|
|
|
|
}; |
296
|
|
|
|
|
|
|
|
297
|
0
|
|
|
|
|
|
return $c->_execute({ |
298
|
|
|
|
|
|
|
api => 1, |
299
|
|
|
|
|
|
|
method => 'listPadsOfAuthor', |
300
|
|
|
|
|
|
|
key => 'padIDs', |
301
|
|
|
|
|
|
|
args => $args |
302
|
|
|
|
|
|
|
}); |
303
|
|
|
|
|
|
|
} |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
#################### subroutine header end #################### |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
sub get_author_name { |
310
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
311
|
0
|
|
|
|
|
|
my $author_id = shift; |
312
|
|
|
|
|
|
|
|
313
|
0
|
0
|
|
|
|
|
unless (defined($author_id)) { |
314
|
0
|
|
|
|
|
|
carp 'Please provide an author id'; |
315
|
0
|
|
|
|
|
|
return undef; |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
0
|
|
|
|
|
|
my $args = { |
319
|
|
|
|
|
|
|
authorID => $author_id |
320
|
|
|
|
|
|
|
}; |
321
|
|
|
|
|
|
|
|
322
|
0
|
|
|
|
|
|
return $c->_execute({ |
323
|
|
|
|
|
|
|
api => '1.1', |
324
|
|
|
|
|
|
|
method => 'getAuthorName', |
325
|
|
|
|
|
|
|
key => 'authorName', |
326
|
|
|
|
|
|
|
args => $args |
327
|
|
|
|
|
|
|
}); |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
################################################################# |
332
|
|
|
|
|
|
|
################################################################# |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
#################### subroutine header end #################### |
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
sub create_session { |
341
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
342
|
0
|
|
|
|
|
|
my $group_id = shift; |
343
|
0
|
|
|
|
|
|
my $author_id = shift; |
344
|
0
|
|
|
|
|
|
my $valid_until = shift; |
345
|
|
|
|
|
|
|
|
346
|
0
|
0
|
|
|
|
|
unless (defined($valid_until)) { |
347
|
0
|
|
|
|
|
|
carp 'Please provide 3 arguments : the group id, the author id and a valid unix timestamp'; |
348
|
0
|
|
|
|
|
|
return undef; |
349
|
|
|
|
|
|
|
} |
350
|
0
|
0
|
|
|
|
|
unless ($valid_until =~ m/\d+/) { |
351
|
0
|
|
|
|
|
|
carp 'Please provide a *valid* unix timestamp as third argument'; |
352
|
0
|
|
|
|
|
|
return undef; |
353
|
|
|
|
|
|
|
} |
354
|
|
|
|
|
|
|
|
355
|
0
|
|
|
|
|
|
my $args = { |
356
|
|
|
|
|
|
|
groupID => $group_id, |
357
|
|
|
|
|
|
|
authorID => $author_id, |
358
|
|
|
|
|
|
|
validUntil => $valid_until |
359
|
|
|
|
|
|
|
}; |
360
|
|
|
|
|
|
|
|
361
|
0
|
|
|
|
|
|
return $c->_execute({ |
362
|
|
|
|
|
|
|
api => 1, |
363
|
|
|
|
|
|
|
method => 'createSession', |
364
|
|
|
|
|
|
|
key => 'sessionID', |
365
|
|
|
|
|
|
|
args => $args |
366
|
|
|
|
|
|
|
}); |
367
|
|
|
|
|
|
|
} |
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
#################### subroutine header end #################### |
374
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
sub delete_session { |
377
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
378
|
0
|
|
|
|
|
|
my $session_id = shift; |
379
|
|
|
|
|
|
|
|
380
|
0
|
0
|
|
|
|
|
unless (defined($session_id)) { |
381
|
0
|
|
|
|
|
|
carp 'Please provide a session id'; |
382
|
0
|
|
|
|
|
|
return undef; |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
|
385
|
0
|
|
|
|
|
|
my $args = { |
386
|
|
|
|
|
|
|
sessionID => $session_id |
387
|
|
|
|
|
|
|
}; |
388
|
|
|
|
|
|
|
|
389
|
0
|
|
|
|
|
|
return $c->_execute({ |
390
|
|
|
|
|
|
|
api => 1, |
391
|
|
|
|
|
|
|
method => 'deleteSession', |
392
|
|
|
|
|
|
|
boolean => 1, |
393
|
|
|
|
|
|
|
args => $args |
394
|
|
|
|
|
|
|
}); |
395
|
|
|
|
|
|
|
} |
396
|
|
|
|
|
|
|
|
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
#################### subroutine header end #################### |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
sub get_session_info { |
405
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
406
|
0
|
|
|
|
|
|
my $session_id = shift; |
407
|
|
|
|
|
|
|
|
408
|
0
|
0
|
|
|
|
|
unless (defined($session_id)) { |
409
|
0
|
|
|
|
|
|
carp 'Please provide a session id'; |
410
|
0
|
|
|
|
|
|
return undef; |
411
|
|
|
|
|
|
|
} |
412
|
|
|
|
|
|
|
|
413
|
0
|
|
|
|
|
|
my $args = { |
414
|
|
|
|
|
|
|
sessionID => $session_id |
415
|
|
|
|
|
|
|
}; |
416
|
|
|
|
|
|
|
|
417
|
0
|
|
|
|
|
|
return $c->_execute({ |
418
|
|
|
|
|
|
|
api => 1, |
419
|
|
|
|
|
|
|
method => 'getSessionInfo', |
420
|
|
|
|
|
|
|
args => $args |
421
|
|
|
|
|
|
|
}); |
422
|
|
|
|
|
|
|
} |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
#################### subroutine header end #################### |
429
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
sub list_sessions_of_group { |
432
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
433
|
0
|
|
|
|
|
|
my $group_id = shift; |
434
|
|
|
|
|
|
|
|
435
|
0
|
0
|
|
|
|
|
unless (defined($group_id)) { |
436
|
0
|
|
|
|
|
|
carp 'Please provide a group id'; |
437
|
0
|
|
|
|
|
|
return undef; |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
|
440
|
0
|
|
|
|
|
|
my $args = { |
441
|
|
|
|
|
|
|
groupID => $group_id |
442
|
|
|
|
|
|
|
}; |
443
|
|
|
|
|
|
|
|
444
|
0
|
|
|
|
|
|
return $c->_execute({ |
445
|
|
|
|
|
|
|
api => 1, |
446
|
|
|
|
|
|
|
method => 'listSessionsOfGroup', |
447
|
|
|
|
|
|
|
args => $args |
448
|
|
|
|
|
|
|
}); |
449
|
|
|
|
|
|
|
} |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
453
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
#################### subroutine header end #################### |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
sub list_sessions_of_author { |
459
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
460
|
0
|
|
|
|
|
|
my $author_id = shift; |
461
|
|
|
|
|
|
|
|
462
|
0
|
0
|
|
|
|
|
unless (defined($author_id)) { |
463
|
0
|
|
|
|
|
|
carp 'Please provide an author id'; |
464
|
0
|
|
|
|
|
|
return undef; |
465
|
|
|
|
|
|
|
} |
466
|
|
|
|
|
|
|
|
467
|
0
|
|
|
|
|
|
my $args = { |
468
|
|
|
|
|
|
|
authorID => $author_id |
469
|
|
|
|
|
|
|
}; |
470
|
|
|
|
|
|
|
|
471
|
0
|
|
|
|
|
|
return $c->_execute({ |
472
|
|
|
|
|
|
|
api => 1, |
473
|
|
|
|
|
|
|
method => 'listSessionsOfAuthor', |
474
|
|
|
|
|
|
|
args => $args |
475
|
|
|
|
|
|
|
}); |
476
|
|
|
|
|
|
|
} |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
################################################################# |
480
|
|
|
|
|
|
|
################################################################# |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
|
485
|
|
|
|
|
|
|
#################### subroutine header end #################### |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
sub get_text { |
489
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
490
|
0
|
|
|
|
|
|
my $pad_id = shift; |
491
|
0
|
|
|
|
|
|
my $rev = shift; |
492
|
|
|
|
|
|
|
|
493
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
494
|
0
|
|
|
|
|
|
carp 'Please provide at least a pad id'; |
495
|
0
|
|
|
|
|
|
return undef; |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
|
498
|
0
|
|
|
|
|
|
my $args = { |
499
|
|
|
|
|
|
|
padID => $pad_id |
500
|
|
|
|
|
|
|
}; |
501
|
0
|
0
|
|
|
|
|
$args->{rev} = $rev if defined $rev; |
502
|
|
|
|
|
|
|
|
503
|
0
|
|
|
|
|
|
my $result = $c->_execute({ |
504
|
|
|
|
|
|
|
api => 1, |
505
|
|
|
|
|
|
|
method => 'getText', |
506
|
|
|
|
|
|
|
key => 'text', |
507
|
|
|
|
|
|
|
args => $args |
508
|
|
|
|
|
|
|
}); |
509
|
|
|
|
|
|
|
|
510
|
0
|
0
|
|
|
|
|
return $result->{text} if (ref $result eq 'HASH'); |
511
|
0
|
|
|
|
|
|
return $result; |
512
|
|
|
|
|
|
|
} |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
#################### subroutine header end #################### |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
sub set_text { |
522
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
523
|
0
|
|
|
|
|
|
my $pad_id = shift; |
524
|
0
|
|
|
|
|
|
my $text = shift; |
525
|
|
|
|
|
|
|
|
526
|
0
|
0
|
|
|
|
|
unless (defined($text)) { |
527
|
0
|
|
|
|
|
|
carp 'Please provide 2 arguments : a pad id and a text'; |
528
|
0
|
|
|
|
|
|
return undef; |
529
|
|
|
|
|
|
|
} |
530
|
|
|
|
|
|
|
|
531
|
0
|
|
|
|
|
|
my $args = { |
532
|
|
|
|
|
|
|
padID => $pad_id, |
533
|
|
|
|
|
|
|
text => $text |
534
|
|
|
|
|
|
|
}; |
535
|
|
|
|
|
|
|
|
536
|
0
|
|
|
|
|
|
return $c->_execute({ |
537
|
|
|
|
|
|
|
api => 1, |
538
|
|
|
|
|
|
|
method => 'setText', |
539
|
|
|
|
|
|
|
boolean => 1, |
540
|
|
|
|
|
|
|
args => $args |
541
|
|
|
|
|
|
|
}); |
542
|
|
|
|
|
|
|
} |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
#################### subroutine header end #################### |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
sub append_text { |
552
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
553
|
0
|
|
|
|
|
|
my $pad_id = shift; |
554
|
0
|
|
|
|
|
|
my $text = shift; |
555
|
|
|
|
|
|
|
|
556
|
0
|
0
|
|
|
|
|
unless (defined($text)) { |
557
|
0
|
|
|
|
|
|
carp 'Please provide 2 arguments : a pad id and a text'; |
558
|
0
|
|
|
|
|
|
return undef; |
559
|
|
|
|
|
|
|
} |
560
|
|
|
|
|
|
|
|
561
|
0
|
|
|
|
|
|
my $args = { |
562
|
|
|
|
|
|
|
padID => $pad_id, |
563
|
|
|
|
|
|
|
text => $text |
564
|
|
|
|
|
|
|
}; |
565
|
|
|
|
|
|
|
|
566
|
0
|
|
|
|
|
|
return $c->_execute({ |
567
|
|
|
|
|
|
|
api => '1.2.13', |
568
|
|
|
|
|
|
|
method => 'appendText', |
569
|
|
|
|
|
|
|
boolean => 1, |
570
|
|
|
|
|
|
|
args => $args |
571
|
|
|
|
|
|
|
}); |
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
|
575
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
576
|
|
|
|
|
|
|
|
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
#################### subroutine header end #################### |
579
|
|
|
|
|
|
|
|
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
sub get_html { |
582
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
583
|
0
|
|
|
|
|
|
my $pad_id = shift; |
584
|
0
|
|
|
|
|
|
my $rev = shift; |
585
|
|
|
|
|
|
|
|
586
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
587
|
0
|
|
|
|
|
|
carp 'Please provide at least a pad id'; |
588
|
0
|
|
|
|
|
|
return undef; |
589
|
|
|
|
|
|
|
} |
590
|
|
|
|
|
|
|
|
591
|
0
|
|
|
|
|
|
my $args = { |
592
|
|
|
|
|
|
|
padID => $pad_id |
593
|
|
|
|
|
|
|
}; |
594
|
0
|
0
|
|
|
|
|
$args->{rev} = $rev if defined $rev; |
595
|
|
|
|
|
|
|
|
596
|
0
|
|
|
|
|
|
return $c->_execute({ |
597
|
|
|
|
|
|
|
api => 1, |
598
|
|
|
|
|
|
|
method => 'getHTML', |
599
|
|
|
|
|
|
|
key => 'html', |
600
|
|
|
|
|
|
|
args => $args |
601
|
|
|
|
|
|
|
}); |
602
|
|
|
|
|
|
|
} |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
#################### subroutine header end #################### |
609
|
|
|
|
|
|
|
|
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
sub set_html { |
612
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
613
|
0
|
|
|
|
|
|
my $pad_id = shift; |
614
|
0
|
|
|
|
|
|
my $html = shift; |
615
|
|
|
|
|
|
|
|
616
|
0
|
0
|
|
|
|
|
unless (defined($html)) { |
617
|
0
|
|
|
|
|
|
carp 'Please provide 2 arguments : a pad id and a HTML code'; |
618
|
0
|
|
|
|
|
|
return undef; |
619
|
|
|
|
|
|
|
} |
620
|
|
|
|
|
|
|
|
621
|
0
|
|
|
|
|
|
my $args = { |
622
|
|
|
|
|
|
|
padID => $pad_id, |
623
|
|
|
|
|
|
|
html => $html |
624
|
|
|
|
|
|
|
}; |
625
|
|
|
|
|
|
|
|
626
|
0
|
|
|
|
|
|
return $c->_execute({ |
627
|
|
|
|
|
|
|
api => 1, |
628
|
|
|
|
|
|
|
method => 'setHTML', |
629
|
|
|
|
|
|
|
boolean => 1, |
630
|
|
|
|
|
|
|
args => $args |
631
|
|
|
|
|
|
|
}); |
632
|
|
|
|
|
|
|
} |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
|
638
|
|
|
|
|
|
|
#################### subroutine header end #################### |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
|
641
|
|
|
|
|
|
|
sub get_attribute_pool { |
642
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
643
|
0
|
|
|
|
|
|
my $pad_id = shift; |
644
|
|
|
|
|
|
|
|
645
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
646
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
647
|
0
|
|
|
|
|
|
return undef; |
648
|
|
|
|
|
|
|
} |
649
|
|
|
|
|
|
|
|
650
|
0
|
|
|
|
|
|
my $args = { |
651
|
|
|
|
|
|
|
padID => $pad_id |
652
|
|
|
|
|
|
|
}; |
653
|
|
|
|
|
|
|
|
654
|
0
|
|
|
|
|
|
return $c->_execute({ |
655
|
|
|
|
|
|
|
api => '1.2.8', |
656
|
|
|
|
|
|
|
method => 'getAttributePool', |
657
|
|
|
|
|
|
|
key => 'pool', |
658
|
|
|
|
|
|
|
args => $args |
659
|
|
|
|
|
|
|
}); |
660
|
|
|
|
|
|
|
} |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
#################### subroutine header end #################### |
667
|
|
|
|
|
|
|
|
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
sub get_revision_changeset { |
670
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
671
|
0
|
|
|
|
|
|
my $pad_id = shift; |
672
|
0
|
|
|
|
|
|
my $rev = shift; |
673
|
|
|
|
|
|
|
|
674
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
675
|
0
|
|
|
|
|
|
carp 'Please provide at least a pad id'; |
676
|
0
|
|
|
|
|
|
return undef; |
677
|
|
|
|
|
|
|
} |
678
|
|
|
|
|
|
|
|
679
|
0
|
|
|
|
|
|
my $args = { |
680
|
|
|
|
|
|
|
padID => $pad_id |
681
|
|
|
|
|
|
|
}; |
682
|
0
|
0
|
|
|
|
|
$args->{rev} = $rev if defined $rev; |
683
|
|
|
|
|
|
|
|
684
|
0
|
|
|
|
|
|
return $c->_execute({ |
685
|
|
|
|
|
|
|
api => '1.2.8', |
686
|
|
|
|
|
|
|
method => 'getRevisionChangeset', |
687
|
|
|
|
|
|
|
args => $args |
688
|
|
|
|
|
|
|
}); |
689
|
|
|
|
|
|
|
} |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
#################### subroutine header end #################### |
696
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
sub create_diff_html { |
699
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
700
|
0
|
|
|
|
|
|
my $pad_id = shift; |
701
|
0
|
|
|
|
|
|
my $start_rev = shift; |
702
|
0
|
|
|
|
|
|
my $end_rev = shift; |
703
|
|
|
|
|
|
|
|
704
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
705
|
0
|
|
|
|
|
|
carp 'Please provide a pad id, a start_rev and an end_rev'; |
706
|
0
|
|
|
|
|
|
return undef; |
707
|
|
|
|
|
|
|
} |
708
|
|
|
|
|
|
|
|
709
|
0
|
0
|
|
|
|
|
unless (defined($start_rev)) { |
710
|
0
|
|
|
|
|
|
carp 'Please provide a start_rev and an end_rev'; |
711
|
0
|
|
|
|
|
|
return undef; |
712
|
|
|
|
|
|
|
} |
713
|
|
|
|
|
|
|
|
714
|
0
|
0
|
|
|
|
|
unless (defined($end_rev)) { |
715
|
0
|
|
|
|
|
|
carp 'Please provide an end_rev'; |
716
|
0
|
|
|
|
|
|
return undef; |
717
|
|
|
|
|
|
|
} |
718
|
|
|
|
|
|
|
|
719
|
0
|
|
|
|
|
|
my $args = { |
720
|
|
|
|
|
|
|
padID => $pad_id, |
721
|
|
|
|
|
|
|
startRev => $start_rev, |
722
|
|
|
|
|
|
|
endRev => $end_rev |
723
|
|
|
|
|
|
|
}; |
724
|
|
|
|
|
|
|
|
725
|
0
|
|
|
|
|
|
return $c->_execute({ |
726
|
|
|
|
|
|
|
api => '1.2.7', |
727
|
|
|
|
|
|
|
method => 'createDiffHTML', |
728
|
|
|
|
|
|
|
args => $args |
729
|
|
|
|
|
|
|
}); |
730
|
|
|
|
|
|
|
} |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
734
|
|
|
|
|
|
|
|
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
#################### subroutine header end #################### |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
sub restore_revision { |
740
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
741
|
0
|
|
|
|
|
|
my $pad_id = shift; |
742
|
0
|
|
|
|
|
|
my $rev = shift; |
743
|
|
|
|
|
|
|
|
744
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
745
|
0
|
|
|
|
|
|
carp 'Please provide a pad id, a start_rev and an end_rev'; |
746
|
0
|
|
|
|
|
|
return undef; |
747
|
|
|
|
|
|
|
} |
748
|
|
|
|
|
|
|
|
749
|
0
|
0
|
|
|
|
|
unless (defined($rev)) { |
750
|
0
|
|
|
|
|
|
carp 'Please provide a revision number'; |
751
|
0
|
|
|
|
|
|
return undef; |
752
|
|
|
|
|
|
|
} |
753
|
|
|
|
|
|
|
|
754
|
0
|
|
|
|
|
|
my $args = { |
755
|
|
|
|
|
|
|
padID => $pad_id, |
756
|
|
|
|
|
|
|
rev => $rev |
757
|
|
|
|
|
|
|
}; |
758
|
|
|
|
|
|
|
|
759
|
0
|
|
|
|
|
|
return $c->_execute({ |
760
|
|
|
|
|
|
|
api => '1.2.11', |
761
|
|
|
|
|
|
|
method => 'restoreRevision', |
762
|
|
|
|
|
|
|
boolean => 1, |
763
|
|
|
|
|
|
|
args => $args |
764
|
|
|
|
|
|
|
}); |
765
|
|
|
|
|
|
|
} |
766
|
|
|
|
|
|
|
|
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
################################################################# |
769
|
|
|
|
|
|
|
################################################################# |
770
|
|
|
|
|
|
|
|
771
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
772
|
|
|
|
|
|
|
|
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
#################### subroutine header end #################### |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
sub get_chat_history { |
778
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
779
|
0
|
|
|
|
|
|
my $pad_id = shift; |
780
|
0
|
|
|
|
|
|
my $start = shift; |
781
|
0
|
|
|
|
|
|
my $end = shift; |
782
|
|
|
|
|
|
|
|
783
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
784
|
0
|
|
|
|
|
|
carp 'Please provide at least a pad id'; |
785
|
0
|
|
|
|
|
|
return undef; |
786
|
|
|
|
|
|
|
} |
787
|
|
|
|
|
|
|
|
788
|
0
|
|
|
|
|
|
my $args = { |
789
|
|
|
|
|
|
|
padID => $pad_id |
790
|
|
|
|
|
|
|
}; |
791
|
0
|
0
|
|
|
|
|
$args->{start} = $start if defined $start; |
792
|
0
|
0
|
|
|
|
|
$args->{end} = $end if defined $end; |
793
|
|
|
|
|
|
|
|
794
|
0
|
|
|
|
|
|
return $c->_execute({ |
795
|
|
|
|
|
|
|
api => '1.2.7', |
796
|
|
|
|
|
|
|
method => 'getChatHistory', |
797
|
|
|
|
|
|
|
key => 'messages', |
798
|
|
|
|
|
|
|
args => $args |
799
|
|
|
|
|
|
|
}); |
800
|
|
|
|
|
|
|
} |
801
|
|
|
|
|
|
|
|
802
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
804
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
#################### subroutine header end #################### |
807
|
|
|
|
|
|
|
|
808
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
sub get_chat_head { |
810
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
811
|
0
|
|
|
|
|
|
my $pad_id = shift; |
812
|
|
|
|
|
|
|
|
813
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
814
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
815
|
0
|
|
|
|
|
|
return undef; |
816
|
|
|
|
|
|
|
} |
817
|
|
|
|
|
|
|
|
818
|
0
|
|
|
|
|
|
my $args = { |
819
|
|
|
|
|
|
|
padID => $pad_id |
820
|
|
|
|
|
|
|
}; |
821
|
|
|
|
|
|
|
|
822
|
0
|
|
|
|
|
|
return $c->_execute({ |
823
|
|
|
|
|
|
|
api => '1.2.7', |
824
|
|
|
|
|
|
|
method => 'getChatHead', |
825
|
|
|
|
|
|
|
key => 'chatHead', |
826
|
|
|
|
|
|
|
args => $args |
827
|
|
|
|
|
|
|
}); |
828
|
|
|
|
|
|
|
} |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
#################### subroutine header end #################### |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
sub append_chat_message { |
838
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
839
|
0
|
|
|
|
|
|
my $pad_id = shift; |
840
|
0
|
|
|
|
|
|
my $text = shift; |
841
|
0
|
|
|
|
|
|
my $author_id = shift; |
842
|
0
|
|
|
|
|
|
my $timestamp = shift; |
843
|
|
|
|
|
|
|
|
844
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
845
|
0
|
|
|
|
|
|
carp 'Please provide a pad id, a text, an authorID and a timestamp'; |
846
|
0
|
|
|
|
|
|
return undef; |
847
|
|
|
|
|
|
|
} |
848
|
|
|
|
|
|
|
|
849
|
0
|
0
|
|
|
|
|
unless (defined($text)) { |
850
|
0
|
|
|
|
|
|
carp 'Please provide a text, an authorID and a timestamp'; |
851
|
0
|
|
|
|
|
|
return undef; |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
|
854
|
0
|
0
|
|
|
|
|
unless (defined($author_id)) { |
855
|
0
|
|
|
|
|
|
carp 'Please provide an authorID and a timestamp'; |
856
|
0
|
|
|
|
|
|
return undef; |
857
|
|
|
|
|
|
|
} |
858
|
|
|
|
|
|
|
|
859
|
0
|
0
|
|
|
|
|
unless (defined($timestamp)) { |
860
|
0
|
|
|
|
|
|
carp 'Please provide a timestamp'; |
861
|
0
|
|
|
|
|
|
return undef; |
862
|
|
|
|
|
|
|
} |
863
|
|
|
|
|
|
|
|
864
|
0
|
|
|
|
|
|
my $args = { |
865
|
|
|
|
|
|
|
padID => $pad_id, |
866
|
|
|
|
|
|
|
text => $text, |
867
|
|
|
|
|
|
|
authorID => $author_id, |
868
|
|
|
|
|
|
|
time => $timestamp |
869
|
|
|
|
|
|
|
}; |
870
|
|
|
|
|
|
|
|
871
|
0
|
|
|
|
|
|
return $c->_execute({ |
872
|
|
|
|
|
|
|
api => '1.2.12', |
873
|
|
|
|
|
|
|
method => 'appendChatMessage', |
874
|
|
|
|
|
|
|
boolean => 1, |
875
|
|
|
|
|
|
|
args => $args |
876
|
|
|
|
|
|
|
}); |
877
|
|
|
|
|
|
|
} |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
################################################################# |
881
|
|
|
|
|
|
|
################################################################# |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
#################### subroutine header end #################### |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
sub create_pad { |
890
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
891
|
0
|
|
|
|
|
|
my $pad_id = shift; |
892
|
0
|
|
|
|
|
|
my $text = shift; |
893
|
|
|
|
|
|
|
|
894
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
895
|
0
|
|
|
|
|
|
carp 'Please provide at least a pad id'; |
896
|
0
|
|
|
|
|
|
return undef; |
897
|
|
|
|
|
|
|
} |
898
|
|
|
|
|
|
|
|
899
|
0
|
|
|
|
|
|
my $args = { |
900
|
|
|
|
|
|
|
padID => $pad_id |
901
|
|
|
|
|
|
|
}; |
902
|
0
|
0
|
|
|
|
|
$args->{text} = $text if defined $text; |
903
|
|
|
|
|
|
|
|
904
|
0
|
|
|
|
|
|
return $c->_execute({ |
905
|
|
|
|
|
|
|
api => 1, |
906
|
|
|
|
|
|
|
method => 'createPad', |
907
|
|
|
|
|
|
|
boolean => 1, |
908
|
|
|
|
|
|
|
args => $args |
909
|
|
|
|
|
|
|
}); |
910
|
|
|
|
|
|
|
} |
911
|
|
|
|
|
|
|
|
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
#################### subroutine header end #################### |
917
|
|
|
|
|
|
|
|
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
sub get_revisions_count { |
920
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
921
|
0
|
|
|
|
|
|
my $pad_id = shift; |
922
|
|
|
|
|
|
|
|
923
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
924
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
925
|
0
|
|
|
|
|
|
return undef; |
926
|
|
|
|
|
|
|
} |
927
|
|
|
|
|
|
|
|
928
|
0
|
|
|
|
|
|
my $args = { |
929
|
|
|
|
|
|
|
padID => $pad_id |
930
|
|
|
|
|
|
|
}; |
931
|
|
|
|
|
|
|
|
932
|
0
|
|
|
|
|
|
return $c->_execute({ |
933
|
|
|
|
|
|
|
api => 1, |
934
|
|
|
|
|
|
|
method => 'getRevisionsCount', |
935
|
|
|
|
|
|
|
key => 'revisions', |
936
|
|
|
|
|
|
|
args => $args |
937
|
|
|
|
|
|
|
}); |
938
|
|
|
|
|
|
|
} |
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
#################### subroutine header end #################### |
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
|
947
|
|
|
|
|
|
|
sub get_saved_revisions_count { |
948
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
949
|
0
|
|
|
|
|
|
my $pad_id = shift; |
950
|
|
|
|
|
|
|
|
951
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
952
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
953
|
0
|
|
|
|
|
|
return undef; |
954
|
|
|
|
|
|
|
} |
955
|
|
|
|
|
|
|
|
956
|
0
|
|
|
|
|
|
my $args = { |
957
|
|
|
|
|
|
|
padID => $pad_id |
958
|
|
|
|
|
|
|
}; |
959
|
|
|
|
|
|
|
|
960
|
0
|
|
|
|
|
|
return $c->_execute({ |
961
|
|
|
|
|
|
|
api => '1.2.11', |
962
|
|
|
|
|
|
|
method => 'getSavedRevisionsCount', |
963
|
|
|
|
|
|
|
key => 'savedRevisions', |
964
|
|
|
|
|
|
|
args => $args |
965
|
|
|
|
|
|
|
}); |
966
|
|
|
|
|
|
|
} |
967
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
#################### subroutine header end #################### |
973
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
sub list_saved_revisions { |
976
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
977
|
0
|
|
|
|
|
|
my $pad_id = shift; |
978
|
|
|
|
|
|
|
|
979
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
980
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
981
|
0
|
|
|
|
|
|
return undef; |
982
|
|
|
|
|
|
|
} |
983
|
|
|
|
|
|
|
|
984
|
0
|
|
|
|
|
|
my $args = { |
985
|
|
|
|
|
|
|
padID => $pad_id |
986
|
|
|
|
|
|
|
}; |
987
|
|
|
|
|
|
|
|
988
|
0
|
|
|
|
|
|
return $c->_execute({ |
989
|
|
|
|
|
|
|
api => '1.2.11', |
990
|
|
|
|
|
|
|
method => 'listSavedRevisions', |
991
|
|
|
|
|
|
|
key => 'savedRevisions', |
992
|
|
|
|
|
|
|
args => $args |
993
|
|
|
|
|
|
|
}); |
994
|
|
|
|
|
|
|
} |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
998
|
|
|
|
|
|
|
|
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
|
1003
|
|
|
|
|
|
|
sub save_revision { |
1004
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1005
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1006
|
0
|
|
|
|
|
|
my $rev = shift; |
1007
|
|
|
|
|
|
|
|
1008
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1009
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1010
|
0
|
|
|
|
|
|
return undef; |
1011
|
|
|
|
|
|
|
} |
1012
|
|
|
|
|
|
|
|
1013
|
0
|
|
|
|
|
|
my $args = { |
1014
|
|
|
|
|
|
|
padID => $pad_id |
1015
|
|
|
|
|
|
|
}; |
1016
|
0
|
0
|
|
|
|
|
$args->{rev} = $rev if defined $rev; |
1017
|
|
|
|
|
|
|
|
1018
|
0
|
|
|
|
|
|
return $c->_execute({ |
1019
|
|
|
|
|
|
|
api => '1.2.11', |
1020
|
|
|
|
|
|
|
method => 'saveRevision', |
1021
|
|
|
|
|
|
|
boolean => 1, |
1022
|
|
|
|
|
|
|
args => $args |
1023
|
|
|
|
|
|
|
}); |
1024
|
|
|
|
|
|
|
} |
1025
|
|
|
|
|
|
|
|
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
|
1030
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
sub get_users_count { |
1034
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1035
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1036
|
|
|
|
|
|
|
|
1037
|
0
|
|
|
|
|
|
return $c->pad_users_count($pad_id); |
1038
|
|
|
|
|
|
|
} |
1039
|
|
|
|
|
|
|
|
1040
|
|
|
|
|
|
|
sub pad_users_count { |
1041
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1042
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1043
|
|
|
|
|
|
|
|
1044
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1045
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1046
|
0
|
|
|
|
|
|
return undef; |
1047
|
|
|
|
|
|
|
} |
1048
|
|
|
|
|
|
|
|
1049
|
0
|
|
|
|
|
|
my $args = { |
1050
|
|
|
|
|
|
|
padID => $pad_id |
1051
|
|
|
|
|
|
|
}; |
1052
|
|
|
|
|
|
|
|
1053
|
0
|
|
|
|
|
|
return $c->_execute({ |
1054
|
|
|
|
|
|
|
api => 1, |
1055
|
|
|
|
|
|
|
method => 'padUsersCount', |
1056
|
|
|
|
|
|
|
key => 'padUsersCount', |
1057
|
|
|
|
|
|
|
args => $args |
1058
|
|
|
|
|
|
|
}); |
1059
|
|
|
|
|
|
|
} |
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1063
|
|
|
|
|
|
|
|
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
|
1068
|
|
|
|
|
|
|
sub pad_users { |
1069
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1070
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1071
|
|
|
|
|
|
|
|
1072
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1073
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1074
|
0
|
|
|
|
|
|
return undef; |
1075
|
|
|
|
|
|
|
} |
1076
|
|
|
|
|
|
|
|
1077
|
0
|
|
|
|
|
|
my $args = { |
1078
|
|
|
|
|
|
|
padID => $pad_id |
1079
|
|
|
|
|
|
|
}; |
1080
|
|
|
|
|
|
|
|
1081
|
0
|
|
|
|
|
|
return $c->_execute({ |
1082
|
|
|
|
|
|
|
api => '1.1', |
1083
|
|
|
|
|
|
|
method => 'padUsers', |
1084
|
|
|
|
|
|
|
key => 'padUsers', |
1085
|
|
|
|
|
|
|
args => $args |
1086
|
|
|
|
|
|
|
}); |
1087
|
|
|
|
|
|
|
} |
1088
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1094
|
|
|
|
|
|
|
|
1095
|
|
|
|
|
|
|
|
1096
|
|
|
|
|
|
|
sub delete_pad { |
1097
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1098
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1099
|
|
|
|
|
|
|
|
1100
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1101
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1102
|
0
|
|
|
|
|
|
return undef; |
1103
|
|
|
|
|
|
|
} |
1104
|
|
|
|
|
|
|
|
1105
|
0
|
|
|
|
|
|
my $args = { |
1106
|
|
|
|
|
|
|
padID => $pad_id |
1107
|
|
|
|
|
|
|
}; |
1108
|
|
|
|
|
|
|
|
1109
|
0
|
|
|
|
|
|
return $c->_execute({ |
1110
|
|
|
|
|
|
|
api => 1, |
1111
|
|
|
|
|
|
|
method => 'deletePad', |
1112
|
|
|
|
|
|
|
boolean => 1, |
1113
|
|
|
|
|
|
|
args => $args |
1114
|
|
|
|
|
|
|
}); |
1115
|
|
|
|
|
|
|
} |
1116
|
|
|
|
|
|
|
|
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
|
1121
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1122
|
|
|
|
|
|
|
|
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
sub copy_pad { |
1125
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1126
|
0
|
|
|
|
|
|
my $source_id = shift; |
1127
|
0
|
|
|
|
|
|
my $destination_id = shift; |
1128
|
0
|
|
|
|
|
|
my $force = shift; |
1129
|
|
|
|
|
|
|
|
1130
|
0
|
0
|
|
|
|
|
unless (defined($source_id)) { |
1131
|
0
|
|
|
|
|
|
carp 'Please provide a source pad id and a destination pad id'; |
1132
|
0
|
|
|
|
|
|
return undef; |
1133
|
|
|
|
|
|
|
} |
1134
|
|
|
|
|
|
|
|
1135
|
0
|
0
|
|
|
|
|
unless (defined($destination_id)) { |
1136
|
0
|
|
|
|
|
|
carp 'Please provide a destination pad id'; |
1137
|
0
|
|
|
|
|
|
return undef; |
1138
|
|
|
|
|
|
|
} |
1139
|
|
|
|
|
|
|
|
1140
|
0
|
|
|
|
|
|
$source_id =~ s/ /_/g; |
1141
|
0
|
|
|
|
|
|
$destination_id =~ s/ /_/g; |
1142
|
|
|
|
|
|
|
|
1143
|
0
|
|
|
|
|
|
my $args = { |
1144
|
|
|
|
|
|
|
sourceID => $source_id, |
1145
|
|
|
|
|
|
|
destinationID => $destination_id, |
1146
|
|
|
|
|
|
|
}; |
1147
|
0
|
0
|
|
|
|
|
$args->{force} = ($force) ? 'true' : 'false' if defined $force; |
|
|
0
|
|
|
|
|
|
1148
|
|
|
|
|
|
|
|
1149
|
0
|
|
|
|
|
|
return $c->_execute({ |
1150
|
|
|
|
|
|
|
api => '1.2.9', |
1151
|
|
|
|
|
|
|
method => 'copyPad', |
1152
|
|
|
|
|
|
|
boolean => 1, |
1153
|
|
|
|
|
|
|
args => $args |
1154
|
|
|
|
|
|
|
}); |
1155
|
|
|
|
|
|
|
} |
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
|
1158
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1159
|
|
|
|
|
|
|
|
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
|
1164
|
|
|
|
|
|
|
sub move_pad { |
1165
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1166
|
0
|
|
|
|
|
|
my $source_id = shift; |
1167
|
0
|
|
|
|
|
|
my $destination_id = shift; |
1168
|
0
|
|
|
|
|
|
my $force = shift; |
1169
|
|
|
|
|
|
|
|
1170
|
0
|
0
|
|
|
|
|
unless (defined($source_id)) { |
1171
|
0
|
|
|
|
|
|
carp 'Please provide a source pad id and a destination pad id'; |
1172
|
0
|
|
|
|
|
|
return undef; |
1173
|
|
|
|
|
|
|
} |
1174
|
|
|
|
|
|
|
|
1175
|
0
|
0
|
|
|
|
|
unless (defined($destination_id)) { |
1176
|
0
|
|
|
|
|
|
carp 'Please provide a destination pad id'; |
1177
|
0
|
|
|
|
|
|
return undef; |
1178
|
|
|
|
|
|
|
} |
1179
|
|
|
|
|
|
|
|
1180
|
0
|
|
|
|
|
|
$source_id =~ s/ /_/g; |
1181
|
0
|
|
|
|
|
|
$destination_id =~ s/ /_/g; |
1182
|
|
|
|
|
|
|
|
1183
|
0
|
|
|
|
|
|
my $args = { |
1184
|
|
|
|
|
|
|
sourceID => $source_id, |
1185
|
|
|
|
|
|
|
destinationID => $destination_id, |
1186
|
|
|
|
|
|
|
}; |
1187
|
0
|
0
|
|
|
|
|
$args->{force} = ($force) ? 'true' : 'false' if defined $force; |
|
|
0
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
|
1189
|
0
|
|
|
|
|
|
return $c->_execute({ |
1190
|
|
|
|
|
|
|
api => '1.2.9', |
1191
|
|
|
|
|
|
|
method => 'movePad', |
1192
|
|
|
|
|
|
|
boolean => 1, |
1193
|
|
|
|
|
|
|
args => $args |
1194
|
|
|
|
|
|
|
}); |
1195
|
|
|
|
|
|
|
} |
1196
|
|
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1199
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
|
1201
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1202
|
|
|
|
|
|
|
|
1203
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
sub get_read_only_id { |
1205
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1206
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1207
|
|
|
|
|
|
|
|
1208
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1209
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1210
|
0
|
|
|
|
|
|
return undef; |
1211
|
|
|
|
|
|
|
} |
1212
|
|
|
|
|
|
|
|
1213
|
0
|
|
|
|
|
|
my $args = { |
1214
|
|
|
|
|
|
|
padID => $pad_id |
1215
|
|
|
|
|
|
|
}; |
1216
|
|
|
|
|
|
|
|
1217
|
0
|
|
|
|
|
|
return $c->_execute({ |
1218
|
|
|
|
|
|
|
api => 1, |
1219
|
|
|
|
|
|
|
method => 'getReadOnlyID', |
1220
|
|
|
|
|
|
|
key => 'readOnlyID', |
1221
|
|
|
|
|
|
|
args => $args |
1222
|
|
|
|
|
|
|
}); |
1223
|
|
|
|
|
|
|
} |
1224
|
|
|
|
|
|
|
|
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1227
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1230
|
|
|
|
|
|
|
|
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
sub get_pad_id { |
1233
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1234
|
0
|
|
|
|
|
|
my $read_only_id = shift; |
1235
|
|
|
|
|
|
|
|
1236
|
0
|
0
|
|
|
|
|
unless (defined($read_only_id)) { |
1237
|
0
|
|
|
|
|
|
carp 'Please provide a read only id'; |
1238
|
0
|
|
|
|
|
|
return undef; |
1239
|
|
|
|
|
|
|
} |
1240
|
|
|
|
|
|
|
|
1241
|
0
|
|
|
|
|
|
my $args = { |
1242
|
|
|
|
|
|
|
padID => $read_only_id |
1243
|
|
|
|
|
|
|
}; |
1244
|
|
|
|
|
|
|
|
1245
|
0
|
|
|
|
|
|
return $c->_execute({ |
1246
|
|
|
|
|
|
|
api => '1.2.10', |
1247
|
|
|
|
|
|
|
method => 'getPadID', |
1248
|
|
|
|
|
|
|
key => 'padID', |
1249
|
|
|
|
|
|
|
args => $args |
1250
|
|
|
|
|
|
|
}); |
1251
|
|
|
|
|
|
|
} |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
|
1254
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1255
|
|
|
|
|
|
|
|
1256
|
|
|
|
|
|
|
|
1257
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1258
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
sub set_public_status { |
1261
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1262
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1263
|
0
|
|
|
|
|
|
my $public_status = shift; |
1264
|
|
|
|
|
|
|
|
1265
|
0
|
0
|
|
|
|
|
unless (defined($public_status)) { |
1266
|
0
|
|
|
|
|
|
carp 'Please provide 2 arguments : a pad id and a public status (1 or 0)'; |
1267
|
0
|
|
|
|
|
|
return undef; |
1268
|
|
|
|
|
|
|
} |
1269
|
|
|
|
|
|
|
|
1270
|
0
|
0
|
|
|
|
|
my $args = { |
1271
|
|
|
|
|
|
|
padID => $pad_id, |
1272
|
|
|
|
|
|
|
publicStatus => ($public_status) ? 'true' : 'false' |
1273
|
|
|
|
|
|
|
}; |
1274
|
|
|
|
|
|
|
|
1275
|
0
|
|
|
|
|
|
return $c->_execute({ |
1276
|
|
|
|
|
|
|
api => 1, |
1277
|
|
|
|
|
|
|
method => 'setPublicStatus', |
1278
|
|
|
|
|
|
|
boolean => 1, |
1279
|
|
|
|
|
|
|
args => $args |
1280
|
|
|
|
|
|
|
}); |
1281
|
|
|
|
|
|
|
} |
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
|
1284
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1285
|
|
|
|
|
|
|
|
1286
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
|
1290
|
|
|
|
|
|
|
sub get_public_status { |
1291
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1292
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1293
|
|
|
|
|
|
|
|
1294
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1295
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1296
|
0
|
|
|
|
|
|
return undef; |
1297
|
|
|
|
|
|
|
} |
1298
|
|
|
|
|
|
|
|
1299
|
0
|
|
|
|
|
|
my $args = { |
1300
|
|
|
|
|
|
|
padID => $pad_id |
1301
|
|
|
|
|
|
|
}; |
1302
|
|
|
|
|
|
|
|
1303
|
0
|
|
|
|
|
|
return $c->_execute({ |
1304
|
|
|
|
|
|
|
api => 1, |
1305
|
|
|
|
|
|
|
method => 'getPublicStatus', |
1306
|
|
|
|
|
|
|
key => 'publicStatus', |
1307
|
|
|
|
|
|
|
args => $args |
1308
|
|
|
|
|
|
|
}); |
1309
|
|
|
|
|
|
|
} |
1310
|
|
|
|
|
|
|
|
1311
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
|
1315
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1316
|
|
|
|
|
|
|
|
1317
|
|
|
|
|
|
|
|
1318
|
|
|
|
|
|
|
sub set_password { |
1319
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1320
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1321
|
0
|
|
|
|
|
|
my $password = shift; |
1322
|
|
|
|
|
|
|
|
1323
|
0
|
0
|
|
|
|
|
unless (defined($password)) { |
1324
|
0
|
|
|
|
|
|
carp 'Please provide 2 arguments : a pad id and a password'; |
1325
|
0
|
|
|
|
|
|
return undef; |
1326
|
|
|
|
|
|
|
} |
1327
|
|
|
|
|
|
|
|
1328
|
0
|
|
|
|
|
|
my $args = { |
1329
|
|
|
|
|
|
|
padID => $pad_id, |
1330
|
|
|
|
|
|
|
password => $password |
1331
|
|
|
|
|
|
|
}; |
1332
|
|
|
|
|
|
|
|
1333
|
0
|
|
|
|
|
|
return $c->_execute({ |
1334
|
|
|
|
|
|
|
api => 1, |
1335
|
|
|
|
|
|
|
method => 'setPassword', |
1336
|
|
|
|
|
|
|
boolean => 1, |
1337
|
|
|
|
|
|
|
args => $args |
1338
|
|
|
|
|
|
|
}); |
1339
|
|
|
|
|
|
|
} |
1340
|
|
|
|
|
|
|
|
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
|
1345
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1346
|
|
|
|
|
|
|
|
1347
|
|
|
|
|
|
|
|
1348
|
|
|
|
|
|
|
sub is_password_protected { |
1349
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1350
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1351
|
|
|
|
|
|
|
|
1352
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1353
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1354
|
0
|
|
|
|
|
|
return undef; |
1355
|
|
|
|
|
|
|
} |
1356
|
|
|
|
|
|
|
|
1357
|
0
|
|
|
|
|
|
my $args = { |
1358
|
|
|
|
|
|
|
padID => $pad_id |
1359
|
|
|
|
|
|
|
}; |
1360
|
|
|
|
|
|
|
|
1361
|
0
|
|
|
|
|
|
return $c->_execute({ |
1362
|
|
|
|
|
|
|
api => 1, |
1363
|
|
|
|
|
|
|
method => 'isPasswordProtected', |
1364
|
|
|
|
|
|
|
key => 'isPasswordProtected', |
1365
|
|
|
|
|
|
|
args => $args |
1366
|
|
|
|
|
|
|
}); |
1367
|
|
|
|
|
|
|
} |
1368
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
|
1370
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1371
|
|
|
|
|
|
|
|
1372
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1374
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
sub list_authors_of_pad { |
1377
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1378
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1379
|
|
|
|
|
|
|
|
1380
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1381
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1382
|
0
|
|
|
|
|
|
return undef; |
1383
|
|
|
|
|
|
|
} |
1384
|
|
|
|
|
|
|
|
1385
|
0
|
|
|
|
|
|
my $args = { |
1386
|
|
|
|
|
|
|
padID => $pad_id |
1387
|
|
|
|
|
|
|
}; |
1388
|
|
|
|
|
|
|
|
1389
|
0
|
|
|
|
|
|
return $c->_execute({ |
1390
|
|
|
|
|
|
|
api => 1, |
1391
|
|
|
|
|
|
|
method => 'listAuthorsOfPad', |
1392
|
|
|
|
|
|
|
key => 'authorIDs', |
1393
|
|
|
|
|
|
|
args => $args |
1394
|
|
|
|
|
|
|
}); |
1395
|
|
|
|
|
|
|
} |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
|
1398
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1399
|
|
|
|
|
|
|
|
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
|
1404
|
|
|
|
|
|
|
sub list_names_of_authors_of_pad { |
1405
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1406
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1407
|
|
|
|
|
|
|
|
1408
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1409
|
0
|
|
|
|
|
|
carp 'Please provide a pad id'; |
1410
|
0
|
|
|
|
|
|
return undef; |
1411
|
|
|
|
|
|
|
} |
1412
|
|
|
|
|
|
|
|
1413
|
0
|
|
|
|
|
|
my @names; |
1414
|
0
|
|
|
|
|
|
my $anonymous = 0; |
1415
|
|
|
|
|
|
|
|
1416
|
0
|
|
|
|
|
|
my @authors = $c->list_authors_of_pad($pad_id); |
1417
|
0
|
|
|
|
|
|
for my $author (@authors) { |
1418
|
0
|
|
|
|
|
|
my $name = $c->get_author_name($author); |
1419
|
0
|
0
|
|
|
|
|
if (defined($name)) { |
1420
|
0
|
|
|
|
|
|
push @names, $name; |
1421
|
|
|
|
|
|
|
} else { |
1422
|
0
|
|
|
|
|
|
$anonymous++; |
1423
|
|
|
|
|
|
|
} |
1424
|
|
|
|
|
|
|
} |
1425
|
0
|
|
|
|
|
|
@names = sort(@names); |
1426
|
0
|
0
|
|
|
|
|
push @names, $anonymous . ' anonymous' if ($anonymous); |
1427
|
|
|
|
|
|
|
|
1428
|
0
|
0
|
|
|
|
|
return (wantarray) ? @names : \@names; |
1429
|
|
|
|
|
|
|
} |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
|
1432
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1433
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
|
1438
|
|
|
|
|
|
|
sub get_last_edited { |
1439
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1440
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1441
|
|
|
|
|
|
|
|
1442
|
0
|
0
|
|
|
|
|
unless (defined($pad_id)) { |
1443
|
0
|
|
|
|
|
|
carp 'Please provide at least a pad id'; |
1444
|
0
|
|
|
|
|
|
return undef; |
1445
|
|
|
|
|
|
|
} |
1446
|
|
|
|
|
|
|
|
1447
|
0
|
|
|
|
|
|
my $args = { |
1448
|
|
|
|
|
|
|
padID => $pad_id |
1449
|
|
|
|
|
|
|
}; |
1450
|
|
|
|
|
|
|
|
1451
|
0
|
|
|
|
|
|
return $c->_execute({ |
1452
|
|
|
|
|
|
|
api => 1, |
1453
|
|
|
|
|
|
|
method => 'getLastEdited', |
1454
|
|
|
|
|
|
|
key => 'lastEdited', |
1455
|
|
|
|
|
|
|
args => $args |
1456
|
|
|
|
|
|
|
}); |
1457
|
|
|
|
|
|
|
} |
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
|
1460
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1461
|
|
|
|
|
|
|
|
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
|
1466
|
|
|
|
|
|
|
sub send_clients_message { |
1467
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1468
|
0
|
|
|
|
|
|
my $pad_id = shift; |
1469
|
0
|
|
|
|
|
|
my $msg = shift; |
1470
|
|
|
|
|
|
|
|
1471
|
0
|
0
|
|
|
|
|
unless (defined($msg)) { |
1472
|
0
|
|
|
|
|
|
carp "Please provide 2 arguments : the pad id and a message"; |
1473
|
0
|
|
|
|
|
|
return undef; |
1474
|
|
|
|
|
|
|
} |
1475
|
|
|
|
|
|
|
|
1476
|
0
|
|
|
|
|
|
my $args = { |
1477
|
|
|
|
|
|
|
padID => $pad_id, |
1478
|
|
|
|
|
|
|
msg => $msg |
1479
|
|
|
|
|
|
|
}; |
1480
|
|
|
|
|
|
|
|
1481
|
0
|
|
|
|
|
|
return $c->_execute({ |
1482
|
|
|
|
|
|
|
api => '1.1', |
1483
|
|
|
|
|
|
|
method => 'sendClientsMessage', |
1484
|
|
|
|
|
|
|
boolean => 1, |
1485
|
|
|
|
|
|
|
args => $args |
1486
|
|
|
|
|
|
|
}); |
1487
|
|
|
|
|
|
|
} |
1488
|
|
|
|
|
|
|
|
1489
|
|
|
|
|
|
|
|
1490
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1491
|
|
|
|
|
|
|
|
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
#################### subroutine header end #################### |
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
sub check_token { |
1497
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1498
|
|
|
|
|
|
|
|
1499
|
0
|
|
|
|
|
|
my $args = {}; |
1500
|
|
|
|
|
|
|
|
1501
|
0
|
|
|
|
|
|
return $c->_execute({ |
1502
|
|
|
|
|
|
|
api => '1.2', |
1503
|
|
|
|
|
|
|
method => 'checkToken', |
1504
|
|
|
|
|
|
|
boolean => 1, |
1505
|
|
|
|
|
|
|
args => $args |
1506
|
|
|
|
|
|
|
}); |
1507
|
|
|
|
|
|
|
} |
1508
|
|
|
|
|
|
|
|
1509
|
|
|
|
|
|
|
|
1510
|
|
|
|
|
|
|
################################################################# |
1511
|
|
|
|
|
|
|
################################################################# |
1512
|
|
|
|
|
|
|
|
1513
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1514
|
|
|
|
|
|
|
|
1515
|
|
|
|
|
|
|
|
1516
|
|
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
sub list_all_pads { |
1518
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1519
|
|
|
|
|
|
|
|
1520
|
0
|
|
|
|
|
|
my $args = {}; |
1521
|
|
|
|
|
|
|
|
1522
|
0
|
|
|
|
|
|
return $c->_execute({ |
1523
|
|
|
|
|
|
|
api => '1.2.1', |
1524
|
|
|
|
|
|
|
method => 'listAllPads', |
1525
|
|
|
|
|
|
|
key => 'padIDs', |
1526
|
|
|
|
|
|
|
args => $args |
1527
|
|
|
|
|
|
|
}); |
1528
|
|
|
|
|
|
|
} |
1529
|
|
|
|
|
|
|
|
1530
|
|
|
|
|
|
|
################################################################# |
1531
|
|
|
|
|
|
|
################################################################# |
1532
|
|
|
|
|
|
|
|
1533
|
|
|
|
|
|
|
#################### subroutine header begin #################### |
1534
|
|
|
|
|
|
|
|
1535
|
|
|
|
|
|
|
|
1536
|
|
|
|
|
|
|
|
1537
|
|
|
|
|
|
|
sub get_stats { |
1538
|
0
|
|
|
0
|
1
|
|
my $c = shift; |
1539
|
|
|
|
|
|
|
|
1540
|
0
|
|
|
|
|
|
my $args = {}; |
1541
|
|
|
|
|
|
|
|
1542
|
0
|
|
|
|
|
|
return $c->_execute({ |
1543
|
|
|
|
|
|
|
api => '1.2.14', |
1544
|
|
|
|
|
|
|
method => 'getStats', |
1545
|
|
|
|
|
|
|
args => $args |
1546
|
|
|
|
|
|
|
}); |
1547
|
|
|
|
|
|
|
} |
1548
|
|
|
|
|
|
|
|
1549
|
|
|
|
|
|
|
#################### footer pod documentation begin ################### |
1550
|
|
|
|
|
|
|
#################### footer pod documentation end ################### |
1551
|
|
|
|
|
|
|
|
1552
|
|
|
|
|
|
|
1; |
1553
|
|
|
|
|
|
|
|
1554
|
|
|
|
|
|
|
__END__ |