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/karaokeReturns 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.
Declaration
Swift
func getKaraokeSongs(_ req: Request) async throws -> KaraokeSongResponseDataReturn Value
-
getKaraokeSong(_:Asynchronous) GET /api/v3/karaoke/:song_idReturns 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 -> KaraokeSongDataReturn Value
-
getLatestPerformedSongs(_:Asynchronous) GET /api/v3/karaoke/performanceReturns 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.
Declaration
Swift
func getLatestPerformedSongs(_ req: Request) async throws -> KaraokePerformedSongsResultReturn Value
An array of up to 10
KaraokePerformedSongsData -
addFavorite(_:Asynchronous) POST /api/v3/karaoke/:songID/favoriteAdd the specified
KaraokeSongto the user’s list of favorite songs. Must be logged inDeclaration
Swift
func addFavorite(_ req: Request) async throws -> HTTPStatusParameters
songIDin URL path
Return Value
201 Created on success.
-
removeFavorite(_:Asynchronous) POST /api/v3/karaoke/:songID/favorite/removeDELETE /api/v3/karaoke/:songID/favoriteRemove the specified
KaraokeSongfrom the user’s favorite list.Declaration
Swift
func removeFavorite(_ req: Request) async throws -> HTTPStatusParameters
songIDin URL path
Return Value
204 No Content on success. 200 OK if song was already not favorited.
-
userCanLogKaraokeSongPerformances(_:Asynchronous) GET /api/v3/karaoke/userismanagerReturns 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 -> UserAuthorizedToCreateKaraokeLogsReturn Value
200 OK
-
logSongPerformance(_:Asynchronous) POST /api/v3/karaoke/:songID/logperformanceAllows 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 -> HTTPStatusParameters
songIDin URL path
noteNoteCreateDatain request bodyReturn Value
201 Created on success.
-
reloadKaraokeData(_:Asynchronous) POST /api/v3/karaoke/reloadReloads 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 -> HTTPStatusReturn Value
HTTP 200 OKif the settings were updated.
View on GitHub