Skip to content

Spectator Live Game

Antoine CLOP edited this page Aug 2, 2020 · 3 revisions

Spectator / Live Game

Spectator methods provide informations about participants in current games.

Methods

LiveGame

Parameters

  • SummonerId: Represents the unique identifier of a summoner. See Summoners to get this identifier.
  • Region: The region where the summoner plays.

Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (GameInfo?, String?). GameInfo contains informations about a live game with its participants and will be nil only if summoner was not found on this region or is not currently playing. The String parameter contains the first error description encountered if existing.

Usage example

league.lolAPI.getLiveGame(by: SummonerId("xc8IRVLGV1Gb75sbz8JoLdRvIJ_yAKNsSG1RBQVtnGZqZV8"), on: .EUW) { (liveGame, errorMsg) in
    if let liveGame = liveGame {
        print("Success!")
    }
    else {
        print("Request failed cause: \(errorMsg ?? "No error description")")
    }
}

FeaturedGames

Parameters

  • Region: The region where the summoner plays.

Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (FeaturedGames?, String?). FeaturedGames contains a list of GameInfo objects. GameInfo contains informations about a live game with its participants. Result will be nil only if an error occured. The String parameter contains the first error description encountered if existing.

Usage example

league.lolAPI.getFeaturedGames(on: .EUW) { (featuredGames, errorMsg) in
    if let featuredGames = featuredGames {
        print("Success!")
    }
    else {
        print("Request failed cause: \(errorMsg ?? "No error description")")
    }
}
Clone this wiki locally