swagger-docs/backend.yml

246 lines
5.2 KiB
YAML
Raw Normal View History

2020-11-25 17:48:26 +01:00
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'
2020-11-26 00:46:25 +01:00
delete:
2020-11-25 19:00:43 +01:00
tags:
- backend
summary: Logs out a user
operationId: logoff
responses:
2020-11-26 00:46:25 +01:00
204:
2020-11-25 19:00:43 +01:00
description: successful operation
401:
description: Incorrect credentials
content:
application/json:
schema:
$ref: '#/components/schemas/ApiResponse'
2020-11-25 18:49:37 +01:00
/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'
2020-11-25 17:48:26 +01:00
/api/lists:
get:
tags:
- backend
summary: Gets all lists
operationId: getAllLists
responses:
200:
description: Lists
content:
application/json:
schema:
2020-11-26 02:31:14 +01:00
$ref: '#/components/schemas/MainList'
2020-11-25 17:48:26 +01:00
/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:
2020-11-26 01:40:58 +01:00
type: string
format: uuid
2020-11-26 02:31:14 +01:00
- name: offset
in: query
description: Pagination offset
required: false
schema:
type: integer
- name: limit
in: query
description: Pagination limit
required: false
schema:
type: integer
2020-11-25 17:48:26 +01:00
responses:
200:
description: List data
content:
application/json:
schema:
$ref: '#/components/schemas/List'
2020-11-26 03:44:39 +01:00
/api/tracks/{trackid}:
2020-11-25 17:48:26 +01:00
get:
tags:
- backend
summary: Gets a track from a List
operationId: getTrack
parameters:
- name: trackid
in: path
description: ID of a track
required: true
schema:
2020-11-26 01:40:58 +01:00
type: string
format: uuid
2020-11-25 17:48:26 +01:00
responses:
200:
description: Track data
content:
application/json:
schema:
$ref: '#/components/schemas/Track'
components:
schemas:
2020-11-26 02:31:14 +01:00
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
2020-11-25 17:48:26 +01:00
List:
required:
- id
2020-11-26 02:31:14 +01:00
- element_count
2020-11-25 17:48:26 +01:00
- tracklist
type: object
properties:
id:
2020-11-26 01:40:58 +01:00
type: string
format: uuid
2020-11-26 02:31:14 +01:00
element_count:
type: integer
2020-11-25 17:48:26 +01:00
tracklist:
type: array
items:
$ref: '#/components/schemas/Track'
Track:
required:
- id
- title
- artist
- album
- spotify_id
2020-11-25 18:17:55 +01:00
- cover_url
2020-11-25 17:48:26 +01:00
type: object
properties:
id:
2020-11-26 01:40:58 +01:00
type: string
format: uuid
2020-11-25 17:48:26 +01:00
title:
type: string
artist:
type: string
album:
type: string
spotify_id:
type: string
2020-11-25 18:17:55 +01:00
cover_url:
type: string
format: url
2020-11-25 17:48:26 +01:00
LoginToken:
required:
2020-11-26 01:27:24 +01:00
- token
2020-11-25 17:48:26 +01:00
type: object
properties:
2020-11-26 01:27:24 +01:00
token:
2020-11-25 17:48:26 +01:00
type: string
User:
required:
- name
- password
type: object
properties:
name:
type: string
password:
type: string
2020-11-25 18:49:37 +01:00
UserName:
required:
- name
type: object
properties:
name:
type: string
2020-11-25 17:48:26 +01:00
ApiResponse:
required:
- message
- status
type: object
properties:
status:
type: string
message:
type: string