openapi: 3.0.3
info:
  version: "3.0"
  title: "Music Server"
  description: "Changed routing framework from mux to Gin. Swagger doc is now included in the application. A fronted can now be hosted from the application."
  contact:
    email: "zarnor91@gmail.com"
servers:
  - url: https://music.sanplex.xyz/
    description: Main (production) server
  - url: https://tmusic.sanplex.xyz/
    description: Test server
  - url: http://localhost:8080
    description: Local server
tags:
  - name: "Music"
    description: "Endpoints for the music"
  - name: "Version"
    description: "Information about the application"
  - name: "Sync"
    description: "Sync the database with the folders"
paths:
  /music:
    get:
      tags:
        - "Music"
      summary: "Get song"
      description: "Get a specified song from the que, if invalid number it will be the first or the last song in que"
      operationId: "getSong"
      parameters:
        - name: "song"
          in: "query"
          schema:
            type: integer
          description: "The number the song has in the que"
          required: true
      responses:
        "200":
          description: "The speciefied file"
          content:
            audio/mpeg:
              schema:
                type: object
                format: binary
        "500":
          description: "Something wnet wrong on the server"
  /music/first:
    get:
      tags:
        - "Music"
      summary: "Start a match"
      description: "Get a sound check song and starts a new song que"
      operationId: "getFisrt"
      responses:
        "200":
          description: "A file"
          content:
            audio/mpeg:
              schema:
                type: object
                format: binary
        "500":
          description: "Something wnet wrong on the server"
  /music/rand:
    get:
      tags:
        - "Music"
      summary: "Get random song"
      description: "Takes a random song from a random game"
      operationId: "getRandom"
      responses:
        "200":
          description: "A file"
          content:
            audio/mpeg:
              schema:
                type: object
                format: binary
        "500":
          description: "Something wnet wrong on the server"
  /music/rand/low:
    get:
      tags:
        - "Music"
      summary: "Get random song"
      description: "Takes a random song from a random game but increases the chans for games that haven't been played"
      operationId: "getRandomLow"
      responses:
        "200":
          description: "A file"
          content:
            audio/mpeg:
              schema:
                type: object
                format: binary
        "500":
          description: "Something wnet wrong on the server"
  /music/info:
    get:
      tags:
        - "Music"
      summary: "Get info of current song"
      description: "Return the info of the song currently playing"
      operationId: "getInfo"
      responses:
        "200":
          description: "Info of current song"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/info'
        "500":
          description: "Something wnet wrong on the server"
  /music/list:
    get:
      tags:
        - "Music"
      summary: "Gets song que"
      description: "Gets a list of all songs that have been fetched"
      operationId: "getList"
      responses:
        "200":
          description: "A list"
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/list'
        "500":
          description: "Something went wrong on the server"
  /music/next:
    get:
      tags:
        - "Music"
      summary: "Get next song"
      description: "Gets next song in the song que, if there is no more a new random song will be generated."
      operationId: "getNext"
      responses:
        "200":
          description: "A file"
          content:
            audio/mpeg:
              schema:
                type: object
                format: binary
        "500":
          description: "Something wnet wrong on the server"
  /music/previous:
    get:
      tags:
        - "Music"
      summary: "Get previous song"
      description: "Gets previous song in the song que, if there is no more the first song will be returns."
      operationId: "getPrevious"
      responses:
        "200":
          description: "A file"
          content:
            audio/mpeg:
              schema:
                type: object
                format: binary
        "500":
          description: "Something wnet wrong on the server"
  /music/all:
    get:
      tags:
        - "Music"
      summary: "Gets all games"
      description: "Gets a list of all games that is in the database"
      operationId: "getAll"
      responses:
        "200":
          description: "A list"
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                example: ["God of War", "Final Fantasy VII"]
        "500":
          description: "Something went wrong on the server"
  /music/all/order:
    get:
      tags:
        - "Music"
      summary: "Gets all games in order"
      description: "Gets a ordered list of all games that is in the database"
      operationId: "getAll"
      responses:
        "200":
          description: "A list"
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                example: [ "God of War", "Final Fantasy VII" ]
        "500":
          description: "Something went wrong on the server"
  /music/all/random:
    get:
      tags:
        - "Music"
      summary: "Gets all games in random order"
      description: "Gets a list of all games that is in the database in random order"
      operationId: "getAllRandom"
      responses:
        "200":
          description: "A list"
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
                example: ["Final Fantasy VII", "God of War"]
        "500":
          description: "Something went wrong on the server"
  /music/played:
    put:
      tags:
        - "Music"
      summary: "Increase played"
      description: "Increase the number of times the current game has been played"
      operationId: "setPlayed"
      responses:
        "202":
          description: "Accepted"
        "401":
          description: "Bad Request"
        "500":
          description: "Something went wrong on the server"
  /music/addQue:
    get:
      tags:
        - "Music"
      summary: "Adds last song to que"
      description: "Adds the last featched song to the song que"
      operationId: "addQue"
      responses:
        "200":
          description: "OK"
        "401":
          description: "Bad Request"
        "500":
          description: "Something went wrong on the server"
  /music/reset:
    get:
      tags:
        - "Music"
      summary: "Resets the song que"
      description: "Resets the song que for a new match"
      operationId: "reset"
      responses:
        "200":
          description: "successful operation"
        "500":
          description: "Something went wrong on the server"
  /version:
    get:
      tags:
        - "Version"
      summary: "Returns pet inventories by status"
      description: "Returns a map of status codes to quantities"
      operationId: "getVersionInfo"
      responses:
        "200":
          description: "successful operation"
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/versionInfo'
  /sync:
    get:
      tags:
        - "Sync"
      summary: "Sync games"
      description: "Sync the database with the folders"
      operationId: "sync"
      responses:
        "200":
          description: "successful operation"
        "500":
          description: "Something went wrong on the server"
components:
  schemas:
    list:
      type: object
      properties:
        Game:
          type: string
          example: God of War
        Song:
          type: string
          example: Main Theme.mp3
        CurrentlyPlaying:
          type: boolean
          example: true
          description: Only included on the one that's playing
        SongNo:
          type: integer
          example: 3
    info:
      type: object
      properties:
        Game:
          type: string
          example: God of War
        GamePlayed:
          type: integer
          example: 10
        Song:
          type: string
          example: Main Theme.mp3
        SongPlayed:
          type: integer
          example: 10
        SongNo:
          type: integer
          example: 3
    versionInfo:
      type: object
      properties:
        version:
          type: string
          example: 0.5.1
        changelog:
          type: string
          example: "Added shadow to build fat jars. Added support to give property files through arguments."
        history:
          type: array
          items:
            $ref: '#/components/schemas/historyInfo'
    historyInfo:
      type: object
      properties:
        version:
          type: string
          example: 0.5.0
        changelog:
          type: string
          example: "Updated kotlin version, gradle version and al libs. Added connection to database with exposed. Added new endpoints."