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-api-client

v0.3.2

Published

A Node client for interfacing with the League of Legends API

Downloads

4

Readme

lol-api-client Build Status

This is a (work in progess) Node module for interfacing with Riot's developer API

View this project on Github or npm.

Installation

Simply run npm install lol-api-client --save to install the client as a dependency for your project.

Usage

Require the client

const Client = require('lol-api-client')

Instantiate the client. The constructor expects an apiKey, a region, and a platformId. A Riot API key can be acquired here. Riot's list of valid regions provides the supported list of abbreviated region names. If you're not sure what region you should be using, the global region will work for most endpoints - though it's up to Riot whether or not that's fully supported. The platformId argument is one used in Riot's newer routes such as the Champion Mastery routes. Platforms for each region are indirectly documented at the bottom of this page on Riot's developer portal.

const client = new Client('your-api-key', 'na', 'NA1')

All request methods return a Promise. If you typically work with callbacks, or are otherwise new to promises, check out MDN's docs to get a basic understanding of using promises for async code.

client.champions.getAll()
    .then(championData => {
        const champions = championData.champions
        console.log(champions)
    })
    .catch(error => {
        console.error(error)
    })

API

Champions

getAll

Riot endpoint: /champion

Get all existing champions

getById (id)

Riot endpoint: /champion/{id}

Get a single champion by its champion id

getAllStaticData

Riot endpoint: /static-data/{region}/{version}/champion

Get all static champion data. Lore, title, images, etc.

getStaticDataById (id)

Riot endpoint: /static-data/{region}/{version}/champion/{id}

Get static data for a single champion by champion id

Matches

getById (id)

Riot endpoint: matches/{matchId}

Get a single match object by id

getMatchListBySummonerId (id)

Riot endpoint: /matchlist/by-summoner/{summonerId}

Get a list of recent matches for the provided summoner id.

Summoners

getByName (name) or ([names])

Riot endpoint: summoners/by-name/{summonerNames}

Get a list of summoner objects from a provided array of names or a single summoner object from a provided summoner name.

getById (id) or ([ids])

Riot endpoint summoners/{summonerIds}

Get a list of summoner objects from a provided array of ids or a single summoner object from a provided summoner id.

getMasteryPagesById (id) or ([ids])

Riot endpoint summoners/{summonerIds}/masteries

Get a set of mastery pages objects for the provided or summoner or multiple sets of mastery pages for a provided array of summoner ids.

getRunePagesById (id) or ([ids])

Riot endpoint summoners/{summonerIds}/runes

Get a set of rune pages objects for the provided or summoner or multiple sets of rune pages for a provided array of summoner ids.

Champion Mastery

getByPlayerAndChampion (playerId, championId)

Riot endpoint: /championmastery/location/{platformId}/player/{playerId}/champion/{championId}

Get a Champion Mastery object for a given player on a specific champion.

getAllByPlayer (playerId)

Riot endpoint: /championmastery/location/{platformId}/player/{playerId}/champions

Get all mastery scores for the provided player

getScore (playerId)

Riot endpoint: /championmastery/location/{platformId}/player/{playerId}/score

Get a player's total champion mastery score

getTopChampions (playerId)

Riot endpoint: /championmastery/location/{platformId}/player/{playerId}/topchampions

Get a player's top three highest champion mastery scores.

Contributing

If you'd like to contribute to this project, you can file an issue. When you've completed work and are looking for review, file a pull request from your fork of this repository. This project uses Javascript Standard Style, and standard is listed as a dev dependency. There are linter plugins for Atom, Sublime Text and more that can be found on standard's Github page. npm test will lint all code and Travis will fail if standard throws any code style errors. This ensures that there are no pointless discussions about code style, and we can actually discuss implementation, logic, etc during code review.