From 2c1bc2f05af93e13d331e0f6a5c1b617717a50e3 Mon Sep 17 00:00:00 2001 From: Jan Friedli Date: Mon, 13 Jul 2020 08:14:47 +0200 Subject: documented download endpoint --- matweb/oas/download.yml | 33 +++++++++++++++++++++++++++++++++ matweb/rest_api.py | 1 + 2 files changed, 34 insertions(+) create mode 100644 matweb/oas/download.yml (limited to 'matweb') diff --git a/matweb/oas/download.yml b/matweb/oas/download.yml new file mode 100644 index 0000000..4c101a4 --- /dev/null +++ b/matweb/oas/download.yml @@ -0,0 +1,33 @@ +--- +tags: + - "File Download" +summary: 'Download a single cleaned file or zip archive containing multiple files' +consumes: + - "application/json" +produces: + - "*/*" +parameters: +- name: "key" + in: "path" + description: "A key generated for that resource" + required: true + type: "string" +- name: "secret" + in: "path" + description: "A secret generated for that resource" + required: true + type: "string" +- name: "filename" + in: "path" + description: "the filename of the cleaned file" + required: true + type: "string" + + +responses: + 200: + description: "An object containing all info about the cleaned file" + schema: + $ref: '#/definitions/UploadResponse' + 404: + description: "The filename, key or secret are wrong" \ No newline at end of file diff --git a/matweb/rest_api.py b/matweb/rest_api.py index 4aeaa62..20ec155 100644 --- a/matweb/rest_api.py +++ b/matweb/rest_api.py @@ -72,6 +72,7 @@ class APIDownload(Resource): def __init__(self, **kwargs): self.upload_folder = kwargs['upload_folder'] + @swag_from('./oas/download.yml') def get(self, key: str, secret: str, filename: str): complete_path, filepath = utils.is_valid_api_download_file(filename, key, secret, self.upload_folder) # Make sure the file is NOT deleted on HEAD requests -- cgit v1.3