mirror of
https://github.com/JuLi0n21/pwa-player.git
synced 2026-04-19 23:40:05 +00:00
409 lines
9.7 KiB
YAML
409 lines
9.7 KiB
YAML
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
|
|
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
|
|
type: integer
|
|
- description: Index
|
|
in: query
|
|
name: name
|
|
type: string
|
|
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
|
|
/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"
|