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-rework

v0.0.2

Published

Riot Games API library

Downloads

12

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:

  • filter - object - (Optional) Filter the result to only get Champions who match the specific options.
    • The only current option is the option all which can be defined as true or false to define if you want the amount of champions or all champion data.

Result:

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

{ version: '9.2.1',
  id: 'Zyra',
  key: '143',
  name: 'Zyra',
  title: 'Rise of the Thorns',
  blurb:
   'Born in an ancient, sorcerous catastrophe, Zyra is the wrath of nature given form—an alluring hybrid of plant and human, kindling new life with every step. She views the many mortals of Valoran as little more than prey for her seeded progeny, and thinks...',
  info: { attack: 4, defense: 3, magic: 8, difficulty: 7 },
  image:
   { full: 'Zyra.png',
     sprite: 'champion4.png',
     group: 'champion',
     x: 96,
     y: 96,
     w: 48,
     h: 48 },
  tags: [ 'Mage', 'Support' ],
  partype: 'Mana',
  stats:
   { hp: 504,
     hpperlevel: 79,
     mp: 418,
     mpperlevel: 25,
     movespeed: 340,
     armor: 29,
     armorperlevel: 3,
     spellblock: 30,
     spellblockperlevel: 0.5,
     attackrange: 575,
     hpregen: 5.5,
     hpregenperlevel: 0.5,
     mpregen: 13,
     mpregenperlevel: 0.4,
     crit: 0,
     critperlevel: 0,
     attackdamage: 53.376,
     attackdamageperlevel: 3.2,
     attackspeedperlevel: 2.11,
     attackspeed: 0.625 }
}

Example:

api.getChampions({
    'filter': {
        'all': true
    }
}, function(data) {
    for(var champion in data){
        let champData = data[champion]
        console.log(champData);
    }
});

api.getLeagues(options, callback)

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

Options:

  • encryptedSummonerId - string - Encrytpted Summoner Id*.
  • summonerName - string - Summoner Name*.

*Either Encrypted Summoner ID or Name is required.

Result:

[ { leagueId: '239fc0d0-2353-11e8-b378-c81f66dbb56c',
    leagueName: 'Jax\'s Enforcers',
    queueType: 'RANKED_FLEX_SR',
    position: 'NONE',
    tier: 'GOLD',
    rank: 'IV',
    leaguePoints: 19,
    wins: 2,
    losses: 0,
    veteran: false,
    inactive: false,
    freshBlood: false,
    hotStreak: false,
    summonerId: 'OAR8pPNKHhDbkfcg_EMt1geroqvY5kaoPSg-1vbEouNIobA',
    summonerName: 'brTT' },
  { leagueId: '2b164390-01c3-11e8-b72a-c81f66dbb56c',
    leagueName: 'Riven\'s Hunters',
    queueType: 'RANKED_SOLO_5x5',
    position: 'NONE',
    tier: 'PLATINUM',
    rank: 'III',
    leaguePoints: 0,
    wins: 5,
    losses: 9,
    veteran: false,
    inactive: false,
    freshBlood: false,
    hotStreak: false,
    summonerId: 'OAR8pPNKHhDbkfcg_EMt1geroqvY5kaoPSg-1vbEouNIobA',
    summonerName: 'brTT' } ]

Example:

api.getLeagues({
    'region': 'NA',
    'encryptedSummonerId': 'OAR8pPNKHhDbkfcg_EMt1geroqvY5kaoPSg-1vbEouNIobA'
    //-OR-
    //'summonerName': 'brTT'
}, function(data) {
    console.log(data);
});

api.getMasteries(options, callback)

Get mastery pages for summoner.

Options:

  • encryptedSummonerId - string - Encrytpted Summoner Id*.
  • summonerName - string - Summoner Name*.

*Either Summoner ID or Name is required.

Result:

44

Example:

api.getMasteries({
    'region': 'NA',
    'summonerName': 'brTT'
    //-OR-
    // 'encryptedSummonerId': 'OAR8pPNKHhDbkfcg_EMt1geroqvY5kaoPSg-1vbEouNIobA'
}, function(data) {
    console.log(data);
    //process data
});

api.getSummoner(options, callback)

Get basic information about summoner.

Options:

  • summonerName - string - Summoner Name.
  • encryptedSummonerId - string - Encrytpted Summoner Id.
  • pUUID - string - Summoner PUUID.
  • encryptedAId - string - Encrypted Account ID.

One of the options is required

Result:

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

{ id: '0B3bFSvYS42z81iwWxb1ipSY0G04hoNep2fy3Gw5jM4',
  accountId: 'VHUqa9vgdPh1lm1t0R4tmq5wmU4U8P7Shmaxw9viKw',
  puuid:
   'hgZu-QeHsvqlN3VRmnjp19b8Rd8T8q3zkk7VkHJWgIQ420tm0y3KDvUB-7GEhLq9Y4DNTln0UvhKgw',
  name: 'TheOddOne',
  profileIconId: 3152,
  revisionDate: 1536048529000,
  summonerLevel: 33 }

Example:

api.getSummoner({
    'summonerName': 'TheOddOne'
}, function(data) {
    console.log(data);
    // process data
});