banki.test/web/openapi.yml

128 lines
3.5 KiB
YAML
Raw Normal View History

2024-08-19 13:26:18 +02:00
info:
title: Parameters API
version: '1.0'
openapi: '3.1.0'
tags:
- name: Routes
paths:
/api/image:
get:
tags:
- Routes
summary: Get image
description: |-
Get image by SHA256.
This method is designed to be referenced via `<img>`'s `src` attribute, so it returns the image with it's content type in the header.
The image data, such as original name is available in JSON in header `X-Image-Data`
parameters:
- name: sha256
schema:
type: string
in: query
responses:
200:
description: |-
# Important: application/json body is the `X-Image-Data` header value, not the actual body!
The actual body is the raw image. Its content type is in the `Content-Type` header.
content:
image/*:
type:
application/json:
schema:
$ref: '#/components/schemas/Image'
/api:
2024-08-19 13:26:18 +02:00
get:
tags:
- Routes
summary: Get all parameters
description: |-
This route will get all parameters.
To get the image itself, use /api/
2024-08-19 13:26:18 +02:00
responses:
200:
description: OK
content:
application/json:
schema:
2024-08-21 03:48:54 +02:00
type: object
properties:
images:
type: array
items:
$ref: '#/components/schemas/Image'
params:
type: array
items:
$ref: '#/components/schemas/Parameter'
example: {
"images": [
{
"id": 1,
2024-08-21 03:48:54 +02:00
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"original_name": "filename.svg",
"mime": "image/svg+xml"
},
2024-08-21 03:48:54 +02:00
{
2024-08-21 04:00:20 +02:00
"id": 2,
2024-08-21 03:48:54 +02:00
"sha256": "0000000000000000000000000000000000000000000000000000000000000001",
"original_name": "filename.svg",
"mime": "image/svg+xml"
},
],
"params": [
{
"id": 1,
"title": "A thing happening somewhere",
"type": 1,
"icon": null,
"icon_gray": null
},
{
"id": 2,
2024-08-21 03:48:54 +02:00
"title": "The fox jumping over a cat",
"type": 1,
"icon_id": 1,
"icon_gray_id": 2,
2024-08-19 13:26:18 +02:00
}
2024-08-21 03:48:54 +02:00
],
}
2024-08-19 13:26:18 +02:00
components:
schemas:
Image:
type: object
properties:
id:
type: number
example: 1
2024-08-19 13:26:18 +02:00
source_name:
type: string
example: "source_file.jpeg"
sha256:
type: string
required:
- source_name
- url
- example
Parameter:
type: object
properties:
id:
type: number
example: 0
title:
type: string
example: 'A quick brown fox jumping over a lazy cat'
type:
type: number
example: 0
icon:
$ref: '#/components/schemas/Image'
icon_gray:
$ref: '#/components/schemas/Image'
2024-08-19 13:26:18 +02:00
required:
- id
- title
- type