Repository navigation
Expand file tree
/
Copy pathopenapi.json
More file actions
1553 lines (1553 loc) · 38.4 KB
/
Copy pathopenapi.json
File metadata and controls
1553 lines (1553 loc) · 38.4 KB
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.1.0",
"info": {
"title": "Kubuno Mobile API",
"description": "API surface consumed by the Kubuno native mobile apps (iOS/Android): native auth, drive delta-sync, files/folders and push notifications. Core auth/me paths are generated from the server; drive and push paths are documented from their handlers.",
"contact": {
"name": "Kubuno Contributors"
},
"license": {
"name": "AGPL-3.0-or-later",
"identifier": "AGPL-3.0-or-later"
},
"version": "0.1.0"
},
"paths": {
"/api/v1/auth/login": {
"post": {
"tags": [
"auth"
],
"operationId": "login",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoginDto"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Authentifié. Pour client_type 'native'/'desktop' le corps est un NativeTokenResponse ; sinon LoginResponse + cookie HttpOnly refresh_token.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NativeTokenResponse"
}
}
}
},
"422": {
"description": "Identifiants invalides"
}
}
}
},
"/api/v1/auth/logout": {
"post": {
"tags": [
"auth"
],
"operationId": "logout",
"requestBody": {
"description": "Optionnel - clients natifs. Le web envoie le refresh via cookie.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RefreshRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Session révoquée"
}
}
}
},
"/api/v1/auth/refresh": {
"post": {
"tags": [
"auth"
],
"operationId": "refresh",
"requestBody": {
"description": "Optionnel - clients natifs. Le web envoie le refresh via cookie.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RefreshRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Nouveau couple (natif, avec rotation) ou nouvel access_token (web)",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NativeTokenResponse"
}
}
}
},
"401": {
"description": "Refresh invalide, expiré ou réutilisé"
}
}
}
},
"/api/v1/auth/register": {
"post": {
"tags": [
"auth"
],
"operationId": "register",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateUserDto"
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Compte créé"
},
"403": {
"description": "Inscription fermée"
},
"409": {
"description": "Email ou nom d'utilisateur déjà pris"
}
}
}
},
"/api/v1/auth/totp": {
"post": {
"tags": [
"auth"
],
"operationId": "totp_verify",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TotpVerifyDto"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "2FA validée, session émise",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NativeTokenResponse"
}
}
}
},
"401": {
"description": "Session TOTP invalide"
},
"422": {
"description": "Code incorrect"
}
}
}
},
"/api/v1/me": {
"get": {
"tags": [
"me"
],
"operationId": "get_me",
"responses": {
"200": {
"description": "Profil de l'utilisateur courant",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
},
"401": {
"description": "Non authentifié"
}
},
"security": [
{
"bearer": []
}
]
}
},
"/api/v1/me/sessions": {
"get": {
"tags": [
"me"
],
"operationId": "list_sessions",
"responses": {
"200": {
"description": "Sessions actives (refresh tokens) de l'utilisateur, avec client_type",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RefreshToken"
}
}
}
}
},
"401": {
"description": "Non authentifié"
}
},
"security": [
{
"bearer": []
}
]
}
},
"/api/v1/modules": {
"get": {
"tags": [
"modules"
],
"operationId": "list_modules",
"responses": {
"200": {
"description": "Modules actifs et leurs routes/points d'entrée (public, sert la découverte des clients)"
}
}
}
},
"/api/v1/me/push/devices": {
"post": {
"tags": [
"push"
],
"summary": "Register (or refresh) a push device.",
"security": [
{
"bearer": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RegisterDeviceDto"
}
}
}
},
"responses": {
"201": {
"description": "Registered (returns the device id)."
},
"422": {
"description": "Invalid provider/token."
}
}
}
},
"/api/v1/me/push/devices/{id}": {
"delete": {
"tags": [
"push"
],
"summary": "Unregister a push device.",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "Removed."
},
"404": {
"description": "Unknown device."
}
}
}
},
"/api/v1/me/push/preferences": {
"get": {
"tags": [
"push"
],
"summary": "List push opt-out preferences.",
"security": [
{
"bearer": []
}
],
"responses": {
"200": {
"description": "Preferences list."
}
}
},
"patch": {
"tags": [
"push"
],
"summary": "Upsert one push preference.",
"security": [
{
"bearer": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SetPreferenceDto"
}
}
}
},
"responses": {
"200": {
"description": "Saved."
}
}
}
},
"/api/v1/drive/sync/delta": {
"get": {
"tags": [
"drive-sync"
],
"summary": "Changes since a cursor (delta sync).",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "cursor",
"in": "query",
"schema": {
"type": "integer",
"format": "int64",
"default": 0
},
"description": "Last change_seq seen (0 = full snapshot)."
},
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"default": 500
}
}
],
"responses": {
"200": {
"description": "Delta page.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DriveDelta"
}
}
}
}
}
}
},
"/api/v1/drive/sync/file/{id}/content": {
"put": {
"tags": [
"drive-sync"
],
"summary": "Replace a file's content (conflict-safe).",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "If-Match",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Expected etag; mismatch returns 412 (conflict)."
},
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Stable key so a replayed mutation is not applied twice."
}
],
"requestBody": {
"required": true,
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"responses": {
"200": {
"description": "Updated (returns new etag)."
},
"412": {
"description": "Conflict: server content changed."
}
}
}
},
"/api/v1/drive/upload": {
"post": {
"tags": [
"drive"
],
"summary": "Upload a new file (multipart).",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Stable key so a replayed mutation is not applied twice."
}
],
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"schema": {
"type": "object",
"properties": {
"file": {
"type": "string",
"format": "binary"
},
"folder_id": {
"type": "string",
"format": "uuid"
}
},
"required": [
"file"
]
}
}
}
},
"responses": {
"200": {
"description": "Created file."
}
}
}
},
"/api/v1/drive/folders": {
"post": {
"tags": [
"drive"
],
"summary": "Create a folder.",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Stable key so a replayed mutation is not applied twice."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateFolderDto"
}
}
}
},
"responses": {
"200": {
"description": "Created folder.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"folder": {
"$ref": "#/components/schemas/DriveFolder"
}
}
}
}
}
}
}
}
},
"/api/v1/drive/{id}/download": {
"get": {
"tags": [
"drive"
],
"summary": "Download a file's content.",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
}
],
"responses": {
"200": {
"description": "File bytes.",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
}
}
}
},
"/api/v1/drive/{id}/trash": {
"post": {
"tags": [
"drive"
],
"summary": "Move a file to trash.",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
}
},
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Stable key so a replayed mutation is not applied twice."
}
],
"responses": {
"200": {
"description": "Trashed."
}
}
}
},
"/api/v1/mail/changes": {
"get": {
"tags": [
"mail"
],
"summary": "Delta sync: threads changed since a cursor.",
"description": "Returns every thread with a message whose CONDSTORE modseq is greater than `since` (new messages AND flag changes: read, star, important, snooze, label, move), plus the ids of threads that became entirely deleted/trashed. Keyset-paginated on the max modseq. Scoped to the caller.",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "since",
"in": "query",
"schema": {
"type": "integer",
"format": "int64",
"default": 0
},
"description": "Cursor = modseq of the client's last sync. 0 or absent = full sync."
},
{
"name": "limit",
"in": "query",
"schema": {
"type": "integer",
"default": 200,
"maximum": 500
},
"description": "Page size, default 200, capped at 500."
},
{
"name": "account_id",
"in": "query",
"required": false,
"schema": {
"type": "string",
"format": "uuid"
},
"description": "Restrict to one account; absent aggregates all of the user's accounts."
}
],
"responses": {
"200": {
"description": "Delta page.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/MailDelta"
}
}
}
}
}
}
},
"/api/v1/mail/messages/{id}/attachments/{index}": {
"get": {
"tags": [
"mail"
],
"summary": "Download a message attachment (supports HTTP Range).",
"description": "Streams the attachment from disk. Advertises `Accept-Ranges: bytes` and a correct `Content-Length`. A `Range: bytes=start-end` request yields `206 Partial Content` with `Content-Range`; a well-formed but out-of-bounds range yields `416 Range Not Satisfiable` with `Content-Range: bytes */total`. Without a Range header the full file is returned with `200`.",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "uuid"
},
"description": "Message id."
},
{
"name": "index",
"in": "path",
"required": true,
"schema": {
"type": "integer"
},
"description": "Zero-based attachment index within the message."
},
{
"name": "Range",
"in": "header",
"required": false,
"schema": {
"type": "string"
},
"description": "Optional byte range, e.g. `bytes=0-99`, `bytes=100-`, or the suffix form `bytes=-500`."
}
],
"responses": {
"200": {
"description": "Full attachment bytes.",
"headers": {
"Accept-Ranges": {
"schema": {
"type": "string"
}
},
"Content-Length": {
"schema": {
"type": "integer"
}
}
},
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"206": {
"description": "Partial content for the requested range.",
"headers": {
"Content-Range": {
"schema": {
"type": "string"
}
},
"Content-Length": {
"schema": {
"type": "integer"
}
},
"Accept-Ranges": {
"schema": {
"type": "string"
}
}
},
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
}
},
"416": {
"description": "Requested range not satisfiable.",
"headers": {
"Content-Range": {
"schema": {
"type": "string"
}
}
}
}
}
}
},
"/api/v1/mail/send": {
"post": {
"tags": [
"mail"
],
"summary": "Send a message (idempotent with Idempotency-Key).",
"description": "Sends (or schedules) a message. An optional `Idempotency-Key` header deduplicates retried sends per user: the first request sends and memorises its response; a repeat with the same key replays that response without sending again (24 h window). Omitting the header keeps the historical behaviour.",
"security": [
{
"bearer": []
}
],
"parameters": [
{
"name": "Idempotency-Key",
"in": "header",
"required": false,
"schema": {
"type": "string",
"maxLength": 255
},
"description": "Opaque per-send key (e.g. a UUID). Same key + same user = at most one delivery."
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SendMailDto"
}
}
}
},
"responses": {
"200": {
"description": "Sent, scheduled, or a replayed idempotent response.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SendMailResult"
}
}
}
},
"409": {
"description": "A send with this Idempotency-Key is already in flight."
},
"422": {
"description": "Validation error (no recipient, empty subject)."
}
}
}
}
},
"components": {
"schemas": {
"CreateUserDto": {
"type": "object",
"required": [
"email",
"username",
"password"
],
"properties": {
"display_name": {
"type": [
"string",
"null"
]
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"LoginDto": {
"type": "object",
"required": [
"login",
"password"
],
"properties": {
"client_type": {
"type": [
"string",
"null"
],
"description": "'web' (default) keeps the HttpOnly cookie. 'native'/'desktop' receive the\nrefresh token in the JSON body (no cookie) so non-browser clients can\nstore it in the OS keychain and refresh without a cookie jar."
},
"device_name": {
"type": [
"string",
"null"
]
},
"device_type": {
"type": [
"string",
"null"
]
},
"login": {
"type": "string",
"description": "Email ou nom d'utilisateur."
},
"password": {
"type": "string"
}
}
},
"LoginResponse": {
"type": "object",
"required": [
"access_token",
"user"
],
"properties": {
"access_token": {
"type": "string"
},
"user": {
"$ref": "#/components/schemas/User"
}
}
},
"NativeTokenResponse": {
"type": "object",
"description": "Token response for native/desktop clients. The raw refresh token is returned\nin the body (never logged) and rotated on every `/auth/refresh`.\n\n`Debug` is intentionally NOT derived: the refresh token must never reach the\nlogs through a stray `{:?}`.",
"required": [
"access_token",
"refresh_token",
"refresh_expires_at",
"user"
],
"properties": {
"access_token": {
"type": "string"
},
"refresh_expires_at": {
"type": "string",
"format": "date-time"
},
"refresh_token": {
"type": "string"
},
"user": {
"$ref": "#/components/schemas/User"
}
}
},
"RefreshRequest": {
"type": "object",
"description": "Corps optionnel pour les clients natifs : le refresh token est transmis en\nJSON (les navigateurs continuent d'utiliser le cookie HttpOnly).",
"required": [
"refresh_token"
],
"properties": {
"refresh_token": {
"type": "string"
}
}
},
"RefreshToken": {
"type": "object",
"required": [
"id",
"user_id",
"expires_at",
"created_at",
"last_used_at"
],
"properties": {
"client_type": {
"type": [
"string",
"null"
],
"description": "How the session was opened: 'web' | 'native' | 'desktop' | 'api'."
},
"created_at": {
"type": "string",
"format": "date-time"
},
"device_name": {
"type": [
"string",
"null"
]
},
"device_type": {
"type": [
"string",
"null"
]