nhl-api-ts 0.2.1 → 0.3.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.
Files changed (40) hide show
  1. package/README.md +72 -5
  2. package/dist/api/draft.d.mts +61 -0
  3. package/dist/api/draft.mjs +68 -0
  4. package/dist/api/edge.d.mts +198 -1
  5. package/dist/api/edge.mjs +207 -4
  6. package/dist/api/game-center.d.mts +49 -1
  7. package/dist/api/game-center.mjs +47 -0
  8. package/dist/api/misc.d.mts +115 -1
  9. package/dist/api/misc.mjs +147 -2
  10. package/dist/api/players.d.mts +55 -3
  11. package/dist/api/players.mjs +80 -3
  12. package/dist/api/query/cayenne.d.mts +4 -0
  13. package/dist/api/query/cayenne.mjs +13 -0
  14. package/dist/api/query/sorting/sorting-options.d.mts +8 -0
  15. package/dist/api/query/sorting/sorting-options.mjs +30 -0
  16. package/dist/api/schedule.d.mts +19 -6
  17. package/dist/api/schedule.mjs +17 -5
  18. package/dist/api/stats.d.mts +95 -6
  19. package/dist/api/stats.mjs +130 -30
  20. package/dist/api/teams.d.mts +43 -3
  21. package/dist/api/teams.mjs +51 -3
  22. package/dist/cli/commands.mjs +487 -22
  23. package/dist/http-client.d.mts +2 -1
  24. package/dist/http-client.mjs +8 -1
  25. package/dist/index.d.mts +8 -2
  26. package/dist/index.mjs +3 -0
  27. package/dist/nhl-client.d.mts +69 -14
  28. package/dist/nhl-client.mjs +33 -12
  29. package/dist/types/draft.d.mts +97 -0
  30. package/dist/types/draft.mjs +1 -0
  31. package/dist/types/edge.d.mts +299 -3
  32. package/dist/types/game-center.d.mts +223 -8
  33. package/dist/types/index.d.mts +1 -0
  34. package/dist/types/misc.d.mts +101 -0
  35. package/dist/types/misc.mjs +0 -1
  36. package/dist/types/players.d.mts +22 -0
  37. package/dist/types/schedule.d.mts +16 -0
  38. package/dist/types/stats.d.mts +207 -1
  39. package/dist/types/teams.d.mts +29 -1
  40. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
+ import { type PositionTypes } from '#src/api/query/filters.mjs';
1
2
  import type { Context } from '#src/context.mjs';
2
- import type { Prospects, Roster } from '#src/types/index.mjs';
3
+ import type { PlayerSpotlight, Prospects, Roster, StatsApiPage, StatsPlayer } from '#src/types/index.mjs';
3
4
  import type { Id } from '#src/utils.mjs';
4
5
  /**
5
6
  * Gets prospects for a specific team, grouped by position.
@@ -15,14 +16,65 @@ export declare function prospectsByTeam(ctx: Context, { teamAbbr }: {
15
16
  * (forwards, defensemen, goalies). Same data as `teams.teamRoster`.
16
17
  *
17
18
  * @param params.teamAbbr Team abbreviation, e.g. BUF, TOR
18
- * @param params.season Season in YYYYYYYY format, e.g. 20232024
19
+ * @param params.season Season in YYYYYYYY format, e.g. 20232024. Defaults to
20
+ * the current season (`current`; this endpoint has no `now` alias).
19
21
  * @example https://api-web.nhle.com/v1/roster/BUF/20232024
20
22
  */
21
23
  export declare function playersByTeam(ctx: Context, { teamAbbr, season }: {
22
24
  teamAbbr: string;
23
- season: Id;
25
+ season?: Id;
24
26
  }): Promise<Roster>;
