lib/WWW/FBX/Role/API/APIv3.pm

filter: Statementstmt 51.9% 105 / 202 Branchbran 0.0% 0 / 28 Conditioncond 0.0% 0 / 21 MC/DCmcdc 0.0% 0 / 13 Subroutinesub 23.5% 4 / 17 Podpod n/a totaltotal 38.7% 109 / 281 CC 32 SCAR 30.2
CC
32
Cov
42%
__ANON__
42.0
__ANON__
30.0
__ANON__
30.0
CRAP 20.6
« lib/WWW/FBX/Role/Auth.pm ↑ Summary lib/WWW/FBX/Error.pm »
1 package WWW::FBX::Role::API::APIv3;
2 23 ▶use 5.014001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 23 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 23 ▶use WWW::FBX::API;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 23 ▶use MIME::Base64 qw/encode_base64 decode_base64/;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 #sub BUILD {
8 # shift->api_version;
9 #}
10  
11 23 fbx_api_method api_version => (
12 description => <<'',
13 Get API version.
14  
15 path => 'api_version',
16 method => 'GET',
17 params => [],
18 required => [],
19 );
20  
21 0 ▶around api_version => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 my $orig = shift;
23 0 my $self = shift;
24  
25 0 api_url( "" );
26 0 $self->$orig;
27 0 my $uar = $self->uar;
28 0 my ($maj) = $uar->{api_version} =~ /(\d*)\./;
29 0 api_url( "$uar->{api_base_url}v$maj" );
30 23 };
31  
32 23 fbx_api_method req_auth => (
33 description => <<'',
34 Ask for an App token.
35  
36 path => 'login/authorize',
37 method => 'POST',
38 params => [qw/ app_id app_name app_version device_name /],
39 required => [qw/ app_id app_name app_version device_name /],
40  
41 );
42  
43 23 fbx_api_method auth_progress => (
44 description => <<'',
45 Monitor token status.
46  
47 path => 'login/authorize/',
48 method => 'GET',
49 params => [qw/suff/],
50 required => [qw/suff/],
51 );
52  
53 23 fbx_api_method login => (
54 description => <<'',
55 Get login challenge.
56  
57 path => 'login/',
58 method => 'GET',
59 params => [],
60 required => [],
61 );
62  
63 23 fbx_api_method open_session => (
64 description => <<'',
65 Open a session.
66  
67 path => 'login/session/',
68 method => 'POST',
69 params => [ qw/ app_id app_version password / ],
70 required => [ qw/ app_id password / ],
71 );
72  
73 #Download
74 fbx_api_method s'/'_'gr => (
75 description => <<'',
76 Global download getters.
77  
78 path => $_,
79 method => 'GET',
80 params => [ ],
81 required => [ ],
82 23 ) for qw(downloads/ downloads/stats);
83  
84 23 fbx_api_method get_download_task => (
85 description => <<'',
86 Get the download task.
87  
88 path => 'downloads/',
89 method => 'GET',
90 params => [ qw/suff/ ],
91 required => [ qw/suff/ ],
92 );
93  
94 23 fbx_api_method del_download_task => (
95 description => <<'',
96 Get the download task.
97  
98 path => 'downloads/',
99 method => 'DELETE',
100 params => [ qw/suff/ ],
101 required => [ qw/suff/ ],
102 );
103  
104 23 fbx_api_method upd_download_task => (
105 description => <<'',
106 Update the download task.
107  
108 path => 'downloads/',
109 method => 'PUT',
110 params => [ qw/suff io_priority status/ ],
111 required => [ qw/suff/ ],
112 );
113  
114 23 fbx_api_method add_download_task => (
115 description => <<'',
116 Add a download task.
117  
118 path => 'downloads/add',
119 method => 'POST',
120 content_type => 'application/x-www-form-urlencoded',
121 params => [ qw/download_url download_url_list download_dir recursive username password archive_password cookies/],
122 required => [ qw//],
123 );
124  
125 23 fbx_api_method add_download_task_file => (
126 description => <<'',
127 Add a download task by file.
128  
129 path => 'downloads/add',
130 method => 'POST',
131 content_type => 'form-data',
132 params => [ qw/download_file download_dir archive_password/],
133 required => [ qw/download_file/],
134 );
135  
136 23 fbx_api_method change_prio_download_file => (
137 description => <<'',
138 Change the priority of a Download File.
139  
140 path => 'downloads/',
141 method => 'PUT',
142 params => [ qw/suff priority/ ],
143 required => [ qw/suff priority/ ],
144 );
145  
146 #TODO: tracker, blacklist
147  
148 #Download feeds
149 fbx_api_method s'/'_'gr => (
150 description => <<'',
151 Get feed(s).
152  
153 path => $_,
154 method => 'GET',
155 params => [ qw/suff/ ],
156 required => [ ],
157 23 ) for qw(downloads/feeds/);
158  
159 23 fbx_api_method add_feed => (
160 description => <<'',
161 Add a feed.
162  
163 path => 'downloads/feeds/',
164 method => 'POST',
165 params => [ qw/url/ ],
166 required => [ qw/url/ ],
167 );
168  
169 23 fbx_api_method del_feed => (
170 description => <<'',
171 Delete download feed.
172  
173 path => "downloads/feeds/",
174 method => 'DELETE',
175 params => [ qw/suff/ ],
176 required => [ qw/suff/ ],
177 );
178  
179 23 fbx_api_method upd_feed => (
180 description => <<'',
181 Update download feed.
182  
183 path => 'downloads/feeds/',
184 method => 'PUT',
185 params => [ qw/suff auto_download/ ],
186 required => [ qw/suff / ],
187 );
188  
189 fbx_api_method $_ => (
190 description => <<'',
191 Global feed POST.
192  
193 path => 'downloads/feeds/',
194 method => 'POST',
195 params => [ qw/suff/ ],
196 required => [ qw/suff/ ],
197 23 ) for qw/refresh_feed download_feed_item mark_all_read/;
198  
199 23 fbx_api_method refresh_feeds => (
200 description => <<'',
201 Refresh all feeds.
202  
203 path => 'downloads/feeds/fetch',
204 method => 'POST',
205 params => [ ],
206 required => [ ],
207 );
208  
209 #Download config
210 23 fbx_api_method downloads_config => (
211 description => <<'',
212 Get Downloads config.
213  
214 path => "downloads/config",
215 method => 'GET',
216 params => [ ],
217 required => [ ],
218 );
219  
220 fbx_api_method upd_downloads_config => (
221 description => <<'',
222 Update downloads config.
223  
224 path => "downloads/config",
225 method => 'PUT',
226 params => [ qw/throttling max_downloading_tasks download_dir use_watch_dir watch_dir news bt feed/],
227 required => [ ],
228 23 ) for qw(downloads/config/);
229  
230 0 ▶around downloads_config => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
231 0 my $orig = shift;
232 0 my $self = shift;
233  
234 0 my $params = $self->$orig(@_);
235  
236 0 for (qw/download_dir watch_dir/) {
237 0 ▶ $params->{$_} = decode_base64( $params->{$_} ) if exists $params->{$_} and $params->{$_};
Branch: 1 branch
BranchTrueFalseTotal
if exists $params->{$_} and $params->{$_} 0 0 0
Condition0%0/3
exists $params->{$_} and $params->{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{$_} and $params->{$_}
exists $params->{$_} $params->{$_}
Truth table0%0/3
A and B
A= exists $params->{$_}B= $params->{$_}
ABresult
0X0
100
111
238 }
239  
240 0 $params;
241 23 };
242  
243 0 ▶around upd_downloads_config => sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
244 0 my $orig = shift;
245 0 my $self = shift;
246  
247 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
248 0 my $params = $_[0];
249 0 for my $par (qw/download_dir watch_dir/) {
250 0 ▶ $params->{$par} = encode_base64( $params->{$par}, "") if exists $params->{$par} and $params->{$par};
Branch: 1 branch
BranchTrueFalseTotal
if exists $params->{$par} and $params->{$par} 0 0 0
Condition0%0/3
exists $params->{$par} and $params->{$par}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{$par} and $params->{$par}
exists $params->{$par} $params->{$par}
Truth table0%0/3
A and B
A= exists $params->{$par}B= $params->{$par}
ABresult
0X0
100
111
251 }
252 }
253  
254 0 $self->$orig(@_);
255 23 };
256  
257 23 fbx_api_method upd_downloads_throttle => (
258 description => <<'',
259 Update download throttling.
260  
261 path => "downloads/throttling",
262 method => 'PUT',
263 params => [ qw/throttling/],
264 required => [ qw/throttling/ ],
265 );
266  
267 #FS
268 fbx_api_method s'/'_'gr => (
269 description => <<'',
270 Get task(s).
271  
272 path => $_,
273 method => 'GET',
274 params => [ qw/suff/ ],
275 required => [ ],
276 23 ) for qw(fs/tasks/);
277  
278 23 fbx_api_method del_task => (
279 description => <<'',
280 Delete task.
281  
282 path => "fs/tasks/",
283 method => 'DELETE',
284 params => [ qw/suff/ ],
285 required => [ ],
286 );
287  
288 23 fbx_api_method upd_task => (
289 description => <<'',
290 Update task.
291  
292 path => "fs/tasks/",
293 method => 'PUT',
294 params => [ qw/suff state/ ],
295 required => [ qw/suff state/ ],
296 );
297  
298 23 fbx_api_method list_files => (
299 description => <<'',
300 List files.
301  
302 path => "fs/ls/",
303 method => 'GET',
304 params => [ qw/suff/ ],
305 required => [ qw/suff/ ],
306 );
307  
308 0 ▶around list_files => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
309 0 my $orig = shift;
310 0 my $self = shift;
311 0 my $params = shift;
312  
313 0 ▶ $params = encode_base64( $params, "") if $params;
Branch: 1 branch
BranchTrueFalseTotal
if $params 0 0 0
314 0 my $res = $self->$orig($params);
315  
316 0 for my $i ( 0.. $#{$res} ) {
317 0 $res->[$i]{path} = decode_base64( $res->[$i]{path} );
318 }
319  
320 0 $res;
321 23 };
322  
323 23 fbx_api_method file_info => (
324 description => <<'',
325 Get file information.
326  
327 path => "fs/info/",
328 method => 'GET',
329 params => [ qw/suff/ ],
330 required => [ qw/suff/ ],
331 );
332  
333 0 ▶around file_info => sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
334 0 my $orig = shift;
335 0 my $self = shift;
336 0 my $params = shift;
337  
338 0 ▶ $params = encode_base64( $params, "") if $params;
Branch: 1 branch
BranchTrueFalseTotal
if $params 0 0 0
339
340 0 my $res = $self->$orig($params);
341  
342 0 for (qw/parent target path/) {
343 0 ▶ $params->{$_} = decode_base64( $params->{$_} ) if exists $params->{$_} and $params->{$_};
Branch: 1 branch
BranchTrueFalseTotal
if exists $params->{$_} and $params->{$_} 0 0 0
Condition0%0/3
exists $params->{$_} and $params->{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{$_} and $params->{$_}
exists $params->{$_} $params->{$_}
Truth table0%0/3
A and B
A= exists $params->{$_}B= $params->{$_}
ABresult
0X0
100
111
344 }
345  
346 0 $params;
347 23 };
348  
349 23 fbx_api_method mv => (
350 description => <<'',
351 Move files.
352  
353 path => "fs/mv/",
354 method => 'POST',
355 params => [ qw/files dst mode/ ],
356 required => [ qw/files dst mode/ ],
357 );
358  
359 23 fbx_api_method cp => (
360 description => <<'',
361 Copy files.
362  
363 path => "fs/cp/",
364 method => 'POST',
365 params => [ qw/files dst mode/ ],
366 required => [ qw/files dst mode/ ],
367 );
368  
369 23 fbx_api_method archive => (
370 description => <<'',
371 Create an archive.
372  
373 path => "fs/archive/",
374 method => 'POST',
375 params => [ qw/files dst/ ],
376 required => [ qw/files dst/ ],
377 );
378  
379 0 ▶around [qw/cp mv archive/] => sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
380 0 my $orig = shift;
381 0 my $self = shift;
382 0 my $params = shift;
383  
384 0 $params->{$_} = encode_base64( $params->{$_},"") for qw/dst/;
385 0 $params->{files}->[$_] = encode_base64( $params->{files}->[$_],"") for 0..$#{$params->{files}};
386
387 0 $self->$orig($params);
388 23 };
389  
390 23 fbx_api_method rm => (
391 description => <<'',
392 Delete files.
393  
394 path => "fs/rm/",
395 method => 'POST',
396 params => [ qw/files/ ],
397 required => [ qw/files/ ],
398 );
399  
400 0 ▶around [qw/rm cat/] => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
401 0 my $orig = shift;
402 0 my $self = shift;
403 0 my $params = shift;
404  
405 0 $params->{files}->[$_] = encode_base64( $params->{files}->[$_],"") for 0..$#{$params->{files}};
406
407 0 $self->$orig($params);
408 23 };
409  
410 23 fbx_api_method cat => (
411 description => <<'',
412 Cat files.
413  
414 path => "fs/cat/",
415 method => 'POST',
416 params => [ qw/files dst multi_volumes delete_files overwrite append/ ],
417 required => [ qw/files dst/ ],
418 );
419  
420 23 fbx_api_method extract => (
421 description => <<'',
422 Extract archive.
423  
424 path => "fs/extract/",
425 method => 'POST',
426 params => [ qw/src dst password delete_archive overwrite/ ],
427 required => [ qw/src dst password delete_archive overwrite/ ],
428 );
429  
430 0 ▶around [qw/extract/] => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
431 0 my $orig = shift;
432 0 my $self = shift;
433 0 my $params = shift;
434  
435 0 $params->{$_} = encode_base64( $params->{$_},"") for qw/src dst/;
436 0 $self->$orig($params);
437 23 };
438  
439 23 fbx_api_method repair => (
440 description => <<'',
441 Repair file.
442  
443 path => "fs/repair/",
444 method => 'POST',
445 params => [ qw/src delete_archive / ],
446 required => [ qw/src delete_archive/ ],
447 );
448  
449 23 fbx_api_method hash => (
450 description => <<'',
451 Repair file.
452  
453 path => "fs/hash/",
454 method => 'POST',
455 params => [ qw/src hash_type/ ],
456 required => [ qw/src hash_type/ ],
457 );
458  
459 0 ▶around [qw/repair hash rename/] => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
460 0 my $orig = shift;
461 0 my $self = shift;
462 0 my $params = shift;
463  
464 0 $params->{$_} = encode_base64( $params->{$_},"") for qw/src/;
465 0 $self->$orig($params);
466 23 };
467  
468 23 fbx_api_method mkdir => (
469 description => <<'',
470 Create directory.
471  
472 path => "fs/mkdir/",
473 method => 'POST',
474 params => [ qw/parent dirname/ ],
475 required => [ qw/parent dirname/ ],
476 );
477  
478 0 ▶around [qw/mkdir/] => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
479 0 my $orig = shift;
480 0 my $self = shift;
481 0 my $params = shift;
482  
483 0 $params->{$_} = encode_base64( $params->{$_},"") for qw/parent/;
484 0 $self->$orig($params);
485 23 };
486  
487 23 fbx_api_method rename => (
488 description => <<'',
489 Rename file or directory.
490  
491 path => "fs/rename/",
492 method => 'POST',
493 params => [ qw/src dst/ ],
494 required => [ qw/src dst/ ],
495 );
496  
497 23 fbx_api_method download_file => (
498 description => <<'',
499 Download a file.
500  
501 path => "dl/",
502 method => 'GET',
503 params => [ qw/suff/ ],
504 required => [ qw/suff/ ],
505 );
506  
507 0 ▶around download_file => sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
508 0 my $orig = shift;
509 0 my $self = shift;
510 0 my $params = shift;
511  
512 0 ▶ $params = encode_base64( $params, "") if $params;
Branch: 1 branch
BranchTrueFalseTotal
if $params 0 0 0
513  
514 0 my $res = $self->$orig($params);
515 0 ▶ if ($res->{filename} and $res->{content}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($res->{"filename"} and $res->{"content"}) 0 0 0
Condition0%0/3
$res->{"filename"} and $res->{"content"}
!ll&&!rl&&r
000
MC/DC0%0/2
$res->{"filename"} and $res->{"content"}
$res->{"filename"} $res->{"content"}
Truth table0%0/3
A and B
A= $res->{"filename"}B= $res->{"content"}
ABresult
0X0
100
111
516 0 ▶ open my $f, ">", $res->{filename} or die "Can't create file $res->{filename} : $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $f, ">", $res->{"filename"} or die qq[Can't create file $res->{"filename"} : $!] 0 0 0
517 0 print $f $res->{content};
518 0 close $f;
519 }
520  
521 0 $res;
522 23 };
523  
524 #Share
525 fbx_api_method s'/'_'gr => (
526 description => <<'',
527 Global share getters.
528  
529 path => $_,
530 method => 'GET',
531 params => [ ],
532 required => [ ],
533 23 ) for qw(share_link/);
534  
535 #Upload
536 fbx_api_method s'/'_'gr => (
537 description => <<'',
538 Global upload getters.
539  
540 path => $_,
541 method => 'GET',
542 params => [ qw/suff/ ],
543 required => [ ],
544 23 ) for qw(upload/);
545  
546 23 fbx_api_method upload_auth => (
547 description => <<'',
548 Upload auth.
549  
550 path => "upload/",
551 method => 'POST',
552 params => [ qw/dirname upload_name/ ],
553 required => [ qw/dirname upload_name/],
554 );
555  
556 0 ▶around upload_auth => sub {
Subroutine __ANON__: not called CC=4 SCAR=30.0
557 0 my $orig = shift;
558 0 my $self = shift;
559  
560 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
561 0 my $params = $_[0];
562 0 ▶ $params->{dirname} = encode_base64( $params->{dirname}, "") if exists $params->{dirname} and $params->{dirname};
Branch: 1 branch
BranchTrueFalseTotal
if exists $params->{"dirname"} and $params->{"dirname"} 0 0 0
Condition0%0/3
exists $params->{"dirname"} and $params->{"dirname"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $params->{"dirname"} and $params->{"dirname"}
exists $params->{"dirname"} $params->{"dirname"}
Truth table0%0/3
A and B
A= exists $params->{"dirname"}B= $params->{"dirname"}
ABresult
0X0
100
111
563 }
564  
565 0 $self->$orig(@_);
566 23 };
567  
568 23 fbx_api_method upload_file => (
569 description => <<'',
570 Upload file.
571  
572 path => "upload/",
573 method => 'POST',
574 params => [ qw/id suff dirname name/ ],
575 required => [ qw/name suff/],
576 content_type => 'form-data',
577 );
578  
579 #if user provided an id, use this one otherwise request one (in that case dirname and upload_name have to be provided)
580 0 ▶around upload_file => sub {
Subroutine __ANON__: not called CC=6 SCAR=37.4
581 0 my $orig = shift;
582 0 my $self = shift;
583 0 my $params = $_[0];
584 0 my $id;
585 my $filename;
586  
587 0 ▶ if ($params and exists $params->{filename} and $params->{filename}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($params and exists $params->{"filename"} and $params->{"filename"}) 0 0 0
Condition0%0/6
$params and exists $params->{"filename"} and $params->{"filename"}
!ll&&!rl&&r
000
$params and exists $params->{"filename"}
!ll&&!rl&&r
000
MC/DC0%0/3
$params and exists $params->{"filename"} and $params->{"filename"}
$params exists $params->{"filename"} $params->{"filename"}
Truth table0%0/4
A and B and C
A= $paramsB= exists $params->{"filename"}C= $params->{"filename"}
ABCresult
0XX0
10X0
1100
1111
588 0 $filename = delete $params->{filename};
589 0 ▶ if (exists $params->{id}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $params->{'id'}) { } 0 0 0
590 0 $id = delete $params->{id};
591 } else {
592 $params->{upload_name} = $filename
593 0 ▶ unless exists $params->{upload_name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params->{"upload_name"} 0 0 0
594 0 my $res = $self->upload_auth(@_);
595 0 delete $params->{dirname};
596 0 delete $params->{upload_name};
597 0 $id = $res->{id};
598 }
599 0 $params->{name} = [ $filename ];
600 0 $params->{suff} = "$id/send";
601 }
602 0 $self->$orig(@_);
603 23 };
604  
605 fbx_api_method s'/'_'gr => (
606 description => <<'',
607 Delete downloads.
608  
609 path => $_,
610 method => 'DELETE',
611 params => [ ],
612 required => [ ],
613 23 ) for qw(upload/clean);
614  
615 #AirMedia
616 fbx_api_method s'/'_'gr => (
617 description => <<'',
618 Global airmedia getters.
619  
620 path => $_,
621 method => 'GET',
622 params => [ ],
623 required => [ ],
624 23 ) for qw(airmedia/config airmedia/receivers/);
625  
626 #RRD
627 23 fbx_api_method rrd => (
628 description => <<'',
629 Get the RRD stats.
630  
631 path => 'rrd/',
632 method => 'POST',
633 params => [qw/db date_start date_end precision fields/],
634 required => [qw/db/],
635 );
636  
637 #CALL
638 fbx_api_method s'/'_'gr => (
639 description => <<'',
640 Global call getters.
641  
642 path => $_,
643 method => 'GET',
644 params => [ qw/suff/ ],
645 required => [ ],
646 23 ) for qw(call/log/);
647  
648 #CONTACTS
649 fbx_api_method s'/'_'gr => (
650 description => <<'',
651 Global contacts getters.
652  
653 path => $_,
654 method => 'GET',
655 params => [ ],
656 required => [ ],
657 23 ) for qw(contact/);
658  
659 #CONNECTION
660 fbx_api_method s'/'_'gr => (
661 description => <<'',
662 Global Connection getters.
663  
664 path => $_,
665 method => 'GET',
666 params => [],
667 required => [],
668 23 ) for qw(connection connection/config connection/ipv6/config connection/xdsl/ connection/ftth);
669  
670 23 fbx_api_method upd_connection => (
671 description => <<'',
672 Update the connection configuration.
673  
674 path => 'connection/config/',
675 method => 'PUT',
676 params => [qw/ping remote_access remote_access_port wol adblock allow_token_request/],
677 required => [qw//],
678 );
679  
680 23 fbx_api_method upd_ipv6_config => (
681 description => <<'',
682 Update the ipv6 connection configuration.
683  
684 path => 'connection/ipv6/config/',
685 method => 'PUT',
686 params => [qw/ ipv6_enabled delegations/],
687 required => [qw//],
688 );
689  
690 23 fbx_api_method connection_dyndns => (
691 description => <<'',
692 Get status or config of dyndns provider.
693  
694 path => 'connection/ddns/',
695 method => 'GET',
696 params => [qw/suff/],
697 required => [qw/suff/],
698 );
699  
700 23 fbx_api_method upd_connection_dyndns => (
701 description => <<'',
702 Set config of dyndns provider.
703  
704 path => 'connection/ddns/',
705 method => 'GET',
706 params => [qw/suff enabled user password hostname/],
707 required => [qw/suff/],
708 );
709  
710 #LAN
711 fbx_api_method s'/'_'gr => (
712 description => <<'',
713 Global Lan getters.
714  
715 path => $_,
716 method => 'GET',
717 params => [],
718 required => [],
719 23 ) for qw(lan/config lan/browser/interfaces);
720  
721 23 fbx_api_method upd_lan_config => (
722 description => <<'',
723 Update lan config.
724  
725 path => 'lan/config/',
726 method => 'PUT',
727 params => [ qw/mode ip name name_dns name_mdns name_netbios/ ],
728 required => [ qw// ],
729 );
730  
731 23 fbx_api_method list_hosts => (
732 description => <<'',
733 Get the list of hosts on a given interface.
734  
735 path => 'lan/browser/',
736 method => 'GET',
737 params => [ qw/suff/ ],
738 required => [ qw/suff/ ],
739 );
740  
741 23 fbx_api_method upd_host => (
742 description => <<'',
743 Update a host config.
744  
745 path => 'lan/browser/',
746 method => 'PUT',
747 params => [ qw/suff id primary_name host_type persistent / ],
748 required => [ qw/suff id/ ],
749 );
750  
751 23 fbx_api_method wol_host => (
752 description => <<'',
753 Send a WoL.
754  
755 path => 'lan/wol/',
756 method => 'POST',
757 params => [ qw/suff mac password/ ],
758 required => [ qw/suff mac/ ],
759 );
760  
761 #Freeplugs
762 23 fbx_api_method freeplugs_net => (
763 description => <<'',
764 Get freeplugs networks and information.
765  
766 path => 'freeplug/',
767 method => 'GET',
768 params => [ qw/suff/ ],
769 required => [ ],
770 );
771  
772 23 fbx_api_method reset_freeplug => (
773 description => <<'',
774 Reset a freeplug.
775  
776 path => 'freeplug/',
777 method => 'POST',
778 params => [ qw/suff/ ],
779 required => [ qw/suff/ ],
780 );
781  
782 #DHCP
783 fbx_api_method s'/'_'gr => (
784 description => <<'',
785 Global DHCP getters.
786  
787 path => $_,
788 method => 'GET',
789 params => [ ],
790 required => [ ],
791 23 ) for qw(dhcp/config dhcp/static_lease dhcp/dynamic_lease);
792 #TODO finish
793  
794 #FTP
795  
796 23 fbx_api_method ftp_config => (
797 description => <<'',
798 Get the FTP config.
799  
800 path => 'ftp/config/',
801 method => 'GET',
802 params => [ ],
803 required => [ ],
804 );
805  
806 23 fbx_api_method set_ftp_config => (
807 description => <<'',
808 Set the FTP config.
809  
810 path => 'ftp/config',
811 method => 'PUT',
812 params => [ qw/enabled allow_anonymous allow_anonymous_write password/ ],
813 required => [ ],
814 );
815  
816 #NAT
817 23 fbx_api_method fw_dmz => (
818 description => <<'',
819 Get dmz config.
820  
821 path => "fw/dmz/",
822 method => 'GET',
823 params => [ ],
824 required => [ ],
825 );
826  
827 fbx_api_method s'/'_'gr => (
828 description => <<'',
829 Global NAT getters.
830  
831 path => $_,
832 method => 'GET',
833 params => [ qw/suff/ ],
834 required => [ qw/suff/ ],
835 23 ) for qw(fw/redir/ fw/incoming/);
836 #TODO rest
837  
838 #UPNP
839 fbx_api_method s'/'_'gr => (
840 description => <<'',
841 Global UPNP getters.
842  
843 path => $_,
844 method => 'GET',
845 params => [ ],
846 required => [ ],
847 23 ) for qw(upnpigd/config upnpigd/redir/);
848 #TODO rest
849  
850 #LCD
851 23 fbx_api_method lcd => (
852 description => <<'',
853 Get the LCD config.
854  
855 path => 'lcd/config/',
856 method => 'GET',
857 params => [ ],
858 required => [ ],
859 );
860 23 fbx_api_method set_lcd => (
861 description => <<'',
862 Set the LCD config.
863  
864 path => 'lcd/config/',
865 method => 'PUT',
866 params => [ qw/brightness orientation orientation_forced/ ],
867 required => [ ],
868 );
869  
870 #SHARES
871 fbx_api_method s'/'_'gr => (
872 description => <<'',
873 Global Network Shares getters.
874  
875 path => $_,
876 method => 'GET',
877 params => [ ],
878 required => [ ],
879 23 ) for qw(netshare/samba netshare/afp);
880 #TODO rest
881  
882 #UPNPAV
883 23 fbx_api_method upnpav => (
884 description => <<'',
885 Get the UPNPAV config.
886  
887 path => 'upnpav/config',
888 method => 'GET',
889 params => [ ],
890 required => [ ],
891 );
892 23 fbx_api_method set_upnpav => (
893 description => <<'',
894 Set the UPNPAV config.
895  
896 path => 'upnpav/config',
897 method => 'PUT',
898 params => [ qw/enabled/],
899 required => [ qw/enabled/],
900 );
901  
902 #SWITCH
903 23 fbx_api_method switch_sts => (
904 description => <<'',
905 Get the switch status.
906  
907 path => 'switch/status/',
908 method => 'GET',
909 params => [ ],
910 required => [ ],
911 );
912  
913 23 fbx_api_method switch_port => (
914 description => <<'',
915 Get the switch port config and status.
916  
917 path => 'switch/port/',
918 method => 'GET',
919 params => [ qw/suff/ ],
920 required => [ qw/suff/ ],
921 );
922  
923 23 fbx_api_method set_switch_port => (
924 description => <<'',
925 Update a port config.
926  
927 path => 'switch/port/',
928 method => 'PUT',
929 params => [ qw/suff duplex speed/ ],
930 required => [ qw/suff/ ],
931 );
932  
933 #wifi
934 fbx_api_method s'/'_'gr => (
935 description => <<'',
936 Global Wifi getters.
937  
938 path => $_,
939 method => 'GET',
940 params => [ ],
941 required => [ ],
942 23 ) for qw(wifi/config wifi/planning wifi/mac_filter);
943  
944 fbx_api_method s'/'_'gr => (
945 description => <<'',
946 Wifi AP and bss configuration.
947  
948 path => $_,
949 method => 'GET',
950 params => [ qw/suff/ ],
951 required => [ qw/suff/ ],
952 23 ) for qw( wifi/ap/ wifi/bss/ );
953  
954 #TODO finish
955  
956 #System
957 23 fbx_api_method system => (
958 description => <<'',
959 Get the system info.
960  
961 path => 'system',
962 method => 'GET',
963 params => [ ],
964 required => [ ],
965 );
966  
967 23 fbx_api_method reboot => (
968 description => <<'',
969 Reboot the system.
970  
971 path => 'system/reboot',
972 method => 'POST',
973 params => [ ],
974 required => [ ],
975 );
976  
977 #VPN server
978 fbx_api_method s'/'_'gr => (
979 description => <<'',
980 Global VPN server getters.
981  
982 path => $_,
983 method => 'GET',
984 params => [ ],
985 required => [ ],
986 23 ) for qw(vpn/ vpn/user/ vpn/ip_pool/);
987  
988 #VPN client
989 fbx_api_method s'/'_'gr => (
990 description => <<'',
991 Global VPN client getters.
992  
993 path => $_,
994 method => 'GET',
995 params => [ ],
996 required => [ ],
997 23 ) for qw(vpn_client/config/ vpn_client/status vpn_client/log);
998 #TODO finish
999  
1000 #Storage
1001 fbx_api_method s'/'_'gr => (
1002 description => <<'',
1003 Global storage getters.
1004  
1005 path => $_,
1006 method => 'GET',
1007 params => [ ],
1008 required => [ ],
1009 23 ) for qw(storage/disk/ storage/partition/);
1010 #TODO finish
1011  
1012 #Parental
1013 fbx_api_method s'/'_'gr => (
1014 description => <<'',
1015 Global parental getters.
1016  
1017 path => $_,
1018 method => 'GET',
1019 params => [ ],
1020 required => [ ],
1021 23 ) for qw(parental/config/ parental/filter/);
1022 #TODO finish
1023  
1024 23 1;
1025 __END__
« lib/WWW/FBX/Role/Auth.pm ↑ Summary lib/WWW/FBX/Error.pm »