2.0.5 • Published 5 years ago

api-riot-games v2.0.5

Weekly downloads
8
License
ISC
Repository
github
Last release
5 years ago

Install

npm i twisted

Environment variables

RIOT_API_KEY = Riot api key

Simple example

LOL:

import { LolApi, Constants } from 'twisted'

const api = new LolApi()

export async function summonerByNameExample () {
  return await api.Lol.Summoner.getByName('Hide on bush', Constants.Regions.KOREA)
}

TFT:

import { TftApi, Constants } from 'twisted'

const api = new TftApi()

export async function matchListTft () {
  const {
    response: {
      puuid
    }
  } = api.Summoner.getByName('MaxiVzla', Constants.Regions.LA1)
  return api.Match.list(puuid, Constants.TftRegions.TftRegions.AMERICAS)
}

More examples

Automatic rate limits reattempts

import { LolApi } from 'twisted'

const api = new LolApi({
   /**
   * If api response is 429 (rate limits) try reattempt after needed time (default true)
   */
  rateLimitRetry: true
  /**
   * Number of time to retry after rate limit response (default 1)
   */
  rateLimitRetryAttempts: 1
  /**
   * Concurrency calls to riot (default infinity)
   */
  concurrency?: undefined,
  /**
   * Riot games api key
   */
  key: '',
  /**
   * Debug methods
   */
  debug: {
    /**
     * Log methods execution time (default false)
     */
    logTime: false
    /**
     * Log urls (default false)
     */
    logUrls: false
  }
})

Endpoints

Everything should be in the same order as in the official docs.

CHAMPION-MASTERY-V4

  • Get all champion mastery entries sorted by number of champion points descending.
  • Get a champion mastery by player ID and champion ID.
  • Get a player's total champion mastery score, which is the sum of individual champion mastery levels.

CHAMPION-V3

  • Retrieve all champions.
  • Retrieve champion by ID.

LEAGUE-V4

  • Get the challenger league for given queue.
  • Get league entries in all queues for a given summoner ID.
  • Get all the league entries.
  • Get the grandmaster league of a specific queue.
  • Get league with given ID, including inactive entries.
  • Get the master league for given queue.
  • Get the queues that have positional ranks enabled. (deprecated June 17th and in v0.9.10)
  • Get league positions in all queues for a given summoner ID. (deprecated June 17th and in v0.9.10)
  • Get all the positional league entries. (deprecated June 17th and in v0.9.10)

LOL-STATUS-V3

  • Get League of Legends status for the given shard.
  • Get matchlist for games played on given account ID and platform ID and filtered using given filter parameters, if any.
  • Get match timeline by match ID.
  • Get match IDs by tournament code.
  • Get match by match ID and tournament code.

SPECTATOR-V4

  • Get current game information for the given summoner ID.
  • Get list of featured games.

SUMMONER-V4

  • Get a summoner by account ID.
  • Get a summoner by summoner name.
  • Get a summoner by PUUID.
  • Get a summoner by summoner ID.

TOURNAMENT-STUB-V4

  • Create a mock tournament code for the given tournament.
  • Gets a mock list of lobby events by tournament code.
  • Creates a mock tournament provider and returns its ID.
  • Creates a mock tournament and returns its ID.

TOURNAMENT-V4

  • Create a tournament code for the given tournament.
  • Returns the tournament code DTO associated with a tournament code string.
  • Update the pick type, map, spectator type, or allowed summoners for a code.
  • Gets a list of lobby events by tournament code.
  • Creates a tournament provider and returns its ID.
  • Creates a tournament and returns its ID.

TFT Endpoints

TFT-SUMMONER-V1

  • Get a summoner by account ID.
  • Get a summoner by summoner name.
  • Get a summoner by PUUID.
  • Get a summoner by summoner ID.

TFT-MATCH-V1

  • Get match list by summoner PUUID.
  • Get match list details.

TFT-LEAGUE-V1

  • Get the challenger league for given queue.
  • Get league entries in all queues for a given summoner ID.
  • Get all the league entries.
  • Get league with given ID, including inactive entries.
  • Get the master league for given queue.

Run all examples

Download code from git and:

Simple

bash npm run example

Specific examples

bash npm run example --example={exampleFunctionName}

With docker

Edit docker-compose.yml with your api key and: bash docker-compose up

2.0.5

5 years ago

2.0.4

5 years ago

2.0.3

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.4.7

5 years ago

1.4.5

5 years ago

1.4.4

5 years ago

1.4.3

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.2.0

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.0.1

5 years ago

0.1.0

5 years ago