swagger-docs/backend.yml

270 lines
5.7 KiB
YAML

openapi: 3.0.3
info:
title: onSpot Backend
description: Backend of onSpot
contact:
email: tormakristof@tormakristof.eu
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
servers:
- url: https://onspot.k8s.kmlabz.com
tags:
- name: backend
description: onSpot Backend interaction
paths:
/api/auth/login:
post:
tags:
- backend
summary: Logs on a user
operationId: logon
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/User'
required: true
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/LoginToken'
401:
description: Incorrect credentials
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
417:
description: JSON invalid schema
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
delete:
security:
- bearerAuth: []
tags:
- backend
summary: Logs out a user
operationId: logoff
responses:
204:
description: successful operation
401:
description: Incorrect credentials
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/api/auth/me:
get:
security:
- bearerAuth: []
tags:
- backend
summary: Current user
operationId: currentUser
responses:
200:
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/UserName'
401:
description: Unauthorized
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
/api/lists:
get:
security:
- bearerAuth: []
tags:
- backend
summary: Gets all lists
operationId: getAllLists
responses:
200:
description: Lists
content:
application/json:
schema:
$ref: '#/components/schemas/MainList'
/api/lists/{listid}:
get:
security:
- bearerAuth: []
tags:
- backend
summary: Gets a single lists
operationId: getList
parameters:
- name: listid
in: path
description: ID of a list
required: true
schema:
type: string
format: uuid
- name: offset
in: query
description: Pagination offset
required: false
schema:
type: integer
- name: limit
in: query
description: Pagination limit
required: false
schema:
type: integer
responses:
200:
description: List data
content:
application/json:
schema:
$ref: '#/components/schemas/List'
/api/items/{itemid}:
get:
security:
- bearerAuth: []
tags:
- backend
summary: Gets data of an item
operationId: getItem
parameters:
- name: itemid
in: path
description: ID of an item
required: true
schema:
type: string
format: uuid
responses:
200:
description: Item data
content:
application/json:
schema:
$ref: '#/components/schemas/Item'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: Token
schemas:
MainList:
type: object
properties:
ids:
type: array
items:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
element_count:
type: integer
type:
type: string
count:
type: integer
List:
required:
- id
- name
- element_count
- itemlist
- type
type: object
properties:
id:
type: string
format: uuid
name:
type: string
element_count:
type: integer
type:
type: string
itemlist:
type: array
items:
$ref: '#/components/schemas/Item'
Item:
required:
- id
- title
type: object
properties:
id:
type: string
format: uuid
title:
type: string
artist:
type: string
album:
type: string
spotify_id:
type: string
cover_url:
type: string
format: url
cover_url_small:
type: string
format: url
type:
type: string
LoginToken:
required:
- token
type: object
properties:
token:
type: string
User:
required:
- name
- password
type: object
properties:
name:
type: string
password:
type: string
UserName:
required:
- name
type: object
properties:
name:
type: string
ApiResponse:
required:
- message
- status
type: object
properties:
status:
type: string
message:
type: string