27
+ /**
28
+ * Gets the players featured in the nhl.com player spotlight.
29
+ *
30
+ * @example https://api-web.nhle.com/v1/player-spotlight
31
+ */
32
+ export declare function playerSpotlight(ctx: Context): Promise<PlayerSpotlight[]>;
33
+ export interface PlayerSearchParams {
34
+ /** Case-insensitive part of the full name, e.g. "matth" or "Ryan O'Reilly". */
35
+ name?: string;
36
+ /** NHL team id of the player's current team, e.g. 10. */
37
+ teamId?: Id;
38
+ /** Position. `F` matches every forward (C, L, R). */
39
+ position?: PositionTypes | 'G';
40
+ /**
41
+ * Extra filter expression, joined to the others with `and`. Only the row
42
+ * fields (`id`, `firstName`, `lastName`, `fullName`, `currentTeamId`,
43
+ * `positionCode`, `sweaterNumber`) can be filtered; anything else is a 400.
44
+ */
45
+ cayenneExp?: string;
46
+ /** Field to sort by, e.g. "lastName". */
47
+ sort?: string;
48
+ /** Sort direction for `sort`. */
49
+ dir?: 'ASC' | 'DESC';
50
+ /** Pagination offset. The API returns at most 5 rows per request. */
51
+ start?: number;
52
+ /** Only return these fields. Rows then hold just these keys. */
53
+ include?: readonly string[];
54
+ /** Leave out these fields. */
55
+ exclude?: readonly string[];
56
+ }
57
+ /**
58
+ * Searches every player on record, past and present. Returns the full page
59
+ * (`{ data, total }`): the API sends **at most 5 rows** per request, whatever
60
+ * the limit, so page with `start` until you have `total` rows.
61
+ *
62
+ * @param params.name Case-insensitive part of the full name, e.g. "matth"
63
+ * @param params.teamId NHL team id of the current team, e.g. 10
64
+ * @param params.position C, L, R, D, G, or F for every forward
65
+ * @param params.cayenneExp Extra filter expression, e.g. "sweaterNumber=34"
66
+ * @param params.sort Field to sort by, e.g. "lastName"
67
+ * @param params.dir ASC or DESC
68
+ * @param params.start Pagination offset
69
+ * @param params.include Only return these fields, e.g. ['id', 'fullName']
70
+ * @param params.exclude Leave out these fields
71
+ * @throws RangeError When no filter is given (the API would return no rows)
72
+ * @example await client.players.playerSearch({ name: 'matthews', position: 'C' })
73
+ */
74
+ export declare function playerSearch(ctx: Context, params: PlayerSearchParams): Promise<StatsApiPage<StatsPlayer>>;
25
75
  export declare const playersApi: {
26
76
  readonly prospectsByTeam: typeof prospectsByTeam;
27
77
  readonly playersByTeam: typeof playersByTeam;
78
+ readonly playerSpotlight: typeof playerSpotlight;
79
+ readonly playerSearch: typeof playerSearch;
28
80
  };
@@ -1,3 +1,5 @@
1
+ import { andClauses, cayenneString } from '#src/api/query/cayenne.mjs';
2
+ import { filter, toQuery, } from '#src/api/query/filters.mjs';
1
3
  import { Endpoint } from '#src/http-client.mjs';
2
4
  /**
3
5
  * Gets prospects for a specific team, grouped by position.
@@ -13,10 +15,85 @@ export async function prospectsByTeam(ctx, { teamAbbr }) {
13
15
  * (forwards, defensemen, goalies). Same data as `teams.teamRoster`.
14
16
  *
15
17
  * @param params.teamAbbr Team abbreviation, e.g. BUF, TOR
16
- * @param params.season Season in YYYYYYYY format, e.g. 20232024
18
+ * @param params.season Season in YYYYYYYY format, e.g. 20232024. Defaults to
19
+ * the current season (`current`; this endpoint has no `now` alias).
17
20
  * @example https://api-web.nhle.com/v1/roster/BUF/20232024
18
21
  */
