Twisted
League of legends api wrapper

Simple example
RIOT:
import { RiotApi, Constants } from 'twisted'
const api = new RiotApi()
export async function getAccount () {
return (await api.Account.getByRiotId("Hide on bush", "KR1", Constants.RegionGroups.AMERICAS)).response
}
LOL:
import { LolApi, Constants } from 'twisted'
const api = new LolApi()
export async function getSummoner () {
const user = await getAccount()
return await api.Summoner.getByPUUID(user.puuid, Constants.Regions.KOREA)
}
TFT:
import { TftApi, Constants } from 'twisted'
const api = new TftApi()
export async function matchListTft () {
const user = await getAccount()
return api.Match.list(user.puuid, Constants.RegionGroups.KOREA)
}
More examples
Automatic rate limits reattempts
import { LolApi } from 'twisted'
const api = new LolApi({
rateLimitRetry: true
rateLimitRetryAttempts: 1
concurrency: undefined,
key: '',
debug: {
logTime: false
logUrls: false
logRatelimit?: false
}
})
Endpoints
Everything should be in the same order as in the official docs.
Riot Endpoints
ACCOUNT-V1
LOL Endpoints
CHAMPION-MASTERY-V4
CHAMPION-V3
CLASH
MATCH-V5
MATCH-V4 (deprecated)
LEAGUE-V4
LOL-CHALLENGES-V1
LOL-STATUS-V3
LOL-STATUS-V4
SPECTATOR-V5
SPECTATOR-V4 (deprecated April 5)
SUMMONER-V4
TOURNAMENT-STUB-V4
TOURNAMENT-V4
TFT Endpoints
TFT-SPECTATOR-V5
TFT-SUMMONER-V1
TFT-MATCH-V1
TFT-LEAGUE-V1
Run all examples
Download code from git and:
Simple
$ RIOT_API_KEY={YOUR_KEY} yarn example
Specific examples
$ RIOT_API_KEY={YOUR_KEY} yarn example {exampleFunctionName}
With docker
Edit docker-compose.yml with your api key and:
$ docker-compose up
Real project
We did a project based on a "twisted" package, this project is not finished but it is a very good example
Github: https://github.com/twisted-gg
Options
The following environment variables can be set either in the .env file or as shown in the examples:
RIOT_API_KEY
Obtained from the Riot Games developer page(https://developer.riotgames.com/)
Necessary to use this library.
UPDATE_CHAMPION_IDS
This library has an option to fetch an actual version of champion IDs regularly. This is useful in case a new champion
gets added, while the application runs. E.g. data crawlers, or services which aren't supposed to be restarted regularly.
Set the value to true or 1 to enable this feature.