nhl-api-ts 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +315 -2
- package/dist/api/edge.d.mts +180 -0
- package/dist/api/edge.mjs +184 -0
- package/dist/api/game-center.d.mts +84 -0
- package/dist/api/game-center.mjs +74 -0
- package/dist/api/helpers.d.mts +47 -0
- package/dist/api/helpers.mjs +106 -0
- package/dist/api/misc.d.mts +40 -0
- package/dist/api/misc.mjs +43 -0
- package/dist/api/players.d.mts +28 -0
- package/dist/api/players.mjs +18 -0
- package/dist/api/query/builder.d.mts +22 -0
- package/dist/api/query/builder.mjs +30 -0
- package/dist/api/query/filters.d.mts +93 -0
- package/dist/api/query/filters.mjs +118 -0
- package/dist/api/query/index.d.mts +4 -0
- package/dist/api/query/index.mjs +4 -0
- package/dist/api/query/sorting/goalie-sorts.d.mts +61 -0
- package/dist/api/query/sorting/goalie-sorts.mjs +54 -0
- package/dist/api/query/sorting/sorting-options.d.mts +136 -0
- package/dist/api/query/sorting/sorting-options.mjs +94 -0
- package/dist/api/schedule.d.mts +117 -0
- package/dist/api/schedule.mjs +131 -0
- package/dist/api/standings.d.mts +29 -0
- package/dist/api/standings.mjs +38 -0
- package/dist/api/stats.d.mts +153 -0
- package/dist/api/stats.mjs +166 -0
- package/dist/api/teams.d.mts +59 -0
- package/dist/api/teams.mjs +91 -0
- package/dist/cli/colors.d.mts +14 -0
- package/dist/cli/colors.mjs +13 -0
- package/dist/cli/commands.d.mts +27 -0
- package/dist/cli/commands.mjs +695 -0
- package/dist/cli/run.d.mts +9 -0
- package/dist/cli/run.mjs +313 -0
- package/dist/cli.d.mts +2 -0
- package/dist/cli.mjs +13 -0
- package/dist/config.d.mts +20 -0
- package/dist/config.mjs +4 -0
- package/dist/context.d.mts +6 -0
- package/dist/context.mjs +1 -0
- package/dist/errors.d.mts +35 -0
- package/dist/errors.mjs +49 -0
- package/dist/http-client.d.mts +27 -0
- package/dist/http-client.mjs +95 -0
- package/dist/index.d.mts +22 -0
- package/dist/index.mjs +15 -0
- package/dist/nhl-client.d.mts +101 -0
- package/dist/nhl-client.mjs +40 -0
- package/dist/types/common.d.mts +81 -0
- package/dist/types/common.mjs +2 -0
- package/dist/types/edge.d.mts +1024 -0
- package/dist/types/edge.mjs +1 -0
- package/dist/types/game-center.d.mts +1194 -0
- package/dist/types/game-center.mjs +1 -0
- package/dist/types/helpers.d.mts +17 -0
- package/dist/types/helpers.mjs +1 -0
- package/dist/types/index.d.mts +10 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/misc.d.mts +68 -0
- package/dist/types/misc.mjs +2 -0
- package/dist/types/players.d.mts +42 -0
- package/dist/types/players.mjs +1 -0
- package/dist/types/schedule.d.mts +456 -0
- package/dist/types/schedule.mjs +1 -0
- package/dist/types/standings.d.mts +104 -0
- package/dist/types/standings.mjs +1 -0
- package/dist/types/stats.d.mts +1086 -0
- package/dist/types/stats.mjs +1 -0
- package/dist/types/teams.d.mts +29 -0
- package/dist/types/teams.mjs +1 -0
- package/dist/utils.d.mts +4 -0
- package/dist/utils.mjs +3 -0
- package/package.json +85 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrew Angelle
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,316 @@
|
|
|
1
|
-
#
|
|
1
|
+
# nhl-api-ts
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK **and** command line tool for the NHL API and NHL EDGE stats.
|
|
4
|
+
|
|
5
|
+
Every SDK method is also available as a CLI command.
|
|
6
|
+
|
|
7
|
+
- Zero runtime dependencies (uses the built-in `fetch`)
|
|
8
|
+
- Node.js >= 24, ESM only
|
|
9
|
+
- Fully typed: every response has a named interface you can [extend](docs/recipes/extending-response-types.md)
|
|
10
|
+
|
|
11
|
+
## Documentation
|
|
12
|
+
|
|
13
|
+
- [Concepts](docs/concepts.md): ID formats, the two NHL APIs, "now" redirects, pagination, retries
|
|
14
|
+
- [Errors](docs/errors.md): every error, its cause and the fix
|
|
15
|
+
- [Recipes](docs/recipes/): [filtered stats](docs/recipes/filter-skater-stats.md),
|
|
16
|
+
[pagination](docs/recipes/paginate-stats.md), [live scores](docs/recipes/live-scores.md),
|
|
17
|
+
[season-wide data](docs/recipes/season-wide-data.md), [retries](docs/recipes/retries.md),
|
|
18
|
+
[CLI + jq](docs/recipes/cli-and-jq.md), [testing](docs/recipes/testing.md),
|
|
19
|
+
[extending response types](docs/recipes/extending-response-types.md)
|
|
20
|
+
- [Examples](examples/): runnable scripts
|
|
21
|
+
- [API report](api-report.md): the full public TypeScript API
|
|
22
|
+
- [OpenAPI](openapi.yaml): every HTTP path the SDK calls
|
|
23
|
+
- [Migration guide](MIGRATION.md): breaking changes between versions
|
|
24
|
+
- For LLMs and agents: [llms.txt](llms.txt), [llms-full.txt](llms-full.txt),
|
|
25
|
+
[Agent Skill](skills/nhl-api-ts/SKILL.md)
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pnpm add nhl-api-ts # SDK
|
|
31
|
+
pnpm add -g nhl-api-ts # CLI (`nhl-api-ts` on your PATH)
|
|
32
|
+
# or run the CLI without installing:
|
|
33
|
+
npx nhl-api-ts --help
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## SDK quick start
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { createNHLClient } from 'nhl-api-ts';
|
|
40
|
+
|
|
41
|
+
const client = createNHLClient();
|
|
42
|
+
|
|
43
|
+
const teams = await client.teams.teams();
|
|
44
|
+
const standings = await client.standings.leagueStandings();
|
|
45
|
+
const games = await client.schedule.dailySchedule();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Every method is `async` and takes a single options object:
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
await client.gameCenter.boxscore({ gameId: '2023020280' });
|
|
52
|
+
await client.edge.skaterDetail({ playerId: 8478402, season: 20232024 });
|
|
53
|
+
await client.stats.teamSummary({ startSeason: 20202021, endSeason: 20232024 });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
IDs and seasons accept either strings or numbers.
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const client = createNHLClient({
|
|
62
|
+
debug: true, // log each request URL to stderr (default false)
|
|
63
|
+
timeout: 30, // seconds (default 10)
|
|
64
|
+
followRedirects: true, // "/now" endpoints redirect to today's data (default true)
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## API modules
|
|
69
|
+
|
|
70
|
+
All methods below live on `client.<module>`. Parameters in `[brackets]` are
|
|
71
|
+
optional.
|
|
72
|
+
|
|
73
|
+
### teams
|
|
74
|
+
|
|
75
|
+
- `teams({ [date] })` — all teams with conference, division and `franchise_id`
|
|
76
|
+
- `teamRoster({ teamAbbr, season })`
|
|
77
|
+
- `franchises()`
|
|
78
|
+
|
|
79
|
+
### standings
|
|
80
|
+
|
|
81
|
+
- `leagueStandings({ [date], [season] })` — `season` uses that season's final standings
|
|
82
|
+
- `seasonStandingManifest()`
|
|
83
|
+
|
|
84
|
+
### schedule
|
|
85
|
+
|
|
86
|
+
- `dailySchedule({ [date] })` — date is validated/normalized (`2024-10-9` → `2024-10-09`)
|
|
87
|
+
- `weeklySchedule({ [date] })`
|
|
88
|
+
- `teamMonthlySchedule({ teamAbbr, [month] })`
|
|
89
|
+
- `teamWeeklySchedule({ teamAbbr, [date] })`
|
|
90
|
+
- `teamSeasonSchedule({ teamAbbr, season })`
|
|
91
|
+
- `calendarSchedule({ date })`
|
|
92
|
+
- `playoffCarousel({ season })`
|
|
93
|
+
- `playoffSeriesSchedule({ season, series })`
|
|
94
|
+
- `playoffBracket({ year })`
|
|
95
|
+
|
|
96
|
+
### gameCenter
|
|
97
|
+
|
|
98
|
+
- `boxscore({ gameId })`
|
|
99
|
+
- `playByPlay({ gameId })`
|
|
100
|
+
- `matchUp({ gameId })`
|
|
101
|
+
- `dailyScores({ [date] })`
|
|
102
|
+
- `shiftChartData({ gameId, [excludes] })`
|
|
103
|
+
- `seasonSeriesMatchup({ gameId })`
|
|
104
|
+
- `gameStory({ gameId })`
|
|
105
|
+
|
|
106
|
+
### stats
|
|
107
|
+
|
|
108
|
+
- `gametypesPerSeasonDirectoryByTeam({ teamAbbr })`
|
|
109
|
+
- `playerCareerStats({ playerId })`
|
|
110
|
+
- `playerGameLog({ playerId, seasonId, gameType })`
|
|
111
|
+
- `teamSummary({ startSeason, endSeason, [gameTypeId], [isGame], [isAggregate], [sortExpr], [start], [limit], [factCayenneExp], [defaultCayenneExp] })`
|
|
112
|
+
- `skaterStatsSummary({ startSeason, endSeason, [franchiseId], [gameTypeId], [aggregate], [sortExpr], [start], [limit], [factCayenneExp], [defaultCayenneExp] })`
|
|
113
|
+
- `skaterStatsWithQueryContext({ queryContext, reportType, [sortExpr], [aggregate], [start], [limit] })`
|
|
114
|
+
- `goalieStatsSummary({ startSeason, [endSeason], [statsType], [gameTypeId], [franchiseId], [aggregate], [sortExpr], [start], [limit], [factCayenneExp], [defaultCayenneExp] })`
|
|
115
|
+
|
|
116
|
+
### edge
|
|
117
|
+
|
|
118
|
+
Every EDGE method takes `[season]` and `[gameType]` (2 = regular season, the
|
|
119
|
+
default; 3 = playoffs). Without `season` the current season (`/now`) is used.
|
|
120
|
+
|
|
121
|
+
- Skaters (`{ playerId }`): `skaterDetail`, `skaterShotSpeedDetail`,
|
|
122
|
+
`skaterSkatingSpeedDetail`, `skaterShotLocationDetail`,
|
|
123
|
+
`skaterSkatingDistanceDetail`, `skaterComparison`, `skaterZoneTime`,
|
|
124
|
+
`catSkaterDetail`
|
|
125
|
+
- Goalies (`{ playerId }`): `goalieDetail`, `goalieShotLocationDetail`,
|
|
126
|
+
`goalie5v5Detail`, `goalieComparison`, `goalieSavePercentageDetail`,
|
|
127
|
+
`catGoalieDetail`
|
|
128
|
+
- Teams (`{ teamId }`): `teamDetail`, `teamSkatingDistanceDetail`,
|
|
129
|
+
`teamZoneTimeDetails`, `teamShotLocationDetail`, `teamShotSpeedDetail`,
|
|
130
|
+
`teamSkatingSpeedDetail`
|
|
131
|
+
- Landing pages (no id): `skaterLanding`, `goalieLanding`, `teamLanding`
|
|
132
|
+
|
|
133
|
+
### players
|
|
134
|
+
|
|
135
|
+
- `prospectsByTeam({ teamAbbr })`
|
|
136
|
+
- `playersByTeam({ teamAbbr, season })`
|
|
137
|
+
|
|
138
|
+
### misc
|
|
139
|
+
|
|
140
|
+
- `glossary()`, `config()`, `countries()`, `seasonSpecificRulesAndInfo()`,
|
|
141
|
+
`draftYearAndRounds()`
|
|
142
|
+
|
|
143
|
+
### helpers
|
|
144
|
+
|
|
145
|
+
These make one or more requests per team and sleep `apiSleepRate` seconds
|
|
146
|
+
between teams to avoid rate limiting.
|
|
147
|
+
|
|
148
|
+
- `gameIdsBySeason({ season, [gameTypes], [apiSleepRate] })`
|
|
149
|
+
- `allPlayers({ season, [apiSleepRate] })`
|
|
150
|
+
- `allPlayersSummaryStatistics({ season, [apiSleepRate] })`
|
|
151
|
+
|
|
152
|
+
## Query builder
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
import { createNHLClient, buildQuery, isValidQuery, filter, PositionTypes } from 'nhl-api-ts';
|
|
156
|
+
|
|
157
|
+
const client = createNHLClient();
|
|
158
|
+
|
|
159
|
+
const context = buildQuery([
|
|
160
|
+
filter.gameType('2'),
|
|
161
|
+
filter.season('20232024', '20232024'),
|
|
162
|
+
filter.position(PositionTypes.ALL_FORWARDS),
|
|
163
|
+
filter.draft('2015', '1'),
|
|
164
|
+
]);
|
|
165
|
+
|
|
166
|
+
if (!isValidQuery(context)) console.error(context.errors);
|
|
167
|
+
|
|
168
|
+
const { data, total } = await client.stats.skaterStatsWithQueryContext({
|
|
169
|
+
queryContext: context,
|
|
170
|
+
reportType: 'summary',
|
|
171
|
+
aggregate: true,
|
|
172
|
+
});
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Available filters: `filter.decision`, `filter.draft`, `filter.experience`,
|
|
176
|
+
`filter.franchise`, `filter.gameType`, `filter.homeRoad`,
|
|
177
|
+
`filter.nationality`, `filter.opponent`, `filter.position`, `filter.season`,
|
|
178
|
+
`filter.shootCatch`, `filter.status`.
|
|
179
|
+
|
|
180
|
+
Skater report types: `summary`, `bios`, `faceoffpercentages`, `faceoffwins`,
|
|
181
|
+
`goalsForAgainst`, `realtime`, `penalties`, `penaltykill`, `penaltyShots`,
|
|
182
|
+
`powerplay`, `puckPossessions`, `summaryshooting`, `percentages`,
|
|
183
|
+
`scoringRates`, `scoringpergame`, `shootout`, `shottype`, `timeonice`.
|
|
184
|
+
|
|
185
|
+
## Extending the types
|
|
186
|
+
|
|
187
|
+
Response types come from real API responses, and the NHL adds fields without
|
|
188
|
+
notice. Every object type is an `interface`, so you can add what's missing with
|
|
189
|
+
module augmentation:
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
declare module 'nhl-api-ts' {
|
|
193
|
+
interface Boxscore {
|
|
194
|
+
someNewField?: string;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
New play types and report types are added through registries (`PlayTypes`,
|
|
200
|
+
`SkaterReportRows`, `GoalieReportRows`). See
|
|
201
|
+
[Extending response types](docs/recipes/extending-response-types.md) for those
|
|
202
|
+
and for the one-off cast.
|
|
203
|
+
|
|
204
|
+
## Errors
|
|
205
|
+
|
|
206
|
+
HTTP failures throw exceptions that all extend `NHLApiException`, which has
|
|
207
|
+
`statusCode` and `errorCode`:
|
|
208
|
+
|
|
209
|
+
| Status | Exception |
|
|
210
|
+
| ------ | ---------------------------- |
|
|
211
|
+
| 400 | `BadRequestException` |
|
|
212
|
+
| 401 | `UnauthorizedException` |
|
|
213
|
+
| 404 | `ResourceNotFoundException` |
|
|
214
|
+
| 429 | `RateLimitExceededException` |
|
|
215
|
+
| 5xx | `ServerErrorException` |
|
|
216
|
+
| other | `NHLApiException` |
|
|
217
|
+
|
|
218
|
+
Invalid input (bad dates, unknown seasons) throws a `RangeError`.
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
import { ResourceNotFoundException } from 'nhl-api-ts';
|
|
222
|
+
|
|
223
|
+
try {
|
|
224
|
+
await client.gameCenter.boxscore({ gameId: 1 });
|
|
225
|
+
} catch (err) {
|
|
226
|
+
if (err instanceof ResourceNotFoundException) console.log(err.statusCode); // 404
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## CLI
|
|
231
|
+
|
|
232
|
+
```
|
|
233
|
+
nhl-api-ts <module> <command> [args] [options]
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Modules and commands are the kebab-case names of the SDK modules and methods,
|
|
237
|
+
and options are the kebab-case parameter names. Required parameters can be
|
|
238
|
+
passed positionally, in order, or as flags. Results are printed to stdout as
|
|
239
|
+
JSON.
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
nhl-api-ts --help # list modules
|
|
243
|
+
nhl-api-ts edge --help # list a module's commands
|
|
244
|
+
nhl-api-ts stats team-summary --help # a command's arguments and options
|
|
245
|
+
|
|
246
|
+
nhl-api-ts teams teams
|
|
247
|
+
nhl-api-ts schedule daily-schedule --date 2024-10-09
|
|
248
|
+
nhl-api-ts game-center boxscore 2023020280
|
|
249
|
+
nhl-api-ts game-center shift-chart-data 2023020280 --excludes eventDetails,playerStats
|
|
250
|
+
nhl-api-ts standings league-standings --season 20222023
|
|
251
|
+
nhl-api-ts edge skater-detail 8478402 --season 20232024 --game-type 3
|
|
252
|
+
nhl-api-ts stats team-summary 20202021 20232024 --game-type-id 3 --limit 5
|
|
253
|
+
nhl-api-ts stats goalie-stats-summary 20232024 --stats-type advanced
|
|
254
|
+
nhl-api-ts helpers game-ids-by-season 20232024 --game-types 2,3
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
The query builder is available through filter flags on
|
|
258
|
+
`stats skater-stats-with-query-context`:
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
nhl-api-ts stats skater-stats-with-query-context summary \
|
|
262
|
+
--season-start 20232024 --position F --nationality SWE --rookie --limit 10
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
Filter flags: `--season-start`, `--season-end`, `--franchise-id`,
|
|
266
|
+
`--game-type`, `--position` (F/C/L/R/D), `--nationality`, `--decision`
|
|
267
|
+
(W/L/O), `--draft-year`, `--draft-round`, `--rookie` / `--no-rookie`,
|
|
268
|
+
`--home-road` (H/R), `--opponent-franchise-id`, `--shoot-catch` (L/R),
|
|
269
|
+
`--active`, `--hall-of-fame`.
|
|
270
|
+
|
|
271
|
+
Global options:
|
|
272
|
+
|
|
273
|
+
| Option | Description |
|
|
274
|
+
| ----------------------- | --------------------------------- |
|
|
275
|
+
| `--compact` | Print JSON on a single line |
|
|
276
|
+
| `--debug` | Log request URLs to stderr |
|
|
277
|
+
| `--timeout <seconds>` | Request timeout (default 10) |
|
|
278
|
+
| `--no-follow-redirects` | Do not follow HTTP redirects |
|
|
279
|
+
| `-v`, `--version` | Print the version |
|
|
280
|
+
|
|
281
|
+
Exit codes: `0` success, `1` API or network error, `2` invalid usage.
|
|
282
|
+
Progress and warning messages from `helpers` go to stderr, so stdout is always
|
|
283
|
+
clean JSON.
|
|
284
|
+
|
|
285
|
+
Pipe output to `jq` to slice it:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
nhl-api-ts teams teams --compact | jq -r '.[].abbr'
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Development
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
pnpm install
|
|
295
|
+
pnpm test # node:test, runs the TypeScript sources directly
|
|
296
|
+
pnpm typecheck
|
|
297
|
+
pnpm lint:check
|
|
298
|
+
pnpm build # emits dist/
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for the full set of checks, and
|
|
302
|
+
[AGENTS.md](AGENTS.md) for repository conventions.
|
|
303
|
+
|
|
304
|
+
Try the CLI from source:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
node --conditions=source src/cli.mts --help
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
## Credits
|
|
311
|
+
|
|
312
|
+
Ported from [nhl-api-py](https://github.com/coreyjs/nhl-api-py).
|
|
313
|
+
|
|
314
|
+
## License
|
|
315
|
+
|
|
316
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import type { Context } from '#src/context.mjs';
|
|
2
|
+
import type { CatGoalieDetail, CatSkaterDetail, Goalie5v5Detail, GoalieComparison, GoalieDetail, GoalieLanding, GoalieSavePercentageDetail, GoalieShotLocationDetail, SkaterComparison, SkaterDetail, SkaterLanding, SkaterShotLocationDetail, SkaterShotSpeedDetail, SkaterSkatingDistanceDetail, SkaterSkatingSpeedDetail, SkaterZoneTime, TeamDetail, TeamLanding, TeamShotLocationDetail, TeamShotSpeedDetail, TeamSkatingDistanceDetail, TeamSkatingSpeedDetail, TeamZoneTimeDetails } from '#src/types/index.mjs';
|
|
3
|
+
import type { Id } from '#src/utils.mjs';
|
|
4
|
+
export interface EdgeSeasonParams {
|
|
5
|
+
/** Season in YYYYYYYY format, e.g. 20232024. Defaults to the current season ("now"). */
|
|
6
|
+
season?: Id;
|
|
7
|
+
/** 2=Regular season (default), 3=Playoffs. Ignored when `season` is omitted. */
|
|
8
|
+
gameType?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface EdgePlayerParams extends EdgeSeasonParams {
|
|
11
|
+
/** NHL player id, e.g. 8478402 */
|
|
12
|
+
playerId: Id;
|
|
13
|
+
}
|
|
14
|
+
export interface EdgeTeamParams extends EdgeSeasonParams {
|
|
15
|
+
/** NHL team id, e.g. 10 */
|
|
16
|
+
teamId: Id;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Get NHL EDGE skater detail statistics for a specific player.
|
|
20
|
+
*
|
|
21
|
+
* @example await client.edge.skaterDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
22
|
+
*/
|
|
23
|
+
export declare const skaterDetail: (ctx: Context, params: EdgePlayerParams) => Promise<SkaterDetail>;
|
|
24
|
+
/**
|
|
25
|
+
* Get NHL EDGE shot speed details for a specific skater.
|
|
26
|
+
*
|
|
27
|
+
* @example await client.edge.skaterShotSpeedDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
28
|
+
*/
|
|
29
|
+
export declare const skaterShotSpeedDetail: (ctx: Context, params: EdgePlayerParams) => Promise<SkaterShotSpeedDetail>;
|
|
30
|
+
/**
|
|
31
|
+
* Get NHL EDGE skating speed details for a specific skater.
|
|
32
|
+
*
|
|
33
|
+
* @example await client.edge.skaterSkatingSpeedDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
34
|
+
*/
|
|
35
|
+
export declare const skaterSkatingSpeedDetail: (ctx: Context, params: EdgePlayerParams) => Promise<SkaterSkatingSpeedDetail>;
|
|
36
|
+
/**
|
|
37
|
+
* Get NHL EDGE shot location details for a specific skater.
|
|
38
|
+
*
|
|
39
|
+
* @example await client.edge.skaterShotLocationDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
40
|
+
*/
|
|
41
|
+
export declare const skaterShotLocationDetail: (ctx: Context, params: EdgePlayerParams) => Promise<SkaterShotLocationDetail>;
|
|
42
|
+
/**
|
|
43
|
+
* Get NHL EDGE skating distance details for a specific skater.
|
|
44
|
+
*
|
|
45
|
+
* @example await client.edge.skaterSkatingDistanceDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
46
|
+
*/
|
|
47
|
+
export declare const skaterSkatingDistanceDetail: (ctx: Context, params: EdgePlayerParams) => Promise<SkaterSkatingDistanceDetail>;
|
|
48
|
+
/**
|
|
49
|
+
* Get NHL EDGE comparison statistics for a specific skater.
|
|
50
|
+
*
|
|
51
|
+
* @example await client.edge.skaterComparison({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
52
|
+
*/
|
|
53
|
+
export declare const skaterComparison: (ctx: Context, params: EdgePlayerParams) => Promise<SkaterComparison>;
|
|
54
|
+
/**
|
|
55
|
+
* Get NHL EDGE zone time details for a specific skater.
|
|
56
|
+
*
|
|
57
|
+
* @example await client.edge.skaterZoneTime({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
58
|
+
*/
|
|
59
|
+
export declare const skaterZoneTime: (ctx: Context, params: EdgePlayerParams) => Promise<SkaterZoneTime>;
|
|
60
|
+
/**
|
|
61
|
+
* Get NHL EDGE skater landing page data.
|
|
62
|
+
*
|
|
63
|
+
* @example await client.edge.skaterLanding({ season: '20232024' })
|
|
64
|
+
*/
|
|
65
|
+
export declare const skaterLanding: (ctx: Context, params?: EdgeSeasonParams) => Promise<SkaterLanding>;
|
|
66
|
+
/**
|
|
67
|
+
* Get NHL CAT (Catch All Tracking) EDGE skater details.
|
|
68
|
+
*
|
|
69
|
+
* @example await client.edge.catSkaterDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
70
|
+
*/
|
|
71
|
+
export declare const catSkaterDetail: (ctx: Context, params: EdgePlayerParams) => Promise<CatSkaterDetail>;
|
|
72
|
+
/**
|
|
73
|
+
* Get NHL EDGE goalie detail statistics for a specific player.
|
|
74
|
+
*
|
|
75
|
+
* @example await client.edge.goalieDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
76
|
+
*/
|
|
77
|
+
export declare const goalieDetail: (ctx: Context, params: EdgePlayerParams) => Promise<GoalieDetail>;
|
|
78
|
+
/**
|
|
79
|
+
* Get NHL EDGE shot location details for a specific goalie.
|
|
80
|
+
*
|
|
81
|
+
* @example await client.edge.goalieShotLocationDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
82
|
+
*/
|
|
83
|
+
export declare const goalieShotLocationDetail: (ctx: Context, params: EdgePlayerParams) => Promise<GoalieShotLocationDetail>;
|
|
84
|
+
/**
|
|
85
|
+
* Get NHL EDGE 5v5 performance details for a specific goalie.
|
|
86
|
+
*
|
|
87
|
+
* @example await client.edge.goalie5v5Detail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
88
|
+
*/
|
|
89
|
+
export declare const goalie5v5Detail: (ctx: Context, params: EdgePlayerParams) => Promise<Goalie5v5Detail>;
|
|
90
|
+
/**
|
|
91
|
+
* Get NHL EDGE comparison statistics for a specific goalie.
|
|
92
|
+
*
|
|
93
|
+
* @example await client.edge.goalieComparison({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
94
|
+
*/
|
|
95
|
+
export declare const goalieComparison: (ctx: Context, params: EdgePlayerParams) => Promise<GoalieComparison>;
|
|
96
|
+
/**
|
|
97
|
+
* Get NHL EDGE save percentage details for a specific goalie.
|
|
98
|
+
*
|
|
99
|
+
* @example await client.edge.goalieSavePercentageDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
100
|
+
*/
|
|
101
|
+
export declare const goalieSavePercentageDetail: (ctx: Context, params: EdgePlayerParams) => Promise<GoalieSavePercentageDetail>;
|
|
102
|
+
/**
|
|
103
|
+
* Get NHL EDGE goalie landing page data.
|
|
104
|
+
*
|
|
105
|
+
* @example await client.edge.goalieLanding({ season: '20232024' })
|
|
106
|
+
*/
|
|
107
|
+
export declare const goalieLanding: (ctx: Context, params?: EdgeSeasonParams) => Promise<GoalieLanding>;
|
|
108
|
+
/**
|
|
109
|
+
* Get NHL CAT (Catch All Tracking) EDGE goalie details.
|
|
110
|
+
*
|
|
111
|
+
* @example await client.edge.catGoalieDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
112
|
+
*/
|
|
113
|
+
export declare const catGoalieDetail: (ctx: Context, params: EdgePlayerParams) => Promise<CatGoalieDetail>;
|
|
114
|
+
/**
|
|
115
|
+
* Get NHL EDGE team detail statistics for a specific team.
|
|
116
|
+
*
|
|
117
|
+
* @example await client.edge.teamDetail({ teamId: 10 })
|
|
118
|
+
*/
|
|
119
|
+
export declare const teamDetail: (ctx: Context, params: EdgeTeamParams) => Promise<TeamDetail>;
|
|
120
|
+
/**
|
|
121
|
+
* Get NHL EDGE skating distance details for a specific team.
|
|
122
|
+
*
|
|
123
|
+
* @example await client.edge.teamSkatingDistanceDetail({ teamId: 10 })
|
|
124
|
+
*/
|
|
125
|
+
export declare const teamSkatingDistanceDetail: (ctx: Context, params: EdgeTeamParams) => Promise<TeamSkatingDistanceDetail>;
|
|
126
|
+
/**
|
|
127
|
+
* Get NHL EDGE zone time details for a specific team.
|
|
128
|
+
*
|
|
129
|
+
* @example await client.edge.teamZoneTimeDetails({ teamId: 10 })
|
|
130
|
+
*/
|
|
131
|
+
export declare const teamZoneTimeDetails: (ctx: Context, params: EdgeTeamParams) => Promise<TeamZoneTimeDetails>;
|
|
132
|
+
/**
|
|
133
|
+
* Get NHL EDGE shot location details for a specific team.
|
|
134
|
+
*
|
|
135
|
+
* @example await client.edge.teamShotLocationDetail({ teamId: 10 })
|
|
136
|
+
*/
|
|
137
|
+
export declare const teamShotLocationDetail: (ctx: Context, params: EdgeTeamParams) => Promise<TeamShotLocationDetail>;
|
|
138
|
+
/**
|
|
139
|
+
* Get NHL EDGE team landing page data.
|
|
140
|
+
*
|
|
141
|
+
* @example await client.edge.teamLanding({ season: '20232024' })
|
|
142
|
+
*/
|
|
143
|
+
export declare const teamLanding: (ctx: Context, params?: EdgeSeasonParams) => Promise<TeamLanding>;
|
|
144
|
+
/**
|
|
145
|
+
* Get NHL EDGE shot speed details for a specific team.
|
|
146
|
+
*
|
|
147
|
+
* @example await client.edge.teamShotSpeedDetail({ teamId: 10 })
|
|
148
|
+
*/
|
|
149
|
+
export declare const teamShotSpeedDetail: (ctx: Context, params: EdgeTeamParams) => Promise<TeamShotSpeedDetail>;
|
|
150
|
+
/**
|
|
151
|
+
* Get NHL EDGE skating speed details for a specific team.
|
|
152
|
+
*
|
|
153
|
+
* @example await client.edge.teamSkatingSpeedDetail({ teamId: 10 })
|
|
154
|
+
*/
|
|
155
|
+
export declare const teamSkatingSpeedDetail: (ctx: Context, params: EdgeTeamParams) => Promise<TeamSkatingSpeedDetail>;
|
|
156
|
+
export declare const edgeApi: {
|
|
157
|
+
readonly skaterDetail: typeof skaterDetail;
|
|
158
|
+
readonly skaterShotSpeedDetail: typeof skaterShotSpeedDetail;
|
|
159
|
+
readonly skaterSkatingSpeedDetail: typeof skaterSkatingSpeedDetail;
|
|
160
|
+
readonly skaterShotLocationDetail: typeof skaterShotLocationDetail;
|
|
161
|
+
readonly skaterSkatingDistanceDetail: typeof skaterSkatingDistanceDetail;
|
|
162
|
+
readonly skaterComparison: typeof skaterComparison;
|
|
163
|
+
readonly skaterZoneTime: typeof skaterZoneTime;
|
|
164
|
+
readonly skaterLanding: typeof skaterLanding;
|
|
165
|
+
readonly catSkaterDetail: typeof catSkaterDetail;
|
|
166
|
+
readonly goalieDetail: typeof goalieDetail;
|
|
167
|
+
readonly goalieShotLocationDetail: typeof goalieShotLocationDetail;
|
|
168
|
+
readonly goalie5v5Detail: typeof goalie5v5Detail;
|
|
169
|
+
readonly goalieComparison: typeof goalieComparison;
|
|
170
|
+
readonly goalieSavePercentageDetail: typeof goalieSavePercentageDetail;
|
|
171
|
+
readonly goalieLanding: typeof goalieLanding;
|
|
172
|
+
readonly catGoalieDetail: typeof catGoalieDetail;
|
|
173
|
+
readonly teamDetail: typeof teamDetail;
|
|
174
|
+
readonly teamSkatingDistanceDetail: typeof teamSkatingDistanceDetail;
|
|
175
|
+
readonly teamZoneTimeDetails: typeof teamZoneTimeDetails;
|
|
176
|
+
readonly teamShotLocationDetail: typeof teamShotLocationDetail;
|
|
177
|
+
readonly teamLanding: typeof teamLanding;
|
|
178
|
+
readonly teamShotSpeedDetail: typeof teamShotSpeedDetail;
|
|
179
|
+
readonly teamSkatingSpeedDetail: typeof teamSkatingSpeedDetail;
|
|
180
|
+
};
|