npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lol-riot-api-module

v3.0.3

Published

A wrapper for League of Legends' official API

Downloads

9

Readme

lol-riot-api

A wrapper module for League of Legends' official API. In the documentation below there will be references to the official methods used for each method.

All methods can be either used with a callback method or as a promise

Download

lol-riot-api is installable via:

  • GitHub git clone https://github.com/Pupix/lol-riot-api-module.git
  • npm: npm install lol-riot-api-module

Quick example

const API = require('lol-riot-api-module');
const api = new API({
        key: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
        region: 'euw'
    });

Using callbacks


    const options = { name: 'Pupix' };

    api.getSummoner(options, (err, data) => {
        console.log(data);
    });
    //=> {
             "id": 20920441,
             "name": "Pupix",
             "profileIconId": 580,
             "summonerLevel": 30,
             "revisionDate": 1431200284000
         }

Using promises


    const options = { name: 'Pupix' };

    api.getSummoner(options).then(data => {
        console.log(data);
    });
    //=> {
             "id": 20920441,
             "name": 'Pupix',
             "profileIconId": 580,
             "summonerLevel": 30,
             "revisionDate": 1431200284000
         }

Getting started

The API constructor accepts an object with the default key and region to be used for the API calls. You can get a key from Riot Games' developer portal.

If no region is passed, the API will default to na (North America).

The possible regions are the following:

  • br (Brazil)
  • eune (Europe North-East)
  • euw (Europe West)
  • jp (Japan)
  • kr (Korean)
  • lan (Latin America North)
  • las (Latin America South)
  • na (North America)
  • oce (Oceania)
  • ru (Russia)
  • tr (Turkish)
  • pbe (Public Beta Environment)

Documentation

Whenever possible, if a configuration object (referred as options in the documentation) is not required the callback can be passed directly as first parameter to all methods.

Methods

Account

Champions

Featured games

Leagues

Matches

Static data

Status

Summoner


getAccountMatchlist(options, callback)

Get matchlist for ranked games played on given account ID and platform ID and filtered using given filter parameters, if any.

Parameters

  1. options {Object}
  • options.accountId {number | string} The account ID.
  • [options.beginIndex] {number | string} The begin index to use for filtering matchlist.
  • [options.beginTime] {number | string} The begin time to use for filtering matchlist specified as epoch milliseconds.
  • [options.champion] {Array | number | string} Set of champion IDs for which to filtering matchlist.
  • [options.endIndex] {number | string} The end index to use for filtering matchlist.
  • [options.endTime] {number | string} The end time to use for filtering matchlist specified as epoch milliseconds.
  • [options.season] {Array | number | string} Set of season IDs for which to filtering matchlist.
  • [options.queue] {Array | number | string} Set of queue IDs for which to filtering matchlist.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getAccountRecentMatchlist(options, callback)

Get matchlist for last 20 matches played on given account ID.

Parameters

  1. options {Object}
  • options.accountId {number | string} The account ID.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getChampionsStatus(options, callback)

Gets the status of champions.

Parameters

  1. options {Object}
  • [options.id] {boolean} Optional parameter to retrieve only a specific champion.
  • [options.freeToPlay] {boolean} Optional filter to retrieve only free to play champions.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getFeaturedGames(options, callback)

Get list of featured games.

Parameters

  1. options {Object}
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getChallengerLeague(options, callback)

Get the challenger league for a given queue.

Parameters

  1. options {Object}
  • [options.queue = "RANKED_SOLO_5x5"] {string} Game queue type.
    • Possible values: "RANKED_SOLO_5x5" | "RANKED_FLEX_SR" | "RANKED_FLEX_TT"
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getMasterLeague(options, callback)

Get the master league for a given queue.

Parameters

  1. options {Object}
  • [options.queue = "RANKED_SOLO_5x5"] {string} Game queue type.
    • Possible values: "RANKED_SOLO_5x5" | "RANKED_FLEX_SR" | "RANKED_FLEX_TT"
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getMatch(options, callback)

Get match by match ID.

Parameters

  1. options {Object}
  • options.id {number | string} The match ID.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getMatchTimeline(options, callback)

Get match by match ID.

Parameters

  1. options {Object}
  • options.matchId {number | string} The match ID.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getChampionsStaticData(options, callback)

Gets static data of champions.

Parameters

  1. [options] {Object}
    • [options.id] {number | string} Champion ID to retrieve.
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.dataById] {boolean} If specified, the returned data map will use the champions' Id as the keys. If not specified or specified as false, the returned data map will use the champions' keys instead.
    • [options.champData] {Array | string} Tags to return additional data. Only id, key, name, and title are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
      • Possible values: "all" | "allytips" | "altimages" | "blurb" | "enemytips" | "image" | "info" | "lore" | "partype" | "passive" | "recommended" | "skins" | "spells" | "stats" | "tags"
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getItemsStaticData(options, callback)

Gets static data of items.