19
22
  export async function playersByTeam(ctx, { teamAbbr, season }) {
20
- return (await ctx.get(Endpoint.API_WEB_V1, `roster/${teamAbbr}/${season}`)).json();
23
+ return (await ctx.get(Endpoint.API_WEB_V1, `roster/${teamAbbr}/${season ?? 'current'}`)).json();
21
24
  }
22
- export const playersApi = { prospectsByTeam, playersByTeam };
25
+ /**
26
+ * Gets the players featured in the nhl.com player spotlight.
27
+ *
28
+ * @example https://api-web.nhle.com/v1/player-spotlight
29
+ */
30
+ export async function playerSpotlight(ctx) {
31
+ return (await ctx.get(Endpoint.API_WEB_V1, 'player-spotlight')).json();
32
+ }
33
+ function playerSearchClauses({ name, teamId, position, cayenneExp, }) {
34
+ const clauses = [];
35
+ if (name?.trim()) {
36
+ clauses.push(`fullName likeIgnoreCase ${cayenneString(`%${name.trim()}%`)}`);
37
+ }
38
+ if (teamId !== undefined && teamId !== null) {
39
+ clauses.push(`currentTeamId=${teamId}`);
40
+ }
41
+ if (position !== undefined) {
42
+ clauses.push(position === 'G'
43
+ ? "positionCode='G'"
44
+ : toQuery(filter.position(position)));
45
+ }
46
+ if (cayenneExp?.trim()) {
47
+ clauses.push(cayenneExp);
48
+ }
49
+ return clauses;
50
+ }
51
+ /**
52
+ * Searches every player on record, past and present. Returns the full page
53
+ * (`{ data, total }`): the API sends **at most 5 rows** per request, whatever
54
+ * the limit, so page with `start` until you have `total` rows.
55
+ *
56
+ * @param params.name Case-insensitive part of the full name, e.g. "matth"
57
+ * @param params.teamId NHL team id of the current team, e.g. 10
58
+ * @param params.position C, L, R, D, G, or F for every forward
59
+ * @param params.cayenneExp Extra filter expression, e.g. "sweaterNumber=34"
60
+ * @param params.sort Field to sort by, e.g. "lastName"
61
+ * @param params.dir ASC or DESC
62
+ * @param params.start Pagination offset
63
+ * @param params.include Only return these fields, e.g. ['id', 'fullName']
64
+ * @param params.exclude Leave out these fields
65
+ * @throws RangeError When no filter is given (the API would return no rows)
66
+ * @example await client.players.playerSearch({ name: 'matthews', position: 'C' })
67
+ */
68
+ export async function playerSearch(ctx, params) {
69
+ const { sort, dir, start, include, exclude } = params;
70
+ const clauses = playerSearchClauses(params);
71
+ if (clauses.length === 0) {
72
+ throw new RangeError('Missing filter. Pass name, teamId, position or cayenneExp.');
73
+ }
74
+ const query = {
75
+ cayenneExp: andClauses(clauses),
76
+ };
77
+ if (sort !== undefined) {
78
+ query.sort = sort;
79
+ }
80
+ if (dir !== undefined) {
81
+ query.dir = dir;
82
+ }
83
+ if (start !== undefined) {
84
+ query.start = start;
85
+ }
86
+ if (include && include.length > 0) {
87
+ query.include = include;
88
+ }
89
+ if (exclude && exclude.length > 0) {
90
+ query.exclude = exclude;
91
+ }
92
+ return (await ctx.get(Endpoint.API_STATS, 'en/players', query)).json();
93
+ }
94
+ export const playersApi = {
95
+ prospectsByTeam,
96
+ playersByTeam,
97
+ playerSpotlight,
98
+ playerSearch,
99
+ };
@@ -0,0 +1,4 @@
1
+ /** Quotes a value as a cayenne string literal, backslash-escaping `\` and `'`. */
2
+ export declare function cayenneString(value: string): string;
3
+ /** Joins clauses with `and`, parenthesizing each when there is more than one. */
4
+ export declare function andClauses(clauses: readonly string[]): string;
@@ -0,0 +1,13 @@
1
+ // Internal helpers for SDK methods that build their own `cayenneExp`. Not
2
+ // exported from the package: `buildQuery` / `filter` cover the report filters.
3
+ /** Quotes a value as a cayenne string literal, backslash-escaping `\` and `'`. */
4
+ export function cayenneString(value) {
5
+ return `'${value.replace(/[\\']/g, (char) => `\\${char}`)}'`;
6
+ }
7
+ /** Joins clauses with `and`, parenthesizing each when there is more than one. */
8
+ export function andClauses(clauses) {
9
+ if (clauses.length === 1) {
10
+ return clauses[0];
11
+ }
12
+ return clauses.map((clause) => `(${clause})`).join(' and ');
13
+ }
@@ -133,4 +133,12 @@ export declare const SKATER_REPORT_TYPES: string[];
133
133
  * summary sort for unknown report types.
