viktor v0.1.1 Viktor

Primary interface to the League of Legends API. For convenience’s sake, endpoint methods may be called directly from this module. In some cases, the method names aren’t 1:1 (e.g. Viktor.ranked_stats delegates to Viktor.Operation.Stats.ranked), so be sure to read the documentation.

Examples

Viktor.start_link
current_game = Viktor.current_game("na", 21066)
current_game_without_delegate = Viktor.Operation.CurrentGame.current_game("na", 21066)

Summary

Functions

API Key

Get challenger tier leagues

Retrieve champion by ID

Gets all champion masteries for a summoner

Gets all champion masteries for a summoner

Retrieve all champions

Retrieve all champions or free champions if free_to_play is true

Get current game information for the given summoner ID

Get list of featured_games

Get league entries mapped by summoner ID for a given list of summoner IDs

Get leagues mapped by summoner ID for a given list of summoner IDs

Get master tier leagues

Get a player’s total champion mastery score, which is sum of individual champion mastery levels

Retrieve match by match ID

Retrieve match by match ID. Includes timeline if flag set to true

Retrieve match list by summoner ID

Retrieve match list by summoner ID and filter params as keywords. Available filters

Get ranked stats by summoner ID for current season

Get ranked stats by summoner ID and season

Get recent games by summoner ID

Initialize with API Key set in RIOT_API_KEY environment variable

Initialize with API Key if it wasn’t set in config or environment variable

Retrieves champion list with default keys and values

Retrieves champion list using optional keywords to modify result

See Viktor.Operation.StaticData.champion_by_id/3

Get player stats summaries by summoner ID for current season

Get player stats summaries by summoner ID and season

Get league entries mapped by team ID for a given list of team IDs

Get leagues mapped by team ID for a given list of team IDs

See Viktor.Operation.ChampionMastery.topchampions/2

Get specified number of top champion mastery entries sorted by number of champion points descending

Retrieve match by match ID and tournament code

Retrieve match by match ID and tournament code with timeline data if include_timeline is true

Retrieve match IDs by tournament code

Functions

api_key()

API Key

Examples

Viktor.api_key
challenger_league(region, type)

Get challenger tier leagues.

Examples

challenger_league = Viktor.challenger_league("na", "RANKED_SOLO_5x5")
champion(region, id)

Retrieve champion by ID.

Examples

champion = Viktor.champion("na", 1)
champion_masteries(region, summoner_id)

Gets all champion masteries for a summoner.

Examples

masteries = Viktor.champion_masteries("na", 21066)
champion_mastery(region, summoner_id, champion_id)

Gets all champion masteries for a summoner.

Examples

mastery = Viktor.champion_mastery("na", 21066, 1)
champions(region)

Retrieve all champions.

Examples

All Champions

all_champions = Viktor.champions("na")
%{"champions" => [%{"active" => true, "botEnabled" => false,
     "botMmEnabled" => false, "freeToPlay" => false, "id" => 266,
     "rankedPlayEnabled" => true},
   %{"active" => true, "botEnabled" => false, "botMmEnabled" => true,
     "freeToPlay" => false, "id" => 103, "rankedPlayEnabled" => true},
   %{"active" => true, "botEnabled" => false, "botMmEnabled" => true,
     "freeToPlay" => false, "id" => 84, "rankedPlayEnabled" => true}]
     }%
champions(region, free_to_play)

Retrieve all champions or free champions if free_to_play is true.

Examples

All Champions

free_champions = Viktor.champion("na", true)
current_game(region, summoner_id)

Get current game information for the given summoner ID.

Examples

current_game = Viktor.current_game("na", 21066)
league_entries(region, summoner_ids)

Get league entries mapped by summoner ID for a given list of summoner IDs.

Examples

league_entries = Viktor.league_entries("na", "21066")
leagues(region, summoner_ids)

Get leagues mapped by summoner ID for a given list of summoner IDs.

Examples

leagues = Viktor.leagues("na", "21066")
master_league(region, type)

Get master tier leagues.

Examples

master_league = Viktor.master_league("na", "RANKED_SOLO_5x5")
mastery_score(region, summoner_id)

Get a player’s total champion mastery score, which is sum of individual champion mastery levels.

Examples

mastery_score = Viktor.mastery_score("na", 21066)
match(region, match_id)

Retrieve match by match ID.

Examples

match = Viktor.match("na", 2077473238)
match(region, match_id, include_timeline)

Retrieve match by match ID. Includes timeline if flag set to true.

Examples

match = Viktor.match("na", 2077473238, true)
match_list(region, summoner_id)

Retrieve match list by summoner ID.

Examples

match_list = Viktor.match_list("na", 21066)
match_list(region, summoner_id, params)

Retrieve match list by summoner ID and filter params as keywords. Available filters:

  • championIds - Comma-separated list of champion IDs to use for fetching games.
  • rankedQueues - Comma-separated list of ranked queue types to use for fetching games. Non-ranked queue types will be ignored.

    • TEAM_BUILDER_DRAFT_RANKED_5x5,RANKED_SOLO_5x5,RANKED_TEAM_3x3,RANKED_TEAM_5x5
  • seasons - Comma-separated list of seasons to use for fetching games.

    • PRESEASON3,SEASON3,PRESEASON2014,SEASON2014,PRESEASON2015,SEASON2015,PRESEASON2016,SEASON2016
  • beginTime - The begin time to use for fetching games specified as epoch milliseconds.
  • endTime - The end time to use for fetching games specified as epoch milliseconds.
  • beginIndex - The begin index to use for fetching games.
  • endIndex - The end index to use for fetching games.

