0.4.0 • Published 4 months ago

@viriato/lol-esports-api v0.4.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

Unofficial League Esports API Wrapper

NPM Package Publisher

This is a simple wrapper of League of Legends' eSports API.

A huge contribution to this project has been vickz84259's documentation, from which the API responses' types have been generated.

Full API Reference


Usage

Events

Fetching currently live events:
import APIClient from "lol-esports-api";

const client = new APIClient();
const liveEvents = await client.events.getLive();

Games

Fetching a game:
import APIClient from "lol-esports-api";

const client = new APIClient();
const game = await client.games.get("110853167109116577");
Fetching data for a portion of a game:

The API's response contains a frames array property where each element represents a "snapshot" of the game's state. It spans a period of 10 seconds.

If given a startingDate parameter value of a later point in time than the end of the game, it will return with the game's last 10 frames. This can be useful if you'd like to fetch a game's finished state data.

It includes information such as objectives taken and players' scoreboard data. To fetch more detailed information, see getDetails.

import APIClient from "lol-esports-api";

const client = new APIClient();

const gameWindow = await client.games.getWindow(
  "110853167109116577",
  "2023-10-19T09:35:40.000Z" // can either be a string or a Date
);
Fetching detailed data for a portion of a game:

Works similarly to getWindow, except it returns with more detailed information such as champion level and stats, creep score, gold earned, ability level up sequence, etc.

import APIClient from "lol-esports-api";

const client = new APIClient();

const detailedGameWindow = await client.games.getDetails(
  "110853167109116577",
  "2023-10-19T09:35:40.000Z" // can either be a string or a Date
);

Leagues

Fetching all leagues:
import APIClient from "lol-esports-api";

const client = new APIClient();
const leagues = await client.leagues.get();
Fetching a league's tournaments:
import APIClient from "lol-esports-api";

const client = new APIClient();
const leagueTournaments = await client.leagues.getTournaments(
  "98767975604431411"
);
Fetching a league's schedule:
import APIClient from "lol-esports-api";

const client = new APIClient();
const leagueSchedule = await client.leagues.getSchedule("98767975604431411");

Matches

Fetching a match's event:
import APIClient from "lol-esports-api";

const client = new APIClient();
const matchEvent = await client.matches.getEvent("108998961199240268");

Teams

Fetching all teams:
import APIClient from "lol-esports-api";

const client = new APIClient();
const teams = await client.teams.get();
Fetching a single team:
import APIClient from "lol-esports-api";

const client = new APIClient();
const fnaticTeam = await client.teams.get("fnatic");

Tournaments

Fetch a tournament's completed events:
import APIClient from "lol-esports-api";

const client = new APIClient();
const tournaments = await client.tournaments.getCompletedEvents(
  "108998961191900167"
);
Fetch a tournament's standings:
import APIClient from "lol-esports-api";

const client = new APIClient();
const standings = await client.tournaments.getStandings("108998961191900167");
0.4.0

4 months ago

0.3.0

6 months ago

0.2.5

6 months ago

0.2.4

6 months ago

0.2.3

6 months ago

0.2.2

6 months ago

0.2.1

6 months ago

0.2.0

6 months ago

0.1.0

7 months ago