forked from etkecc/mrs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yml
1272 lines (1270 loc) · 38.6 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: Matrix Rooms Search
version: '0.x.x'
description: 'Matrix Rooms Search service'
license:
name: AGPL-3.0
url: https://www.gnu.org/licenses/agpl-3.0.txt
externalDocs:
description: Git repo
url: https://gitlab.com/etke.cc/mrs/api
servers:
- url: http://localhost:8080
description: local
paths:
/.well-known/matrix/server:
get:
tags:
- Matrix S2S API
summary: Matrix server delegation
description: The delegated server information.
operationId: matrix_server_delegation
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
m.server:
type: string
description: The server name to delegate server-server communications to, with optional port
example: 'example.com:443'
/.well-known/matrix/client:
get:
tags:
- Matrix CS API
summary: Matrix client delegation
description: The delegated server information intended for clients
operationId: matrix_client_delegation
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
m.homeserver:
type: object
properties:
base_url:
type: string
description: The server URL to use with clients
example: 'https://example.com'
/.well-known/matrix/support:
get:
tags:
- Matrix CS API
summary: Matrix support details
description: Homeserver Admin Contact and Support page
operationId: matrix_support
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
support_page:
type: string
description: The support page URL
example: 'https://example.com/contact'
contacts:
type: array
items:
type: object
properties:
matrix_id:
type: string
description: Matrix ID of the contact
example: '@admin:example.com'
email_address:
type: string
description: Email address of the contact
example: '[email protected]'
role:
type: string
description: Role of the contact
example: 'm.role.admin'
/_matrix/client/versions:
get:
tags:
- Matrix CS API
summary: Gets the versions of the specification supported by the server.
description: The versions are made-up, because the whole point of that endpoint is to be a workaround for services like matrix.to
operationId: matrix_client_versions
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
versions:
type: array
items:
type: string
example: 'v2.0'
unstable_features:
type: object
properties:
uk.half-shot.msc1929:
type: boolean
description: Made-up MSC1929 unstable feature
example: true
im.nheko.summary.msc3266:
type: boolean
description: Made-up MSC3266 unstable feature
example: true
/_matrix/federation/v1/version:
get:
tags:
- Matrix S2S API
summary: matrix server name and version
description: Get the implementation name and version of this homeserver.
operationId: matrix_server_version
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
server:
type: object
properties:
name:
type: string
description: The server implementation name
example: 'MatrixRoomsSearch'
version:
type: string
description: The server implementation's version
example: 'v0.0.0'
/_matrix/key/v2/server:
get:
tags:
- Matrix S2S API
summary: matrix server's published signing keys
description: Gets the homeserver’s published signing keys
operationId: matrix_server_key
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
server_name:
type: string
description: DNS name of the homeserver.
example: 'example.com'
valid_until_ts:
type: integer
description: POSIX timestamp in milliseconds when the list of valid keys should be refreshed
example: 1698164427133
verify_keys:
type: object
additionalProperties: { }
old_verify_keys:
type: object
additionalProperties: { }
signatures:
type: object
additionalProperties: { }
/_matrix/federation/v1/query/directory:
get:
tags:
- Matrix S2S API
summary: Performs a query to get the mapped room ID and list of resident homeservers in the room for a given room alias
description: "Performs a query to get the mapped room ID and list of resident homeservers in the room for a given room alias. Homeservers should only query room aliases that belong to the target server (identified by the DNS Name in the alias). Servers may wish to cache the response to this query to avoid requesting the information too often."
operationId: matrix_server_query_directory
parameters:
- name: room_alias
in: query
description: room alias
required: true
schema:
type: string
example: '#alias:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
room_id:
type: string
description: room id
example: '!random:example.com'
servers:
type: array
items:
type: string
description: server name
example: example.com
'401':
description: unauthorized
'404':
description: room not found
'500':
description: json marshaling failed
security:
- matrix:
/_matrix/client/r0/directory/room/{room_alias}:
get:
tags:
- Matrix CS API
summary: Requests that the server resolve a room alias to a room ID.
description: "The server will check indexed rooms to resolve the alias if the domain part of the alias does not correspond to the server’s own domain."
operationId: matrix_server_client_query_directory
parameters:
- name: room_alias
in: path
description: room alias
required: true
schema:
type: string
example: '#alias:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
room_id:
type: string
description: room id
example: '!random:example.com'
servers:
type: array
items:
type: string
description: server name
example: example.com
'400':
description: invalid room alias
'404':
description: room not found
'500':
description: json marshaling failed
/_matrix/client/v3/directory/room/{room_alias}:
get:
tags:
- Matrix CS API
summary: Requests that the server resolve a room alias to a room ID.
description: "The server will check indexed rooms to resolve the alias if the domain part of the alias does not correspond to the server’s own domain."
operationId: matrix_server_client_query_directory
parameters:
- name: room_alias
in: path
description: room alias
required: true
schema:
type: string
example: '#alias:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
room_id:
type: string
description: room id
example: '!random:example.com'
servers:
type: array
items:
type: string
description: server name
example: example.com
'400':
description: invalid room alias
'404':
description: room not found
'500':
description: json marshaling failed
/_matrix/client/r0/directory/list/room/{room_id}:
get:
tags:
- Matrix CS API
summary: Gets the visibility of a given room on the server’s public room directory.
description: "Visibility is always 'public' for the rooms known to MRS, otherwise 404 is returned"
operationId: matrix_server_client_query_directory
parameters:
- name: room_id
in: path
description: room id
required: true
schema:
type: string
example: '!roomID:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
visibility:
type: string
description: always public
example: public
'404':
description: room not found
'500':
description: json marshaling failed
/_matrix/client/v3/directory/list/room/{room_id}:
get:
tags:
- Matrix CS API
summary: Gets the visibility of a given room on the server’s public room directory.
description: "Visibility is always 'public' for the rooms known to MRS, otherwise 404 is returned"
operationId: matrix_server_client_query_directory
parameters:
- name: room_id
in: path
description: room id
required: true
schema:
type: string
example: '!roomID:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
visibility:
type: string
description: always public
example: public
'404':
description: room not found
'500':
description: json marshaling failed
/_matrix/client/unstable/im.nheko.summary/summary/{room_id_or_alias}:
get:
tags:
- Matrix CS API
summary: MSC3266 - fetch a summary of a room by id or alias
description: "MSC3266 - The API returns a summary of the given room, if it is known by MRS and publicly accessible"
operationId: matrix_server_client_query_room_summary_correct
parameters:
- name: room_id_or_alias
in: path
description: room ID or alias
required: true
schema:
type: string
example: '#alias:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
documentation:
type: string
example: "https://github.com/deepbluev7/matrix-doc/blob/room-summaries/proposals/3266-room-summary.md#rationale-and-description-of-response-fields"
'400':
description: invalid room alias
'404':
description: room not found
'500':
description: json marshaling failed
/_matrix/client/unstable/im.nheko.summary/rooms/{room_id_or_alias}/summary:
get:
tags:
- Matrix CS API
summary: MSC3266 - fetch a summary of a room by id or alias
description: "MSC3266 - The API returns a summary of the given room, if it is known by MRS and publicly accessible"
operationId: matrix_server_client_query_room_summary_incorrect
parameters:
- name: room_id_or_alias
in: path
description: room ID or alias
required: true
schema:
type: string
example: '#alias:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
documentation:
type: string
example: "https://github.com/deepbluev7/matrix-doc/blob/room-summaries/proposals/3266-room-summary.md#rationale-and-description-of-response-fields"
'400':
description: invalid room alias
'404':
description: room not found
'500':
description: json marshaling failed
/_matrix/media/r0/thumbnail/{server_name}/{media_id}:
get:
tags:
- Matrix CS API
summary: Get room avatar
operationId: avatar
parameters:
- name: server_name
in: path
description: server name to get avatar from
required: true
schema:
type: string
example: example.com
- name: media_id
in: path
description: media ID of the avatar
required: true
schema:
type: string
example: tiHQGISntgETFKWJvQWUhUBw
- name: height
in: query
description: desired avatar height
schema:
type: int
example: 40
- name: width
in: query
description: desired avatar width
schema:
type: int
example: 40
- name: method
in: query
description: "one of: [crop, scale]."
schema:
type: string
example: "crop"
responses:
'200':
description: successful operation
content:
'image/jpeg':
schema:
type: string
format: binary
'image/png':
schema:
type: string
format: binary
'image/webp':
schema:
type: string
format: binary
'image/...':
schema:
type: string
format: binary
'204':
description: no results found.
/_matrix/media/v3/thumbnail/{server_name}/{media_id}:
get:
tags:
- Matrix CS API
summary: Get room avatar
operationId: avatar
parameters:
- name: server_name
in: path
description: server name to get avatar from
required: true
schema:
type: string
example: example.com
- name: media_id
in: path
description: media ID of the avatar
required: true
schema:
type: string
example: tiHQGISntgETFKWJvQWUhUBw
- name: height
in: query
description: desired avatar height
schema:
type: int
example: 40
- name: width
in: query
description: desired avatar width
schema:
type: int
example: 40
- name: method
in: query
description: "one of: [crop, scale]."
schema:
type: string
example: "crop"
responses:
'200':
description: successful operation
content:
'image/jpeg':
schema:
type: string
format: binary
'image/png':
schema:
type: string
format: binary
'image/webp':
schema:
type: string
format: binary
'image/...':
schema:
type: string
format: binary
'204':
description: no results found.
/_matrix/federation/v1/publicRooms:
get:
tags:
- Matrix S2S API
summary: the same search, but through Matrix Server-Server API
description: Gets all the public rooms indexed by MRS. Use https://spec.matrix.org/v1.8/server-server-api/#public-room-directory for details
operationId: matrix_server_publicrooms_get
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
documentation:
type: string
example: "https://spec.matrix.org/v1.8/server-server-api/#get_matrixfederationv1publicrooms"
'401':
description: unauthorized
'500':
description: internal server error
security:
- matrix:
post:
tags:
- Matrix S2S API
summary: the same search, but through Matrix Server-Server API
description: Gets all the public rooms indexed by MRS. Use https://spec.matrix.org/v1.8/server-server-api/#public-room-directory for details
operationId: matrix_server_publicrooms_post
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
documentation:
type: string
example: "https://spec.matrix.org/v1.8/server-server-api/#post_matrixfederationv1publicrooms"
'401':
description: unauthorized
'500':
description: internal server error
security:
- matrix:
/_health:
get:
tags:
- public
summary: Healthcheck endpoint
description: check that service is alive
operationId: health
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
status:
type: string
description: ok
example: 'ok'
/stats:
get:
tags:
- public
summary: Statistics
description: returns instance statistics
operationId: stats
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Stats'
/catalog/servers:
get:
tags:
- public
summary: Get servers catalog
description: Returns a list of all servers with rooms counts
operationId: catalog_servers
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
server_name:
type: integer
description: rooms count
example: 100
/discover/bulk:
post:
tags:
- public
summary: Add new servers in bulk
operationId: addServerBulk
requestBody:
content:
application/json:
schema:
type: array
items:
type: string
description: server name / base domain
example: example.com
responses:
'202':
description: payload accepted
'401':
description: unauthorized (provided credentials are invalid)
'500':
description: something is wrong, check the logs
security:
- discovery:
/discover/{server_name}:
post:
tags:
- public
summary: Add a new server
description: Add a new server. Without auth requests limited to 1 rps, with auth there is no such limitation
operationId: addServer
parameters:
- name: server_name
in: path
description: server name,domain
required: true
schema:
type: string
example: 'example.com'
responses:
'201':
description: server has been added
'208':
description: server already discovered
'401':
description: unauthorized (provided credentials are invalid)
'429':
description: too many requests, slow down.
'500':
description: something is wrong, check the logs
security:
- { }
- discovery:
/avatar/{server_name}/{media_id}:
get:
tags:
- public
summary: Get room avatar
operationId: avatar
parameters:
- name: server_name
in: path
description: server name to get avatar from
required: true
schema:
type: string
example: example.com
- name: media_id
in: path
description: media ID of the avatar
required: true
schema:
type: string
example: tiHQGISntgETFKWJvQWUhUBw
responses:
'200':
description: successful operation
content:
'image/jpeg':
schema:
type: string
format: binary
'image/png':
schema:
type: string
format: binary
'image/webp':
schema:
type: string
format: binary
'image/...':
schema:
type: string
format: binary
'204':
description: no results found.
/search:
get:
tags:
- public
summary: Search something! (query params)
description: Search for matrix rooms
operationId: search_query
parameters:
- name: q
in: query
description: search query
required: true
schema:
type: string
- name: l
in: query
description: limit
required: false
schema:
type: integer
default: 10
- name: o
in: query
description: offset
required: false
schema:
type: integer
default: 0
- name: s
in: query
description: sort by, comma-separated list of fields. `-` prefix means descending
required: true
schema:
type: string
default: -members,-_score
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Entry'
'204':
description: no results found.
'401':
description: unauthorized (if optional search auth is enabled)
/search/{q}/{l}/{o}/{s}:
get:
tags:
- public
summary: Search something! (path params)
description: Search for matrix rooms
operationId: search_path
parameters:
- name: q
in: path
description: search query
required: true
schema:
type: string
- name: l
in: path
description: limit
required: false
schema:
type: integer
default: 10
- name: o
in: path
description: offset
required: false
schema:
type: integer
default: 0
- name: s
in: path
description: sort by, comma-separated list of fields. `-` prefix means descending
required: true
schema:
type: string
default: -_score,-members
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Entry'
'204':
description: no results found.
'401':
description: unauthorized (if optional search auth is enabled)
/mod/report/{room_id}:
post:
tags:
- public
- moderation
summary: Report a room
operationId: mod_report
parameters:
- name: room_id
in: path
description: room ID
required: true
schema:
type: string
example: '!randomString:example.com'
requestBody:
content:
application/json:
schema:
type: object
properties:
reason:
type: string
description: Report reason
example: CSAM
no_msc1929:
type: boolean
description: Do not share the report with the owner of the room's homeserver, even if email is present in MSC1929 contacts
example: true
responses:
'202':
description: successful operation
'429':
description: too many requests
/mod/list:
get:
tags:
- private
- moderation
description: List all banned rooms
operationId: mod_list
responses:
'204':
description: no banned rooms yet
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
type: string
description: banned matrix room ID
example: '!randomString:example.com'
security:
- moderation:
- automaticToken:
/mod/list/{server_name}:
get:
tags:
- private
- moderation
parameters:
- name: server_name
in: path
description: server name
required: true
schema:
type: string
example: 'example.com'
description: List banned rooms of specific server
operationId: mod_list_server
responses:
'204':
description: no banned rooms yet
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
type: string
description: banned matrix room ID
example: '!randomString:example.com'
security:
- moderation:
- automaticToken:
/mod/ban/{room_id}:
get:
tags:
- private
- moderation
description: Ban a room (erase from search index)
operationId: mod_ban
parameters:
- name: room_id
in: path
description: room ID
required: true
schema:
type: string
example: '!randomString:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: response message
example: 'the room has been banned'
security:
- moderation:
- automaticToken:
/mod/unban/{room_id}:
get:
tags:
- private
- moderation
description: Unban a room (it won't be available in the search index until next reindex!)
operationId: mod_unban
parameters:
- name: room_id
in: path
description: room ID
required: true
schema:
type: string
example: '!randomString:example.com'
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
properties:
message:
type: string
description: response message
example: 'the room has been unbanned'
security:
- moderation:
- automaticToken:
/metrics:
get:
tags:
- private
summary: Prometheus metrics
description: Get Prometheus metrics of the MRS instance
operationId: metrics
responses:
'200':
description: successful operation
security:
- metrics: