banki.test/web/openapi.yml

128 lines
3.5 KiB
YAML

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:
get:
tags:
- Routes
summary: Get all parameters
description: |-
This route will get all parameters.
To get the image itself, use `/api/image?sha256=SHA256HASH`
responses:
200:
description: OK
content:
application/json:
schema:
type: object
properties:
images:
type: array
items:
$ref: '#/components/schemas/Image'
params:
type: array
items:
$ref: '#/components/schemas/Parameter'
example: {
"images": [
{
"id": 1,
"sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"original_name": "filename.svg",
"mime": "image/svg+xml"
},
{
"id": 2,
"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,
"title": "The fox jumping over a cat",
"type": 1,
"icon_id": 1,
"icon_gray_id": 2,
}
],
}
components:
schemas:
Image:
type: object
properties:
id:
type: number
example: 1
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'
required:
- id
- title
- type