Skip to content

Riot Accounts

Antoine CLOP edited this page Aug 2, 2020 · 1 revision

Riot Accounts

Riot Accounts are common data throughout all games about a player. It contains the SummonerPuuid and RiotId.

Methods

Account (by SummonerPuuid)

Parameters

  • SummonerPuuid: Represents the unique identifier of a summoner.
  • WorldRegion: The global region where RiotAccount exists.

Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (RiotAccount?, String?). RiotAccount contains the SummonerPuuid and RiotId of the player found. Result will be nil only if player with SummonerPuuid was not found on this WorldRegion. The String parameter contains the first error description encountered if existing.

Usage example

league.riotAPI.getAccount(byPuuid: SummonerPuuid("Mopk9O_5xL3InZzRnXOMW0ay0FDpTcfKwjeWMLDLvVZhNa17JsrjXJt8jRfxq23R_Ct5RHLLh4-6dA"), on: .Europe) { (riotAccount, errorMsg) in
    if let riotAccount = riotAccount {
        print("Success!")
    } else {
        print("Request failed cause: \(errorMsg ?? "No error description")")
    }
}

Account(by RiotId)

Parameters

  • RiotId: A Player global identifier. It is composed of the name appearing in game as well as a tag
  • WorldRegion: The global region where RiotAccount exists.

Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (RiotAccount?, String?). RiotAccount contains the SummonerPuuid and RiotId of the player found. Result will be nil only if player with RiotId was not found on this WorldRegion. The String parameter contains the first error description encountered if existing.

Usage example

league.riotAPI.getAccount(byRiotId: RiotId(gameName: "Sc0ra", tagLine: "EUW"), on: .Europe) { (riotAccount, errorMsg) in
    if let riotAccount = riotAccount {
        print("Success!")
    } else {
        print("Request failed cause: \(errorMsg ?? "No error description")")
    }
}

AccountActiveShards

Parameters

  • SummonerPuuid: Represents the unique identifier of a summoner.
  • ShardGame: a Riot's game compatible with shard api
  • WorldRegion: The global region where RiotAccount exists.

Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (RiotAccountActiveShard?, String?). RiotAccountActiveShard contains the shard value. Result will be nil only if player with SummonerPuuid was not found on this WorldRegion, in the specified game. The String parameter contains the first error description encountered if existing.

Usage example

guard let shardGame = ShardGame(.LEGENDS_OF_RUNNETERRA) else { return }
league.riotAPI.getAccountActiveShards(puuid: SummonerPuuid("Mopk9O_5xL3InZzRnXOMW0ay0FDpTcfKwjeWMLDLvVZhNa17JsrjXJt8jRfxq23R_Ct5RHLLh4-6dA"), game: shardGame, on: .Europe) { (riotActiveShard, errorMsg) in
    if let riotActiveShard = riotActiveShard {
        print("Success!")
    } else {
        print("Request failed cause: \(errorMsg ?? "No error description")")
    }
}
Clone this wiki locally