swagger-docs/backend.yml
2020-11-26 02:31:14 +01:00

253 lines
5.4 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:
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:
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:
tags:
- backend
summary: Gets all lists
operationId: getAllLists
responses:
200:
description: Lists
content:
application/json:
schema:
$ref: '#/components/schemas/MainList'
/api/lists/{listid}:
get:
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/lists/{listid}/{trackid}:
get:
tags:
- backend
summary: Gets a track from a List
operationId: getTrack
parameters:
- name: listid
in: path
description: ID of a list
required: true
schema:
type: string
format: uuid
- name: trackid
in: path
description: ID of a track
required: true
schema:
type: string
format: uuid
responses:
200:
description: Track data
content:
application/json:
schema:
$ref: '#/components/schemas/Track'
components:
schemas:
MainList:
type: object
properties:
ids:
type: array
items:
type: object
properties:
id:
type: string
format: uuid
name:
type: string
element_count:
type: integer
count:
type: integer
List:
required:
- id
- element_count
- tracklist
type: object
properties:
id:
type: string
format: uuid
element_count:
type: integer
tracklist:
type: array
items:
$ref: '#/components/schemas/Track'
Track:
required:
- id
- title
- artist
- album
- spotify_id
- cover_url
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
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