{ "openapi": "3.0.1", "info": { "title": "Admin panel API", "description": "It's API", "version": "1.0.0" }, "servers": [ { "url": "http://localhost:8080/api" } ], "tags": [ { "name": "auth", "description": "auth key for admin panel" }, { "name": "playlist", "description": "playlists go brr" }, { "name": "song", "description": "songs go tata" }, { "name": "user", "description": "user's sleeping" } ], "paths": { "/auth": { "post": { "tags": [ "auth" ], "summary": "get auth key. Only works for accs with 'admin' role", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserAuth" } } } }, "responses": { "200": { "description": "successful query", "content": { "application/json": { "schema": { "type": "string" } } } }, "400": { "description": "invalid query", "content": {} }, "404": { "description": "acc not found", "content": {} } } } }, "/content/playlist/title/{title}": { "get": { "tags": [ "playlist" ], "summary": "Get list of playlist with matching title", "parameters": [ { "name": "offset", "in": "query", "required": true, "schema": { "type": "int" } }, { "name": "limit", "in": "query", "required": true, "schema": { "type": "int" } }, { "name": "title", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "200": { "description": "successful query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Playlist" } } } }, "400": { "description": "invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/content/playlist/{id}": { "get": { "tags": [ "playlist" ], "summary": "Get playlist by ID", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlaylistInfo" } } } }, "400": { "description": "invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] }, "delete": { "tags": [ "playlist" ], "summary": "Deletes a playlist by ID", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlaylistInfo" } } } }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/content/playlist": { "get": { "tags": [ "playlist" ], "summary": "Get list of playlists", "parameters": [ { "name": "offset", "in": "query", "required": true, "schema": { "type": "integer" } }, { "name": "limit", "in": "query", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "succesful query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Playlist" } } } }, "400": { "description": "invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] }, "put": { "tags": [ "playlist" ], "summary": "Updates a playlist with form data", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlaylistInfo" } } } }, "responses": { "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] }, "post": { "tags": [ "playlist" ], "summary": "Add a new playlist", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlaylistInfo" } } } }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PlaylistInfo" } } } } }, "security": [ { "bearerAuth": [] } ] } }, "/content/playlist/{id}/songs": { "get": { "tags": [ "playlist" ], "summary": "Get list of songs in playlist", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } }, { "name": "offset", "in": "query", "required": true, "schema": { "type": "integer" } }, { "name": "limit", "in": "query", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "succesful query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Song" } } } }, "400": { "description": "invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/content/playlist/{idP}/song/": { "delete": { "tags": [ "playlist" ], "summary": "Remove all songs from playlist", "parameters": [ { "name": "idP", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "succesful query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SongInfo" } } } }, "400": { "description": "invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/content/song/name/{name}": { "get": { "tags": [ "song" ], "summary": "Get lsit of songs that matches name", "parameters": [ { "name": "name", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "offset", "in": "query", "required": true, "schema": { "type": "integer" } }, { "name": "limit", "in": "query", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "succesful query", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Song" } } } }, "400": { "description": "invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/content/song": { "get": { "tags": [ "song" ], "summary": "Get list of songs", "parameters": [ { "name": "offset", "in": "query", "required": true, "schema": { "type": "integer" } }, { "name": "limit", "in": "query", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Song" } } } }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] }, "put": { "tags": [ "song" ], "summary": "Update an existing song", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SongInfo" } } } }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SongInfo" } } } }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] }, "post": { "tags": [ "song" ], "summary": "Add new song", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SongInfo" } } } }, "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SongInfo" } } } }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/content/song/{id}": { "post": { "tags": [ "song" ], "summary": "Get song with ID", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] }, "delete": { "tags": [ "song" ], "summary": "Delete song with ID", "parameters": [ { "name": "id", "required": true, "in": "path", "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/content/song/{idS}/playlist/{idP}": { "post": { "tags": [ "song" ], "summary": "Bind song to playlist with IDs", "parameters": [ { "name": "idS", "in": "path", "required": true, "schema": { "type": "integer" } }, { "name": "idP", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful operation", "content": {} }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/user": { "get": { "tags": [ "user" ], "summary": "Get list of users", "parameters": [ { "name": "offset", "in": "query", "required": true, "schema": { "type": "integer" } }, { "name": "limit", "in": "query", "required": true, "schema": { "type": "integer" } }, { "name": "usertype", "in": "query", "description": "admin, artist or user", "required": false, "schema": { "type": "string" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/User" } } } }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/user/id/{id}": { "get": { "tags": [ "user" ], "summary": "Get user by ID", "parameters": [ { "name": "id", "in": "path", "required": true, "schema": { "type": "integer" } } ], "responses": { "200": { "description": "successful operation", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UserInfo" } } } }, "400": { "description": "Invalid query", "content": {} } }, "security": [ { "bearerAuth": [] } ] } }, "/user/email/{email}": { "get": { "tags": [ "user" ], "summary": "Get users matching the given email", "parameters": [ { "name": "offset", "in": "query", "required": true, "schema": { "type": "int" } }, { "name": "limit", "in": "query", "required": true, "schema": { "type": "int" } }, { "name": "usertype", "description": "admin, user or artist", "in": "path", "required": true, "schema": { "type": "string" } }, { "name": "email", "in": "path", "required": true, "schema": { "type": "string" } } ], "responses": { "default": { "description": "successful operation", "content": {} } }, "security": [ { "bearerAuth": [] } ] } } }, "components": { "schemas": { "User": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "email": { "type": "string" } } }, "UserInfo": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "email": { "type": "string" }, "username": { "type": "string" }, "user_type": { "type": "string" }, "birthday": { "type": "string", "format": "date" }, "country": { "type": "string" }, "premium_type": { "type": "string" }, "start_at": { "type": "string", "format": "timestamp" }, "end_at": { "type": "string", "format": "timestamp" } } }, "Song": { "type": "object", "properties": { "song_id": { "type": "integer", "format": "int64" }, "playlist_id": { "type": "integer", "format": "int64" }, "name": { "type": "string" } } }, "SongInfo": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "name": { "type": "string" }, "source": { "type": "string" }, "user_id": { "type": "integer", "format": "int64" } } }, "Playlist": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "title": { "type": "string" } } }, "PlaylistInfo": { "type": "object", "properties": { "id": { "type": "integer", "format": "int64" }, "title": { "type": "string" }, "user_id": { "type": "integer", "format": "int64" }, "type": { "type": "string" }, "img_src": { "type": "string" } } }, "UserAuth": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string" } } } }, "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } } } }