Files
MusicServer/cmd/docs/swagger.yaml
T

965 lines
23 KiB
YAML

definitions:
backend.GameWithSongs:
properties:
game_id:
type: integer
game_last_played:
type: string
game_name:
type: string
game_played:
type: integer
songs:
items:
$ref: '#/definitions/backend.SongInfoForStats'
type: array
type: object
backend.SongInfoForStats:
properties:
file_name:
type: string
game_id:
type: integer
game_name:
type: string
path:
type: string
song_name:
type: string
times_played:
type: integer
type: object
backend.StatisticsSummary:
properties:
avg_game_plays:
type: number
max_game_plays:
type: integer
min_game_plays:
type: integer
never_played_games:
type: integer
played_games:
type: integer
total_game_plays:
type: integer
total_games:
type: integer
type: object
backend.VersionData:
properties:
changelog:
example:
- '["Initial release"'
- '"Bug fixes"]'
items:
type: string
type: array
version:
example: 1.0.0
type: string
type: object
server.TokenRequest:
properties:
client_type:
description: 'Optional: "web", "mobile", "api"'
type: string
type: object
server.TokenResponse:
properties:
client_type:
type: string
expires_at:
type: string
token:
type: string
type: object
info:
contact: {}
paths:
/api/v1/statistics/games/last-played:
get:
consumes:
- application/json
description: Returns the most recently played games
parameters:
- description: 'Number of results (default: 10)'
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/backend.GameWithSongs'
type: array
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get last played games
tags:
- statistics
/api/v1/statistics/games/least-played:
get:
consumes:
- application/json
description: Returns the top N least played games with their songs
parameters:
- description: 'Number of results (default: 10)'
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/backend.GameWithSongs'
type: array
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get least played games
tags:
- statistics
/api/v1/statistics/games/most-played:
get:
consumes:
- application/json
description: Returns the top N most played games with their songs
parameters:
- description: 'Number of results (default: 10)'
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/backend.GameWithSongs'
type: array
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get most played games
tags:
- statistics
/api/v1/statistics/games/never-played:
get:
consumes:
- application/json
description: Returns all games that have never been played (times_played = 0)
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/backend.GameWithSongs'
type: array
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get never played games
tags:
- statistics
/api/v1/statistics/games/oldest-played:
get:
consumes:
- application/json
description: Returns the least recently played games (that have been played
at least once)
parameters:
- description: 'Number of results (default: 10)'
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/backend.GameWithSongs'
type: array
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get oldest played games
tags:
- statistics
/api/v1/statistics/songs/least-played:
get:
consumes:
- application/json
description: Returns the top N least played songs with their game info
parameters:
- description: 'Number of results (default: 10)'
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/backend.SongInfoForStats'
type: array
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get least played songs
tags:
- statistics
/api/v1/statistics/songs/most-played:
get:
consumes:
- application/json
description: Returns the top N most played songs with their game info
parameters:
- description: 'Number of results (default: 10)'
in: query
name: limit
type: integer
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/backend.SongInfoForStats'
type: array
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get most played songs
tags:
- statistics
/api/v1/statistics/summary:
get:
consumes:
- application/json
description: Returns overall statistics about the music library
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/backend.StatisticsSummary'
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Get statistics summary
tags:
- statistics
/api/v1/token:
delete:
consumes:
- application/json
description: Deletes the current session token
parameters:
- description: Bearer token
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties:
type: string
type: object
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Invalidate session token
tags:
- auth
post:
consumes:
- application/json
description: Returns a new session token for API access
parameters:
- description: Client type
in: body
name: request
required: true
schema:
$ref: '#/definitions/server.TokenRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/server.TokenResponse'
"400":
description: Bad Request
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Create session token
tags:
- auth
/api/v1/token/cleanup:
post:
consumes:
- application/json
description: Removes all expired session tokens from the database
parameters:
- description: Bearer token
in: header
name: Authorization
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
additionalProperties: true
type: object
"401":
description: Unauthorized
schema:
additionalProperties:
type: string
type: object
"500":
description: Internal Server Error
schema:
additionalProperties:
type: string
type: object
summary: Cleanup expired sessions
tags:
- auth
/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
/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 soundtracks
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 soundtracks 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 soundtracks
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Sync soundtracks 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 soundtracks 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: Soundtracks and songs are deleted from the database
schema:
type: string
"423":
description: Syncing is in progress
schema:
type: string
summary: Reset soundtracks database
tags:
- sync
/version:
get:
consumes:
- application/json
description: get latest version info
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/backend.VersionData'
"404":
description: Not Found
schema:
type: string
summary: Getting the latest version of the backend
tags:
- version
/version/history:
get:
consumes:
- application/json
description: get version history
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/backend.VersionData'
type: array
"404":
description: Not Found
schema:
type: string
summary: Getting the version history of the backend
tags:
- version
swagger: "2.0"