134
134
  */
135
135
  export declare function defaultSortForReport(report: string): SortExpr[];
136
+ /**
137
+ * Default sort criteria for a team summary. Falls back to points and wins.
138
+ */
139
+ export declare function defaultSortForTeamSummary(expr: SortExpr[] | undefined, isAggregate: boolean): SortExpr[];
140
+ /**
141
+ * Default sort criteria for a skater stats summary. Falls back to points
142
+ */
143
+ export declare function defaultSortForSkaterStatsSummary(expr: SortExpr[] | undefined): SortExpr[];
136
144
  export {};
@@ -92,3 +92,33 @@ export function defaultSortForReport(report) {
92
92
  ? sortingLookup[report]
93
93
  : undefined) ?? skaterSummaryDefaultSorting);
94
94
  }
95
+ /**
96
+ * Default sort criteria for a team summary. Falls back to points and wins.
97
+ */
98
+ export function defaultSortForTeamSummary(expr, isAggregate) {
99
+ if (expr && expr.length > 0) {
100
+ return expr;
101
+ }
102
+ return [
103
+ { property: 'points', direction: 'DESC' },
104
+ { property: 'wins', direction: 'DESC' },
105
+ // aggregated rows span seasons, so they have no teamId
106
+ {
107
+ property: isAggregate ? 'franchiseId' : 'teamId',
108
+ direction: 'ASC',
109
+ },
110
+ ];
111
+ }
112
+ /**
113
+ * Default sort criteria for a skater stats summary. Falls back to points
114
+ */
115
+ export function defaultSortForSkaterStatsSummary(expr) {
116
+ if (expr && expr.length > 0) {
117
+ return expr;
118
+ }
119
+ return [
120
+ { property: 'points', direction: 'DESC' },
121
+ { property: 'gamesPlayed', direction: 'ASC' },
122
+ { property: 'playerId', direction: 'ASC' },
123
+ ];
124
+ }
@@ -1,5 +1,5 @@
1
1
  import type { Context } from '#src/context.mjs';
2
- import type { CalendarSchedule, ClubScheduleGame, OddsPartner, PlayoffBracket, PlayoffCarousel, PlayoffSeriesSchedule, ScheduleGame, TeamSeasonSchedule, WeeklySchedule } from '#src/types/index.mjs';
2
+ import type { CalendarSchedule, ClubScheduleGame, OddsPartner, PlayoffBracket, PlayoffCarousel, PlayoffSeriesMeta, PlayoffSeriesSchedule, ScheduleGame, TeamSeasonSchedule, WeeklySchedule } from '#src/types/index.mjs';
3
3
  import type { Id } from '#src/utils.mjs';
4
4
  /**
5
5
  * Parses and normalizes a YYYY-MM-DD date: single-digit months/days are
@@ -59,21 +59,21 @@ export declare function teamWeeklySchedule(ctx: Context, { teamAbbr, date }: {
59
59
  * Gets the full season schedule for a specified team.
60
60
  *
61
61
  * @param params.teamAbbr Team abbreviation, e.g. BUF, TOR
62
- * @param params.season Season in YYYYYYYY format, e.g. 20232024
62
+ * @param params.season Season in YYYYYYYY format, e.g. 20232024. Defaults to "now".
63
63
  * @example https://api-web.nhle.com/v1/club-schedule-season/BUF/20232024
64
64
  */
