-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yml
5604 lines (5571 loc) · 162 KB
/
openapi.yml
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
openapi: 3.0.3
info:
title: Adapt REST API
description: Public REST API for the Adapt chat platform
license:
name: AGPL-3.0
version: 0.1.0
servers:
- url: https://api.adapt.chat
description: Production
paths:
/bots:
get:
tags:
- users
summary: Get All Bots
description: Fetches all bot accounts owned by the authenticated user.
operationId: get_bots
responses:
'200':
description: List of bots
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Bot'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
post:
tags:
- users
summary: Create Bot
description: Registers a new bot account with the given payload.
operationId: create_bot
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateBotPayload'
required: true
responses:
'201':
description: Bot ID and token
content:
application/json:
schema:
$ref: '#/components/schemas/CreateBotResponse'
'400':
description: Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: Username is already taken
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/bots/{bot_id}:
get:
tags:
- users
summary: Get Bot
description: Fetches information about a bot account by its ID.
operationId: get_bot
parameters:
- name: bot_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'200':
description: Bot object
content:
application/json:
schema:
$ref: '#/components/schemas/Bot'
'404':
description: Bot not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
delete:
tags:
- users
summary: Delete Bot
description: Deletes a bot account. Requires the bot owner's password if the bot is in over 20 guilds.
operationId: delete_bot
parameters:
- name: bot_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/DeleteBotPayload'
nullable: true
required: false
responses:
'204':
description: Bot was successfully deleted
'400':
description: Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Invalid token/credentials
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
patch:
tags:
- users
summary: Edit Bot
description: Modifies information about a bot account.
operationId: edit_bot
parameters:
- name: bot_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EditBotPayload'
required: true
responses:
'200':
description: Bot object after modification
content:
application/json:
schema:
$ref: '#/components/schemas/Bot'
'400':
description: Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'409':
description: Username is already taken
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/bots/{bot_id}/tokens:
post:
tags:
- users
summary: Regenerate Bot Token
description: |-
Regenerates a token for a bot you own. If the bot is in over 20 guilds, you must provide the bot
owner's password.
operationId: regenerate_bot_token
parameters:
- name: bot_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
requestBody:
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/RegenerateBotTokenPayload'
nullable: true
required: false
responses:
'200':
description: Token regenerated
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
'400':
description: Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Invalid token/credentials
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/channels/{channel_id}:
get:
tags:
- channels
summary: Get Channel
description: |-
Gets information about a channel given its ID. This includes guild channels, DM channels, and
group DM channels.
operationId: get_channel
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'200':
description: Channel information
content:
application/json:
schema:
$ref: '#/components/schemas/Channel'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
delete:
tags:
- channels
summary: Delete Channel
description: |-
Deletes a channel. For guild channels, you must have the `MANAGE_CHANNELS` permission to use
this endpoint. For standard DM channels, you must be a recipient of the DM. For group DM
channels, you must be the owner of the group DM.
operationId: delete_channel
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'204':
description: Channel deleted
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
patch:
tags:
- channels
summary: Edit Channel
description: |-
Edits a channel with the given payload.
For guild channels, you must have the `MODIFY_CHANNELS` permission to use this endpoint.
operationId: edit_channel
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EditChannelPayload'
required: true
responses:
'200':
description: Channel with updated details
content:
application/json:
schema:
$ref: '#/components/schemas/Channel'
'400':
description: Invalid payload
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/channels/{channel_id}/ack/{message_id}:
put:
tags:
- channels
summary: Acknowledge Channel
description: |-
Acknowledges a channel up to the given message ID, marking the message and all messages before
it as read.
Note that a message with the given ID does not have to actually exist; to mark a specific
message as unread you can pass ``message_id - 1`` to this endpoint instead.
operationId: acknowledge_channel
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'204':
description: Channel acknowledged
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/channels/{channel_id}/messages:
get:
tags:
- messages
summary: Get Message History
description: |-
Fetches multiple messages from the channel's message history in bulk.
If in a guild, you must have the `VIEW_MESSAGE_HISTORY` permission to use this endpoint.
operationId: get_message_history
parameters:
- name: before
in: query
description: |-
If specified, only messages before this message will be returned. If any messages exactly
match this ID, they will **not** be returned.
required: false
schema:
type: integer
format: int64
nullable: true
minimum: 0
- name: after
in: query
description: |-
If specified, only messages after this message will be returned. If any messages exactly
match this ID, they will **not** be returned.
required: false
schema:
type: integer
format: int64
nullable: true
minimum: 0
- name: limit
in: query
description: |-
The limit of messages to return. If unspecified, this defaults to ``100``. Must be between
``0`` and ``200``.
required: false
schema:
type: integer
format: int32
minimum: 0
- name: user_id
in: query
description: If specified, only messages sent by the given user will be returned.
required: false
schema:
type: integer
format: int64
nullable: true
minimum: 0
- name: oldest_first
in: query
description: |-
Whether or not to query messages starting from the oldest message first. Defaults to
``false``.
If ``true``, messages will be sorted from oldest to newest. If ``false``, messages will be
sorted from newest to oldest.
required: false
schema:
type: boolean
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'200':
description: Array of message objects
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Message'
'400':
description: Invalid query
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
post:
tags:
- messages
summary: Create Message
description: |-
Sends a message in the given channel. You must have both the `VIEW_CHANNEL` and `SEND_MESSAGES`
permissions in that channel if this message is being sent in a guild.
operationId: create_message
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CreateMessagePayload'
required: true
responses:
'201':
description: Message object
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/channels/{channel_id}/messages/{message_id}:
get:
tags:
- messages
summary: Get Message
description: |-
Gets a message in the given channel with the given ID.
If in a guild, you must have the `VIEW_MESSAGE_HISTORY` permission to use this endpoint.
operationId: get_message
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'200':
description: Message object
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel or message not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
delete:
tags:
- messages
summary: Delete Message
description: |-
Deletes a message in the given channel. In a guild, you must have the `VIEW_CHANNEL` permission
to delete your own messages, with addition to the `MANAGE_MESSAGES` permission if you want to
delete messages sent by other members. If you have this permission, you are only able to delete
any messages sent by members who have either left the guild or are ranked lower than you in the
role hierarchy.
operationId: delete_message
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'204':
description: Message deleted
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel or message not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
patch:
tags:
- messages
summary: Edit Message
description: |-
Edits a message in the given channel. You must have the `VIEW_CHANNEL` and `SEND_MESSAGES`
permissions in that channel if the target message is in a guild.
operationId: edit_message
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/EditMessagePayload'
required: true
responses:
'200':
description: Message object
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel or message not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/channels/{channel_id}/messages/{message_id}/pin:
put:
tags:
- messages
summary: Pin Message
description: |-
Pins a message to its given channel. You must have the `PIN_MESSAGES` permission in the
channel, or be in a DM-type channel. This endpoint is idempotent.
operationId: pin_message
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'204':
description: Message pinned
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel or message not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
delete:
tags:
- messages
summary: Unpin Message
description: |-
Unpins a message from its given channel. You must have the `PIN_MESSAGES` permission in the
channel, or be in a DM-type channel. This endpoint is idempotent, so it may still return
success even if the message wasn't originally pinned.
operationId: unpin_message
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'204':
description: Message unpinned
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel or message not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/channels/{channel_id}/messages/{message_id}/reactions:
get:
tags:
- messages
summary: Get Message Reactions
description: |-
Fetches all reactions for a message. The reaction objects returned in the response will include
the `created_at` field. If in a guild, this requires the `VIEW_CHANNEL` permission.
operationId: get_message_reactions
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'200':
description: Array of reaction objects
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Reaction'
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel or message not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
delete:
tags:
- messages
summary: Clear Reactions
description: |-
Removes all reactions from a message. This requires the `MANAGE_MESSAGES` permission in the
guild.
This method is idempotent: if you try to remove reactions from a message that has no reactions,
nothing will happen.
operationId: clear_reactions
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
responses:
'204':
description: Reactions removed
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel or message not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/channels/{channel_id}/messages/{message_id}/reactions/{emoji}:
delete:
tags:
- messages
summary: Remove All Reactions for Emoji
description: |-
Removes all reactions for a given emoji from a message. This requires the `MANAGE_MESSAGES`
permission in the guild.
The emoji path parameter should be either a literal unicode emoji or the ID of a custom emoji.
operationId: remove_all_reactions_for_emoji
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: emoji
in: path
required: true
schema:
type: string
responses:
'204':
description: Reactions removed
'401':
description: Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'403':
description: Missing permissions
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
'404':
description: Channel, message, or emoji not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
security:
- token: []
/channels/{channel_id}/messages/{message_id}/reactions/{emoji}/me:
put:
tags:
- messages
summary: Add Reaction
description: |-
Adds a reaction to a message. If in a guild and the reaction does not exist, this will require
the `ADD_REACTIONS` permission.
This endpoint is idempotent: if you have already reacted to this message with this emoji,
nothing will happen.
The emoji path parameter should be either a literal unicode emoji or the ID of a custom emoji.
operationId: add_reaction
parameters:
- name: channel_id
in: path
required: true
schema:
type: integer
format: int64
minimum: 0
- name: message_id
in: path
required: true
schema:
type: integer
format: int64