From da8d05f656da6f8091afa0d14c5d2bd633dc6065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Wed, 25 Nov 2020 17:48:26 +0100 Subject: [PATCH] create api definition --- backend.yml | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 backend.yml diff --git a/backend.yml b/backend.yml new file mode 100644 index 0000000..b27b4dc --- /dev/null +++ b/backend.yml @@ -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 \ No newline at end of file