mirror of
https://0xacab.org/jvoisin/mat2-web.git
synced 2025-05-13 11:42:25 -04:00
documented bulk creator
This commit is contained in:
parent
77269a82e6
commit
b148e03cb5
3 changed files with 51 additions and 2 deletions
48
matweb/oas/bulk.yml
Normal file
48
matweb/oas/bulk.yml
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
---
|
||||||
|
tags:
|
||||||
|
- "File Bulk Download"
|
||||||
|
summary: 'Group multiple files to download as one zip archive'
|
||||||
|
consumes:
|
||||||
|
- "application/json"
|
||||||
|
produces:
|
||||||
|
- "application/json"
|
||||||
|
parameters:
|
||||||
|
- in: "body"
|
||||||
|
name: "body"
|
||||||
|
description: "The files that will be combined for one single download"
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/BulkBody'
|
||||||
|
|
||||||
|
responses:
|
||||||
|
201:
|
||||||
|
description: "A new resource to download all files as one archive"
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/UploadResponse'
|
||||||
|
400:
|
||||||
|
description: "Invalid input"
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/ErrorResponse'
|
||||||
|
500:
|
||||||
|
description: "Unable to clean the file"
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/ErrorResponse'
|
||||||
|
|
||||||
|
definitions:
|
||||||
|
BulkBody:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
download_list:
|
||||||
|
type: "array"
|
||||||
|
description: "An object containing the files you want to create a bulk download for"
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/BulkFile'
|
||||||
|
BulkFile:
|
||||||
|
type: "object"
|
||||||
|
properties:
|
||||||
|
file_name:
|
||||||
|
type: "string"
|
||||||
|
key:
|
||||||
|
type: "string"
|
||||||
|
secret:
|
||||||
|
type: "string"
|
|
@ -22,7 +22,7 @@ parameters:
|
||||||
example: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=='
|
example: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=='
|
||||||
|
|
||||||
responses:
|
responses:
|
||||||
200:
|
201:
|
||||||
description: "An object containing all info about the cleaned file"
|
description: "An object containing all info about the cleaned file"
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/UploadResponse'
|
$ref: '#/definitions/UploadResponse'
|
||||||
|
|
|
@ -64,7 +64,7 @@ class APIUpload(Resource):
|
||||||
filename=output_filename,
|
filename=output_filename,
|
||||||
_external=True
|
_external=True
|
||||||
)
|
)
|
||||||
)
|
), 201
|
||||||
|
|
||||||
|
|
||||||
class APIDownload(Resource):
|
class APIDownload(Resource):
|
||||||
|
@ -110,6 +110,7 @@ class APIBulkDownloadCreator(Resource):
|
||||||
}
|
}
|
||||||
v = Validator(schema)
|
v = Validator(schema)
|
||||||
|
|
||||||
|
@swag_from('./oas/bulk.yml')
|
||||||
def post(self):
|
def post(self):
|
||||||
utils.check_upload_folder(self.upload_folder)
|
utils.check_upload_folder(self.upload_folder)
|
||||||
data = request.json
|
data = request.json
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue