Skip to content
Antoine CLOP edited this page Aug 1, 2020 · 2 revisions

Items

Items are in game object that players can buy to increase their champion statistics or unlock new effects.

Methods

  • Items()
  • Item(by: ItemId)
  • item(byName: String)
  • items(byTag: String)

Items

Parameters

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.

Usage example

league.lolAPI.getItems() { (allItems, errorMsg) in
    if let allItems = allItems {
        print("Success!")
    }
    else {
        print("Request failed cause: \(errorMsg ?? "No error description")")
    }
}

Item (By ItemId)

Parameters

  • 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.

Usage example

league.lolAPI.getItem(by: ItemId(3153)) { (item, errorMsg) in
    if let item = item {
        print("Success!")
    }
    else {
        print("Request failed cause: \(errorMsg ?? "No error description")")
    }
}

Item (By Name)

Parameters

  • 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.

Usage example

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")")
    }
}

Items (By Tag)

Parameters

  • 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.

Usage example

league.lolAPI.getItems(byTag: "LifeSteal") { (itemsWithTag, errorMsg) in
    if let itemsWithTag = itemsWithTag {
        print("Success!")
    }
    else {
        print("Request failed cause: \(errorMsg ?? "No error description")")
    }
}
Clone this wiki locally