Add Swag annotations to all handler endpoints for OpenAPI documentation

This commit is contained in:
2026-05-18 21:50:53 +02:00
parent fabd6a6931
commit e57609725e
7 changed files with 2287 additions and 0 deletions
+773
View File
@@ -23,6 +23,779 @@ var doc = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/character": {
"get": {
"description": "Returns the image for a specific character",
"consumes": [
"application/json"
],
"produces": [
"image/png"
],
"tags": [
"characters"
],
"summary": "Get character image",
"parameters": [
{
"type": "string",
"description": "Character name",
"name": "name",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
}
}
}
},
"/characters": {
"get": {
"description": "Returns a list of all available characters",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"characters"
],
"summary": "Get list of characters",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"/dbtest": {
"get": {
"description": "Tests the database connection",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"database"
],
"summary": "Test database connection",
"responses": {
"200": {
"description": "TestedDB",
"schema": {
"type": "string"
}
}
}
}
},
"/download": {
"get": {
"description": "Checks for the latest version of the application",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"download"
],
"summary": "Check for latest version",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/download/linux": {
"get": {
"description": "Redirects to download the latest Linux version",
"produces": [
"application/octet-stream"
],
"tags": [
"download"
],
"summary": "Download latest Linux version",
"responses": {
"302": {
"description": "Found",
"schema": {
"type": "string"
}
}
}
}
},
"/download/list": {
"get": {
"description": "Lists all assets available for the latest version",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"download"
],
"summary": "List assets of latest version",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"/download/windows": {
"get": {
"description": "Redirects to download the latest Windows version",
"produces": [
"application/octet-stream"
],
"tags": [
"download"
],
"summary": "Download latest Windows version",
"responses": {
"302": {
"description": "Found",
"schema": {
"type": "string"
}
}
}
}
},
"/health": {
"get": {
"description": "Returns the health status of the server",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"health"
],
"summary": "Check server health",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/music": {
"get": {
"description": "Returns a specific song by name",
"consumes": [
"application/json"
],
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get a specific song",
"parameters": [
{
"type": "string",
"description": "Song name",
"name": "song",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"400": {
"description": "song can't be empty",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/addPlayed": {
"get": {
"description": "Adds the latest song to the played list",
"consumes": [
"application/json"
],
"tags": [
"music"
],
"summary": "Add latest to played",
"responses": {
"204": {
"description": ""
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/addQue": {
"get": {
"description": "Adds the latest song to the queue",
"consumes": [
"application/json"
],
"tags": [
"music"
],
"summary": "Add latest to queue",
"responses": {
"204": {
"description": ""
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/all/order": {
"get": {
"description": "Returns a list of all games in order",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Get all games",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/all/random": {
"get": {
"description": "Returns a list of all games in random order",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Get all games random",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/info": {
"get": {
"description": "Returns information about the current song",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Get current song info",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/music/list": {
"get": {
"description": "Returns a list of played songs",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Get played songs list",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
},
"/music/next": {
"get": {
"description": "Returns the next song in the queue",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get next song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/played": {
"put": {
"description": "Marks a song as played by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Mark song as played",
"parameters": [
{
"type": "integer",
"description": "Song ID",
"name": "song",
"in": "query",
"required": true
}
],
"responses": {
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/previous": {
"get": {
"description": "Returns the previous song in the queue",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get previous song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/rand": {
"get": {
"description": "Returns a random song",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get random song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/rand/classic": {
"get": {
"description": "Returns a random song from the classic selection",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get random classic song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/rand/low": {
"get": {
"description": "Returns a random song with low chance selection",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get random song with low chance",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/reset": {
"get": {
"description": "Resets the music state",
"consumes": [
"application/json"
],
"tags": [
"music"
],
"summary": "Reset music state",
"responses": {
"204": {
"description": ""
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/soundTest": {
"get": {
"description": "Returns the sound check song",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get sound check song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/sync": {
"get": {
"description": "Starts syncing games with only new changes",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sync"
],
"summary": "Sync games with only changes",
"responses": {
"200": {
"description": "Start syncing games",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/sync/full": {
"get": {
"description": "Starts a full sync of all games",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sync"
],
"summary": "Sync all games fully",
"responses": {
"200": {
"description": "Start syncing games full",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/sync/progress": {
"get": {
"description": "Returns the current sync progress or result",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sync"
],
"summary": "Get sync progress",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/sync/reset": {
"get": {
"description": "Resets the games database by deleting all games and songs",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sync"
],
"summary": "Reset games database",
"responses": {
"200": {
"description": "Games and songs are deleted from the database",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/version": {
"get": {
"description": "get string by ID",
+773
View File
@@ -4,6 +4,779 @@
"contact": {}
},
"paths": {
"/character": {
"get": {
"description": "Returns the image for a specific character",
"consumes": [
"application/json"
],
"produces": [
"image/png"
],
"tags": [
"characters"
],
"summary": "Get character image",
"parameters": [
{
"type": "string",
"description": "Character name",
"name": "name",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
}
}
}
},
"/characters": {
"get": {
"description": "Returns a list of all available characters",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"characters"
],
"summary": "Get list of characters",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"/dbtest": {
"get": {
"description": "Tests the database connection",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"database"
],
"summary": "Test database connection",
"responses": {
"200": {
"description": "TestedDB",
"schema": {
"type": "string"
}
}
}
}
},
"/download": {
"get": {
"description": "Checks for the latest version of the application",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"download"
],
"summary": "Check for latest version",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/download/linux": {
"get": {
"description": "Redirects to download the latest Linux version",
"produces": [
"application/octet-stream"
],
"tags": [
"download"
],
"summary": "Download latest Linux version",
"responses": {
"302": {
"description": "Found",
"schema": {
"type": "string"
}
}
}
}
},
"/download/list": {
"get": {
"description": "Lists all assets available for the latest version",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"download"
],
"summary": "List assets of latest version",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
},
"/download/windows": {
"get": {
"description": "Redirects to download the latest Windows version",
"produces": [
"application/octet-stream"
],
"tags": [
"download"
],
"summary": "Download latest Windows version",
"responses": {
"302": {
"description": "Found",
"schema": {
"type": "string"
}
}
}
}
},
"/health": {
"get": {
"description": "Returns the health status of the server",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"health"
],
"summary": "Check server health",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
}
}
}
},
"/music": {
"get": {
"description": "Returns a specific song by name",
"consumes": [
"application/json"
],
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get a specific song",
"parameters": [
{
"type": "string",
"description": "Song name",
"name": "song",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"400": {
"description": "song can't be empty",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/addPlayed": {
"get": {
"description": "Adds the latest song to the played list",
"consumes": [
"application/json"
],
"tags": [
"music"
],
"summary": "Add latest to played",
"responses": {
"204": {
"description": ""
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/addQue": {
"get": {
"description": "Adds the latest song to the queue",
"consumes": [
"application/json"
],
"tags": [
"music"
],
"summary": "Add latest to queue",
"responses": {
"204": {
"description": ""
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/all/order": {
"get": {
"description": "Returns a list of all games in order",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Get all games",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/all/random": {
"get": {
"description": "Returns a list of all games in random order",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Get all games random",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/info": {
"get": {
"description": "Returns information about the current song",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Get current song info",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/music/list": {
"get": {
"description": "Returns a list of played songs",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Get played songs list",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
}
}
}
}
},
"/music/next": {
"get": {
"description": "Returns the next song in the queue",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get next song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/played": {
"put": {
"description": "Marks a song as played by its ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"music"
],
"summary": "Mark song as played",
"parameters": [
{
"type": "integer",
"description": "Song ID",
"name": "song",
"in": "query",
"required": true
}
],
"responses": {
"204": {
"description": ""
},
"400": {
"description": "Bad Request",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/previous": {
"get": {
"description": "Returns the previous song in the queue",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get previous song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/rand": {
"get": {
"description": "Returns a random song",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get random song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/rand/classic": {
"get": {
"description": "Returns a random song from the classic selection",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get random classic song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/rand/low": {
"get": {
"description": "Returns a random song with low chance selection",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get random song with low chance",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/reset": {
"get": {
"description": "Resets the music state",
"consumes": [
"application/json"
],
"tags": [
"music"
],
"summary": "Reset music state",
"responses": {
"204": {
"description": ""
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/music/soundTest": {
"get": {
"description": "Returns the sound check song",
"produces": [
"audio/mpeg"
],
"tags": [
"music"
],
"summary": "Get sound check song",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "file"
}
},
"404": {
"description": "Not Found",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/sync": {
"get": {
"description": "Starts syncing games with only new changes",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sync"
],
"summary": "Sync games with only changes",
"responses": {
"200": {
"description": "Start syncing games",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/sync/full": {
"get": {
"description": "Starts a full sync of all games",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sync"
],
"summary": "Sync all games fully",
"responses": {
"200": {
"description": "Start syncing games full",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/sync/progress": {
"get": {
"description": "Returns the current sync progress or result",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sync"
],
"summary": "Get sync progress",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"additionalProperties": true
}
}
}
}
},
"/sync/reset": {
"get": {
"description": "Resets the games database by deleting all games and songs",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"sync"
],
"summary": "Reset games database",
"responses": {
"200": {
"description": "Games and songs are deleted from the database",
"schema": {
"type": "string"
}
},
"423": {
"description": "Syncing is in progress",
"schema": {
"type": "string"
}
}
}
}
},
"/version": {
"get": {
"description": "get string by ID",
+508
View File
@@ -15,6 +15,514 @@ definitions:
info:
contact: {}
paths:
/character:
get:
consumes:
- application/json
description: Returns the image for a specific character
parameters:
- description: Character name
in: query
name: name
required: true
type: string
produces:
- image/png
responses:
"200":
description: OK
schema:
type: file
summary: Get character image
tags:
- characters
/characters:
get:
consumes:
- application/json
description: Returns a list of all available characters
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
type: string
type: array
summary: Get list of characters
tags:
- characters
/dbtest:
get:
consumes:
- application/json
description: Tests the database connection
produces:
- application/json
responses:
"200":
description: TestedDB
schema:
type: string
summary: Test database connection
tags:
- database
/download:
get:
consumes:
- application/json
description: Checks for the latest version of the application
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
summary: Check for latest version
tags:
- download
/download/linux:
get:
description: Redirects to download the latest Linux version
produces:
- application/octet-stream
responses:
"302":
description: Found
schema:
type: string
summary: Download latest Linux version
tags:
- download
/download/list:
get:
consumes:
- application/json
description: Lists all assets available for the latest version
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
type: string
type: array
summary: List assets of latest version
tags:
- download
/download/windows:
get:
description: Redirects to download the latest Windows version
produces:
- application/octet-stream
responses:
"302":
description: Found
schema:
type: string
summary: Download latest Windows version
tags:
- download
/health:
get:
consumes:
- application/json
description: Returns the health status of the server
produces:
- application/json
responses:
"200":
description: OK
schema:
type: string
summary: Check server health
tags:
- health
/music:
get:
consumes:
- application/json
description: Returns a specific song by name
parameters:
- description: Song name
in: query
name: song
required: true
type: string
produces:
- audio/mpeg
responses:
"200":
description: OK
schema:
type: file
"400":
description: song can't be empty
schema:
type: string
"404":
description: Not Found
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Get a specific song
tags:
- music
/music/addPlayed:
get:
consumes:
- application/json
description: Adds the latest song to the played list
responses:
"204":
description: ""
"423":
description: Syncing is in progress
schema:
type: string
summary: Add latest to played
tags:
- music
/music/addQue:
get:
consumes:
- application/json
description: Adds the latest song to the queue
responses:
"204":
description: ""
"423":
description: Syncing is in progress
schema:
type: string
summary: Add latest to queue
tags:
- music
/music/all/order:
get:
consumes:
- application/json
description: Returns a list of all games in order
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
additionalProperties: true
type: object
type: array
"423":
description: Syncing is in progress
schema:
type: string
summary: Get all games
tags:
- music
/music/all/random:
get:
consumes:
- application/json
description: Returns a list of all games in random order
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
additionalProperties: true
type: object
type: array
"423":
description: Syncing is in progress
schema:
type: string
summary: Get all games random
tags:
- music
/music/info:
get:
consumes:
- application/json
description: Returns information about the current song
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: Get current song info
tags:
- music
/music/list:
get:
consumes:
- application/json
description: Returns a list of played songs
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
additionalProperties: true
type: object
type: array
summary: Get played songs list
tags:
- music
/music/next:
get:
description: Returns the next song in the queue
produces:
- audio/mpeg
responses:
"200":
description: OK
schema:
type: file
"404":
description: Not Found
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Get next song
tags:
- music
/music/played:
put:
consumes:
- application/json
description: Marks a song as played by its ID
parameters:
- description: Song ID
in: query
name: song
required: true
type: integer
produces:
- application/json
responses:
"204":
description: ""
"400":
description: Bad Request
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Mark song as played
tags:
- music
/music/previous:
get:
description: Returns the previous song in the queue
produces:
- audio/mpeg
responses:
"200":
description: OK
schema:
type: file
"404":
description: Not Found
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Get previous song
tags:
- music
/music/rand:
get:
description: Returns a random song
produces:
- audio/mpeg
responses:
"200":
description: OK
schema:
type: file
"404":
description: Not Found
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Get random song
tags:
- music
/music/rand/classic:
get:
description: Returns a random song from the classic selection
produces:
- audio/mpeg
responses:
"200":
description: OK
schema:
type: file
"404":
description: Not Found
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Get random classic song
tags:
- music
/music/rand/low:
get:
description: Returns a random song with low chance selection
produces:
- audio/mpeg
responses:
"200":
description: OK
schema:
type: file
"404":
description: Not Found
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Get random song with low chance
tags:
- music
/music/reset:
get:
consumes:
- application/json
description: Resets the music state
responses:
"204":
description: ""
"423":
description: Syncing is in progress
schema:
type: string
summary: Reset music state
tags:
- music
/music/soundTest:
get:
description: Returns the sound check song
produces:
- audio/mpeg
responses:
"200":
description: OK
schema:
type: file
"404":
description: Not Found
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Get sound check song
tags:
- music
/sync:
get:
consumes:
- application/json
description: Starts syncing games with only new changes
produces:
- application/json
responses:
"200":
description: Start syncing games
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Sync games with only changes
tags:
- sync
/sync/full:
get:
consumes:
- application/json
description: Starts a full sync of all games
produces:
- application/json
responses:
"200":
description: Start syncing games full
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Sync all games fully
tags:
- sync
/sync/progress:
get:
consumes:
- application/json
description: Returns the current sync progress or result
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
summary: Get sync progress
tags:
- sync
/sync/reset:
get:
consumes:
- application/json
description: Resets the games database by deleting all games and songs
produces:
- application/json
responses:
"200":
description: Games and songs are deleted from the database
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Reset games database
tags:
- sync
/version:
get:
consumes:
+30
View File
@@ -14,18 +14,41 @@ func NewDownloadHandler() *DownloadHandler {
return &DownloadHandler{}
}
// CheckLatest godoc
// @Summary Check for latest version
// @Description Checks for the latest version of the application
// @Tags download
// @Accept json
// @Produce json
// @Success 200 {string} string
// @Router /download [get]
func (d *DownloadHandler) checkLatest(ctx echo.Context) error {
log.Println("Checking latest version")
latest := backend.CheckLatest()
return ctx.JSON(http.StatusOK, latest)
}
// ListAssetsOfLatest godoc
// @Summary List assets of latest version
// @Description Lists all assets available for the latest version
// @Tags download
// @Accept json
// @Produce json
// @Success 200 {array} string
// @Router /download/list [get]
func (d *DownloadHandler) listAssetsOfLatest(ctx echo.Context) error {
log.Println("Listing assets")
assets := backend.ListAssetsOfLatest()
return ctx.JSON(http.StatusOK, assets)
}
// DownloadLatestWindows godoc
// @Summary Download latest Windows version
// @Description Redirects to download the latest Windows version
// @Tags download
// @Produce octet-stream
// @Success 302 {string} string
// @Router /download/windows [get]
func (d *DownloadHandler) downloadLatestWindows(ctx echo.Context) error {
log.Println("Downloading latest windows")
asset := backend.DownloadLatestWindows()
@@ -33,6 +56,13 @@ func (d *DownloadHandler) downloadLatestWindows(ctx echo.Context) error {
return ctx.Redirect(http.StatusFound, asset)
}
// DownloadLatestLinux godoc
// @Summary Download latest Linux version
// @Description Redirects to download the latest Linux version
// @Tags download
// @Produce octet-stream
// @Success 302 {string} string
// @Router /download/linux [get]
func (d *DownloadHandler) downloadLatestLinux(ctx echo.Context) error {
log.Println("Downloading latest linux")
asset := backend.DownloadLatestLinux()
+33
View File
@@ -33,20 +33,53 @@ func (i *IndexHandler) GetVersion(ctx echo.Context) error {
return ctx.JSON(http.StatusOK, versionHistory)
}
// GetDBTest godoc
// @Summary Test database connection
// @Description Tests the database connection
// @Tags database
// @Accept json
// @Produce json
// @Success 200 {string} string "TestedDB"
// @Router /dbtest [get]
func (i *IndexHandler) GetDBTest(ctx echo.Context) error {
backend.TestDB()
return ctx.JSON(http.StatusOK, "TestedDB")
}
// HealthCheck godoc
// @Summary Check server health
// @Description Returns the health status of the server
// @Tags health
// @Accept json
// @Produce json
// @Success 200 {string} string "OK"
// @Router /health [get]
func (i *IndexHandler) HealthCheck(ctx echo.Context) error {
return ctx.JSON(http.StatusOK, db.Health())
}
// GetCharacterList godoc
// @Summary Get list of characters
// @Description Returns a list of all available characters
// @Tags characters
// @Accept json
// @Produce json
// @Success 200 {array} string
// @Router /characters [get]
func (i *IndexHandler) GetCharacterList(ctx echo.Context) error {
characters := backend.GetCharacterList()
return ctx.JSON(http.StatusOK, characters)
}
// GetCharacter godoc
// @Summary Get character image
// @Description Returns the image for a specific character
// @Tags characters
// @Accept json
// @Produce image/png
// @Param name query string true "Character name"
// @Success 200 {file} file
// @Router /character [get]
func (i *IndexHandler) GetCharacter(ctx echo.Context) error {
character := ctx.QueryParam("name")
return ctx.File(backend.GetCharacter(character))
+135
View File
@@ -17,6 +17,18 @@ func NewMusicHandler() *MusicHandler {
return &MusicHandler{}
}
// GetSong godoc
// @Summary Get a specific song
// @Description Returns a specific song by name
// @Tags music
// @Accept json
// @Produce audio/mpeg
// @Param song query string true "Song name"
// @Success 200 {file} file
// @Failure 400 {string} string "song can't be empty"
// @Failure 404 {string} string "Not Found"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music [get]
func (m *MusicHandler) GetSong(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -35,6 +47,15 @@ func (m *MusicHandler) GetSong(ctx echo.Context) error {
return ctx.Stream(http.StatusOK, "audio/mpeg", file)
}
// GetSoundCheckSong godoc
// @Summary Get sound check song
// @Description Returns the sound check song
// @Tags music
// @Produce audio/mpeg
// @Success 200 {file} file
// @Failure 404 {string} string "Not Found"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/soundTest [get]
func (m *MusicHandler) GetSoundCheckSong(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -49,6 +70,14 @@ func (m *MusicHandler) GetSoundCheckSong(ctx echo.Context) error {
return ctx.Stream(http.StatusOK, "audio/mpeg", file)
}
// ResetMusic godoc
// @Summary Reset music state
// @Description Resets the music state
// @Tags music
// @Accept json
// @Success 204
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/reset [get]
func (m *MusicHandler) ResetMusic(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -58,6 +87,15 @@ func (m *MusicHandler) ResetMusic(ctx echo.Context) error {
return ctx.NoContent(http.StatusOK)
}
// GetRandomSong godoc
// @Summary Get random song
// @Description Returns a random song
// @Tags music
// @Produce audio/mpeg
// @Success 200 {file} file
// @Failure 404 {string} string "Not Found"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/rand [get]
func (m *MusicHandler) GetRandomSong(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -72,6 +110,15 @@ func (m *MusicHandler) GetRandomSong(ctx echo.Context) error {
return ctx.Stream(http.StatusOK, "audio/mpeg", file)
}
// GetRandomSongLowChance godoc
// @Summary Get random song with low chance
// @Description Returns a random song with low chance selection
// @Tags music
// @Produce audio/mpeg
// @Success 200 {file} file
// @Failure 404 {string} string "Not Found"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/rand/low [get]
func (m *MusicHandler) GetRandomSongLowChance(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -86,6 +133,15 @@ func (m *MusicHandler) GetRandomSongLowChance(ctx echo.Context) error {
return ctx.Stream(http.StatusOK, "audio/mpeg", file)
}
// GetRandomSongClassic godoc
// @Summary Get random classic song
// @Description Returns a random song from the classic selection
// @Tags music
// @Produce audio/mpeg
// @Success 200 {file} file
// @Failure 404 {string} string "Not Found"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/rand/classic [get]
func (m *MusicHandler) GetRandomSongClassic(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -100,16 +156,41 @@ func (m *MusicHandler) GetRandomSongClassic(ctx echo.Context) error {
return ctx.Stream(http.StatusOK, "audio/mpeg", file)
}
// GetSongInfo godoc
// @Summary Get current song info
// @Description Returns information about the current song
// @Tags music
// @Accept json
// @Produce json
// @Success 200 {object} map[string]interface{}
// @Router /music/info [get]
func (m *MusicHandler) GetSongInfo(ctx echo.Context) error {
song := backend.GetSongInfo()
return ctx.JSON(http.StatusOK, song)
}
// GetPlayedSongs godoc
// @Summary Get played songs list
// @Description Returns a list of played songs
// @Tags music
// @Accept json
// @Produce json
// @Success 200 {array} map[string]interface{}
// @Router /music/list [get]
func (m *MusicHandler) GetPlayedSongs(ctx echo.Context) error {
songList := backend.GetPlayedSongs()
return ctx.JSON(http.StatusOK, songList)
}
// GetNextSong godoc
// @Summary Get next song
// @Description Returns the next song in the queue
// @Tags music
// @Produce audio/mpeg
// @Success 200 {file} file
// @Failure 404 {string} string "Not Found"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/next [get]
func (m *MusicHandler) GetNextSong(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -124,6 +205,15 @@ func (m *MusicHandler) GetNextSong(ctx echo.Context) error {
return ctx.Stream(http.StatusOK, "audio/mpeg", file)
}
// GetPreviousSong godoc
// @Summary Get previous song
// @Description Returns the previous song in the queue
// @Tags music
// @Produce audio/mpeg
// @Success 200 {file} file
// @Failure 404 {string} string "Not Found"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/previous [get]
func (m *MusicHandler) GetPreviousSong(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -138,6 +228,15 @@ func (m *MusicHandler) GetPreviousSong(ctx echo.Context) error {
return ctx.Stream(http.StatusOK, "audio/mpeg", file)
}
// GetAllGames godoc
// @Summary Get all games
// @Description Returns a list of all games in order
// @Tags music
// @Accept json
// @Produce json
// @Success 200 {array} map[string]interface{}
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/all/order [get]
func (m *MusicHandler) GetAllGames(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -147,6 +246,15 @@ func (m *MusicHandler) GetAllGames(ctx echo.Context) error {
return ctx.JSON(http.StatusOK, gameList)
}
// GetAllGamesRandom godoc
// @Summary Get all games random
// @Description Returns a list of all games in random order
// @Tags music
// @Accept json
// @Produce json
// @Success 200 {array} map[string]interface{}
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/all/random [get]
func (m *MusicHandler) GetAllGamesRandom(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -156,6 +264,17 @@ func (m *MusicHandler) GetAllGamesRandom(ctx echo.Context) error {
return ctx.JSON(http.StatusOK, gameList)
}
// PutPlayed godoc
// @Summary Mark song as played
// @Description Marks a song as played by its ID
// @Tags music
// @Accept json
// @Produce json
// @Param song query int true "Song ID"
// @Success 204
// @Failure 400 {string} string "Bad Request"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/played [put]
func (m *MusicHandler) PutPlayed(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -170,6 +289,14 @@ func (m *MusicHandler) PutPlayed(ctx echo.Context) error {
return ctx.NoContent(http.StatusOK)
}
// AddLatestToQue godoc
// @Summary Add latest to queue
// @Description Adds the latest song to the queue
// @Tags music
// @Accept json
// @Success 204
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/addQue [get]
func (m *MusicHandler) AddLatestToQue(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -179,6 +306,14 @@ func (m *MusicHandler) AddLatestToQue(ctx echo.Context) error {
return ctx.NoContent(http.StatusOK)
}
// AddLatestPlayed godoc
// @Summary Add latest to played
// @Description Adds the latest song to the played list
// @Tags music
// @Accept json
// @Success 204
// @Failure 423 {string} string "Syncing is in progress"
// @Router /music/addPlayed [get]
func (m *MusicHandler) AddLatestPlayed(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
+35
View File
@@ -15,6 +15,14 @@ func NewSyncHandler() *SyncHandler {
return &SyncHandler{}
}
// SyncProgress godoc
// @Summary Get sync progress
// @Description Returns the current sync progress or result
// @Tags sync
// @Accept json
// @Produce json
// @Success 200 {object} map[string]interface{}
// @Router /sync/progress [get]
func (s *SyncHandler) SyncProgress(ctx echo.Context) error {
if backend.Syncing {
log.Println("Getting progress")
@@ -26,6 +34,15 @@ func (s *SyncHandler) SyncProgress(ctx echo.Context) error {
return ctx.JSON(http.StatusOK, response)
}
// SyncGamesNewOnlyChanges godoc
// @Summary Sync games with only changes
// @Description Starts syncing games with only new changes
// @Tags sync
// @Accept json
// @Produce json
// @Success 200 {string} string "Start syncing games"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /sync [get]
func (s *SyncHandler) SyncGamesNewOnlyChanges(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -36,6 +53,15 @@ func (s *SyncHandler) SyncGamesNewOnlyChanges(ctx echo.Context) error {
return ctx.JSON(http.StatusOK, "Start syncing games")
}
// SyncGamesNewFull godoc
// @Summary Sync all games fully
// @Description Starts a full sync of all games
// @Tags sync
// @Accept json
// @Produce json
// @Success 200 {string} string "Start syncing games full"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /sync/full [get]
func (s *SyncHandler) SyncGamesNewFull(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")
@@ -46,6 +72,15 @@ func (s *SyncHandler) SyncGamesNewFull(ctx echo.Context) error {
return ctx.JSON(http.StatusOK, "Start syncing games full")
}
// ResetGames godoc
// @Summary Reset games database
// @Description Resets the games database by deleting all games and songs
// @Tags sync
// @Accept json
// @Produce json
// @Success 200 {string} string "Games and songs are deleted from the database"
// @Failure 423 {string} string "Syncing is in progress"
// @Router /sync/reset [get]
func (s *SyncHandler) ResetGames(ctx echo.Context) error {
if backend.Syncing {
log.Println("Syncing is in progress")