RiotModule

Bedy Riot module

GitHub package.json version (subfolder of monorepo)

A simple library to communicate with Riot’s League of Legend API.

GitHub last commit (branch) GitHub (Pre-)Release Date codecov

Table of Contents

Prerequisites

To use this library you will need an API key to access the Riot API.

To get this key you need to make a request to Riot.

Riot Developer Portal

Features

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 18.0 or higher is required.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Login to Github registry package

Require PAT (Personal access token) for install the package

npm login --scope=@mbelangerb --auth-type=legacy --registry=https://npm.pkg.github.com

Installation is done using the npm install command:

npm install @mbelangerb/riotmodule

Requirement

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

In production, to be able to communicate with the Riot API, you must add the following keys. Riot_LolToken and Riot_TftToken

If you are in development mode NODE_ENV="development" you can use a unique key valid for 24 hours that is provided to you by Riot and allows access to all features (League of Legend & TFT) with the key : Riot_APIDevKey

If you want enabled the cache system you need to add key CacheEnabled=true

.env Exemple

# Production Mode
Riot_LolToken='RGAPI-'
Riot_TftToken='RGAPI-'

# Developper Mode (24 hours tokens)
Riot_APIDevKey='RGAPI-'

How to use

Exemple

import { RiotService, ValidationService, RiotHttpStatusCode } from '@mbelangerb/riotmodule';

# Initialize 'RiotService'
const service: RiotService = new RiotService();

# Validate Region
let valideRegion: string = ValidationService.convertToRealRegion(region);

# Get SummonerDTO
import { ISummonerDTO } from '@mbelangerb/riotmodule';
const apiSummoner: ISummonerDTO = await service.SummonerV4.getBySummonerName(summonerName, region);

League of Legends API

For more information about Riot’s Developer API, please consult the official API access. : link

API Versions

| Route | Status | |–|–| | Account | Static Badge | | Champion | Static Badge | | Champion-Mastery | Static Badge | | League | Static Badge | | Summoner | Static Badge | | TFTLeague* | Static Badge | | TFTSummoner* | Static Badge |

*The TFT entity used for summoner and league information is the same as that used for League of Legend.

Authors