forked from nikborovets/disk-cloud-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.yml
More file actions
358 lines (337 loc) · 8.88 KB
/
api.yml
File metadata and controls
358 lines (337 loc) · 8.88 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
openapi: 3.0.0
info:
description: architecture hometask
version: 3.2.3
title: Task Swagger
termsOfService: http://swagger.io/terms/
tags:
- name: Drive
description: Everything about Drive in fs
externalDocs:
description: Find out more
url: http://swagger.io
paths:
/api/v1/drive:
get:
tags:
- Drive
parameters:
- name: path
in: query
description: The path of the resource in the drive
required: true
schema:
type: string
- name: operation
in: query
description: ls/download/open/share
required: true
schema:
type: string
responses:
'200':
description: List of files in the specified directory
content:
application/json:
schema:
$ref: "#/components/schemas/FileItems"
'400':
$ref: '#/components/responses/ParseError'
'401':
$ref: "#/components/responses/Unauthorized"
'404':
$ref: "#/components/responses/NotFound"
post:
tags:
- Drive
parameters:
- name: path
in: query
description: The path of the resource in the drive
required: true
schema:
type: string
- name: operation
in: query
description: create/upload
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
file_name:
type: string
description: Name of the file to be created/uploaded
file_type:
type: string
enum: ['File', 'Directory']
description: Type of the file (File or Directory)
data:
type: string
description: file content
responses:
'200':
description: add successfully new file
'400':
$ref: '#/components/responses/ParseError'
'401':
$ref: "#/components/responses/Unauthorized"
'404':
$ref: "#/components/responses/NotFound"
'409':
$ref: "#/components/responses/FileExists"
put:
tags:
- Drive
parameters:
- name: path
in: query
description: The path of the resource in the drive
required: true
schema:
type: string
- name: operation
in: query
description: mv/update
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
destination:
type: string
description: The destination path for moving/updating the resource
data:
type: string
description: Additional data for the update operation
responses:
'200':
description: file is successfully updated
'400':
$ref: '#/components/responses/ParseError'
'401':
$ref: "#/components/responses/Unauthorized"
'404':
$ref: "#/components/responses/NotFound"
delete:
tags:
- Drive
parameters:
- name: path
in: query
description: The path of the resource in the drive
required: true
schema:
type: string
responses:
'200':
description: Project is successfully deleted
'400':
$ref: '#/components/responses/ParseError'
'401':
$ref: "#/components/responses/Unauthorized"
'403':
$ref: "#/components/responses/InsufficientPermissions"
'404':
$ref: "#/components/responses/NotFound"
/api/v1/drive/common:
get:
tags:
- Drive
summary: Get files with common access
responses:
'200':
description: List of files with common access
content:
application/json:
schema:
$ref: "#/components/schemas/FileItems"
'401':
$ref: "#/components/responses/Unauthorized"
/api/v1/drive/trash:
get:
tags:
- Drive
summary: View files in trash
responses:
'200':
description: List of files in trash
content:
application/json:
schema:
$ref: "#/components/schemas/FileItems"
'401':
$ref: "#/components/responses/Unauthorized"
/api/v1/common/{generated_link}:
get:
tags:
- Drive
summary: Access file system using generated link
parameters:
- name: generated_link
in: path
description: The generated link for accessing the file system
required: true
schema:
type: string
responses:
'200':
description: Access granted for unauthorized user
content:
application/json:
schema:
$ref: "#/components/schemas/FileItems"
'400':
$ref: '#/components/responses/ParseError'
/api/v1/common/{generated_link}/download:
get:
tags:
- Drive
summary: Download file using generated link
parameters:
- name: generated_link
in: path
description: The generated link for downloading the file
required: true
schema:
type: string
responses:
'200':
description: File is successfully downloaded
content:
application/json:
schema:
$ref: "#/components/schemas/FileItem"
'400':
$ref: '#/components/responses/ParseError'
'404':
$ref: "#/components/responses/NotFound"
/api/v1/common/{generated_link}/open:
get:
tags:
- Drive
summary: Open file using generated link
parameters:
- name: generated_link
in: path
description: The generated link for opening the file
required: true
schema:
type: string
responses:
'200':
description: File is successfully opened
content:
application/json:
schema:
$ref: "#/components/schemas/FileItem"
'400':
$ref: '#/components/responses/ParseError'
'401':
$ref: "#/components/responses/Unauthorized"
'404':
$ref: "#/components/responses/NotFound"
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: https://e464-176-214-100-148.ngrok-free.app
components:
responses:
Unauthorized:
description: Необходима авторизация
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
NotFound:
description: Не существующий путь
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
FileExists:
description: Файл с таким именем уже существует
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
InsufficientPermissions:
description: Недостаточно прав
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
ParseError:
description: Нет необхоимого паметра
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
schemas:
FileItem:
type: object
required:
- id
- name
- creator
- time_creation
- time_updation
- size
properties:
id:
type: number
name:
type: string
time_creation:
type: string
time_updation:
type: string
size:
type: number
creator:
$ref: '#/components/schemas/User'
FileItems:
type: array
items:
$ref: "#/components/schemas/FileItem"
User:
type: object
required:
- id
- name
- surname
- login
properties:
id:
type: integer
name:
type: string
surname:
type: string
login:
type: string
Users:
type: array
items:
$ref: "#/components/schemas/User"
Error:
type: object
required:
- code
- message
properties:
code:
type: integer
message:
type: string