add swagger docs

This commit is contained in:
2025-02-03 03:06:35 +01:00
parent 0479db520b
commit 1c266a5d2e
7 changed files with 2155 additions and 212 deletions

687
go-backend/docs/docs.go Normal file
View File

@@ -0,0 +1,687 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"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
},
"url": {
"type": "string",
"example": "https://osu.ppy.sh/beatmaps/123456"
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "localhost:8080",
BasePath: "/api/v1/",
Schemes: []string{},
Title: "go-osu-music-hoster",
Description: "Server Hosting ur own osu files over a simple Api",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}

View File

@@ -0,0 +1,663 @@
{
"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
},
"url": {
"type": "string",
"example": "https://osu.ppy.sh/beatmaps/123456"
}
}
}
}
}

View File

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