add upload method

This commit is contained in:
blek 2023-10-08 15:07:15 +10:00
parent 4f0718e75d
commit afadf08b40
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 32 additions and 0 deletions

View File

@ -64,6 +64,38 @@ paths:
schema:
type: object
example: {}
/api/files/upload:
post:
summary: Upload a file
description: |-
A programmatic way to upload a file.
The request must be encoded in `multipart/form-data` to ensure that the binary file is transferred properly.
tags:
- File API
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
file:
type: string
example: binary file data
description: binary file data
metadata:
type: object
description: file info
properties:
sha512:
type: string
description: SHA512 hash of the file to ensure integrity
name:
type: string
description: Optional name of the file so it would be accessible like file.blek.codes/uploads/{name}
responses:
200:
description: File uploaded successfully
components: