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

riot-api

v0.1.0

Published

Riot Games API library

Downloads

2

Readme

RiotAPI

A node.js library for fetching League of Legends data from the Riot API.

Riot's API requires a API Key. More information about how to get a Key, Rate Limits and more can be found on their official Site.

Game constants like queue types, maps, game types, game modes and rune slots are explained here.

Getting started

RiotAPI is designed to be simple.

var RiotApi = require('riot-api');
var api = new RiotApi('YOUR_API_KEY_GOES_HERE');

Each Method takes an options object and a callback. The callback is always a json object, either a set of results or a status message if the call was invalid.

Methods

api.getChampions(options, callback)

Retrieve all champions currently in the game.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE.
  • filter - object - (Optional) Filter the result to only get Champions who match the specific options.
  • active - boolean - Indicates if the champion is active.
  • rankedPlayEnabled - boolean - Ranked play enabled flag.
  • botEnabled - boolean - Bot enabled flag (for custom games).
  • botMmEnabled - boolean - Bot Match Made enabled flag (for Co-op vs. AI games).
  • freeToPlay - boolean - Indicates if the champion is free to play. Free to play champions are rotated periodically.
  • attackRank - int - Champion attack rank.
  • defenseRank - int - Champion defense rank.
  • difficultyRank - int - Champion difficulty rank.
  • magicRank - int - Champion magic rank.
  • id - int - Champion ID.
  • name - string - Champion name.

Result:

The Result is a array of objects containing information about the champion. An object might look like this:

{
    "botMmEnabled": false,
    "defenseRank": 4,
    "attackRank": 8,
    "id": 266,
    "rankedPlayEnabled": true,
    "name": "Aatrox",
    "botEnabled": false,
    "difficultyRank": 6,
    "active": true,
    "freeToPlay": false,
    "magicRank": 3
}

Example:

api.getChampions({
    'region': 'NA',
    'filter': {
        'freeToPlay': true
    }
}, function(data) {
    console.log('These champions are currently free to play:');
    data.forEach(function(champion) {
        console.log('Name: ' + champion.name + ', Difficulty: ' + champion.difficultyRank);
    });
});

api.getRecentGames(options, callback)

Get the recent games for summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is a object with informations about the recent games of the given summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getChampions({
    'region': 'NA',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getLeagues(options, callback)

Retrieves leagues data for summoner, including leagues for all of summoner's teams.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE, BR, TR.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.
  • queue - string - (Optional) Only recive data for the given queue type. Legal values are: RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the leagues for the given summoner. The object is the exact same object given by the default API call (except if you only want to recieve a specific queue type), which can be tested here.

Example:

api.getLeagues({
    'region': 'NA',
    'queue': 'RANKED_SOLO_5x5',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getStatsSummary(options, callback)

Get player stats summaries for summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.
  • season - int - (Optional) If specified, stats for the given season are returned. Otherwise, stats for the current season are returned.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the stats of summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getStatsSummary({
    'region': 'NA',
    'season': 3,
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getRankedStats(options, callback)

Get ranked stats for summoner. Includes statistics for Twisted Treeline and Summoner's Rift

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.
  • season - int - (Optional) If specified, stats for the given season are returned. Otherwise, stats for the current season are returned.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the ranked stats of summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getRankedStats({
    'region': 'NA',
    'season': 3,
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getMasteries(options, callback)

Get mastery pages for summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the mastery pages of summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getMasteries({
    'region': 'NA',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getRunes(options, callback)

Get rune pages for summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the rune pages of summoner. The object is the exact same object given by the default API call, which can be tested here.

The runeSlotId fields are explained here.

Example:

api.getRunes({
    'region': 'NA',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getSummonerNamesByIds(options, callback)

Get list of summoner names by summoner IDs.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerIds - array[int] - Summoner ID's.

Result:

The Result is an array with objects containing name and id of a summoner.

[
    {
        "id": 60783,
        "name": "TheOddOne"
    },
    {
        "id": 5908,
        "name": "Dyrus"
    }
]

Example:

api.getRunes({
    'region': 'NA',
    'summonerIds': [60783, 5908]
}, function(data) {
    //process data
});

api.getSummoner(options, callback)

Get basic information about summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is an object containing basic information of a summoner.

{
    "id": 60783,
    "name": "TheOddOne",
    "profileIconId": 558,
    "summonerLevel": 30,
    "revisionDate": 1386684611000,
    "revisionDateStr": "12/10/2013 02:10 PM UTC"
}

Example:

api.getSummoner({
    'region': 'NA',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});

api.getTeams(options, callback)

Retrieves teams of summoner.

Options:

  • region - string - Region where to retrieve the data. If no region is given, NA will be used. Currently available regions are: NA, EUW, EUNE, TR, BR.
  • summonerId - int - Summoner ID*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

The Result is a object with data about the teams of summoner. The object is the exact same object given by the default API call, which can be tested here.

Example:

api.getTeams({
    'region': 'NA',
    'summonerName': 'TheOddOne'
    //-OR-
    //'summonerId': 60783
}, function(data) {
    //process data
});