raiderio-api 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -0
- package/dist/index.d.ts +1193 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +572 -0
- package/dist/index.js.map +1 -0
- package/package.json +59 -0
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# raiderio-api
|
|
2
|
+
|
|
3
|
+
A typed Node.js client and helpers for the [Raider.io API](https://raider.io/api).
|
|
4
|
+
|
|
5
|
+
- **Fully typed** — every endpoint returns a parsed, typed response.
|
|
6
|
+
- **Grouped by area** — `character`, `general`, `guild`, `mythicPlus`, `raiding`.
|
|
7
|
+
- **Tiny runtime** — built on [`ky`](https://github.com/sindresorhus/ky). ESM-only.
|
|
8
|
+
- **No API key required** — the Raider.io API is public; most endpoints work without one.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npm install raiderio-api
|
|
14
|
+
# or
|
|
15
|
+
pnpm add raiderio-api
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
> Requires Node.js `^20.19.0 || ^22.13.0 || >=24`. This package is **ESM-only**.
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { createRaiderioClient } from 'raiderio-api'
|
|
24
|
+
|
|
25
|
+
const client = createRaiderioClient()
|
|
26
|
+
|
|
27
|
+
const profile = await client.character.profile('eu', 'ysondre', 'melestra', [
|
|
28
|
+
'gear',
|
|
29
|
+
'mythic_plus_scores_by_season'
|
|
30
|
+
])
|
|
31
|
+
|
|
32
|
+
console.log(profile.name, profile.gear?.item_level_equipped)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
You can also instantiate the class directly:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { RaiderioClient } from 'raiderio-api'
|
|
39
|
+
|
|
40
|
+
const client = new RaiderioClient()
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Options
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
const client = createRaiderioClient({
|
|
47
|
+
// Optional. Most endpoints are public and work without a key.
|
|
48
|
+
key: process.env.RAIDERIO_API_KEY,
|
|
49
|
+
// Optional. Forwarded to the underlying `ky` instance
|
|
50
|
+
// (timeout, retry, hooks, custom fetch, etc.).
|
|
51
|
+
kyOptions: {
|
|
52
|
+
timeout: 10_000,
|
|
53
|
+
retry: 2
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Per-request overrides are supported on the escape hatch (see below).
|
|
59
|
+
|
|
60
|
+
## Endpoints
|
|
61
|
+
|
|
62
|
+
Each method returns a `Promise` of the fully-typed response.
|
|
63
|
+
|
|
64
|
+
| Group | Methods |
|
|
65
|
+
| ------------ | --------------------------------------------------------------------------------------------------- |
|
|
66
|
+
| `character` | `profile` |
|
|
67
|
+
| `general` | `periods` |
|
|
68
|
+
| `guild` | `bossKill`, `profile` |
|
|
69
|
+
| `mythicPlus` | `affixes`, `leaderboardCapacity`, `runDetails`, `runs`, `scoreTiers`, `seasonCutoffs`, `staticData` |
|
|
70
|
+
| `raiding` | `bossRankings`, `hallOfFame`, `progression`, `raidRankings`, `staticData` |
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
const affixes = await client.mythicPlus.affixes('us', 'en')
|
|
74
|
+
const periods = await client.general.periods()
|
|
75
|
+
const guild = await client.guild.profile('us', 'illidan', 'liquid', [
|
|
76
|
+
'raid_progression'
|
|
77
|
+
])
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Advanced: resource builders + escape hatch
|
|
81
|
+
|
|
82
|
+
Every endpoint is backed by a standalone **resource builder** that returns a
|
|
83
|
+
`Resource` description (`path` + `query`). You can build one by hand and send it
|
|
84
|
+
through the client, with optional per-request overrides:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
import { createRaiderioClient, characterProfile } from 'raiderio-api'
|
|
88
|
+
|
|
89
|
+
const client = createRaiderioClient()
|
|
90
|
+
|
|
91
|
+
const resource = characterProfile('eu', 'ysondre', 'melestra', ['gear'])
|
|
92
|
+
const profile = await client.request(resource, { key: 'per-request-key' })
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The low-level `HttpClient` is also exported for fully custom setups.
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
[MIT](./LICENSE)
|