Parameters

  1. [options] {Object}
    • [options.id] {number | string} Item ID to retrieve.
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.itemData] {Array | string} Tags to return additional data. Only id, name, plaintext, group, and description are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
      • Possible values: "all" | "colloq" | "consumeOnFull" | "consumed" | "depth" | "effect" | "from" | "gold" | "hideFromAll" | "image" | "inStore" | "into" | "maps" | "requiredChampion" | "sanitizedDescription" | "specialRecipe" | "stacks" | "stats" | "tags"
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getLanguageStringsStaticData(options, callback)

Gets static data of items.

Parameters

  1. [options] {Object}
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getLanguagesStaticData(options, callback)

Gets the list of languages.

Parameters

  1. [options] {Object}
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getMapsStaticData(options, callback)

Gets the list of maps.

Parameters

  1. [options] {Object}
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getMasteriesStaticData(options, callback)

Gets static data of masteries.

Parameters

  1. [options] {Object}
    • [options.id] {number | string} Mastery ID to retrieve.
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.masteryData] {Array | string} Tags to return additional data. Only id, name, and description are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
      • Possible values: "all" | "image" | "masteryTree" | "prereq" | "ranks" | "sanitizeDescription"
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getProfileIconsStaticData(options, callback)

Gets the list of profile icons.

Parameters

  1. [options] {Object}
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getRealmsStaticData(options, callback)

Gets the list of realms.

Parameters

  1. [options] {Object}
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getRunesStaticData(options, callback)

Gets static data of ruunes.

Parameters

  1. [options] {Object}
    • [options.id] {number | string} Mastery ID to retrieve.
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.runeData] {Array | string} Tags to return additional data. Only id, name, rune, and description are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
      • Possible values: "all" | "colloq" | "consumeOnFull" | "consumed" | "depth" | "from" | "gold" | "hideFromAll" | "image" | "inStore" | "into" | "maps" | "requiredChampion" | "sanitizedDescription" | "specialRecipe" | "stacks" | "stats" | "tags"
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummonerSpellsStaticData(options, callback)

Gets static data of champions.

Parameters

  1. [options] {Object}
    • [options.id] {number | string} SummonerSpell ID to retrieve.
    • [options.locale] {string} Locale code for returned data (e.g., en_US, es_ES). If not specified, the default locale for the region is used.
    • [options.version] {string} 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.
    • [options.dataById] {boolean} If specified, the returned data map will use the champions' Id as the keys. If not specified or specified as false, the returned data map will use the champions' keys instead.
    • [options.spellData] {Array | string} Tags to return additional data. Only type, version, data, id, key, name, description, and summonerLevel are returned by default if this parameter isn't specified. To return all additional data, use the tag 'all'.
      • Possible values: "all" | "cooldown" | "cooldownBurn" | "cost" | "costBurn" | "costType" | "effect" | "effectBurn" | "image" | "key" | "leveltip" | "maxrank" | "modes" | "range" | "rangeBurn" | "resource" | "sanitizedDescription" | "sanitizedTooltip" | "tooltip" | "vars"
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getVersionsStaticData(options, callback)

Gets the list of realms.

Parameters

  1. [options] {Object}
    • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
    • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  2. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getStatus(options, callback)

Get League of Legends status.

Parameters

  1. options {Object}
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummoner(options, callback)

Gets summoner based on id, accountId or name.

Parameters

  1. options {Object}
  • [options.id] {number | string} The ID of the summoner.
  • [options.summonerId] {number | string} The ID of the summoner.
  • [options.accountId] {number | string} The account ID of the summoner.
  • [options.name] {string} The name of the summoner.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummonerActiveGame(options, callback)

Get current game information for the given summoner ID.

Parameters

  1. options {Object}
  • options.summonerId {number | string} The ID of the summoner.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummonerChampionMastery(options, callback)

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

Parameters

  1. options {Object}
  • options.summonerId {number | string} Summoner ID associated with the player.
  • [options.championId] {number | string} Champion ID to retrieve Champion Mastery for.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummonerChampionMasteryScore(options, callback)

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

Parameters

  1. options {Object}
  • options.summonerId {number | string} Summoner ID associated with the player.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummonerLeagues(options, callback)

Get leagues in all queues for a given summoner ID.

Parameters

  1. options {Object}
  • options.summonerId {number | string} Summoner ID associated with the player.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummonerLeaguePositions(options, callback)

Get league positions in all queues for a given summoner ID.

Parameters

  1. options {Object}
  • options.summonerId {number | string} Summoner ID associated with the player.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummonerMasteries(options, callback)

Get mastery pages for a given summoner ID.

Parameters

  1. options {Object}
  • options.summonerId {number | string} Summoner ID associated with the player.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.

getSummonerRunes(options, callback)

Get rune pages for a given summoner ID.

Parameters

  1. options {Object}
  • options.summonerId {number | string} Summoner ID associated with the player.
  • [options.region] {string} Optional region to be used instead of the API's region to retrieve data.
  • [options.apiKey] {string} Optional key to be used instead of the API's key to retrieve data.
  1. [callback] {Function} Optional function to be called after the server's response is received, with (error, data) as parameters.