-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-spec.yaml
More file actions
159 lines (159 loc) · 3.79 KB
/
Copy pathapi-spec.yaml
File metadata and controls
159 lines (159 loc) · 3.79 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
openapi: 3.0.3
info:
title: eXstream File API
version: 0.1.0
servers:
- url: http://localhost:6001
- url: http://localhost:8080
security:
- bearerAuth: []
paths:
/files:
get:
summary: List stored files.
parameters:
- $ref: "#/components/parameters/XUsername"
- $ref: "#/components/parameters/XRole"
responses:
"200":
description: File list
content:
application/json:
schema:
$ref: "#/components/schemas/FileList"
"403":
description: Missing identity headers
/file:
post:
summary: Upload a file and receive a unique file-service link.
parameters:
- $ref: "#/components/parameters/XUsername"
- $ref: "#/components/parameters/XRole"
requestBody:
required: true
content:
application/json:
schema:
type: string
description: File payload, usually a data URL from the web client.
text/plain:
schema:
type: string
description: File payload, usually a data URL from the web client.
responses:
"200":
description: Uploaded file link
content:
application/json:
schema:
$ref: "#/components/schemas/FileLink"
"403":
description: Missing identity headers
/file/{path}:
get:
summary: Read a file by safe relative path.
parameters:
- $ref: "#/components/parameters/FilePath"
- $ref: "#/components/parameters/XUsername"
- $ref: "#/components/parameters/XRole"
responses:
"200":
description: Stored file
content:
application/json:
schema:
$ref: "#/components/schemas/FileBody"
"404":
description: File not found
post:
summary: Create a file.
parameters:
- $ref: "#/components/parameters/FilePath"
requestBody:
$ref: "#/components/requestBodies/FileWrite"
responses:
"200":
description: Created
"409":
description: File already exists
put:
summary: Update a file.
parameters:
- $ref: "#/components/parameters/FilePath"
requestBody:
$ref: "#/components/requestBodies/FileWrite"
responses:
"200":
description: Updated
"404":
description: File not found
delete:
summary: Delete a file.
parameters:
- $ref: "#/components/parameters/FilePath"
responses:
"200":
description: Deleted
"404":
description: File not found
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
parameters:
XUsername:
name: X-Username
in: header
schema:
type: string
XRole:
name: X-Role
in: header
schema:
type: string
enum: [ADMIN, USER]
FilePath:
name: path
in: path
required: true
schema:
type: string
requestBodies:
FileWrite:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/FileWrite"
schemas:
FileWrite:
type: object
required: [content]
properties:
content:
type: string
FileBody:
type: object
properties:
path:
type: string
content:
type: string
FileList:
type: object
properties:
files:
type: array
items:
type: string
FileLink:
type: object
properties:
ok:
type: boolean
path:
type: string
url:
type: string