javilobo8 / riot-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@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
  • 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

About

License:MIT License


Languages

Language:TypeScript 100.0%