KaraokeController

struct KaraokeController : APIRouteCollection

Methods for accessing the list of boardgames available in the onboard Games Library.

  • Required. Registers routes to the incoming router.

    Declaration

    Swift

    func registerRoutes(_ app: Application) throws
  • getKaraokeSongs(_:) Asynchronous

    GET /api/v3/karaoke

    Returns an array of karaoke songs in a structure designed to support pagination. Can be called while not logged in; if logged in favorite information is returned.

    This call can’t be used to browse the entire ~25000 song library. You must specify either a search string with >2 chars, or specify favorites=true.

    URL Query Parameters

    • ?search=STRING - Only show songs whose artist or title contains the given string. If a single letter or %23 is sent, it will return songs where the artist matches the letter, or starts with a number.
    • ?favorite=TRUE - Only return songs that have been favorited by current user.
    • ?start=INT - Offset from start of results set
    • ?limit=INT - the maximum number of songs to retrieve: 1-200, default is 50.

    See more

    Declaration

    Swift

    func getKaraokeSongs(_ req: Request) async throws -> KaraokeSongResponseData
  • getKaraokeSong(_:) Asynchronous

    GET /api/v3/karaoke/:song_id

    Returns a single karaoke song. Can be called while not logged in; if logged in favorite information is returned.

    Declaration

    Swift

    func getKaraokeSong(_ req: Request) async throws -> KaraokeSongData

    Return Value

    KaraokeSongData

  • GET /api/v3/karaoke/performance

    Returns an array of karaoke songs that have been marked as being performed. Can be called while not logged in; if logged in favorite information is returned.

    • ?search=STRING - Only show songs whose artist or title contains the given string.
    • ?start=INT - Offset from start of results set
    • ?limit=INT - the maximum number of songs to retrieve: 1-200, default is 50.
    See more

    Declaration

    Swift

    func getLatestPerformedSongs(_ req: Request) async throws -> KaraokePerformedSongsResult

    Return Value

    An array of up to 10 KaraokePerformedSongsData

  • addFavorite(_:) Asynchronous

    POST /api/v3/karaoke/:songID/favorite

    Add the specified KaraokeSong to the user’s list of favorite songs. Must be logged in

    Declaration

    Swift

    func addFavorite(_ req: Request) async throws -> HTTPStatus

    Parameters

    songID

    in URL path

    Return Value

    201 Created on success.

  • removeFavorite(_:) Asynchronous

    POST /api/v3/karaoke/:songID/favorite/remove DELETE /api/v3/karaoke/:songID/favorite

    Remove the specified KaraokeSong from the user’s favorite list.

    Declaration

    Swift

    func removeFavorite(_ req: Request) async throws -> HTTPStatus

    Parameters

    songID

    in URL path

    Return Value

    204 No Content on success. 200 OK if song was already not favorited.

  • GET /api/v3/karaoke/userismanager

    Returns TRUE in isAuthorized if the user is a Karaoke Manager, meaning they can create entries in the Karaoke Song Log.

    Declaration

    Swift

    func userCanLogKaraokeSongPerformances(_ req: Request) async throws -> UserAuthorizedToCreateKaraokeLogs

    Return Value

    200 OK

  • logSongPerformance(_:) Asynchronous

    POST /api/v3/karaoke/:songID/logperformance

    Allows authorized users to create log entries for karaoke performances. Each log entry is timestamped, references a song in the Karaoke song catalog, and has a freeform text field for entering the song performer(s). Song performers don’t need to be Twit-arr users and may not have accounts, but @mentions in the note field should be processed.

    Declaration

    Swift

    func logSongPerformance(_ req: Request) async throws -> HTTPStatus

    Parameters

    songID

    in URL path

    note

    NoteCreateData in request body

    Return Value

    201 Created on success.

  • reloadKaraokeData(_:) Asynchronous

    POST /api/v3/karaoke/reload

    Reloads the karaoke data from the seed file. Removes all previous entries.

    Throws

    A 5xx response should be reported as a likely bug, please and thank you.

    Declaration

    Swift

    func reloadKaraokeData(_ req: Request) async throws -> HTTPStatus

    Return Value

    HTTP 200 OK if the settings were updated.