-
Notifications
You must be signed in to change notification settings - Fork 13
Summoners
Summoners are League of Legends players. Using Riot API will often require information such as SummonerId, AccountId or SummonerName.
Since Riot API v4 released in early december 2018, summoner identifiers such as AccountId, SummonerId and SummonerPuuid are encrypted using sender's API key. This means those values will be different each time you regenerate your key.
- Summoner(byName: String, on: Region)
- Summoner(by: AccountId, on: Region)
- Summoner(by: SummonerId, on: Region)
- Summoner(by: SummonerPuuid, on: Region)
- byName: Summoner's name, which is the same as in game name.
- Region: The region where Summoner is playing.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (Summoner?, String?)
. Summoner contains all information about a summoner, such as summonerId, summonerAccountId. Result will be nil only if summoner with byName name was not found on this Region. The String parameter contains the first error description encountered if existing.
league.lolAPI.getSummoner(byName: "Sc0ra", on: .EUW) { (summoner, errorMsg) in
if let summoner = summoner {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
Summoner (by AccountId)
- AccountId: Summoner's accountId (not summonerId!).
- Region: The region where Summoner is playing.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (Summoner?, String?)
. Summoner contains all information about a summoner, such as summonerId, summonerName. Result will be nil only if summoner with AccountId was not found on this Region. The String parameter contains the first error description encountered if existing.
league.lolAPI.getSummoner(by: AccountId("DLxCapBHUF7dip1I0o5rDxZqSfwRVUko17Am6pweQalE5Q"), on: .EUW) { (summoner, errorMsg) in
if let summoner = summoner {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
Summoner (by SummonerId)
- SummonerId: Represents the unique identifier of a summoner.
- Region: The region where Summoner is playing.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (Summoner?, String?)
. Summoner contains all information about a summoner, such as summonerName, summonerAccountId. Result will be nil only if summoner with SummonerId was not found on this Region. The String parameter contains the first error description encountered if existing.
league.lolAPI.getSummoner(by: SummonerId("xc8IRVLGV1Gb75sbz8JoLdRvIJ_yAKNsSG1RBQVtnGZqZV8"), on: .EUW) { (summoner, errorMsg) in
if let summoner = summoner {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
Summoner (by SummonerPuuid)
- SummonerPuuid: Represents the unique identifier of a summoner.
- Region: The region where Summoner is playing.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (Summoner?, String?)
. Summoner contains all information about a summoner, such as summonerName, summonerAccountId. Result will be nil only if summoner with SummonerId was not found on this Region. The String parameter contains the first error description encountered if existing.
league.lolAPI.getSummoner(by: SummonerPuuid("8O-V8DGHm3YimSunwz6I6lntBnJVpPexIso6so6DtgXBZMNPnuktCigiLS7AXniMmqJFUvoc3Zrrzw"), on: .EUW) { (summoner, errorMsg) in
if let summoner = summoner {
print("Success")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}