diff --git a/matweb/oas/bulk.yml b/matweb/oas/bulk.yml new file mode 100644 index 0000000..f91573f --- /dev/null +++ b/matweb/oas/bulk.yml @@ -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" \ No newline at end of file diff --git a/matweb/oas/upload.yml b/matweb/oas/upload.yml index c7a9bd7..71cb87b 100644 --- a/matweb/oas/upload.yml +++ b/matweb/oas/upload.yml @@ -22,7 +22,7 @@ parameters: example: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==' responses: - 200: + 201: description: "An object containing all info about the cleaned file" schema: $ref: '#/definitions/UploadResponse' diff --git a/matweb/rest_api.py b/matweb/rest_api.py index 0e47a5d..2bf44f0 100644 --- a/matweb/rest_api.py +++ b/matweb/rest_api.py @@ -64,7 +64,7 @@ class APIUpload(Resource): filename=output_filename, _external=True ) - ) + ), 201 class APIDownload(Resource): @@ -110,6 +110,7 @@ class APIBulkDownloadCreator(Resource): } v = Validator(schema) + @swag_from('./oas/bulk.yml') def post(self): utils.check_upload_folder(self.upload_folder) data = request.json