-
Notifications
You must be signed in to change notification settings - Fork 13
Champions (Detailed)
This page is archived
The documentation for this methods have moved to Champions in version 3.0.0
If LeagueAPI version is <3.0.0, stay on this page
Champion methods exist in RiotAPI but only contain dynamic variables (isEnabled, isFree...). Champions in custom methods provide champion properties that are constant during a patch time. Those methods can search a champion from a name, which can be usefull to get champion's unique identifier (ChampionId)
- ChampionDetails(byName: String)
- ChampionDetails(by: ChampionId)
- AllChampionIds()
- AllChampionNames()
- ChampionNames(for: ChampionRole)
- byName: The name of the champion. Champions are defined by 3 characteristics: id, name and championIdName. id is a unique ChampionId which is required in all other champion requests. This request attempts to match byName parameter with name or championIdName. name is the name players can see in champion select. championIdName can be equal to name in many cases but does not contain special characters (Kha'Zix has KhaZix as championIdName)
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (ChampionDetails?, String?)
. ChampionDetails contains identification data as well as skins (with images), statistics and lore texts. Result will be nil only if parameter byName didn't match any name or championIdName. The String parameter contains the first error description encountered if existing.
league.getChampionDetails(byName: "Ahri") { (champion, errorMsg) in
if let champion = champion {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- ChampionId: Represents the unique identifier of a champion. See section ChampionDetails(byName) to get this identifier.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (ChampionDetails?, String?)
. ChampionDetails contains identification data as well as skins (with images), statistics and lore texts. Result will be nil only if parameter ChampionId didn't match any champion identifier. The String parameter contains the first error description encountered if existing.
league.getChampionDetails(by: ChampionId(103)) { (champion, errorMsg) in
if let champion = champion {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: ([ChampionId]?, String?)
. ChampionId array contains the unique identifier for all champions and will be nil only if an error occured. The String parameter contains the first error description encountered if existing.
league.getAllChampionIds() { (championIds, errorMsg) in
if let championIds = championIds {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: ([String]?, String?)
. String array contains the name of champions and will be nil only if an error occured. The String parameter contains the first error description encountered if existing.
league.getAllChampionNames() { (championNames, errorMsg) in
if let championNames = championNames {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- ChampionRole: Champions have 2 roles affected. Roles define their playstyle (Assassin, Fighter, Mage...).
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: ([String]?, String?)
. String array contains the name of champions who have byRole as role and will be nil only if an error occured. The String parameter contains the first error description encountered if existing.
guard let championRole = ChampionRole(.Assassin) else { return }
league.getChampionNames(for: championRole) { (championNames, errorMsg) in
if let championNames = championNames {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}