-
Notifications
You must be signed in to change notification settings - Fork 13
Match History
Match history contains methods to get finished games. Those games contain a lot of statistics for each player.
- MatchList(by: AccountId, on: Region, beginTime: Datetime? = nil, endTime: Datetime? = nil, beginIndex: Int? = nil, endIndex: Int? = nil, championId: ChampionId? = nil, queue: QueueMode? = nil, season: Season? = nil)
- MatchIds(by: TournamentCode, on: Region)
- Match(by: GameId, and: TournamentCode, on: Region)
- Match(by: GameId, on: Region)
- MatchTimeline(by: GameId, on: Region)
- AccountId: Represents the unique identifier of a summoner's account (not summonerId!). See Summoners to get this identifier.
- Region: The region where the summoner plays.
- beginTime: Optional parameter specifying the earliest start time for a match in results. If this value is lower than endTime, then it will result in Bad Request from Riot API with no result. If not specified, it will be considered as current time.
- endTime: Optional parameter specifying the latest start time for a match in results. If specified but beginTime was not, it will be ignored. If this value is greater than beginTime, then it will result in Bad Request from Riot API with no result. If not specified, it will be considered as old enough to contain the first ever played game time.
- beginIndex: Optional parameter specifying the lowest index of the match. Indexing start at 0 which is the index of the latest match. If this value is greater than endIndex, then it will result in Bad Request from Riot API with no result. If not specified, it will be considered equal to 0.
- endIndex: Optional parameter specifying the greatest index of the match. If this value is lower than beginIndex or is greater than beginIndex+100, then it will result in Bad Request from Riot API with no result. If not specified it will be considered as beginIndex+100
- ChampionId: Optional parameter filtering results where summoner (designated by accountId) played the champion with corresponding identifier. If not specified, all champions are valid results.
- QueueMode: Optional parameter filtering results by queue mode. If not specified, all queue modes are valid results. To create a QueueMode object, you'll be asked for an enum parameter containing .Unknown. Do not use this value or nil will be returned by initializer. This value is present only for internal usage and keeping compatibility with future Riot API queue values.
- Season: Optional parameter filtering results by season. If not specified, all seasons are valid results. To create a Season object, you'll be asked for an enum parameter containing .Unknown. Do not use this value or nil will be returned by initializer. This value is present only for internal usage and keeping compatibility with future Riot API queue values.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (MatchList?, String?)
. MatchList contains a list of match identification information. It may be nil if a parameter rule was broken, if a champion with identifier ChampionId was not found or if summoner with AccountId on Region was not found. The String parameter contains the first error description encountered if existing.
guard let queueMode = QueueMode(.DefinitelyNotDominion) else { return }
guard let season = Season(.Season8) else { return }
league.riotAPI.getMatchList(by: AccountId("DLxCapBHUF7dip1I0o5rDxZqSfwRVUko17Am6pweQalE5Q"), on: .EUW, beginTime: Datetime(), endTime: Datetime().datetimeByAdding(month: 1), beginIndex: 0, endIndex: 100, championId: ChampionId (103), queue: queueMode, season: season) { (matchList, errorMsg) in
if let matchList = matchList {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- TournamentCode: A tournament code. See Tournaments to get this code.
- Region: The region where the tournament took place.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: ([GameId]?, String?)
. GameId array contains a list of game identifier. It may be nil if TournamentCode was not found on this Region. The String parameter contains the first error description encountered if existing.
league.riotAPI.getMatchIds(by: TournamentCode("Tournament Code"), on: .EUW) { (gameIds, errorMsg) in
if let gameIds = gameIds {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- GameId: Represents the unique identifier of a game. To get this identifier, you must call MatchIds method first.
- TournamentCode: A tournament code. See Tournaments to get this code.
- Region: The region where the game took place.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (Match?, String?)
. Match contains a lot of statistics on the game. It may be nil if TournamentCode was not found on this Region or if GameId does not exists. The String parameter contains the first error description encountered if existing.
league.riotAPI.getMatch(by: GameId(43), and: TournamentCode("Tournament Code"), on: .EUW) { (game, errorMsg) in
if let game = game {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- GameId: Represents the unique identifier of a game. To get this identifier, you must call MatchList method first.
- Region: The region where the game took place.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (Match?, String?)
. Match contains a lot of statistics on the game. It may be nil if GameId was not found on this Region. The String parameter contains the first error description encountered if existing.
league.riotAPI.getMatch(by: GameId(43), on: .EUW) { (game, errorMsg) in
if let game = game {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}
- GameId: Represents the unique identifier of a game. To get this identifier, you must call MatchList method first.
- Region: The region where the game took place.
Since this method is asynchrone, there is not return value. Response will be provided with a handler closure with parameters: (MatchTimeline?, String?)
. MatchTimeline contains records of game events with time when it happened. It may be nil if GameId was not found on this Region. The String parameter contains the first error description encountered if existing.
league.riotAPI.getMatchTimeline(by: GameId(43), on: .EUW) { (gameTimeline, errorMsg) in
if let gameTimeline = gameTimeline {
print("Success!")
}
else {
print("Request failed cause: \(errorMsg ?? "No error description")")
}
}