Files
pwa-player/go-backend/docs/swagger.json
2025-02-03 03:09:00 +01:00

659 lines
22 KiB
JSON

{
"swagger": "2.0",
"info": {
"description": "Server Hosting ur own osu files over a simple Api",
"title": "go-osu-music-hoster",
"contact": {},
"version": "1.0"
},
"host": "localhost:8080",
"basePath": "/api/v1/",
"paths": {
"/audio/{filepath}": {
"get": {
"description": "Retrieves a song file from the server based on the provided encoded filepath",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Retrieves a song file by its encoded path",
"parameters": [
{
"type": "string",
"description": "Base64 encoded file path",
"name": "filepath",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The requested song file",
"schema": {
"type": "file"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "File Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/collection": {
"get": {
"description": "Retrieves a collection of songs using the provided index.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"songs"
],
"summary": "Get a collection of songs by index",
"parameters": [
{
"type": "integer",
"description": "Index",
"name": "index",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Song"
}
}
},
"400": {
"description": "Invalid parameter",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "string"
}
}
}
}
},
"/collections": {
"get": {
"description": "Retrieves collections from the database with pagination based on the query parameter",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"search"
],
"summary": "Retrieves collections based on a query",
"parameters": [
{
"type": "string",
"description": "Search query",
"name": "query",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Limit the number of results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"default": 0,
"description": "Offset for pagination",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "List of collections",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Collection"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/image/{filepath}": {
"get": {
"description": "Retrieves an image file from the server based on the provided encoded filepath",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Retrieves an image file by its encoded path",
"parameters": [
{
"type": "string",
"description": "Base64 encoded file path",
"name": "filepath",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "The requested image file",
"schema": {
"type": "file"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"404": {
"description": "File Not Found",
"schema": {
"type": "string"
}
}
}
}
},
"/login": {
"get": {
"description": "Redirects users to an external authentication page",
"tags": [
"auth"
],
"summary": "Redirect to login page",
"responses": {
"307": {
"description": "Temporary Redirect",
"schema": {
"type": "string"
}
}
}
}
},
"/ping": {
"get": {
"description": "Returns a pong response if the server is running",
"tags": [
"health"
],
"summary": "Check server health",
"responses": {
"200": {
"description": "pong",
"schema": {
"type": "string"
}
}
}
}
},
"/search/active": {
"get": {
"description": "Searches active records in the database based on the query parameter",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"search"
],
"summary": "Searches active records based on a query",
"parameters": [
{
"type": "string",
"description": "Search query",
"name": "query",
"in": "query",
"required": true
},
{
"type": "integer",
"default": 10,
"description": "Limit the number of results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"default": 0,
"description": "Offset for pagination",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "Active search result",
"schema": {
"$ref": "#/definitions/main.ActiveSearch"
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/search/artist": {
"get": {
"description": "Searches for artists in the database based on the query parameter",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"search"
],
"summary": "Searches for artists based on a query",
"parameters": [
{
"type": "string",
"description": "Search query",
"name": "query",
"in": "query",
"required": true
},
{
"type": "integer",
"default": 10,
"description": "Limit the number of results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"default": 0,
"description": "Offset for pagination",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "List of artists",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/search/collections": {
"get": {
"description": "Searches collections in the database based on the query parameter",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"search"
],
"summary": "Searches collections based on a query",
"parameters": [
{
"type": "string",
"description": "Search query",
"name": "query",
"in": "query",
"required": true
},
{
"type": "integer",
"default": 10,
"description": "Limit the number of results",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"default": 0,
"description": "Offset for pagination",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "List of collections",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Collection"
}
}
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"type": "string"
}
}
}
}
},
"/song/{hash}": {
"get": {
"description": "Retrieves a song using its unique hash identifier.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"songs"
],
"summary": "Get a song by its hash",
"parameters": [
{
"type": "string",
"description": "Song hash",
"name": "hash",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/main.Song"
}
},
"400": {
"description": "Invalid parameter",
"schema": {
"type": "string"
}
},
"404": {
"description": "Song not found",
"schema": {
"type": "string"
}
}
}
}
},
"/songs/favorites": {
"get": {
"description": "Retrieves favorite songs filtered by a query with pagination support.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"songs"
],
"summary": "Get a list of favorite songs based on a query",
"parameters": [
{
"type": "string",
"description": "Search query",
"name": "query",
"in": "query",
"required": true
},
{
"type": "integer",
"default": 10,
"description": "Limit",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"default": 0,
"description": "Offset",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Song"
}
}
},
"400": {
"description": "Invalid parameter",
"schema": {
"type": "string"
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "string"
}
}
}
}
},
"/songs/recents": {
"get": {
"description": "Retrieves recent songs with pagination support.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"songs"
],
"summary": "Get a list of recent songs",
"parameters": [
{
"type": "integer",
"default": 10,
"description": "Limit",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"default": 0,
"description": "Offset",
"name": "offset",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Song"
}
}
},
"500": {
"description": "Internal server error",
"schema": {
"type": "string"
}
}
}
}
}
},
"definitions": {
"main.ActiveSearch": {
"description": "ActiveSearch holds search results for a given artist",
"type": "object",
"properties": {
"artist": {
"type": "string",
"example": "Ed Sheeran"
},
"songs": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Song"
}
}
}
},
"main.Collection": {
"description": "Collection holds a list of songs",
"type": "object",
"properties": {
"items": {
"type": "integer",
"example": 15
},
"name": {
"type": "string",
"example": "Best of 2023"
},
"songs": {
"type": "array",
"items": {
"$ref": "#/definitions/main.Song"
}
}
}
},
"main.Song": {
"description": "Song represents a song with metadata",
"type": "object",
"properties": {
"artist": {
"type": "string",
"example": "Ed Sheeran"
},
"audio": {
"type": "string",
"example": "audio.mp3"
},
"beatmap_id": {
"type": "integer",
"example": 123456
},
"creator": {
"type": "string",
"example": "JohnDoe"
},
"file": {
"type": "string",
"example": "beatmap.osu"
},
"folder": {
"type": "string",
"example": "osu/Songs/123456"
},
"image": {
"type": "string",
"example": "cover.jpg"
},
"md5_hash": {
"type": "string",
"example": "abcd1234efgh5678"
},
"title": {
"type": "string",
"example": "Shape of You"
},
"total_time": {
"type": "integer",
"example": 240
}
}
}
}
}