You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-10Lines changed: 30 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ A customizable, promise-based, and command-oriented TypeScript library and fluen
24
24
-**Fluent interface** for seamless method chaining
25
25
-**Built-in, customizable debugging** using `debug`
26
26
27
-
**Documentation** available [here](https://bcho04.github.io/galeforce/) and in the section [below](#guide).
27
+
Automatically-generated **documentation**is available [here](https://bcho04.github.io/galeforce/), and code **examples** can be found the section [below](#guide).
28
28
29
29
## Table of Contents
30
30
@@ -140,6 +140,26 @@ Each endpoint in the Galeforce library is an instance of an `Action` containing
140
140
>```
141
141
>
142
142
</details>
143
+
144
+
<details>
145
+
<summary><code>.URL()</code></summary>
146
+
147
+
> Returns the endpoint URL associated with the `Action` and its previously-set parameters.
148
+
>
149
+
> **Example**
150
+
>
151
+
> ```javascript
152
+
>/* Gets the Data Dragon URL associated with the Galeforce icon. */
153
+
>constgaleforceURL=galeforce.ddragon.item.art() // Fetch item icon art from Data Dragon
154
+
> .version('11.9.1') // See the .<property>() section for documentation. Sets the version to retrieve data from.
155
+
> .assetId('6671') // See below for documentation. Get the icon for the Galeforce item.
156
+
> .URL(); // Get the encoded URL corresponding with the selected endpoint as a string.
@@ -152,13 +172,11 @@ Each endpoint in the Galeforce library is an instance of an `Action` containing
152
172
>constcurrentGameInfo=awaitgaleforce.lol.spectator.active() // Target the /lol/spectator/v4/active-games/by-summoner/{summonerId} endpoint
153
173
> .region(galeforce.regions.lol.NORTH_AMERICA) // Sets the request region to 'na1' (i.e., target the NA server)
154
174
> .summonerId('summonerId') // Sets the request summonerId to 'summonerId'
155
-
> .exec() // See .exec() above.
175
+
> .exec();// See .exec() above.
156
176
>```
157
177
>
158
178
> `.<property>()` methods may only be called once and are removed from the Action after being used.
159
179
>
160
-
> **Example**
161
-
>
162
180
> ```javascript
163
181
>/* Gets current game info for a specific summonerId. */
164
182
>constcurrentGameInfo=awaitgaleforce.lol.spectator.active() // Target the /lol/spectator/v4/active-games/by-summoner/{summonerId} endpoint
@@ -188,26 +206,28 @@ Galeforce includes DTOs for all Riot API responses as TypeScript interfaces. Alt
188
206
189
207
### Config structure
190
208
191
-
When initializing Galeforce, a config object (JSON) or a path to a YAML file must be passed to the `GaleforceModule()` constructor as an argument:
209
+
When initializing Galeforce, a config object (JSON) or a path to a YAML file may *optionally* be passed to the `GaleforceModule()` constructor as an argument:
192
210
193
211
```javascript
194
212
constgaleforce=newGaleforceModule(/* config file path or object */);
195
213
```
196
214
197
-
Template string-like values (such as `${RIOT_KEY}`) will be evaluated using environment variables in `process.env`. The configuration file must have the following structure:
215
+
Omitting 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.
216
+
217
+
Template string-like values (such as `${RIOT_KEY}`) will be evaluated using environment variables in `process.env`. The configuration file must have the following structure (all top-level fields are optional):
198
218
199
219
```yaml
200
-
riot-api:# REQUIRED
220
+
riot-api:
201
221
key: ${RIOT_KEY} # (string) Your Riot API key from https://developer.riotgames.com
202
-
cache:# OPTIONAL
222
+
cache:
203
223
type: ${CACHE_TYPE} # (string) What kind of cache to use ('redis', 'javascript', 'null')
204
224
uri: ${CACHE_URI} # (string) The cache URI to connect to (required for 'redis' cache)
205
-
rate-limit: #OPTIONAL, Requires a cache to be configured.
225
+
rate-limit: # Requires a cache to be configured.
206
226
prefix: riotapi-ratelimit- # The prefix for the Riot API rate limit keys in the cache.
207
227
intervals: # key <secs>: value <number of requests>.
208
228
120: 100
209
229
1: 20
210
-
debug: [] #OPTIONAL, A list containing any of 'action', 'payload', 'rate-limit', 'riot-api', '*' (all).
230
+
debug: [] # A list containing any of 'action', 'payload', 'rate-limit', 'riot-api', '*' (all).
0 commit comments