create api definition

This commit is contained in:
Torma Kristóf 2020-11-25 17:48:26 +01:00
parent b1154563cf
commit da8d05f656
1 changed files with 175 additions and 0 deletions

175
backend.yml Normal file
View File

@ -0,0 +1,175 @@
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'
/api/lists:
get:
tags:
- backend
summary: Gets all lists
operationId: getAllLists
responses:
200:
description: Lists
content:
application/json:
schema:
$ref: '#/components/schemas/ListArray'
/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: 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: integer
- name: trackid
in: path
description: ID of a track
required: true
schema:
type: integer
responses:
200:
description: Track data
content:
application/json:
schema:
$ref: '#/components/schemas/Track'
components:
schemas:
ListArray:
type: array
items:
$ref: '#/components/schemas/List'
List:
required:
- id
- tracklist
type: object
properties:
id:
type: integer
tracklist:
type: array
items:
$ref: '#/components/schemas/Track'
Track:
required:
- id
- title
- artist
- album
- spotify_id
type: object
properties:
id:
type: integer
title:
type: string
artist:
type: string
album:
type: string
spotify_id:
type: string
LoginToken:
required:
- token
type: object
properties:
token:
type: string
User:
required:
- name
- password
type: object
properties:
name:
type: string
password:
type: string
ApiResponse:
required:
- message
- status
type: object
properties:
status:
type: string
message:
type: string