Skip to content

Summoners

Antoine CLOP edited this page Aug 1, 2020 · 5 revisions

Summoners

Summoners are League of Legends players. Using Riot API will often require information such as SummonerId, AccountId or SummonerName.

Identifiers

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.

Methods

Summoner (by Name)

Parameters

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

Usage example

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)

Parameters

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

Usage example

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)

Parameters

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

Usage example

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)

Parameters

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

Usage example

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