Per Riot: It is up to the caller to ensure that the combination of filter parameters provided is valid for the requested summoner, otherwise, no matches may be returned. If either of the beginTime or endTime parameters is set, they must both be set, although there is no maximum limit on their range. If the beginTime parameter is specified on its own, endTime is assumed to be the current time. If the endTime parameter is specified on its own, beginTime is assumed to be the start of the summoner’s match history.

Examples

some_seasons = Viktor.match_list("na", 21066, [seasons: "SEASON2014,SEASON2015,SEASON2016" ])
some_ranked_queues = Viktor.match_list("na", 21066, [rankedQueues: "RANKED_SOLO_5x5,TEAM_BUILDER_DRAFT_RANKED_5x5" ])
combo = Viktor.match_list("na", 21066, [championIds: "7", seasons: "PRESEASON2015", beginIndex: 0, endIndex: 5])
ranked_stats(region, summoner_id)

Get ranked stats by summoner ID for current season.

Examples

ranked = Viktor.ranked_stats("na", 21066)
ranked_stats(region, summoner_id, season)

Get ranked stats by summoner ID and season.

Examples

season_3 = Viktor.ranked_stats("na", 21066, "SEASON3")
season_4 = Viktor.ranked_stats("na", 21066, "SEASON2014")
season_5 = Viktor.ranked_stats("na", 21066, "SEASON2015")
season_6 = Viktor.ranked_stats("na", 21066, "SEASON2016")
recent_games(region, summoner_id)

Get recent games by summoner ID.

Examples

recent_games = Viktor.recent_games("na", 21066)
start_link()

Initialize with API Key set in RIOT_API_KEY environment variable.

Examples

Viktor.start_link("api_key_from_rito")
start_link(api_key)

Initialize with API Key if it wasn’t set in config or environment variable.

Examples

Viktor.start_link("api_key_from_rito")
static_data_champion(region)

Retrieves champion list with default keys and values.

Examples

champions = Viktor.static_data_champions("na")
static_data_champion(region, params)

Retrieves champion list using optional keywords to modify result:

  • locale Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
  • version Data dragon version for returned data. If not specified, the latest version for the region is used. List of valid versions can be obtained from the /versions endpoint.
  • dataById If specified as true, the returned data map will use the champions’ IDs as the keys. If not specified or specified as false, the returned data map will use the champions’ keys instead.
  • champData Tags to return additional data. Only type, version, data, id, key, name, and title are returned by default if this parameter isn’t specified. To return all additional data, use the tag ‘all’.

    • all,allytips,altimages,blurb,enemytips,image,info,lore,partype,passive,recommended,skins,spells,stats,tags

Examples

champions = Viktor.static_data_champions("na")
static_data_champion_by_id(region, id, params)

See Viktor.Operation.StaticData.champion_by_id/3.

summary_stats(region, summoner_id)

Get player stats summaries by summoner ID for current season.

Examples

summary = Viktor.summary_stats("na", 21066)
summary_stats(region, summoner_id, season)

Get player stats summaries by summoner ID and season.

Examples

season_3 = Viktor.summary_stats("na", 21066, "SEASON3")
season_4 = Viktor.summary_stats("na", 21066, "SEASON2014")
season_5 = Viktor.summary_stats("na", 21066, "SEASON2015")
season_6 = Viktor.summary_stats("na", 21066, "SEASON2016")
team_league_entries(region, team_ids)

Get league entries mapped by team ID for a given list of team IDs.

Examples

team_league_entries = Viktor.team_league_entries("na", "TEAM-fa073ee0-51ca-11e4-82cc-782bcb4d0bb2")
team_leagues(region, team_ids)

Get leagues mapped by team ID for a given list of team IDs.

Examples

team_leagues = Viktor.team_leagues("na", "TEAM-fa073ee0-51ca-11e4-82cc-782bcb4d0bb2")
top_champion_masteries(region, summoner_id)

See Viktor.Operation.ChampionMastery.topchampions/2.

top_champion_masteries(region, summoner_id, count)

Get specified number of top champion mastery entries sorted by number of champion points descending.

Examples

default_is_3 = Viktor.top_champion_masteries("na", 21066)
top_10 = Viktor.top_champion_masteries("na", 21066, 10)
tournament_match(region, match_id, tournament_code)

Retrieve match by match ID and tournament code.

Examples

tournament_match = Viktor.tournament_match_ids("na", 1234, "some_tourney_code")
tournament_match(region, match_id, tournament_code, include_timeline)

Retrieve match by match ID and tournament code with timeline data if include_timeline is true.

Examples

tournament_match = Viktor.tournament_match_ids("na", 1234, "some_tourney_code", true)
tournament_match_ids(region, tournament_code)

Retrieve match IDs by tournament code.

Examples

tournament_match_ids = Viktor.tournament_match_ids("na", "some_tourney_code")