{"id":26895341,"url":"https://github.com/b-cho/galeforce","last_synced_at":"2025-05-12T19:25:01.853Z","repository":{"id":42964369,"uuid":"225068930","full_name":"b-cho/galeforce","owner":"b-cho","description":"A customizable, promise-based, and command-oriented TypeScript fluent interface and library for the Riot Games API.","archived":false,"fork":false,"pushed_at":"2024-03-06T14:10:17.000Z","size":4626,"stargazers_count":41,"open_issues_count":4,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T19:24:47.830Z","etag":null,"topics":["es6","fluent-interface","galeforce","javascript","league-of-legends","leagueoflegends","legends-of-runeterra","lol","lor","nodejs","nodejs-library","redis","riot-api","riot-games","teamfight-tactics","tft","typescript","typescript-library","val","valorant"],"latest_commit_sha":null,"homepage":"https://b-cho.github.io/galeforce/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b-cho.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-30T20:56:17.000Z","updated_at":"2025-01-07T21:01:21.000Z","dependencies_parsed_at":"2024-07-09T18:05:13.893Z","dependency_job_id":null,"html_url":"https://github.com/b-cho/galeforce","commit_stats":null,"previous_names":["bcho04/galeforce"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b-cho%2Fgaleforce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b-cho%2Fgaleforce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b-cho%2Fgaleforce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b-cho%2Fgaleforce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b-cho","download_url":"https://codeload.github.com/b-cho/galeforce/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253806942,"owners_count":21967267,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["es6","fluent-interface","galeforce","javascript","league-of-legends","leagueoflegends","legends-of-runeterra","lol","lor","nodejs","nodejs-library","redis","riot-api","riot-games","teamfight-tactics","tft","typescript","typescript-library","val","valorant"],"created_at":"2025-04-01T01:56:01.913Z","updated_at":"2025-05-12T19:25:01.800Z","avatar_url":"https://github.com/b-cho.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Galeforce\n\n***\n\n[![NPM](https://nodei.co/npm/galeforce.png?compact=true)](https://www.npmjs.com/package/galeforce)\n\n![npm](https://img.shields.io/npm/dt/galeforce)\n[![Node CI](https://github.com/bcho04/galeforce/workflows/Node%20CI/badge.svg)](https://github.com/bcho04/galeforce/workflows/Node%20CI/badge.svg)\n[![CodeQL](https://github.com/bcho04/galeforce/workflows/CodeQL/badge.svg)](https://github.com/bcho04/galeforce/workflows/CodeQL/badge.svg)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/18a92440f7a5457db04632699c3546a6)](https://www.codacy.com/gh/bcho04/galeforce/dashboard?utm_source=github.com\\\u0026utm_medium=referral\\\u0026utm_content=bcho04/galeforce\\\u0026utm_campaign=Badge_Grade)\n[![codecov](https://codecov.io/gh/bcho04/galeforce/branch/master/graph/badge.svg?token=7BJHF5KVX9)](https://codecov.io/gh/bcho04/galeforce)\n[![shields.io dependencies](https://img.shields.io/librariesio/release/npm/galeforce)](https://img.shields.io/librariesio/release/npm/galeforce)\n[![GitHub last commit](https://img.shields.io/github/last-commit/bcho04/galeforce.svg?style=flat)](https://img.shields.io/github/last-commit/bcho04/galeforce.svg?style=flat)\n\nA customizable, promise-based, and command-oriented TypeScript library and fluent interface for the Riot Games API.\n\n## Features\n\n*   **Full API support** for all Riot games, Data Dragon (LoL and LoR), and the Live Client Data API\n    *   Environment variable config integration for API keys and other values on both the desktop and platforms including Heroku\n*   **Customizable rate limiting** with Redis clustering support and automated retries\n*   **Fully-typed DTOs and parameters** for *all* endpoints\n*   **Fluent interface** for seamless method chaining\n*   **Built-in, informative debugging** using `debug`\n\nAutomatically-generated **documentation** is available [here](https://bcho04.github.io/galeforce/), and code **examples** can be found the section [below](#examples).\n\n## Table of Contents\n\n*   [Galeforce](#galeforce)\n    *   [Features](#features)\n    *   [Table of Contents](#table-of-contents)\n    *   [Examples](#examples)\n    *   [Guide](#guide)\n        *   [Actions](#actions)\n        *   [Using DTOs](#using-dtos)\n        *   [Config structure](#config-structure)\n        *   [Documentation](#documentation)\n    *   [Disclaimer](#disclaimer)\n\n***\n\n## Examples\n\nIf you're using **ES6/TypeScript**, simply add\n\n```typescript\nimport GaleforceModule from 'galeforce';\n\nconst galeforce = new GaleforceModule(/* config */);\n```\n\nto use the library. Or, if you're using **CommonJS** and `require()`, add Galeforce to your project like this:\n\n```javascript\nconst GaleforceModule = require('galeforce');\n\nconst galeforce = new GaleforceModule(/* config */);\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eGet summoner data for a list of summoners\u003c/summary\u003e\n\n```javascript\nconst summoners = ['a', 'b', 'c'];\nconst promises = summoners.map(summoner =\u003e galeforce.lol.summoner()\n  .region(galeforce.region.lol.NORTH_AMERICA)\n  .name(summoner)\n  .exec()\n); // list of request promises\nPromise.all(promises).then((result) =\u003e {\n  console.log(result); // [{ name: 'a', ... }, ...]\n});\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eGet list of recent matchId values for a given puuid\u003c/summary\u003e\n\n```javascript\nconst matchIds = await galeforce.lol.match.list()\n  .region(galeforce.region.riot.AMERICAS)\n  .puuid(puuid)\n  .exec();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eGet match data using await\u003c/summary\u003e\n\n```javascript\nconst matchData = await galeforce.lol.match.match()\n  .region(galeforce.region.riot.AMERICAS)\n  .matchId(matchId)\n  .exec();\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eGet total number of mastery points for a summoner\u003c/summary\u003e\n\n```javascript\nconst totalMasteryPoints = (await galeforce.lol.mastery.list()\n  .region(galeforce.region.lol.NORTH_AMERICA)\n  .summonerId(summonerId)\n  .exec())\n  .reduce((previous, current) =\u003e previous + current.championPoints, 0);\n```\n\n\u003c/details\u003e\n\n***\n\n## Guide\n\n### Actions\n\nEach endpoint in the Galeforce library is an instance of an `Action` containing the following methods:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003e.exec()\u003c/code\u003e\u003c/summary\u003e\n\n\u003e Executes the `Action` with the parameters set by methods such as `.region()`, `.summonerId()`, etc., returning a *Promise*.\n\u003e\n\u003e **Example**\n\u003e\n\u003e ```javascript\n\u003e /* Gets Valorant platform and status data. */\n\u003e galeforce.val.status() // Target the /val/status/v1/platform-data endpoint\n\u003e   .region(galeforce.region.val.NORTH_AMERICA) // See below for documentation.\n\u003e   .exec() // Sends a Valorant server status request to the val-status-v1 endpoint\n\u003e   .then((data) =\u003e { // Use the returned data\n\u003e     /* manipulate status data */\n\u003e   });\n\u003e ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003e.URL()\u003c/code\u003e\u003c/summary\u003e\n\n\u003e Returns the endpoint URL associated with the `Action` and its previously-set parameters.\n\u003e\n\u003e **Example**\n\u003e\n\u003e ```javascript\n\u003e /* Gets the Data Dragon URL associated with the Galeforce icon. */\n\u003e const galeforceURL = galeforce.lol.ddragon.item.art() // Fetch item icon art from Data Dragon\n\u003e   .version('11.9.1') // See the .\u003cproperty\u003e() section for documentation. Sets the version to retrieve data from.\n\u003e   .assetId(6671) // See below for documentation. Get the icon for the Galeforce item.\n\u003e   .URL(); // Get the encoded URL corresponding with the selected endpoint as a string.\n\u003e\n\u003e console.log(galeforceURL); // 'https://ddragon.leagueoflegends.com/cdn/11.9.1/img/item/6671.png'\n\u003e ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003e.\u003cem\u003e\u0026lt;property\u0026gt;\u003c/em\u003e()\u003c/code\u003e\u003c/summary\u003e\n\n\u003e Sets the *property* (`region`, `summonerId`, `puuid`, etc.) in the Action request payload. Different methods are exposed for each endpoint depending on the required path, query, and body parameters.\n\u003e\n\u003e **Example**\n\u003e\n\u003e ```javascript\n\u003e /* Gets current game info for a specific summonerId. */\n\u003e const currentGameInfo = await galeforce.lol.spectator.active() // Target the /lol/spectator/v4/active-games/by-summoner/{summonerId} endpoint\n\u003e   .region(galeforce.region.lol.NORTH_AMERICA) // Sets the request region to 'na1' (i.e., target the NA server)\n\u003e   .summonerId('summonerId') // Sets the request summonerId to 'summonerId'\n\u003e   .exec(); // See .exec() above.\n\u003e ```\n\u003e\n\u003e `.\u003cproperty\u003e()` methods may only be called once and are removed from the Action after being used.\n\u003e\n\u003e ```javascript\n\u003e /* Gets current game info for a specific summonerId. */\n\u003e const currentGameInfo = await galeforce.lol.spectator.active() // Target the /lol/spectator/v4/active-games/by-summoner/{summonerId} endpoint\n\u003e   .region(galeforce.region.lol.NORTH_AMERICA) // Sets the request region to 'na1' (i.e., target the NA server)\n\u003e   .region(galeforce.region.lol.KOREA) // galeforce.lol.spectator.active(...).region(...).region is not a function\n\u003e ```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003ccode\u003e.set()\u003c/code\u003e\u003c/summary\u003e\n\n\u003e Sets multiple *properties* (`region`, `summonerId`, `puuid`, etc.) in the Action request payload simultaneously.\n\u003e\n\u003e **Example**\n\u003e\n\u003e ```javascript\n\u003e /* Gets league entries for a given Teamfight Tactics ranked league. */\n\u003e const TFTLeagueInfo = await galeforce.tft.league.entries() // Target the /tft/league/v1/entries/{tier}/{division} endpoint\n\u003e   .set({ // Set multiple Action payload properties simultaneously\n\u003e     region: galeforce.region.lol.NORTH_AMERICA, // Sets the request region to 'na1' (i.e., target the NA server)\n\u003e     tier: galeforce.tier.DIAMOND, // Sets the request tier to 'DIAMOND' (i.e., search for players in Diamond)\n\u003e     division: galeforce.division.IV, // Sets the request division to 'IV' (i.e., search for players in division IV of their tier)\n\u003e   })\n\u003e   .exec(); // See .exec() above.\n\u003e ```\n\n\u003c/details\u003e\n\n### Using DTOs\n\nGaleforce includes DTOs for all Riot API responses as TypeScript interfaces. Although all actions already return an object typed with the corresponding DTO, these can be accessed explicitly via **`GaleforceModule.dto`** or as another export:\n\n\u003e ```typescript\n\u003e import GaleforceModule from 'galeforce';\n\u003e\n\u003e const summonerData: GaleforceModule.dto.SummonerDTO = ... \n\u003e // get summoner data\n\u003e ```\n\n\u003e ```typescript\n\u003e import GaleforceModule, { dto } from 'galeforce';\n\u003e\n\u003e const summonerData: dto.SummonerDTO = ...\n\u003e // get summoner data\n\u003e ```\n\n### Config structure\n\nWhen initializing Galeforce, a config object (JSON) or a path to a YAML file may *optionally* be passed to the `GaleforceModule()` constructor as an argument:\n\n```javascript\nconst galeforce = new GaleforceModule(/* optional config file path or object */);\n```\n\nOmitting the config will prevent Galeforce from being able to interface with the [Riot Games API](https://developer.riotgames.com/) (as no API key will be specified), although Data Dragon and the Live Client Data API will still be available.\n\nTemplate string-like values (such as `${RIOT_KEY}`) will be evaluated using environment variables in `process.env`. The configuration file may contain any of the following structure (all top-level fields are optional):\n\n```yaml\nriot-api:\n  key: 'RGAPI-???' # (string) Your Riot API key from https://developer.riotgames.com\nrate-limit:\n  type: 'bottleneck' # (string) The type of rate limiter Galeforce should use ('bottleneck', 'null')\n  cache:\n    type: ${CACHE_TYPE} # (string) What kind of cache to use ('redis', 'internal')\n    uri: ${CACHE_URI} # (string) The cache URI to connect to (required for 'redis' cache)\n    key-id: 'galeforce' # (string) The key ID to use for rate-limiting keys in the Redis cache\n  options:\n    intervals: # (key \u003cseconds\u003e: value \u003cnumber of requests\u003e) Manually-set local rate limits, applied per region\n      120: 100\n      1: 20\n    max-concurrent: null # (null | number) The maximum number of concurrent requests allowed. Setting to null allows unlimited concurrent requests.\n    min-time: 0 # (number) The minimum amount of time between consecutive requests\n    retry-count-after-429: 3 # (number) The number of retry attempts after an HTTP 429 error is received, delayed by response header\ndebug: [] # A list containing any of 'action', 'payload', 'rate-limit', 'riot-api', '*' (all)\n```\n\n### Documentation\n\nSee [here](https://bcho04.github.io/galeforce/) for further documentation and a complete list of methods.\n\n***\n\n## Disclaimer\n\nGaleforce isn't endorsed by Riot Games and doesn't reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends © Riot Games, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb-cho%2Fgaleforce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb-cho%2Fgaleforce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb-cho%2Fgaleforce/lists"}