nhl-api-ts 0.2.0 → 0.2.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 +9 -4
- package/dist/api/edge.d.mts +23 -23
- package/dist/api/edge.mjs +69 -23
- package/dist/api/game-center.d.mts +14 -14
- package/dist/api/game-center.mjs +20 -8
- package/dist/api/helpers.d.mts +6 -6
- package/dist/api/helpers.mjs +6 -6
- package/dist/api/misc.d.mts +5 -5
- package/dist/api/misc.mjs +15 -5
- package/dist/api/players.d.mts +4 -4
- package/dist/api/players.mjs +6 -2
- package/dist/api/schedule.d.mts +18 -18
- package/dist/api/schedule.mjs +26 -14
- package/dist/api/standings.d.mts +3 -3
- package/dist/api/standings.mjs +4 -4
- package/dist/api/stats.d.mts +10 -10
- package/dist/api/stats.mjs +16 -12
- package/dist/api/teams.d.mts +5 -5
- package/dist/api/teams.mjs +10 -6
- package/dist/cli/colors.d.mts +2 -2
- package/dist/cli/colors.mjs +6 -2
- package/dist/cli/commands.mjs +36 -26
- package/dist/cli/run.mjs +7 -5
- package/dist/http-client.mjs +2 -2
- package/dist/nhl-client.d.mts +1 -1
- package/dist/nhl-client.mjs +8 -6
- package/dist/types/common.d.mts +0 -1
- package/dist/types/edge.d.mts +2 -2
- package/dist/types/game-center.d.mts +54 -111
- package/dist/types/players.d.mts +1 -2
- package/dist/types/schedule.d.mts +34 -62
- package/dist/types/standings.d.mts +1 -2
- package/dist/types/stats.d.mts +106 -110
- package/dist/utils.d.mts +1 -1
- package/dist/utils.mjs +3 -1
- package/package.json +7 -28
package/README.md
CHANGED
|
@@ -290,21 +290,26 @@ nhl-api-ts teams teams --compact | jq -r '.[].abbr'
|
|
|
290
290
|
|
|
291
291
|
## Development
|
|
292
292
|
|
|
293
|
+
This package lives in a pnpm workspace. Run these from the
|
|
294
|
+
[repository root](https://github.com/andrewangelle/nhl-api-ts):
|
|
295
|
+
|
|
293
296
|
```bash
|
|
294
297
|
pnpm install
|
|
295
298
|
pnpm test # node:test, runs the TypeScript sources directly
|
|
296
299
|
pnpm typecheck
|
|
297
300
|
pnpm lint:check
|
|
298
|
-
pnpm build # emits dist/
|
|
301
|
+
pnpm build # emits packages/nhl-api-ts/dist/
|
|
299
302
|
```
|
|
300
303
|
|
|
301
|
-
See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
302
|
-
|
|
304
|
+
See [CONTRIBUTING.md](https://github.com/andrewangelle/nhl-api-ts/blob/main/CONTRIBUTING.md)
|
|
305
|
+
for the full set of checks, and
|
|
306
|
+
[AGENTS.md](https://github.com/andrewangelle/nhl-api-ts/blob/main/AGENTS.md) for
|
|
307
|
+
repository conventions.
|
|
303
308
|
|
|
304
309
|
Try the CLI from source:
|
|
305
310
|
|
|
306
311
|
```bash
|
|
307
|
-
node --conditions=source src/cli.mts --help
|
|
312
|
+
node --conditions=source packages/nhl-api-ts/src/cli.mts --help
|
|
308
313
|
```
|
|
309
314
|
|
|
310
315
|
## Credits
|
package/dist/api/edge.d.mts
CHANGED
|
@@ -20,139 +20,139 @@ export interface EdgeTeamParams extends EdgeSeasonParams {
|
|
|
20
20
|
*
|
|
21
21
|
* @example await client.edge.skaterDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
22
22
|
*/
|
|
23
|
-
export declare
|
|
23
|
+
export declare function skaterDetail(ctx: Context, params: EdgePlayerParams): Promise<SkaterDetail>;
|
|
24
24
|
/**
|
|
25
25
|
* Get NHL EDGE shot speed details for a specific skater.
|
|
26
26
|
*
|
|
27
27
|
* @example await client.edge.skaterShotSpeedDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
28
28
|
*/
|
|
29
|
-
export declare
|
|
29
|
+
export declare function skaterShotSpeedDetail(ctx: Context, params: EdgePlayerParams): Promise<SkaterShotSpeedDetail>;
|
|
30
30
|
/**
|
|
31
31
|
* Get NHL EDGE skating speed details for a specific skater.
|
|
32
32
|
*
|
|
33
33
|
* @example await client.edge.skaterSkatingSpeedDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
34
34
|
*/
|
|
35
|
-
export declare
|
|
35
|
+
export declare function skaterSkatingSpeedDetail(ctx: Context, params: EdgePlayerParams): Promise<SkaterSkatingSpeedDetail>;
|
|
36
36
|
/**
|
|
37
37
|
* Get NHL EDGE shot location details for a specific skater.
|
|
38
38
|
*
|
|
39
39
|
* @example await client.edge.skaterShotLocationDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
40
40
|
*/
|
|
41
|
-
export declare
|
|
41
|
+
export declare function skaterShotLocationDetail(ctx: Context, params: EdgePlayerParams): Promise<SkaterShotLocationDetail>;
|
|
42
42
|
/**
|
|
43
43
|
* Get NHL EDGE skating distance details for a specific skater.
|
|
44
44
|
*
|
|
45
45
|
* @example await client.edge.skaterSkatingDistanceDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
46
46
|
*/
|
|
47
|
-
export declare
|
|
47
|
+
export declare function skaterSkatingDistanceDetail(ctx: Context, params: EdgePlayerParams): Promise<SkaterSkatingDistanceDetail>;
|
|
48
48
|
/**
|
|
49
49
|
* Get NHL EDGE comparison statistics for a specific skater.
|
|
50
50
|
*
|
|
51
51
|
* @example await client.edge.skaterComparison({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
52
52
|
*/
|
|
53
|
-
export declare
|
|
53
|
+
export declare function skaterComparison(ctx: Context, params: EdgePlayerParams): Promise<SkaterComparison>;
|
|
54
54
|
/**
|
|
55
55
|
* Get NHL EDGE zone time details for a specific skater.
|
|
56
56
|
*
|
|
57
57
|
* @example await client.edge.skaterZoneTime({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
58
58
|
*/
|
|
59
|
-
export declare
|
|
59
|
+
export declare function skaterZoneTime(ctx: Context, params: EdgePlayerParams): Promise<SkaterZoneTime>;
|
|
60
60
|
/**
|
|
61
61
|
* Get NHL EDGE skater landing page data.
|
|
62
62
|
*
|
|
63
63
|
* @example await client.edge.skaterLanding({ season: '20232024' })
|
|
64
64
|
*/
|
|
65
|
-
export declare
|
|
65
|
+
export declare function skaterLanding(ctx: Context, params?: EdgeSeasonParams): Promise<SkaterLanding>;
|
|
66
66
|
/**
|
|
67
67
|
* Get NHL CAT (Catch All Tracking) EDGE skater details.
|
|
68
68
|
*
|
|
69
69
|
* @example await client.edge.catSkaterDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
70
70
|
*/
|
|
71
|
-
export declare
|
|
71
|
+
export declare function catSkaterDetail(ctx: Context, params: EdgePlayerParams): Promise<CatSkaterDetail>;
|
|
72
72
|
/**
|
|
73
73
|
* Get NHL EDGE goalie detail statistics for a specific player.
|
|
74
74
|
*
|
|
75
75
|
* @example await client.edge.goalieDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
76
76
|
*/
|
|
77
|
-
export declare
|
|
77
|
+
export declare function goalieDetail(ctx: Context, params: EdgePlayerParams): Promise<GoalieDetail>;
|
|
78
78
|
/**
|
|
79
79
|
* Get NHL EDGE shot location details for a specific goalie.
|
|
80
80
|
*
|
|
81
81
|
* @example await client.edge.goalieShotLocationDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
82
82
|
*/
|
|
83
|
-
export declare
|
|
83
|
+
export declare function goalieShotLocationDetail(ctx: Context, params: EdgePlayerParams): Promise<GoalieShotLocationDetail>;
|
|
84
84
|
/**
|
|
85
85
|
* Get NHL EDGE 5v5 performance details for a specific goalie.
|
|
86
86
|
*
|
|
87
87
|
* @example await client.edge.goalie5v5Detail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
88
88
|
*/
|
|
89
|
-
export declare
|
|
89
|
+
export declare function goalie5v5Detail(ctx: Context, params: EdgePlayerParams): Promise<Goalie5v5Detail>;
|
|
90
90
|
/**
|
|
91
91
|
* Get NHL EDGE comparison statistics for a specific goalie.
|
|
92
92
|
*
|
|
93
93
|
* @example await client.edge.goalieComparison({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
94
94
|
*/
|
|
95
|
-
export declare
|
|
95
|
+
export declare function goalieComparison(ctx: Context, params: EdgePlayerParams): Promise<GoalieComparison>;
|
|
96
96
|
/**
|
|
97
97
|
* Get NHL EDGE save percentage details for a specific goalie.
|
|
98
98
|
*
|
|
99
99
|
* @example await client.edge.goalieSavePercentageDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
100
100
|
*/
|
|
101
|
-
export declare
|
|
101
|
+
export declare function goalieSavePercentageDetail(ctx: Context, params: EdgePlayerParams): Promise<GoalieSavePercentageDetail>;
|
|
102
102
|
/**
|
|
103
103
|
* Get NHL EDGE goalie landing page data.
|
|
104
104
|
*
|
|
105
105
|
* @example await client.edge.goalieLanding({ season: '20232024' })
|
|
106
106
|
*/
|
|
107
|
-
export declare
|
|
107
|
+
export declare function goalieLanding(ctx: Context, params?: EdgeSeasonParams): Promise<GoalieLanding>;
|
|
108
108
|
/**
|
|
109
109
|
* Get NHL CAT (Catch All Tracking) EDGE goalie details.
|
|
110
110
|
*
|
|
111
111
|
* @example await client.edge.catGoalieDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
112
112
|
*/
|
|
113
|
-
export declare
|
|
113
|
+
export declare function catGoalieDetail(ctx: Context, params: EdgePlayerParams): Promise<CatGoalieDetail>;
|
|
114
114
|
/**
|
|
115
115
|
* Get NHL EDGE team detail statistics for a specific team.
|
|
116
116
|
*
|
|
117
117
|
* @example await client.edge.teamDetail({ teamId: 10 })
|
|
118
118
|
*/
|
|
119
|
-
export declare
|
|
119
|
+
export declare function teamDetail(ctx: Context, params: EdgeTeamParams): Promise<TeamDetail>;
|
|
120
120
|
/**
|
|
121
121
|
* Get NHL EDGE skating distance details for a specific team.
|
|
122
122
|
*
|
|
123
123
|
* @example await client.edge.teamSkatingDistanceDetail({ teamId: 10 })
|
|
124
124
|
*/
|
|
125
|
-
export declare
|
|
125
|
+
export declare function teamSkatingDistanceDetail(ctx: Context, params: EdgeTeamParams): Promise<TeamSkatingDistanceDetail>;
|
|
126
126
|
/**
|
|
127
127
|
* Get NHL EDGE zone time details for a specific team.
|
|
128
128
|
*
|
|
129
129
|
* @example await client.edge.teamZoneTimeDetails({ teamId: 10 })
|
|
130
130
|
*/
|
|
131
|
-
export declare
|
|
131
|
+
export declare function teamZoneTimeDetails(ctx: Context, params: EdgeTeamParams): Promise<TeamZoneTimeDetails>;
|
|
132
132
|
/**
|
|
133
133
|
* Get NHL EDGE shot location details for a specific team.
|
|
134
134
|
*
|
|
135
135
|
* @example await client.edge.teamShotLocationDetail({ teamId: 10 })
|
|
136
136
|
*/
|
|
137
|
-
export declare
|
|
137
|
+
export declare function teamShotLocationDetail(ctx: Context, params: EdgeTeamParams): Promise<TeamShotLocationDetail>;
|
|
138
138
|
/**
|
|
139
139
|
* Get NHL EDGE team landing page data.
|
|
140
140
|
*
|
|
141
141
|
* @example await client.edge.teamLanding({ season: '20232024' })
|
|
142
142
|
*/
|
|
143
|
-
export declare
|
|
143
|
+
export declare function teamLanding(ctx: Context, params?: EdgeSeasonParams): Promise<TeamLanding>;
|
|
144
144
|
/**
|
|
145
145
|
* Get NHL EDGE shot speed details for a specific team.
|
|
146
146
|
*
|
|
147
147
|
* @example await client.edge.teamShotSpeedDetail({ teamId: 10 })
|
|
148
148
|
*/
|
|
149
|
-
export declare
|
|
149
|
+
export declare function teamShotSpeedDetail(ctx: Context, params: EdgeTeamParams): Promise<TeamShotSpeedDetail>;
|
|
150
150
|
/**
|
|
151
151
|
* Get NHL EDGE skating speed details for a specific team.
|
|
152
152
|
*
|
|
153
153
|
* @example await client.edge.teamSkatingSpeedDetail({ teamId: 10 })
|
|
154
154
|
*/
|
|
155
|
-
export declare
|
|
155
|
+
export declare function teamSkatingSpeedDetail(ctx: Context, params: EdgeTeamParams): Promise<TeamSkatingSpeedDetail>;
|
|
156
156
|
export declare const edgeApi: {
|
|
157
157
|
readonly skaterDetail: typeof skaterDetail;
|
|
158
158
|
readonly skaterShotSpeedDetail: typeof skaterShotSpeedDetail;
|
package/dist/api/edge.mjs
CHANGED
|
@@ -18,55 +18,73 @@ async function getEdge(ctx, path, id, params) {
|
|
|
18
18
|
*
|
|
19
19
|
* @example await client.edge.skaterDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
20
20
|
*/
|
|
21
|
-
export
|
|
21
|
+
export async function skaterDetail(ctx, params) {
|
|
22
|
+
return getEdge(ctx, 'edge/skater-detail', params.playerId, params);
|
|
23
|
+
}
|
|
22
24
|
/**
|
|
23
25
|
* Get NHL EDGE shot speed details for a specific skater.
|
|
24
26
|
*
|
|
25
27
|
* @example await client.edge.skaterShotSpeedDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
26
28
|
*/
|
|
27
|
-
export
|
|
29
|
+
export async function skaterShotSpeedDetail(ctx, params) {
|
|
30
|
+
return getEdge(ctx, 'edge/skater-shot-speed-detail', params.playerId, params);
|
|
31
|
+
}
|
|
28
32
|
/**
|
|
29
33
|
* Get NHL EDGE skating speed details for a specific skater.
|
|
30
34
|
*
|
|
31
35
|
* @example await client.edge.skaterSkatingSpeedDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
32
36
|
*/
|
|
33
|
-
export
|
|
37
|
+
export async function skaterSkatingSpeedDetail(ctx, params) {
|
|
38
|
+
return getEdge(ctx, 'edge/skater-skating-speed-detail', params.playerId, params);
|
|
39
|
+
}
|
|
34
40
|
/**
|
|
35
41
|
* Get NHL EDGE shot location details for a specific skater.
|
|
36
42
|
*
|
|
37
43
|
* @example await client.edge.skaterShotLocationDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
38
44
|
*/
|
|
39
|
-
export
|
|
45
|
+
export async function skaterShotLocationDetail(ctx, params) {
|
|
46
|
+
return getEdge(ctx, 'edge/skater-shot-location-detail', params.playerId, params);
|
|
47
|
+
}
|
|
40
48
|
/**
|
|
41
49
|
* Get NHL EDGE skating distance details for a specific skater.
|
|
42
50
|
*
|
|
43
51
|
* @example await client.edge.skaterSkatingDistanceDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
44
52
|
*/
|
|
45
|
-
export
|
|
53
|
+
export async function skaterSkatingDistanceDetail(ctx, params) {
|
|
54
|
+
return getEdge(ctx, 'edge/skater-skating-distance-detail', params.playerId, params);
|
|
55
|
+
}
|
|
46
56
|
/**
|
|
47
57
|
* Get NHL EDGE comparison statistics for a specific skater.
|
|
48
58
|
*
|
|
49
59
|
* @example await client.edge.skaterComparison({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
50
60
|
*/
|
|
51
|
-
export
|
|
61
|
+
export async function skaterComparison(ctx, params) {
|
|
62
|
+
return getEdge(ctx, 'edge/skater-comparison', params.playerId, params);
|
|
63
|
+
}
|
|
52
64
|
/**
|
|
53
65
|
* Get NHL EDGE zone time details for a specific skater.
|
|
54
66
|
*
|
|
55
67
|
* @example await client.edge.skaterZoneTime({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
56
68
|
*/
|
|
57
|
-
export
|
|
69
|
+
export async function skaterZoneTime(ctx, params) {
|
|
70
|
+
return getEdge(ctx, 'edge/skater-zone-time', params.playerId, params);
|
|
71
|
+
}
|
|
58
72
|
/**
|
|
59
73
|
* Get NHL EDGE skater landing page data.
|
|
60
74
|
*
|
|
61
75
|
* @example await client.edge.skaterLanding({ season: '20232024' })
|
|
62
76
|
*/
|
|
63
|
-
export
|
|
77
|
+
export async function skaterLanding(ctx, params = {}) {
|
|
78
|
+
return getEdge(ctx, 'edge/skater-landing', undefined, params);
|
|
79
|
+
}
|
|
64
80
|
/**
|
|
65
81
|
* Get NHL CAT (Catch All Tracking) EDGE skater details.
|
|
66
82
|
*
|
|
67
83
|
* @example await client.edge.catSkaterDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
68
84
|
*/
|
|
69
|
-
export
|
|
85
|
+
export async function catSkaterDetail(ctx, params) {
|
|
86
|
+
return getEdge(ctx, 'cat/edge/skater-detail', params.playerId, params);
|
|
87
|
+
}
|
|
70
88
|
// ========================
|
|
71
89
|
// GOALIE ENDPOINTS
|
|
72
90
|
// ========================
|
|
@@ -75,43 +93,57 @@ export const catSkaterDetail = async (ctx, params) => getEdge(ctx, 'cat/edge/ska
|
|
|
75
93
|
*
|
|
76
94
|
* @example await client.edge.goalieDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
77
95
|
*/
|
|
78
|
-
export
|
|
96
|
+
export async function goalieDetail(ctx, params) {
|
|
97
|
+
return getEdge(ctx, 'edge/goalie-detail', params.playerId, params);
|
|
98
|
+
}
|
|
79
99
|
/**
|
|
80
100
|
* Get NHL EDGE shot location details for a specific goalie.
|
|
81
101
|
*
|
|
82
102
|
* @example await client.edge.goalieShotLocationDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
83
103
|
*/
|
|
84
|
-
export
|
|
104
|
+
export async function goalieShotLocationDetail(ctx, params) {
|
|
105
|
+
return getEdge(ctx, 'edge/goalie-shot-location-detail', params.playerId, params);
|
|
106
|
+
}
|
|
85
107
|
/**
|
|
86
108
|
* Get NHL EDGE 5v5 performance details for a specific goalie.
|
|
87
109
|
*
|
|
88
110
|
* @example await client.edge.goalie5v5Detail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
89
111
|
*/
|
|
90
|
-
export
|
|
112
|
+
export async function goalie5v5Detail(ctx, params) {
|
|
113
|
+
return getEdge(ctx, 'edge/goalie-5v5-detail', params.playerId, params);
|
|
114
|
+
}
|
|
91
115
|
/**
|
|
92
116
|
* Get NHL EDGE comparison statistics for a specific goalie.
|
|
93
117
|
*
|
|
94
118
|
* @example await client.edge.goalieComparison({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
95
119
|
*/
|
|
96
|
-
export
|
|
120
|
+
export async function goalieComparison(ctx, params) {
|
|
121
|
+
return getEdge(ctx, 'edge/goalie-comparison', params.playerId, params);
|
|
122
|
+
}
|
|
97
123
|
/**
|
|
98
124
|
* Get NHL EDGE save percentage details for a specific goalie.
|
|
99
125
|
*
|
|
100
126
|
* @example await client.edge.goalieSavePercentageDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
101
127
|
*/
|
|
102
|
-
export
|
|
128
|
+
export async function goalieSavePercentageDetail(ctx, params) {
|
|
129
|
+
return getEdge(ctx, 'edge/goalie-save-percentage-detail', params.playerId, params);
|
|
130
|
+
}
|
|
103
131
|
/**
|
|
104
132
|
* Get NHL EDGE goalie landing page data.
|
|
105
133
|
*
|
|
106
134
|
* @example await client.edge.goalieLanding({ season: '20232024' })
|
|
107
135
|
*/
|
|
108
|
-
export
|
|
136
|
+
export async function goalieLanding(ctx, params = {}) {
|
|
137
|
+
return getEdge(ctx, 'edge/goalie-landing', undefined, params);
|
|
138
|
+
}
|
|
109
139
|
/**
|
|
110
140
|
* Get NHL CAT (Catch All Tracking) EDGE goalie details.
|
|
111
141
|
*
|
|
112
142
|
* @example await client.edge.catGoalieDetail({ playerId: 8478402, season: '20232024', gameType: 2 })
|
|
113
143
|
*/
|
|
114
|
-
export
|
|
144
|
+
export async function catGoalieDetail(ctx, params) {
|
|
145
|
+
return getEdge(ctx, 'cat/edge/goalie-detail', params.playerId, params);
|
|
146
|
+
}
|
|
115
147
|
// ========================
|
|
116
148
|
// TEAM ENDPOINTS
|
|
117
149
|
// ========================
|
|
@@ -120,43 +152,57 @@ export const catGoalieDetail = async (ctx, params) => getEdge(ctx, 'cat/edge/goa
|
|
|
120
152
|
*
|
|
121
153
|
* @example await client.edge.teamDetail({ teamId: 10 })
|
|
122
154
|
*/
|
|
123
|
-
export
|
|
155
|
+
export async function teamDetail(ctx, params) {
|
|
156
|
+
return getEdge(ctx, 'edge/team-detail', params.teamId, params);
|
|
157
|
+
}
|
|
124
158
|
/**
|
|
125
159
|
* Get NHL EDGE skating distance details for a specific team.
|
|
126
160
|
*
|
|
127
161
|
* @example await client.edge.teamSkatingDistanceDetail({ teamId: 10 })
|
|
128
162
|
*/
|
|
129
|
-
export
|
|
163
|
+
export async function teamSkatingDistanceDetail(ctx, params) {
|
|
164
|
+
return getEdge(ctx, 'edge/team-skating-distance-detail', params.teamId, params);
|
|
165
|
+
}
|
|
130
166
|
/**
|
|
131
167
|
* Get NHL EDGE zone time details for a specific team.
|
|
132
168
|
*
|
|
133
169
|
* @example await client.edge.teamZoneTimeDetails({ teamId: 10 })
|
|
134
170
|
*/
|
|
135
|
-
export
|
|
171
|
+
export async function teamZoneTimeDetails(ctx, params) {
|
|
172
|
+
return getEdge(ctx, 'edge/team-zone-time-details', params.teamId, params);
|
|
173
|
+
}
|
|
136
174
|
/**
|
|
137
175
|
* Get NHL EDGE shot location details for a specific team.
|
|
138
176
|
*
|
|
139
177
|
* @example await client.edge.teamShotLocationDetail({ teamId: 10 })
|
|
140
178
|
*/
|
|
141
|
-
export
|
|
179
|
+
export async function teamShotLocationDetail(ctx, params) {
|
|
180
|
+
return getEdge(ctx, 'edge/team-shot-location-detail', params.teamId, params);
|
|
181
|
+
}
|
|
142
182
|
/**
|
|
143
183
|
* Get NHL EDGE team landing page data.
|
|
144
184
|
*
|
|
145
185
|
* @example await client.edge.teamLanding({ season: '20232024' })
|
|
146
186
|
*/
|
|
147
|
-
export
|
|
187
|
+
export async function teamLanding(ctx, params = {}) {
|
|
188
|
+
return getEdge(ctx, 'edge/team-landing', undefined, params);
|
|
189
|
+
}
|
|
148
190
|
/**
|
|
149
191
|
* Get NHL EDGE shot speed details for a specific team.
|
|
150
192
|
*
|
|
151
193
|
* @example await client.edge.teamShotSpeedDetail({ teamId: 10 })
|
|
152
194
|
*/
|
|
153
|
-
export
|
|
195
|
+
export async function teamShotSpeedDetail(ctx, params) {
|
|
196
|
+
return getEdge(ctx, 'edge/team-shot-speed-detail', params.teamId, params);
|
|
197
|
+
}
|
|
154
198
|
/**
|
|
155
199
|
* Get NHL EDGE skating speed details for a specific team.
|
|
156
200
|
*
|
|
157
201
|
* @example await client.edge.teamSkatingSpeedDetail({ teamId: 10 })
|
|
158
202
|
*/
|
|
159
|
-
export
|
|
203
|
+
export async function teamSkatingSpeedDetail(ctx, params) {
|
|
204
|
+
return getEdge(ctx, 'edge/team-skating-speed-detail', params.teamId, params);
|
|
205
|
+
}
|
|
160
206
|
export const edgeApi = {
|
|
161
207
|
skaterDetail,
|
|
162
208
|
skaterShotSpeedDetail,
|
|
@@ -8,9 +8,9 @@ import type { Id } from '#src/utils.mjs';
|
|
|
8
8
|
* @param params.gameId Game id, e.g. 2023020280
|
|
9
9
|
* @example https://api-web.nhle.com/v1/gamecenter/2023020280/boxscore
|
|
10
10
|
*/
|
|
11
|
-
export declare
|
|
11
|
+
export declare function boxscore(ctx: Context, { gameId }: {
|
|
12
12
|
gameId: Id;
|
|
13
|
-
})
|
|
13
|
+
}): Promise<Boxscore>;
|
|
14
14
|
/**
|
|
15
15
|
* Get the full play-by-play feed for a specific NHL game, containing every
|
|
16
16
|
* recorded event (shots, hits, faceoffs, goals, penalties...).
|
|
@@ -18,9 +18,9 @@ export declare const boxscore: (ctx: Context, { gameId }: {
|
|
|
18
18
|
* @param params.gameId Game id, e.g. 2023020280
|
|
19
19
|
* @example https://api-web.nhle.com/v1/gamecenter/2023020280/play-by-play
|
|
20
20
|
*/
|
|
21
|
-
export declare
|
|
21
|
+
export declare function playByPlay(ctx: Context, { gameId }: {
|
|
22
22
|
gameId: Id;
|
|
23
|
-
})
|
|
23
|
+
}): Promise<PlayByPlay>;
|
|
24
24
|
/**
|
|
25
25
|
* Get the landing-page summary for a specific NHL game, including scoring by
|
|
26
26
|
* period, three stars and penalties.
|
|
@@ -28,9 +28,9 @@ export declare const playByPlay: (ctx: Context, { gameId }: {
|
|
|
28
28
|
* @param params.gameId Game id, e.g. 2023020280
|
|
29
29
|
* @example https://api-web.nhle.com/v1/gamecenter/2023020280/landing
|
|
30
30
|
*/
|
|
31
|
-
export declare
|
|
31
|
+
export declare function matchUp(ctx: Context, { gameId }: {
|
|
32
32
|
gameId: Id;
|
|
33
|
-
})
|
|
33
|
+
}): Promise<GameLanding>;
|
|
34
34
|
/**
|
|
35
35
|
* Get scores and game states for all NHL games on a given date. Returns the
|
|
36
36
|
* current day's scores when no date is supplied.
|
|
@@ -38,9 +38,9 @@ export declare const matchUp: (ctx: Context, { gameId }: {
|
|
|
38
38
|
* @param params.date Date in YYYY-MM-DD format. Defaults to "now".
|
|
39
39
|
* @example https://api-web.nhle.com/v1/score/2023-10-15
|
|
40
40
|
*/
|
|
41
|
-
export declare
|
|
41
|
+
export declare function dailyScores(ctx: Context, { date }?: {
|
|
42
42
|
date?: string;
|
|
43
|
-
})
|
|
43
|
+
}): Promise<DailyScores>;
|
|
44
44
|
/**
|
|
45
45
|
* Get individual player shift data for a specific game, including start/end
|
|
46
46
|
* times and durations.
|
|
@@ -49,10 +49,10 @@ export declare const dailyScores: (ctx: Context, { date }?: {
|
|
|
49
49
|
* @param params.excludes Fields to exclude from the response. Defaults to ["eventDetails"].
|
|
50
50
|
* @example https://api.nhle.com/stats/rest/en/shiftcharts?cayenneExp=gameId=2023020280 and ...
|
|
51
51
|
*/
|
|
52
|
-
export declare
|
|
52
|
+
export declare function shiftChartData(ctx: Context, { gameId, excludes }: {
|
|
53
53
|
gameId: Id;
|
|
54
54
|
excludes?: string[];
|
|
55
|
-
})
|
|
55
|
+
}): Promise<ShiftChart>;
|
|
56
56
|
/**
|
|
57
57
|
* Get the season-series record and contextual stats for a specific game,
|
|
58
58
|
* including team season stats and last games.
|
|
@@ -60,9 +60,9 @@ export declare const shiftChartData: (ctx: Context, { gameId, excludes }: {
|
|
|
60
60
|
* @param params.gameId Game id, e.g. 2023020280
|
|
61
61
|
* @example https://api-web.nhle.com/v1/gamecenter/2023020280/right-rail
|
|
62
62
|
*/
|
|
63
|
-
export declare
|
|
63
|
+
export declare function seasonSeriesMatchup(ctx: Context, { gameId }: {
|
|
64
64
|
gameId: Id;
|
|
65
|
-
})
|
|
65
|
+
}): Promise<RightRail>;
|
|
66
66
|
/**
|
|
67
67
|
* Get the narrative game story for a specific game, including scoring
|
|
68
68
|
* summaries, three stars and team game stats.
|
|
@@ -70,9 +70,9 @@ export declare const seasonSeriesMatchup: (ctx: Context, { gameId }: {
|
|
|
70
70
|
* @param params.gameId Game id, e.g. 2023020280
|
|
71
71
|
* @example https://api-web.nhle.com/v1/wsc/game-story/2023020280
|
|
72
72
|
*/
|
|
73
|
-
export declare
|
|
73
|
+
export declare function gameStory(ctx: Context, { gameId }: {
|
|
74
74
|
gameId: Id;
|
|
75
|
-
})
|
|
75
|
+
}): Promise<GameStory>;
|
|
76
76
|
export declare const gameCenterApi: {
|
|
77
77
|
readonly boxscore: typeof boxscore;
|
|
78
78
|
readonly playByPlay: typeof playByPlay;
|
package/dist/api/game-center.mjs
CHANGED
|
@@ -9,7 +9,9 @@ async function getWeb(ctx, resource) {
|
|
|
9
9
|
* @param params.gameId Game id, e.g. 2023020280
|
|
10
10
|
* @example https://api-web.nhle.com/v1/gamecenter/2023020280/boxscore
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export async function boxscore(ctx, { gameId }) {
|
|
13
|
+
return getWeb(ctx, `gamecenter/${gameId}/boxscore`);
|
|
14
|
+
}
|
|
13
15
|
/**
|
|
14
16
|
* Get the full play-by-play feed for a specific NHL game, containing every
|
|
15
17
|
* recorded event (shots, hits, faceoffs, goals, penalties...).
|
|
@@ -17,7 +19,9 @@ export const boxscore = async (ctx, { gameId }) => getWeb(ctx, `gamecenter/${gam
|
|
|
17
19
|
* @param params.gameId Game id, e.g. 2023020280
|
|
18
20
|
* @example https://api-web.nhle.com/v1/gamecenter/2023020280/play-by-play
|
|
19
21
|
*/
|
|
20
|
-
export
|
|
22
|
+
export async function playByPlay(ctx, { gameId }) {
|
|
23
|
+
return getWeb(ctx, `gamecenter/${gameId}/play-by-play`);
|
|
24
|
+
}
|
|
21
25
|
/**
|
|
22
26
|
* Get the landing-page summary for a specific NHL game, including scoring by
|
|
23
27
|
* period, three stars and penalties.
|
|
@@ -25,7 +29,9 @@ export const playByPlay = async (ctx, { gameId }) => getWeb(ctx, `gamecenter/${g
|
|
|
25
29
|
* @param params.gameId Game id, e.g. 2023020280
|
|
26
30
|
* @example https://api-web.nhle.com/v1/gamecenter/2023020280/landing
|
|
27
31
|
*/
|
|
28
|
-
export
|
|
32
|
+
export async function matchUp(ctx, { gameId }) {
|
|
33
|
+
return getWeb(ctx, `gamecenter/${gameId}/landing`);
|
|
34
|
+
}
|
|
29
35
|
/**
|
|
30
36
|
* Get scores and game states for all NHL games on a given date. Returns the
|
|
31
37
|
* current day's scores when no date is supplied.
|
|
@@ -33,7 +39,9 @@ export const matchUp = async (ctx, { gameId }) => getWeb(ctx, `gamecenter/${game
|
|
|
33
39
|
* @param params.date Date in YYYY-MM-DD format. Defaults to "now".
|
|
34
40
|
* @example https://api-web.nhle.com/v1/score/2023-10-15
|
|
35
41
|
*/
|
|
36
|
-
export
|
|
42
|
+
export async function dailyScores(ctx, { date } = {}) {
|
|
43
|
+
return getWeb(ctx, `score/${date ? date : 'now'}`);
|
|
44
|
+
}
|
|
37
45
|
/**
|
|
38
46
|
* Get individual player shift data for a specific game, including start/end
|
|
39
47
|
* times and durations.
|
|
@@ -42,11 +50,11 @@ export const dailyScores = async (ctx, { date } = {}) => getWeb(ctx, `score/${da
|
|
|
42
50
|
* @param params.excludes Fields to exclude from the response. Defaults to ["eventDetails"].
|
|
43
51
|
* @example https://api.nhle.com/stats/rest/en/shiftcharts?cayenneExp=gameId=2023020280 and ...
|
|
44
52
|
*/
|
|
45
|
-
export
|
|
53
|
+
export async function shiftChartData(ctx, { gameId, excludes = ['eventDetails'] }) {
|
|
46
54
|
const excludeP = excludes.join(',');
|
|
47
55
|
const exprP = `gameId=${gameId} and ((duration != '00:00' and typeCode = 517) or typeCode != 517 )`;
|
|
48
56
|
return (await ctx.get(Endpoint.API_STATS, `en/shiftcharts?cayenneExp=${exprP}&exclude=${excludeP}`)).json();
|
|
49
|
-
}
|
|
57
|
+
}
|
|
50
58
|
/**
|
|
51
59
|
* Get the season-series record and contextual stats for a specific game,
|
|
52
60
|
* including team season stats and last games.
|
|
@@ -54,7 +62,9 @@ export const shiftChartData = async (ctx, { gameId, excludes = ['eventDetails']
|
|
|
54
62
|
* @param params.gameId Game id, e.g. 2023020280
|
|
55
63
|
* @example https://api-web.nhle.com/v1/gamecenter/2023020280/right-rail
|
|
56
64
|
*/
|
|
57
|
-
export
|
|
65
|
+
export async function seasonSeriesMatchup(ctx, { gameId }) {
|
|
66
|
+
return getWeb(ctx, `gamecenter/${gameId}/right-rail`);
|
|
67
|
+
}
|
|
58
68
|
/**
|
|
59
69
|
* Get the narrative game story for a specific game, including scoring
|
|
60
70
|
* summaries, three stars and team game stats.
|
|
@@ -62,7 +72,9 @@ export const seasonSeriesMatchup = async (ctx, { gameId }) => getWeb(ctx, `gamec
|
|
|
62
72
|
* @param params.gameId Game id, e.g. 2023020280
|
|
63
73
|
* @example https://api-web.nhle.com/v1/wsc/game-story/2023020280
|
|
64
74
|
*/
|
|
65
|
-
export
|
|
75
|
+
export async function gameStory(ctx, { gameId }) {
|
|
76
|
+
return getWeb(ctx, `wsc/game-story/${gameId}`);
|
|
77
|
+
}
|
|
66
78
|
export const gameCenterApi = {
|
|
67
79
|
boxscore,
|
|
68
80
|
playByPlay,
|
package/dist/api/helpers.d.mts
CHANGED
|
@@ -10,11 +10,11 @@ import type { Id } from '#src/utils.mjs';
|
|
|
10
10
|
* @param params.apiSleepRate Seconds to sleep between team requests. Defaults to 1.
|
|
11
11
|
* @example await client.helpers.gameIdsBySeason({ season: '20232024', gameTypes: [2] })
|
|
12
12
|
*/
|
|
13
|
-
export declare
|
|
13
|
+
export declare function gameIdsBySeason(ctx: Context, { season, gameTypes, apiSleepRate, }: {
|
|
14
14
|
season: Id;
|
|
15
15
|
gameTypes?: number[];
|
|
16
16
|
apiSleepRate?: number;
|
|
17
|
-
})
|
|
17
|
+
}): Promise<number[]>;
|
|
18
18
|
/**
|
|
19
19
|
* Gets every rostered player across all NHL teams for a given season. Each
|
|
20
20
|
* player gets a `team` abbreviation and flattened `firstName` / `lastName`.
|
|
@@ -23,10 +23,10 @@ export declare const gameIdsBySeason: (ctx: Context, { season, gameTypes, apiSle
|
|
|
23
23
|
* @param params.apiSleepRate Seconds to sleep between team requests. Defaults to 0.5.
|
|
24
24
|
* @example await client.helpers.allPlayers({ season: '20232024' })
|
|
25
25
|
*/
|
|
26
|
-
export declare
|
|
26
|
+
export declare function allPlayers(ctx: Context, { season, apiSleepRate }: {
|
|
27
27
|
season: Id;
|
|
28
28
|
apiSleepRate?: number;
|
|
29
|
-
})
|
|
29
|
+
}): Promise<AllPlayersEntry[]>;
|
|
30
30
|
/**
|
|
31
31
|
* Gets summary statistics for every skater in a given season, merged with
|
|
32
32
|
* the roster info from `allPlayers` (stat fields win on key collisions).
|
|
@@ -36,10 +36,10 @@ export declare const allPlayers: (ctx: Context, { season, apiSleepRate }: {
|
|
|
36
36
|
* @param params.apiSleepRate Seconds to sleep between team requests. Defaults to 1.
|
|
37
37
|
* @example await client.helpers.allPlayersSummaryStatistics({ season: '20232024' })
|
|
38
38
|
*/
|
|
39
|
-
export declare
|
|
39
|
+
export declare function allPlayersSummaryStatistics(ctx: Context, { season, apiSleepRate }: {
|
|
40
40
|
season: Id;
|
|
41
41
|
apiSleepRate?: number;
|
|
42
|
-
})
|
|
42
|
+
}): Promise<PlayerSummaryStatistics[]>;
|
|
43
43
|
export declare const helpersApi: {
|
|
44
44
|
readonly gameIdsBySeason: typeof gameIdsBySeason;
|
|
45
45
|
readonly allPlayers: typeof allPlayers;
|