@javilobo8/riot-api

Another Riot API Wrapper

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@javilobo8/riot-api
401.7.02 months ago5 years agoMinified + gzip package size for @javilobo8/riot-api in KB

Readme

@javilobo8/riot-api
!npm packagenpm-imgnpm-url !Build Statusbuild-imgbuild-url !Downloadsdownloads-imgdownloads-url !Issuesissues-imgissues-url !Code Coveragecodecov-imgcodecov-url
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