@javilobo8/riot-api
TypeScript icon, indicating that this package has built-in type declarations

1.7.0 • Public • Published

@javilobo8/riot-api

npm package Build Status Downloads Issues Code Coverage

Another Riot API wrapper for Node.js.

Features

  • Fully typed
  • Promise-based
  • Constants
  • Axios based requests

TODO

  • Add replacement for DDragon CDN host
  • Add Redis cache
  • Parse response and error Rate Limit headers
  • [x] Add new spectator byPuuid v5 endpoint

Installation

npm install @javilobo8/riot-api

Usage

import { RiotAPILOL, DDragonAPI } from '@javilobo8/riot-api';

// RiotAPILOL
const riotApi = new RiotAPILOL({
  apiKey: 'RGAPI-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
});

const accountResponse = await riotApi.account.byRiotId('EUW', 'javilobo8', 'zoso');
/*
{
  data: {
    puuid: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
    gameName: 'javilobo8',
    tagLine: 'zoso',
  },
  status: 200,
  statusText: 'OK',
  headers: {
    'x-app-rate-limit': 'XX:XX,XX:XX',
    'x-method-rate-limit': 'XX:XX,XX:XX',
    'x-app-rate-limit-count': 'XX:XX,XX:XX',
    'x-method-rate-limit-count': 'XX:XX,XX:XX',
    ...
  },
}
*/

// DDragonAPI
const ddragonApi = new DDragonAPI();

const versionResponse = await ddragonApi.ddragon.getCurrentVersion();
/*
{
  data: '11.16.1', // Current patch version
  status: 200,
  statusText: 'OK',
  headers: {
    ...
  },
}
*/

Debugging

This package uses the debug package to log debug messages. To enable debug messages, set the DEBUG environment variable to riot-api:*.

DEBUG=riot-api:* node your-app.js

Base package: @javilobo8/riot-api

Package Sidebar

Install

npm i @javilobo8/riot-api

Weekly Downloads

3

Version

1.7.0

License

MIT

Unpacked Size

62.8 kB

Total Files

55

Last publish

Collaborators

  • javilobo8