forked from rocboss/paopao-ce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.json
334 lines (334 loc) · 10.6 KB
/
openapi.json
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
{
"openapi": "3.0.0",
"info": {
"title": "paopao-ce API",
"description": "# The paopao-ce API documentation\n\nWelcome to the paopao-ce API documentation!\n\n",
"version": "0.1.0"
},
"servers": [
{
"url": "https://api.paopao.info"
}
],
"tags": [],
"paths": {
"/{bucket}": {
"post": {
"summary": "Upload Image",
"description": "Upload an image to the given bucket.\nThe `content-type` header must be provided as well\nas the `content-length` header otherwise the request will be rejected.\n\nThe uploaded file must also not exceed the given `content-length`.",
"parameters": [
{
"name": "bucket",
"schema": {
"type": "string"
},
"in": "path",
"description": "The bucket that the image should be uploaded.",
"required": true,
"deprecated": false
},
{
"name": "content-length",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "The total size of the image in bytes.",
"required": true,
"deprecated": false
},
{
"name": "format",
"schema": {
"$ref": "#/components/schemas/ImageKind"
},
"in": "query",
"description": "The format that the uploaded image is encoded in.\n\nIf not provided, lust will guess the encoding.",
"required": false,
"deprecated": false
}
],
"requestBody": {
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UploadInfo"
}
}
}
},
"404": {
"description": "Bucket not found"
},
"400": {
"description": "The image format was incorrect or the system was\nunable to guess the format of the image."
},
"413": {
"description": "The upload exceeds the configured maximum file size."
},
"401": {
"description": "You are not authorized to complete this action.\n\nThis normally means the `Authorization` bearer has been left out\nof the request or is invalid."
}
}
}
},
"/{bucket}/{image_id}": {
"get": {
"summary": "Fetch Image",
"description": "Fetch the image from the storage backend and apply and additional affects\nif required.",
"parameters": [
{
"name": "bucket",
"schema": {
"type": "string"
},
"in": "path",
"description": "The bucket to try fetch the image from.",
"required": true,
"deprecated": false
},
{
"name": "image_id",
"schema": {
"type": "string",
"format": "uuid"
},
"in": "path",
"description": "The id of the image.",
"required": true,
"deprecated": false
},
{
"name": "format",
"schema": {
"$ref": "#/components/schemas/ImageKind"
},
"in": "query",
"description": "The encoding format that the image should be returned as.",
"required": false,
"deprecated": false
},
{
"name": "size",
"schema": {
"type": "string"
},
"in": "query",
"description": "The size preset that should be used when returning the image.",
"required": false,
"deprecated": false
},
{
"name": "width",
"schema": {
"type": "integer",
"format": "uint32"
},
"in": "query",
"description": "A custom width to resize the returned image to.",
"required": false,
"deprecated": false
},
{
"name": "height",
"schema": {
"type": "integer",
"format": "uint32"
},
"in": "query",
"description": "A custom height to resize the returned image to.",
"required": false,
"deprecated": false
},
{
"name": "accept",
"schema": {
"type": "string"
},
"in": "header",
"description": "A set of `,` seperated content-types that could be sent as a response.\nE.g. `image/png,image/webp,image/gif`",
"required": false,
"deprecated": false
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/octet-stream": {
"schema": {
"type": "string",
"format": "binary"
}
}
},
"headers": {
"CONTENT-TYPE": {
"required": true,
"deprecated": false,
"schema": {
"type": "string"
}
}
}
},
"400": {
"description": "The request is invalid with the current configuration.\n\nSee the detail section for more info.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Detail"
}
}
}
},
"404": {
"description": "Bucket does not exist or image does not exist.\n\nSee the detail section for more info.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Detail"
}
}
}
}
}
},
"delete": {
"summary": "Delete Image",
"description": "Delete the given image.\nThis will purge all variants of the image including sizing presets and formats.\n\nImages that do not exist already will be ignored and will not return a 404.",
"parameters": [
{
"name": "bucket",
"schema": {
"type": "string"
},
"in": "path",
"description": "The bucket to try delete the image from.",
"required": true,
"deprecated": false
},
{
"name": "image_id",
"schema": {
"type": "string",
"format": "uuid"
},
"in": "path",
"description": "The image to delete try delete.",
"required": true,
"deprecated": false
}
],
"responses": {
"200": {
"description": ""
},
"401": {
"description": "You are not authorized to complete this action.\n\nThis normally means the `Authorization` bearer has been left out\nof the request or is invalid."
},
"404": {
"description": "Bucket does not exist."
}
}
}
}
},
"components": {
"schemas": {
"Detail": {
"type": "object",
"required": [
"detail"
],
"properties": {
"detail": {
"type": "string",
"description": "Additional information regarding the response."
}
}
},
"ImageKind": {
"type": "string",
"enum": [
"png",
"jpeg",
"webp",
"gif"
]
},
"ImageUploadInfo": {
"type": "object",
"required": [
"sizing_id"
],
"properties": {
"sizing_id": {
"type": "integer",
"format": "uint32",
"description": "The computed image sizing id.\n\nThis is useful for tracking files outside of lust as this is\ngenerally used for filtering within the storage systems."
}
}
},
"UploadInfo": {
"type": "object",
"required": [
"image_id",
"processing_time",
"io_time",
"checksum",
"images",
"bucket_id"
],
"properties": {
"image_id": {
"type": "string",
"format": "uuid",
"description": "The generated ID for the file.\n\nThis can be used to access the file for the given bucket."
},
"processing_time": {
"type": "number",
"format": "float",
"description": "The time spent processing the image in seconds."
},
"io_time": {
"type": "number",
"format": "float",
"description": "The time spent uploading the image to the persistent store."
},
"checksum": {
"type": "integer",
"format": "uint32",
"description": "The crc32 checksum of the uploaded image."
},
"images": {
"type": "array",
"description": "The information that is specific to the image.",
"items": {
"$ref": "#/components/schemas/ImageUploadInfo"
}
},
"bucket_id": {
"type": "integer",
"format": "uint32",
"description": "The id of the bucket the image was stored in.\n\nThis is useful for tracking files outside of lust as this is\ngenerally used for filtering within the storage systems."
}
}
}
}
}
}