-
Notifications
You must be signed in to change notification settings - Fork 13
Items
Items are in game object that players can buy to increase their champion statistics or unlock new effects.
- Items()
- Item(by: ItemId)
- item(byName: String)
- items(byTag: String)
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: ([Item]?, String?)
. Item array contains all informations related to items of the game as well as an unique identifier and will be nil only if an error occured. The String parameter contains the first error description encountered if existing.
league.lolAPI.getItems() { (allItems, errorMsg) in
if let allItems = allItems {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
Item (By ItemId)
- ItemId: Represents the unique identifier of an item. See Items above to get this identifier. Note that an item with id = 0 is reserved for no item. Thus, requesting item with ItemId=0 will return nil with no errors as it is a valid ItemId.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (Item?, String?)
. Item contains all informations related to the item with unique identifier matching parameter and will be nil only if item with parameter identifier does not exist. The String parameter contains the first error description encountered if existing.
league.lolAPI.getItem(by: ItemId(3153)) { (item, errorMsg) in
if let item = item {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- byName: The name of an item.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (Item?, String?)
. Item contains all informations related to the item with name matching parameter and will be nil only if item with name byName does not exist. The String parameter contains the first error description encountered if existing.
league.lolAPI.getItem(byName: "Blade Of The Ruined King") { (item, errorMsg) in
if let item = item {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- byTag: Any tag that could designate an item.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: ([Item]?, String?)
. Item array contains all informations related to items of the game that have byTag in their tag list, as well as an unique identifier and will be nil only if an error occured. The String parameter contains the first error description encountered if existing.
league.lolAPI.getItems(byTag: "LifeSteal") { (itemsWithTag, errorMsg) in
if let itemsWithTag = itemsWithTag {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}