organize API routes

This commit is contained in:
blek 2023-10-08 15:01:48 +10:00
parent 7e3be70a8f
commit 4f0718e75d
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 19 additions and 6 deletions

View File

@ -9,27 +9,38 @@ info:
servers: servers:
- url: http://localhost - url: http://localhost
description: Local staging environment description: Local staging environment
tags:
- name: File API
description: API for interacting with files
paths: paths:
/api/get_all: /api/files/get_all:
get: get:
summary: Get all files summary: Get all files
description: |- description: |-
Get all files available. Get all files available.
Returns an array of strings with no metadata. Returns an array of file objects with all data
tags:
- File API
security: security:
- apikey: [ key ] - apikey: [ key ]
responses: responses:
200: 200:
description: An array of file IDs description: An array of file objects
content: content:
application/json: application/json:
schema: schema:
type: array type: array
items: items:
type: string $ref: '#/components/schemas/File'
example: [ 'ZnVjayBwdXRpbg' ] example:
/api/delete: - path: /opt/useruploads/417e1ec1a0e82aac809da7e5aa309e03bf47eaa96ab2e335f5bb739d062d835b04ccebb89214bd5a54879527789a81ae4e9deab813e4212c757b36d08fa8165a
size: 10
name: null
mime: text/plain
delete_at: '1984-01-01T00:00:00.000Z'
sha512: 417e1ec1a0e82aac809da7e5aa309e03bf47eaa96ab2e335f5bb739d062d835b04ccebb89214bd5a54879527789a81ae4e9deab813e4212c757b36d08fa8165a
/api/files/delete:
post: post:
summary: Delete a file summary: Delete a file
description: |- description: |-
@ -38,6 +49,8 @@ paths:
It will work if one of the two conditions are met: It will work if one of the two conditions are met:
1. The requester's IP is the same as the uploader IP 1. The requester's IP is the same as the uploader IP
2. The request is authorized with an API key 2. The request is authorized with an API key
tags:
- File API
security: security:
- apikey: [ key ] - apikey: [ key ]
responses: responses: