-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenapi.yaml
More file actions
2177 lines (2176 loc) · 62.2 KB
/
Copy pathopenapi.yaml
File metadata and controls
2177 lines (2176 loc) · 62.2 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.0.3
info:
title: gdl-api
description: gdl-api express server
version: 'v0.4'
servers:
- url: https://gdl.mcalec.dev/api
description: production server
- url: http://localhost:3030/api
description: local server
tags:
- name: API
description: General API information
- name: Authentication
description: User authentication and OAuth
- name: Files
description: File and directory operations
- name: Downloads
description: File downloads
- name: Uploads
description: File uploads
- name: Random
description: Random file retrieval
- name: Search
description: File and directory search
- name: Statistics
description: API and system statistics
- name: Health
description: Health check endpoints
- name: User
description: User profile and settings
- name: Admin
description: Administrative operations
- name: Pools
description: File pool management
paths:
/:
get:
tags:
- API
summary: Get API information and available endpoints
description: Retrieve general API information, version, and list of available endpoints
responses:
'200':
description: API information with available endpoint URLs
content:
application/json:
schema:
type: object
properties:
name:
type: string
version:
type: string
description:
type: string
author:
type: string
keywords:
type: array
items:
type: string
license:
type: string
host:
type: string
basePath:
type: string
urls:
type: object
properties:
admin:
type: string
auth:
type: string
user:
type: string
files:
type: string
health:
type: string
random:
type: string
search:
type: string
stats:
type: string
upload:
type: string
pool:
type: string
/auth/:
get:
tags:
- Authentication
summary: Get auth API information
description: Get available authentication endpoints
responses:
'200':
description: Auth endpoints
content:
application/json:
schema:
type: object
properties:
urls:
type: object
properties:
check:
type: string
login:
type: string
logout:
type: string
provider:
type: string
register:
type: string
/auth/check/:
get:
tags:
- Authentication
summary: Check user authentication status
description: Check if the current user is authenticated and retrieve their authentication details
responses:
'200':
description: Authentication status and user information
content:
application/json:
schema:
type: object
properties:
authenticated:
type: boolean
user:
type: object
roles:
type: array
items:
type: string
oauth:
type: object
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/auth/login/:
post:
tags:
- Authentication
summary: User login with username/email and password
description: Authenticate a user with their credentials (username or email and password)
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
username:
type: string
description: Username or email of the user
email:
type: string
description: Email address of the user (alternative to username)
password:
type: string
description: User password
required:
- password
responses:
'201':
description: User successfully logged in
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
user:
type: object
'400':
description: Missing credentials, user not found, or invalid password
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: User already logged in
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/auth/logout/:
post:
tags:
- Authentication
summary: User logout
description: Log out the authenticated user and destroy their session
responses:
'201':
description: User successfully logged out
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/UnauthorizedResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/auth/register/:
post:
tags:
- Authentication
summary: User registration
description: Register a new user with username, email, and password
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
username:
type: string
description: Unique username for the user
email:
type: string
format: email
description: Email address of the user
password:
type: string
description: Password for the user account
required:
- username
- password
responses:
'201':
description: User successfully registered and logged in
'400':
description: Missing required fields or invalid email format
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'409':
description: Username or email already exists
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/auth/provider/:
get:
tags:
- Authentication
summary: Get OAuth provider endpoints
description: Get available OAuth provider endpoints for callback, login, link, and unlink operations
responses:
'200':
description: OAuth provider URLs
content:
application/json:
schema:
type: object
properties:
urls:
type: object
properties:
callback:
type: string
login:
type: string
link:
type: string
unlink:
type: string
/auth/provider/login/{provider}:
get:
tags:
- Authentication
summary: Initiate OAuth login
description: Start OAuth authentication flow for the specified provider
parameters:
- in: path
name: provider
required: true
schema:
type: string
enum: [github, discord]
description: OAuth provider name
responses:
'302':
description: Redirect to provider authentication
'400':
description: Invalid provider
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Authentication error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/auth/provider/callback/{provider}:
get:
tags:
- Authentication
summary: OAuth callback endpoint
description: Handle OAuth provider callback after successful authentication
parameters:
- in: path
name: provider
required: true
schema:
type: string
enum: [github, discord]
description: OAuth provider name
- in: query
name: code
required: true
schema:
type: string
description: Authorization code from provider
responses:
'302':
description: Redirect to dashboard on success
/auth/provider/link/{provider}:
get:
tags:
- Authentication
summary: Link OAuth account to existing user
description: Link an OAuth provider account to the currently authenticated user
parameters:
- in: path
name: provider
required: true
schema:
type: string
enum: [github, discord]
description: OAuth provider name
responses:
'302':
description: Redirect to provider authentication
'400':
description: Invalid provider or provider already linked
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/auth/provider/unlink/{provider}:
get:
tags:
- Authentication
summary: Unlink OAuth account from user
description: Remove OAuth provider account from the currently authenticated user
parameters:
- in: path
name: provider
required: true
schema:
type: string
enum: [github, discord]
description: OAuth provider name
responses:
'200':
description: Provider unlinked successfully
'400':
description: Invalid provider or cannot unlink (no other auth method)
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/files/:
get:
tags:
- Files
summary: Get all files and directories from the root
description: List all files and directories from the BASE_DIR with optional sorting and pagination
parameters:
- in: query
name: sort
schema:
type: string
enum: [name, size, date, type]
description: Field to sort by
- in: query
name: direction
schema:
type: string
enum: [asc, desc]
description: Sort direction
- in: query
name: limit
schema:
type: integer
description: Maximum number of results (up to PAGINATION_LIMIT)
- in: query
name: page
schema:
type: integer
description: Page number for pagination
- in: query
name: meta
schema:
type: boolean
description: Include extended file metadata (uuid, hash, sidecar)
responses:
'200':
description: List of files and directories
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/File'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/files/{collection}/:
get:
tags:
- Files
summary: Get files from a specific collection
description: List files and subdirectories within a specific collection
parameters:
- in: path
name: collection
required: true
schema:
type: string
description: Collection name
- in: query
name: sort
schema:
type: string
enum: [name, size, date, type]
description: Field to sort by
- in: query
name: direction
schema:
type: string
enum: [asc, desc]
description: Sort direction
responses:
'200':
description: List of files in collection
'400':
description: Invalid path parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: Collection not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/files/{collection}/{author}/:
get:
tags:
- Files
summary: Get files from a specific author within a collection
description: List files from a specific author directory within a collection
parameters:
- in: path
name: collection
required: true
schema:
type: string
description: Collection name
- in: path
name: author
required: true
schema:
type: string
description: Author/subdirectory name
responses:
'200':
description: List of files from author directory
'404':
description: Path not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/download/:
get:
tags:
- Downloads
summary: Download a file using its UUID
description: Downloads a file from the server using the provided UUID. Supports both GET and POST methods.
parameters:
- in: query
name: uuid
required: true
schema:
type: string
description: The UUID of the file to download
responses:
'200':
description: File content as binary data
'400':
description: Missing or invalid uuid parameter
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: File not found or not accessible
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
tags:
- Downloads
summary: Download a file using its UUID (POST method)
description: Downloads a file from the server using the provided UUID via POST body.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
uuid:
type: string
description: The UUID of the file to download
required:
- uuid
responses:
'200':
description: File content as binary data
'400':
description: Missing or invalid uuid parameter
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: File not found or not accessible
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/upload/:
post:
tags:
- Uploads
summary: Upload a file to the server
description: Upload a single file to GridFS storage with size limits
requestBody:
required: true
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
format: binary
description: The file to upload
required:
- file
responses:
'201':
description: File uploaded successfully
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
fileId:
type: string
description: The GridFS file ID
filename:
type: string
size:
type: number
uploadDate:
type: string
format: date-time
'400':
description: No file provided or file too large
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: File upload failed
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/uuid/{uuid}/{type}:
get:
tags:
- Files
summary: Retrieve file or directory information by UUID
description: Retrieve detailed information about a file or directory using its UUID.
parameters:
- in: path
name: uuid
required: true
schema:
type: string
description: The UUID of the file or directory to retrieve
- in: path
name: type
required: true
schema:
type: string
enum: [file, directory]
description: The type of the entry to retrieve (file or directory)
responses:
'200':
description: File or directory information retrieved successfully
'400':
description: Invalid UUID or type parameter
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: File or directory not found
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/random:
get:
tags:
- Random
summary: Retrieve a random file
description: Retrieve a random file from the database with metadata
responses:
'200':
description: Random file metadata
content:
application/json:
schema:
type: object
properties:
file:
type: string
path:
type: string
collection:
type: string
author:
type: string
size:
type: number
url:
type: string
created:
type: string
format: date-time
modified:
type: string
format: date-time
type:
type: string
hash:
type: string
uuid:
type: string
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: No file found in database
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/random/:
get:
tags:
- Random
summary: Retrieve a random file (with trailing slash)
description: Retrieve a random file from the database with metadata
responses:
'200':
description: Random file metadata
content:
application/json:
schema:
type: object
properties:
file:
type: string
path:
type: string
collection:
type: string
author:
type: string
size:
type: number
url:
type: string
created:
type: string
format: date-time
modified:
type: string
format: date-time
type:
type: string
hash:
type: string
uuid:
type: string
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'403':
description: Insufficient permissions
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'404':
description: No file found in database
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/pool:
get:
tags:
- Pools
summary: List all file pools
description: Retrieve a paginated list of all file pools for the authenticated user
parameters:
- in: query
name: limit
schema:
type: integer
default: 100
description: Maximum number of pools to return
- in: query
name: page
schema:
type: integer
default: 1
description: Page number for pagination
responses:
'200':
description: List of pools with pagination info
content:
application/json:
schema:
type: object
properties:
count:
type: integer
description: Total number of pools
page:
type: integer
limit:
type: integer
results:
type: array
items:
$ref: '#/components/schemas/Pool'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
post:
tags:
- Pools
summary: Create a new file pool
description: Create a new pool to group files together with optional description and tags
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: Name of the pool (required)
description:
type: string
description: Optional description of the pool
tags:
type: array
items:
type: string
description: Optional array of tags
files:
type: array
items:
type: string
description: Optional array of file UUIDs to include in the pool
required:
- name
responses:
'201':
description: Pool created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/Pool'
'400':
description: Invalid pool name or request parameters
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'401':
description: User not authenticated
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Internal server error
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/pool/{uuid}:
get:
tags:
- Pools
summary: Retrieve a specific pool
description: Get detailed information about a specific pool by UUID
parameters:
- in: path
name: uuid
required: true
schema:
type: string
description: Pool UUID
- in: query
name: includeFiles
schema:
type: boolean
default: false
description: Whether to include full file details in the response
responses:
'200':
description: Pool information
content:
application/json: