-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapiary.apib
5522 lines (3405 loc) · 183 KB
/
apiary.apib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
FORMAT: 1A
HOST: http://127.0.0.1:5600/api/v1
# AirDC++ Web API
>Missing information, typos or other errors? You can help with improving the documentation by [editing it on Github](https://github.com/airdcpp-web/airdcpp-apidocs).
>API-related bugs or feature requests? Please report them for the [AirDC++ Web Client project on Github](https://github.com/airdcpp-web/airdcpp-webclient/issues).
AirDC++ Web API is used for communicating with AirDC++ file sharing application via HTTP REST or [WebSockets](https://en.wikipedia.org/wiki/WebSocket).
## Version history
### API version 1 (2017-05-05)
First documented API version
#### Compatible applications
- [AirDC++ Web Client](https://airdcpp-web.github.io) 2.0.0 or newer
- [AirDC++ for Windows](https://www.airdcpp.net) 3.40 or newer
## Communicating with the API
When communicating with the API locally, you can write an extension that is managed by the application itself (see the [Resources section](#resources) below)
You may also access the API from external sources (such as shell scripts or command line).
### API base URL (HTTP)
When connecting to the API via HTTP, all paths in this documentation should be prefixed with `http(s)://SERVER_IP:PORT/api/v1/`.
When calling the API locally from the same computer, the base URL would be `http://127.0.0.1:5600/api/v1/` if the server is configured to use the default HTTP port.
### Example CURL command (HTTP)
The following terminal command can be used to rescan all your shared files:
`curl -H "Content-Type: application/json" -X POST -u myusername:mypassword http://localhost:5600/api/v1/share/refresh`
### Communication protocol details
See [communication-protocols.md on GitHub](https://github.com/airdcpp-web/airdcpp-apidocs/blob/master/communication-protocols.md) for more information about the raw HTTP/WebSocket protocol.
## Resources
### Tools
**[airdcpp-create-extension](https://github.com/airdcpp-web/airdcpp-create-extension)**
Extension starter project for JavaScript
**[airdcpp-apisocket-js](https://github.com/airdcpp-web/airdcpp-apisocket-js)**
Websocket connector for Javascript (Node.js/web browsers) for remote/browser-side communication
### Resources
**[airdcpp-extensions](https://github.com/airdcpp-web/airdcpp-extensions)**
Extension specifications
**[Hooks vs event listeners](https://github.com/airdcpp-web/airdcpp-apidocs/blob/master/communication-protocols.md#action-hooks)**
The difference of hooks and event listeners explained
### Usage examples
- [Example JavaScript extensions](https://github.com/airdcpp-web/airdcpp-extension-js/tree/master/examples)
- [Example Python extension](https://github.com/airdcpp-web/airdcpp-example-python-extension)
- [Release validator extension (JavaScript)](https://github.com/maksis/airdcpp-release-validator)
- [AirDC++ Web UI (JavaScript)](https://github.com/airdcpp-web/airdcpp-webui)
### Support
**Developer hub**
You may join the developer hub at adcs://web-dev.airdcpp.net:1511
**GitHub**
[Issue tracker](https://github.com/airdcpp-web/airdcpp-webclient/issues)
# Group ADC commands
The ADC command module provides low-level functionality for reading/sending/modifying the ADC protocol traffic (client-hub and client-client) and advertising custom ADC protocol features.
You shouldn't generally use this module unless you are implementing a new ADC extension or you have a more advanced use case that can't be implemented by using other API modules. Note that ADC protocol is only being used in ADC hubs (the address starts with adc:// or adcs://) and the API doesn't provide similar functionality for the legacy NMDC hubs.
You should use the official [ADC protocol site](https://adc.sourceforge.io/) (including the protocol specifications) for reference when working with the protocol.
**Minimum API feature level**: 9
## Send command [/adc_commands/commands]
### Send hub command [POST /adc_commands/hub_command]
Note that either `required_features` or `excluded_features` must be provided when sending a `F` type command.
Required permission: *admin*
+ Request (application/json)
+ Attributes
+ hub_url: adcs://myhub.com:6423 (required) - Hub URL
+ command (ADC command, required)
+ cid: NJSHVYR4ZHCZFUEZNGA7M2D72S5AB4WQAMPBKFA (optional) - Command recipient (required for D and E command types)
+ required_features: `ASCH`, `SEGA` (optional) - The command will be broadcasted only to users having all of the listed features (applied only with the F command type, ignored for other types)
+ excluded_features: `ASCH`, `SEGA` (optional) - The command will be broadcasted only to users who don't have any of the listed features (applied only with the F command type, ignored for other types)
+ Response 201
### Send UDP command [POST /adc_commands/udp_command]
Send a protocol command directly to a user over the [UDP protocol](https://en.wikipedia.org/wiki/User_Datagram_Protocol).
Note that only the `U` command type is valid for UDP commands.
Required permission: *admin*
+ Request (application/json)
+ Attributes
+ user (Hinted user, required) - Command recipient
+ command (ADC command, required)
+ hub_fallback: true (boolean, optional) - Send the command via the hub if the user is in passive mode (the command type will be changed to `D` in such case)
+ Default: false
+ Response 201
### Send user connection command [POST /adc_commands/user_connection_command]
Send a protocol command directly to a user over the TCP connection.
Note that only the `C` command type is valid for user connection commands. Commands can't be sent for connections that are in data mode (binary data is being transferred).
Required permission: *admin*
+ Request (application/json)
+ Attributes
+ user_connection: 4515616 (number, required) - User connection ID
+ command (ADC command, required)
+ Response 201
## Hub supports [/adc_commands/supports/hub]
ADC features that are sent to the hub in the [SUP command](https://adc.sourceforge.io/ADC.html#_sup). These won't be broadcasted to all users so features sent in here are typically related only to client-hub communication (see the next section for user supports).
### Add hub support [POST /adc_commands/supports/hub/{support}]
Required permission: *admin*
+ Parameters
+ support: HBRI - Support to be added
+ Response 201
### Remove hub support [DELETE /adc_commands/supports/hub/{support}]
Required permission: *admin*
+ Parameters
+ support: HBRI - Support to be removed
+ Response 204
## Hub user supports [/adc_commands/supports/hub_user]
ADC features that are broadcasted to all users in [INF's SU param](https://adc.sourceforge.io/ADC.html#_inf). Supports that are relevant in client-client communication should be sent here. Note that user connection supports that aren't relevant before establishing the connection shouldn't be sent here in order to save hub's bandwidth (see the next section for user connection supports).
### Add hub user support [POST /adc_commands/supports/hub_user/{support}]
Required permission: *admin*
+ Parameters
+ support: DFAV - Support to be added
+ Response 201
### Remove hub user support [DELETE /adc_commands/supports/hub_user/{support}]
Required permission: *admin*
+ Parameters
+ support: DFAV - Support to be removed
+ Response 204
## User connection supports [/adc_commands/supports/user_connection]
ADC features that are sent to the other user in the [SUP command](https://adc.sourceforge.io/ADC.html#_sup) when a direct TCP connection is being established. Supports that are relevant for direct TCP communication (typically transfers) should be sent here.
### Add user connection support [POST /adc_commands/supports/user_connection/{support}]
Required permission: *admin*
+ Parameters
+ support: MCN1 - Support to be added
+ Response 201
### Remove user connection support [DELETE /adc_commands/supports/user_connection/{support}]
Required permission: *admin*
+ Parameters
+ support: MCN1 - Support to be removed
+ Response 204
## Event listeners [/adc_commands/listeners]
Each listener allows you to subscribe only to a single three-letter command. It's recommended that you only subscribe to the commands that you are interested in to avoid excess traffic.
Required permission: *admin*
### Incoming hub command [POST /adc_commands/listeners/incoming_hub_command[/{command}]]
+ Parameters
+ command: MSG - Command
+ Response 200 (application/json)
+ Attributes
+ user (Hub user, optional) - Possible user who sent the command
+ hub (Hub base, required) - Hub via which the command was received
+ command (ADC command, required)
### Outgoing hub command [POST /adc_commands/listeners/outgoing_hub_command[/{command}]]
+ Parameters
+ command: MSG - Command
+ Response 200 (application/json)
+ Attributes (Outgoing hub command)
### Incoming UDP command [POST /adc_commands/listeners/incoming_udp_command[/{command}]]
Note that sending user isn't specified by this event listener as there is no generic way to connect the command to a specific user. UDP command typically include the CID of the sender but be aware that it can also be faked.
+ Parameters
+ command: RES - Command
+ Response 200 (application/json)
+ Attributes
+ ip: 2a00:1a48:1261::168 (required) - IP address of the sender of the command
+ command (ADC command, required)
### Outgoing UDP command [POST /adc_commands/listeners/outgoing_udp_command[/{command}]]
+ Parameters
+ command: RES - Command
+ Response 200 (application/json)
+ Attributes (Outgoing UDP command)
### Incoming user connection command [POST /adc_commands/listeners/incoming_user_connection_command[/{command}]]
+ Parameters
+ command: MSG - Command
+ Response 200 (application/json)
+ Attributes
+ user_connection (User connection, required)
+ command (ADC command, required)
### Outgoing user connection command [POST /adc_commands/listeners/outgoing_user_connection_command[/{command}]]
+ Parameters
+ command: MSG - Command
+ Response 200 (application/json)
+ Attributes (Outgoing user connection command)
## Hooks [/adc_commands/hooks]
Each hook allows you to subscribe only to a single three-letter command. It's recommended that you only subscribe to the commands that you are interested in to avoid excess traffic.
### Outgoing hub command [POST /adc_commands/hooks/outgoing_hub_command_hook[/{command}]]
+ Parameters
+ command: MSG - Command
+ Request (application/json)
+ Attributes (Outgoing hub command)
+ Response 200 (application/json)
+ Attributes (Named ADC params)
### Outgoing UDP command [POST /adc_commands/hooks/outgoing_udp_command_hook[/{command}]]
+ Parameters
+ command: RES - Command
+ Request (application/json)
+ Attributes (Outgoing UDP command)
+ Response 200 (application/json)
+ Attributes (Named ADC params)
### Outgoing user connection command [POST /adc_commands/hooks/outgoing_user_connection_command_hook[/{command}]]
+ Parameters
+ command: MSG - Command
+ Request (application/json)
+ Attributes (Outgoing user connection command)
+ Response 200 (application/json)
+ Attributes (Named ADC params)
## Data Structures
### ADC command (object, fixed-type)
+ type: D (enum[string], required) - [ADC command type](https://adc.sourceforge.io/ADC.html#_message_types)
+ B
+ C
+ D
+ F
+ H
+ I
+ U
+ command: SCH (required) - Three letter command code
+ params: `TO1/2844416609`, `GE0`, `ANexample`, `ANsearch` (array[string], required) - Command parameters
### Named ADC param
+ name: GE (required) - Parameter name
+ value: 0 (required) - Parameter value
### Named ADC params
+ params (array[Named ADC param], required) - Command parameters to add (existing parameters can't be removed)
### User connection
+ id: 5325 (number, required)
+ user (Hinted user, optional) - Recipient of the command. Note that the user isn't known during the handshake phase.
+ ip: 2a00:1a48:1261::168 (required) - IP address of the remote user
### Outgoing UDP command
+ user (Hub user, required) - Recipient of the command
+ command (ADC command, required)
### Outgoing hub command
+ user (Hub user, optional) - Possible recipient of the command
+ hub (Hub base, required) - Hub via which the command will be sent
+ command (ADC command, required)
### Outgoing user connection command
+ user_connection (User connection, required)
+ command (ADC command, required)
# Group Favorite directories
## Favorite directories [/favorite_directories]
### List favorite directories [GET]
Get a list of all favorite directories.
Required permission: *settings_view*
+ Response 200 (application/json)
+ Attributes (array[Favorite directory], fixed-type)
### Get grouped paths [GET /favorite_directories/grouped_paths]
+ Response 200 (application/json)
+ Attributes (array[Grouped path], fixed-type)
### Create favorite directory [POST]
Required permission: *settings_edit*
+ Request (application/json)
+ Attributes
+ path: /home/airdcpp/share/Linux/ (required) - Directory path
+ name: Linux (optional) - Virtual display name for the directory. Multiple paths can be added with the same name. Name will be determined from the path if not specified.
+ Response 200 (application/json)
+ Attributes (Favorite directory)
## Favorite directory [/favorite_directories/{directory_id}]
### Update favorite directory [PATCH]
Update the specified fields of a favorite directory.
Required permission: *settings_edit*
+ Request (application/json)
+ Attributes
+ name: Linux - Virtual display name for the directory. Multiple paths can be added with the same name.
+ Response 200 (application/json)
+ Attributes (Favorite directory)
### Get favorite directory [GET]
Get a single directory by ID.
Required permission: *settings_view*
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Favorite directory)
### Remove favorite directory [DELETE]
Required permission: *settings_edit*
+ Response 204
## Event listeners [/favorite_directories/listeners]
Required permission: *settings_view*
### Favorite directories updated [POST /favorite_hubs/listeners/favorite_hub_updated]
+ Response 200 (application/json)
+ Attributes (array[Favorite directory], fixed-type)
## Data Structures
### Favorite directory (object, fixed-type)
+ id: CUO74LMZUQMQCBR5UKTIFJPO32LVUH5VZBOL54Y (required)
+ name: Linux (required) - Virtual display name for the directory. Multiple paths can be added with the same name.
+ path: /home/airdcpp/share/Linux/ (required) - Directory path
# Group Favorite hubs
Favorite hubs allow storing commonly used hubs that can be opened automatically on application startup. Various settings, such as user identification info and connectivity, can be customized on per-hub basis.
## Favorite hubs [/favorite_hubs]
### List favorite hubs [GET /favorite_hubs/{start}/{count}]
Get a list of favorite hubs
Required permission: *favorite_hubs_view*
+ Parameters
+ start: 0 - Index of the first item to return
+ count: 100 - Maximum number of items to return, must be larger than 0
+ Response 200 (application/json)
+ Attributes (array[Favorite hub], fixed-type)
### Create favorite hub [POST]
Required permission: *favorite_hubs_edit*
+ Request (application/json)
+ Attributes (Favorite hub request)
+ Response 200 (application/json)
+ Attributes (Favorite hub)
## Favorite hub [/favorite_hubs/{hub_id}]
### Update favorite hub [PATCH]
Update the specified fields of a favorite hub
Required permission: *favorite_hubs_edit*
+ Request (application/json)
+ Attributes (Favorite hub request)
+ name: Demo hub (optional)
+ hub_url: adcs://myhub.com:6423 (optional)
+ Response 200 (application/json)
+ Attributes (Favorite hub)
### Get favorite hub [GET]
Get a single hub by ID.
Required permission: *favorite_hubs_view*
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Favorite hub)
### Remove favorite hub [DELETE]
Required permission: *favorite_hubs_edit*
+ Response 204
## Event listeners [/favorite_hubs/listeners]
Required permission: *favorite_hubs_view*
### Favorite hub created [POST /favorite_hubs/listeners/favorite_hub_created]
+ Response 200 (application/json)
+ Attributes (Favorite hub)
### Favorite hub updated [POST /favorite_hubs/listeners/favorite_hub_updated]
+ Response 200 (application/json)
+ Attributes (Favorite hub)
### Favorite hub created [POST /favorite_hubs/listeners/favorite_hub_removed]
+ Response 200 (application/json)
+ Attributes (Favorite hub)
## Data Structures
### Favorite hub base (object)
+ name: Demo hub (required)
+ hub_description: Demo hub for AirDC++ Web Client (nullable)
+ hub_url: adcs://myhub.com:6423 (required)
+ nick: Developer (nullable) - User nick (defaults to global value if not set)
+ user_description: Just writing scripts (nullable) - User description (defaults to global value if not set)
+ nmdc_encoding: CP1252 (nullable) - Iconv codepage to use for text conversion (NMDC hubs only, defaults to global value if not set)
+ connection_mode_v4 (Connectivity mode, nullable) - IPv4 connectivity mode (defaults to global value if not set)
+ connection_mode_v6 (Connectivity mode, nullable) - IPv6 connectivity mode (defaults to global value if not set)
+ connection_ip_v4: 89.255.248.35 (nullable) - IPv4 address (defaults to global value if not set)
+ connection_ip_v6: 2a00:1a48:1261::168 (nullable) - IPv6 address (defaults to global value if not set)
+ show_joins: false (boolean, nullable) - Show joining/parting users **Minimum API feature level**: 5 (defaults to global value if not set)
+ fav_show_joins: true (boolean, nullable) - Show joining/parting favorite users **Minimum API feature level**: 5 (defaults to global value if not set)
+ use_main_chat_notify: false (boolean, nullable) - Show notification on new chat messages **Minimum API feature level**: 5 (defaults to global value if not set)
+ away_message: I'm away (string, nullable) - Custom away message **Minimum API feature level**: 5 (defaults to global value if not set)
+ log_main: false (boolean, nullable) - Log main chat **Minimum API feature level**: 5 (defaults to global value if not set)
### Favorite hub (Favorite hub base, fixed-type)
+ id: 64723743 (number, required)
+ auto_connect: true (boolean, required) - Automatically connect to this hub on startup
+ connect_state (object, required)
+ id: connected (enum[string])
+ connecting
+ connected
+ disconnected
+ str: Connected
+ current_hub_id: 5 (number) - Current hub session ID (0 = no session)
+ share_profile (Share profile basic, nullable) - Share profile to use (ADC hubs only, defaults to global value if not set)
+ has_password: true (boolean, required) - Specifies whether a password has been saved for this entry
### Favorite hub request (Favorite hub base, fixed-type)
+ share_profile: 7436564 (number, nullable) - Share profile to use (ADC hubs only, defaults to global value if not set)
+ password: mystrongpassword (nullable)
+ auto_connect: true (boolean) - Automatically connect to this hub on startup
# Group Events
Events are used for displaying and logging informative messages and errors to the application user. Note that events are not bind to any specific context;
some entities, such as hubs, provide similar methods for showing information locally to the application user.
## Methods [/events]
### Get events [GET /events/{max_count}]
Get the latest event message. Returned messages are be sorted from oldest to newest.
Required permission: *events_view*
+ Parameters
+ max_count: 0 - Maximum number of messages to return (starts from the latest ones, 0 = unlimited)
+ Response 200 (application/json)
+ Attributes (array[Status message], fixed-type)
### Add event [POST /events]
Send a new event message.
Required permission: *events_edit*
+ Request (application/json)
+ Attributes (Event message request)
+ Response 204
### Clear event cache [DELETE /events]
Required permission: *events_edit*
+ Response 204
### Set all events as read [POST /events/read]
Required permission: *events_edit*
+ Response 204
### Get event counts [GET /events/counts]
Required permission: *events_view*
+ Response 200 (application/json)
+ Attributes (Log message info)
## Event listeners [/events/listeners]
Required permission: *events_view*
### Event counts updated [POST /events/listeners/event_counts]
+ Response 200 (application/json)
+ Attributes (Log message info)
### Event added [POST /events/listeners/event_message]
+ Response 200 (application/json)
+ Attributes (Status message)
## Data Structures
### Event message request (object, fixed-type)
+ text: `[10]APITester: ISO file(s) over 500 MB in share (/Ubuntu/Ubuntu 14.04.iso)` (required)
+ severity: info (Severity, required)
# Group Extensions
## Extensions [/extensions]
### Get extensions [GET]
Get a list of all installed extensions.
Required permission: *admin*
+ Response 200 (application/json)
+ Attributes (array[Extension], fixed-type)
### Register unmanaged extension [POST]
Register an extension from the calling session. The request payload should contain all required fields from package.json.
Sending the whole package.json content is acceptable as well.
Please see [the extension specifications](https://github.com/airdcpp-web/airdcpp-extensions#packagejson) for more information about the package.json format.
Required permission: *admin*
+ Request (application/json)
{
"name": "airdcpp-create-extension",
"version": "0.0.1-beta5",
"description": "Starter project for AirDC++ extension development."
"author": {
"name": "maksis"
},
"keywords": [ "airdcpp", "airdcpp-extensions", "airdcpp-extensions-public", "airdcpp-extensions-test" ],
"bugs": "https://github.com/airdcpp-web/airdcpp-create-extension/issues/",
"repository": {
"type": "git",
"url": "https://github.com/airdcpp-web/airdcpp-create-extension/"
},
"airdcpp": {
"apiVersion": 1,
"minApiFeatureLevel": 0
}
}
+ Response 200 (application/json)
+ Attributes (Extension)
### Install managed extension [POST /extensions/download]
Download extension package from the remote URL. The package will be installed and started automatically.
Required permission: *admin*
+ Request (application/json)
+ Attributes (object)
+ install_id: `airdcpp-create-extension` (required) - Install ID that can be used for tracking the installation progress events. Any (unique) string can be used (such as the name of the extension).
+ url: https://registry.npmjs.org/airdcpp-create-extension/-/airdcpp-create-extension-0.0.1-beta4.tgz (required) - URL from which the extension should be download from
+ shasum: 77f49298863b1460cf65e6c125e659f7dd9dac9e (optional) - Possible SHA1 sum that can be used for validating the package integrity
+ Response 204
## Extension entity [/extensions/{extension_id}]
### Get extension [GET]
Get a single extension by ID.
Required permission: *admin*
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Extension)
### Update extension properties [PATCH]
**Minimum API feature level**: 9
Required permission: *admin*
+ Request (application/json)
+ Attributes (object, fixed-type)
+ disabled: true (boolean) - Whether autostart is disabled for the extension
+ Response 204
### Remove extension [DELETE]
Required permission: *admin*
+ Response 204
## Event listeners [/extensions/listeners]
Required permission: *admin*
All event listeners from extension entities are also available to be used across all sessions (add them with */extensions/listeners/event_name*).
### Extension added [POST /extensions/listeners/extension_created]
+ Response 200 (application/json)
+ Attributes (Extension)
### Extension removed [POST /extensions/listeners/extension_removed]
+ Response 200 (application/json)
+ Attributes (Extension)
### Extension package updated [POST /extensions/listeners/extension_package_updated]
+ Response 200 (application/json)
+ Attributes (Extension)
### Extension installation started [POST /extensions/listeners/extension_installation_started]
+ Response 200 (application/json)
+ Attributes (object, fixed-type)
+ install_id: `airdcpp-create-extension` (required) - The supplied extension install ID
### Extension installation succeeded [POST /extensions/listeners/extension_installation_succeeded]
+ Response 200 (application/json)
+ Attributes (object, fixed-type)
+ install_id: `airdcpp-create-extension` (required) - The supplied extension install ID
### Extension installation failed [POST /extensions/listeners/extension_installation_failed]
+ Response 200 (application/json)
+ Attributes (object, fixed-type)
+ install_id: `airdcpp-create-extension` (required) - The supplied extension install ID
+ message: `Failed to move extension files to the final destination directory (permission denied)` (required)
## Data Structures
### Extension (object, fixed-type)
+ id: `airdcpp-create-extension` (required)
+ name: `airdcpp-create-extension` (required)
+ description: Starter project for AirDC++ extension development (required)
+ version: `0.0.1-beta4` (required)
+ homepage: `https://airdcpp-web.github.io` (nullable)
+ author: maksis (required)
+ disabled: false (boolean, required) - Whether autostart is disabled for the extension. **Minimum API feature level**: 9
+ running: true (boolean, required)
+ private: false (boolean, required) - Whether the extension is private (not published at npm)
+ logs (array[Filesystem item], fixed-type, required)
+ engines: node (array[string], fixed-type, required) - List of scripting engines supported by the extension
+ managed: true (boolean, required) - Whether the extension is managed (installed locally)
+ has_settings: true (boolean, required) - Whether there settings available for configuring
# Group Extension entities
## Methods [/extensions/{extension_id}/methods]
### Start extension [POST /extensions/{extension_id}/start]
Required permission: *admin*
+ Response 204
### Stop extension [POST /extensions/{extension_id}/stop]
Required permission: *admin*
+ Response 204
### Initialization completed [POST /extensions/{extension_id}/ready]
Notify the application that the extension has been initialized and it's ready to process hooks and event listeners. Should be called only by the extension with its own ID.
This method should be used only if the ```airdcpp.signalReady``` package.json boolean is ```true``` (read the [extension specification documentation](https://github.com/airdcpp-web/airdcpp-extensions) for more information about the flag).
+ Response 204
### Post setting definitions [POST /extensions/{extension_id}/settings/definitions]
Post schema for extension-specific settings that can be made available in the UI for configuring. Extensions should generally post their setting definitions on every startup.
Setting definitions can't be changed or removed after they have been posted (the extension must be restarted before new definitions can be added).
Required permission: *admin*
+ Request (application/json)
+ Attributes (array[Setting definition], fixed-type)
+ Response 204
### Get setting definitions [GET /extensions/{extension_id}/settings/definitions]
Get schema information of the extension-specific settings that have been posted earlier (if there are any).
Required permission: *settings_view*
+ Response 200 (application/json)
+ Attributes (array[Setting definition], fixed-type)
### Get setting values [GET /extensions/{extension_id}/settings]
Key-value listing of extension-specific setting keys and their current values.
Required permission: *settings_view*
+ Response 200 (application/json)
+ Attributes (object)
+ Sample
+ spam_on_startup: false (boolean)
+ banner_text: Test
### Update setting values [PATCH /extensions/{extension_id}/settings]
Update the extension-specific setting values. The values are being validated based on the previously posted schema definitions.
Partial updates are supported (only values for the specified keys are being updated).
Required permission: *settings_edit*
+ Request (application/json)
+ Attributes (object)
+ Sample
+ spam_on_startup: false (boolean)
+ banner_text: Test
+ Response 204
## Event listeners [/extensions/{extension_id}/listeners]
All event listeners from extension entities are also available to be used across all sessions (add them with */extensions/listeners/event_name*).
Required permission: *admin*
### Extension started [POST /extensions/listeners/extension_started]
+ Response 200 (application/json)
+ Attributes (Extension)
### Extension stopped [POST /extensions/listeners/extension_stopped]
+ Response 200 (application/json)
+ Attributes (Extension)
### Extension updated [POST /extensions/listeners/extension_updated]
Generic listener for updated extension properties (only the updated ones are sent).
+ Response 200 (application/json)
+ Attributes (Extension)
### Extension settings updated [POST /extensions/listeners/extension_settings_updated]
Key-value listing of updated setting keys and their values (only the updated ones are sent).
+ Response 200 (application/json)
+ Attributes (object)
+ Sample
+ spam_on_startup: false (boolean, sample)
+ banner_text: Test (sample)
# Group Filelists
Filelist API allows browsing remote users' shared content or own share and manages queueing of directory downloads from other users. Note that filelist sessions are shared across API/UI sessions. Filelists of non-AirDC++ users will also contain less information about filelist directories/files.
API sessions use partial filelists so the content of each directory is downloaded only once it has been requested. Due to this, it may take some time when switching from one directory to another (especially when browsing remote NMDC filelists).
## Filelist [/filelists]
### Get filelist sessions [GET]
Get a list of all filelist sessions.
Required permission: *filelists_view*
+ Response 200 (application/json)
+ Attributes (array[Filelist], fixed-type)
### Create remote filelist session [POST]
Queue filelist from an user.
Required permission: *filelists_edit*
+ Request (application/json)
+ Attributes
+ user (Hinted user base, required)
+ directory: /Share/Ubuntu/ (optional) - Initial filelist directory to load. Filelist root is loaded, if not specified.
+ Default: /
+ Response 200 (application/json)
+ Attributes (Filelist)
### Create local filelist session [POST /filelists/self]
Browse own share.
Required permission: *filelists_edit*
+ Request (application/json)
+ Attributes (object)
+ share_profile: 643 (number, optional) - ID of the share profile to browse. Default profile is used if not specified.
+ Response 200 (application/json)
+ Attributes (Filelist)
### Match queue [POST /filelists/match_queue]
Match queue and add the user as source for matching files.
Required permission: *queue_edit*
+ Request (application/json)
+ Attributes (object)
+ user (Hinted user base, required)
+ directory: /Share/Ubuntu/ (optional) - Directory to match from ADC (recursive partial list is used). Full filelist is always matched from NMDC users.
+ Default: /
+ Response 204
## Filelist session [/filelists/{session_id}]
### Get session [GET]
Get a single filelist session by ID.
Required permission: *filelists_view*
+ Request (application/json)
+ Response 200 (application/json)
+ Attributes (Filelist)
### Update session [PATCH]
**Minimum API feature level**: 1
Update filelist session properties
+ Request (application/json)
+ Attributes (object)
+ hub_url: adcs://myhub.com:6423 (optional) - URL of the hub to browse the list through (remote filelists only)
+ share_profile: 643 (number, optional) - ID of the share profile to browse (own filelist only)
+ Response 204
### Remove session [DELETE]
Required permission: *filelists_edit*
+ Response 204
## Directory downloads [/filelists/directory_downloads]
### Get directory downloads [GET]
Get a list of all directory downloads.
Required permission: *download*
+ Response 200 (application/json)
+ Attributes (array[Directory download item], fixed-type)
### Create directory download [POST]