65
65
  export declare function teamSeasonSchedule(ctx: Context, { teamAbbr, season }: {
66
66
  teamAbbr: string;
67
- season: Id;
67
+ season?: Id;
68
68
  }): Promise<TeamSeasonSchedule>;
69
69
  /**
70
70
  * Gets the schedule in calendar format for a specified date.
71
71
  *
72
- * @param params.date Date in YYYY-MM-DD format
72
+ * @param params.date Date in YYYY-MM-DD format. Defaults to "now".
73
73
  * @example https://api-web.nhle.com/v1/schedule-calendar/2023-11-08
74
74
  */
75
- export declare function calendarSchedule(ctx: Context, { date }: {
76
- date: string;
75
+ export declare function calendarSchedule(ctx: Context, { date }?: {
76
+ date?: string;
77
77
  }): Promise<CalendarSchedule>;
78
78
  /**
79
79
  * Gets all playoff series information up to the current round.
@@ -95,6 +95,18 @@ export declare function playoffSeriesSchedule(ctx: Context, { season, series }:
95
95
  season: Id;
96
96
  series: string;
97
97
  }): Promise<PlayoffSeriesSchedule>;
98
+ /**
99
+ * Returns the metadata nhl.com uses to render a playoff series page: the
100
+ * round title and the two seeded teams.
101
+ *
102
+ * @param params.year Year the playoffs took place, e.g. 2024
103
+ * @param params.series Series letter, e.g. "a" (first round) through "o" (final). Case-insensitive.
104
+ * @example https://api-web.nhle.com/v1/meta/playoff-series/2024/a
105
+ */
106
+ export declare function playoffSeriesMeta(ctx: Context, { year, series }: {
107
+ year: Id;
108
+ series: string;
109
+ }): Promise<PlayoffSeriesMeta>;
98
110
  /**
99
111
  * Returns the full playoff bracket for a given year.
100
112
  *
@@ -113,5 +125,6 @@ export declare const scheduleApi: {
113
125
  readonly calendarSchedule: typeof calendarSchedule;
114
126
  readonly playoffCarousel: typeof playoffCarousel;
115
127
  readonly playoffSeriesSchedule: typeof playoffSeriesSchedule;
128
+ readonly playoffSeriesMeta: typeof playoffSeriesMeta;
116
129
  readonly playoffBracket: typeof playoffBracket;
117
130
  };
@@ -87,20 +87,20 @@ export async function teamWeeklySchedule(ctx, { teamAbbr, date }) {
87
87
  * Gets the full season schedule for a specified team.
88
88
  *
89
89
  * @param params.teamAbbr Team abbreviation, e.g. BUF, TOR
90
- * @param params.season Season in YYYYYYYY format, e.g. 20232024
90
+ * @param params.season Season in YYYYYYYY format, e.g. 20232024. Defaults to "now".
91
91
  * @example https://api-web.nhle.com/v1/club-schedule-season/BUF/20232024
92
92
  */
93
93
  export async function teamSeasonSchedule(ctx, { teamAbbr, season }) {
94
- return (await ctx.get(Endpoint.API_WEB_V1, `club-schedule-season/${teamAbbr}/${season}`)).json();
94
+ return (await ctx.get(Endpoint.API_WEB_V1, `club-schedule-season/${teamAbbr}/${season ?? 'now'}`)).json();
95
95
  }
96
96
  /**
97
97
  * Gets the schedule in calendar format for a specified date.
98
98
  *
99
- * @param params.date Date in YYYY-MM-DD format
99
+ * @param params.date Date in YYYY-MM-DD format. Defaults to "now".
100
100
  * @example https://api-web.nhle.com/v1/schedule-calendar/2023-11-08
101
101
  */
102
- export async function calendarSchedule(ctx, { date }) {
103
- return (await ctx.get(Endpoint.API_WEB_V1, `schedule-calendar/${date}`)).json();
102
+ export async function calendarSchedule(ctx, { date } = {}) {
103
+ return (await ctx.get(Endpoint.API_WEB_V1, `schedule-calendar/${date ?? 'now'}`)).json();
104
104
  }
105
105
  /**
106
106
  * Gets all playoff series information up to the current round.
@@ -121,6 +121,17 @@ export async function playoffCarousel(ctx, { season }) {
121
121
  export async function playoffSeriesSchedule(ctx, { season, series }) {
122
122
  return (await ctx.get(Endpoint.API_WEB_V1, `schedule/playoff-series/${season}/${series}`)).json();
123
123
  }
124
+ /**
125
+ * Returns the metadata nhl.com uses to render a playoff series page: the
126
+ * round title and the two seeded teams.
127
+ *
128
+ * @param params.year Year the playoffs took place, e.g. 2024
129
+ * @param params.series Series letter, e.g. "a" (first round) through "o" (final). Case-insensitive.
130
+ * @example https://api-web.nhle.com/v1/meta/playoff-series/2024/a
131
+ */
132
+ export async function playoffSeriesMeta(ctx, { year, series }) {
133
+ return (await ctx.get(Endpoint.API_WEB_V1, `meta/playoff-series/${year}/${series}`)).json();
134
+ }
124
135
  /**
125
136
  * Returns the full playoff bracket for a given year.
126
137
  *
@@ -139,5 +150,6 @@ export const scheduleApi = {
139
150
  calendarSchedule,
140
151
  playoffCarousel,
141
152
  playoffSeriesSchedule,
153
+ playoffSeriesMeta,
142
154
  playoffBracket,
143
155
  };
@@ -1,7 +1,7 @@
1
1
  import { type QueryContext } from '#src/api/query/builder.mjs';
2
2
  import { type SortExpr } from '#src/api/query/sorting/sorting-options.mjs';
3
3
  import type { Context } from '#src/context.mjs';
4
- import type { ClubStatsSeason, GameLogEntry, GoalieReportRows, PlayerLanding, SkaterReportRows, StatsApiPage, TeamSummaryRow } from '#src/types/index.mjs';
4
+ import type { ClubStats, ClubStatsSeason, GameLogEntry, GoalieLeaderCategory, GoalieLeaderRows, GoalieMilestone, GoalieReportRows, GoalieStatsLeaders, OpenUnion, PlayerLanding, SkaterLeaderCategory, SkaterLeaderRows, SkaterMilestone, SkaterReportRows, SkaterStatsLeaders, StatsApiPage, TeamSummaryRow } from '#src/types/index.mjs';
5
5
  import type { Id } from '#src/utils.mjs';
6
6
  export interface TeamSummaryParams {
7
7
  /** Start season in YYYYYYYY format, e.g. 20202021 */
@@ -94,18 +94,61 @@ export declare function playerCareerStats(ctx: Context, { playerId }: {
94
94
  playerId: Id;
95
95
  }): Promise<PlayerLanding>;
96
96
  /**
97
- * Gets a player's game log for a specific season and game type.
97
+ * Gets a player's game log for a season and game type.
98
98
  *
99
99
  * @param params.playerId NHL player id, e.g. 8481528
100
- * @param params.seasonId Season in YYYYYYYY format, e.g. 20232024
101
- * @param params.gameType 1=Preseason, 2=Regular season, 3=Playoffs
100
+ * @param params.seasonId Season in YYYYYYYY format, e.g. 20232024. Defaults to the current season ("now").
101
+ * @param params.gameType 1=Preseason, 2=Regular season (default), 3=Playoffs. Ignored when `seasonId` is omitted.
102
102
  * @example https://api-web.nhle.com/v1/player/8481528/game-log/20232024/2
103
103
  */
104
104
  export declare function playerGameLog(ctx: Context, { playerId, seasonId, gameType, }: {
105
105
  playerId: Id;
106
- seasonId: Id;
107
- gameType: number;
106
+ seasonId?: Id;
107
+ gameType?: number;
108
108
  }): Promise<GameLogEntry[]>;
109
+ export interface StatsLeadersParams<Category extends string> {
110
+ /** Season in YYYYYYYY format, e.g. 20232024. Defaults to the current season ("current"). */
111
+ season?: Id;
112
+ /** 2=Regular season (default), 3=Playoffs. Ignored when `season` is omitted. */
113
+ gameType?: number;
114
+ /** Categories to include. Defaults to every category. An unknown category is a 400. */
115
+ categories?: readonly Category[];
116
+ /** Rows per category. The API defaults to 5; -1 returns every player. */
117
+ limit?: number;
118
+ }
119
+ /**
120
+ * Gets the skater stats leaders for a season, keyed by category.
121
+ *
122
+ * @param params.season Season in YYYYYYYY format. Defaults to the current season.
123
+ * @param params.gameType 2=Regular season (default), 3=Playoffs. Ignored when `season` is omitted.
124
+ * @param params.categories Categories to include, e.g. ['goals', 'points']. Defaults to all.
125
+ * @param params.limit Rows per category. The API defaults to 5; -1 returns every player.
126
+ * @example https://api-web.nhle.com/v1/skater-stats-leaders/20232024/2?categories=goals,points&limit=10
127
+ */
128
+ export declare function skaterStatsLeaders(ctx: Context, params?: StatsLeadersParams<OpenUnion<SkaterLeaderCategory>>): Promise<SkaterStatsLeaders>;
129
+ /**
130
+ * Gets the goalie stats leaders for a season, keyed by category.
131
+ *
132
+ * @param params.season Season in YYYYYYYY format. Defaults to the current season.
133
+ * @param params.gameType 2=Regular season (default), 3=Playoffs. Ignored when `season` is omitted.
134
+ * @param params.categories Categories to include, e.g. ['wins', 'savePctg']. Defaults to all.
135
+ * @param params.limit Rows per category. The API defaults to 5; -1 returns every goalie.
136
+ * @example https://api-web.nhle.com/v1/goalie-stats-leaders/20232024/2?categories=wins&limit=10
137
+ */
138
+ export declare function goalieStatsLeaders(ctx: Context, params?: StatsLeadersParams<OpenUnion<GoalieLeaderCategory>>): Promise<GoalieStatsLeaders>;
139
+ /**
140
+ * Gets a team's skater and goalie stats for a season and game type.
141
+ *
142
+ * @param params.teamAbbr Team abbreviation, e.g. BUF, TOR
143
+ * @param params.season Season in YYYYYYYY format, e.g. 20232024. Defaults to the current season ("now").
144
+ * @param params.gameType 2=Regular season (default), 3=Playoffs. Ignored when `season` is omitted.
145
+ * @example https://api-web.nhle.com/v1/club-stats/TOR/20232024/2
146
+ */
147
+ export declare function clubStats(ctx: Context, { teamAbbr, season, gameType, }: {
148
+ teamAbbr: string;
149
+ season?: Id;
150
+ gameType?: number;
151
+ }): Promise<ClubStats>;
109
152
  /**
110
153
  * Retrieves team summary statistics across one or more seasons.
111
154
  *
@@ -142,12 +185,58 @@ export declare function skaterStatsWithQueryContext<Report extends keyof SkaterR
142
185
  * @example await client.stats.goalieStatsSummary({ startSeason: '20232024', statsType: 'advanced' })
143
186
  */
144
187
  export declare function goalieStatsSummary<Report extends keyof GoalieReportRows = 'summary'>(ctx: Context, { startSeason, endSeason, statsType, gameTypeId, franchiseId, aggregate, sortExpr, start, limit, factCayenneExp, defaultCayenneExp, }: GoalieStatsSummaryParams<Report>): Promise<GoalieReportRows[Report][]>;
188
+ export interface StatsApiLeadersParams<Attribute extends string> {
189
+ /** Stat to rank by. An unknown attribute is a 500, not a 404. */
190
+ attribute: Attribute;
191
+ /** Season in YYYYYYYY format, e.g. 20232024. Defaults to every season on record. */
192
+ season?: Id;
193
+ }
194
+ /**
195
+ * Gets the top 10 single-season skater records for an attribute, e.g.
196
+ * Gretzky's 215 points, or the top 10 of one season.
197
+ *
198
+ * @param params.attribute points, goals, assists or gamesPlayed (case-sensitive)
199
+ * @param params.season Season in YYYYYYYY format, e.g. 20232024. Defaults to every season.
200
+ * @example https://api.nhle.com/stats/rest/en/leaders/skaters/points?cayenneExp=season=20232024
201
+ */
202
+ export declare function skaterLeaders<Attribute extends keyof SkaterLeaderRows>(ctx: Context, params: StatsApiLeadersParams<Attribute>): Promise<SkaterLeaderRows[Attribute][]>;
203
+ /**
204
+ * Gets the top 10 single-season goalie records for an attribute, or the top
205
+ * 10 of one season. There is no minimum games played, so `gaa` / `savePctg`
206
+ * leaders are goalies with a few minutes.
207
+ *
208
+ * @param params.attribute gaa, savePctg, shutouts, timeOnIce or gamesPlayed (case-sensitive)
209
+ * @param params.season Season in YYYYYYYY format, e.g. 20232024. Defaults to every season.
210
+ * @example https://api.nhle.com/stats/rest/en/leaders/goalies/gaa?cayenneExp=season=20232024
211
+ */
212
+ export declare function goalieLeaders<Attribute extends keyof GoalieLeaderRows>(ctx: Context, params: StatsApiLeadersParams<Attribute>): Promise<GoalieLeaderRows[Attribute][]>;
213
+ /**
214
+ * Gets the career milestones active skaters are closing in on (e.g. 200
215
+ * assists, 50 playoff points).
216
+ *
217
+ * @example https://api.nhle.com/stats/rest/en/milestones/skaters
218
+ */
219
+ export declare function skaterMilestones(ctx: Context): Promise<SkaterMilestone[]>;
220
+ /**
221
+ * Gets the career milestones active goalies are closing in on (e.g. 30
222
+ * shutouts, 50 playoff games).
223
+ *
224
+ * @example https://api.nhle.com/stats/rest/en/milestones/goalies
225
+ */
226
+ export declare function goalieMilestones(ctx: Context): Promise<GoalieMilestone[]>;
145
227
  export declare const statsApi: {
146
228
  readonly gametypesPerSeasonDirectoryByTeam: typeof gametypesPerSeasonDirectoryByTeam;
147
229
  readonly playerCareerStats: typeof playerCareerStats;
148
230
  readonly playerGameLog: typeof playerGameLog;
231
+ readonly skaterStatsLeaders: typeof skaterStatsLeaders;
232
+ readonly goalieStatsLeaders: typeof goalieStatsLeaders;
233
+ readonly clubStats: typeof clubStats;
149
234
  readonly teamSummary: typeof teamSummary;
150
235
  readonly skaterStatsSummary: typeof skaterStatsSummary;
151
236
  readonly skaterStatsWithQueryContext: typeof skaterStatsWithQueryContext;
152
237
  readonly goalieStatsSummary: typeof goalieStatsSummary;
238
+ readonly skaterLeaders: typeof skaterLeaders;
239
+ readonly goalieLeaders: typeof goalieLeaders;
240
+ readonly skaterMilestones: typeof skaterMilestones;
241
+ readonly goalieMilestones: typeof goalieMilestones;
153
242
  };