nhle-api 0.5.2 → 0.5.4
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/CHANGELOG.md +55 -1
- package/README.md +161 -80
- package/lib/index.cjs +967 -253
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +2135 -435
- package/lib/index.d.ts +2135 -435
- package/lib/index.js +967 -254
- package/lib/index.js.map +1 -1
- package/package.json +6 -4
package/lib/index.js
CHANGED
|
@@ -6,24 +6,25 @@ var __export = (target, all) => {
|
|
|
6
6
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
// src/api/
|
|
10
|
-
var
|
|
11
|
-
__export(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
score: () => score,
|
|
17
|
-
scoreboard: () => scoreboard,
|
|
18
|
-
team: () => team_exports
|
|
9
|
+
// src/api/edge-adv/index.ts
|
|
10
|
+
var edge_adv_exports2 = {};
|
|
11
|
+
__export(edge_adv_exports2, {
|
|
12
|
+
byTheNumbers: () => byTheNumbers,
|
|
13
|
+
goalies: () => goalies_exports,
|
|
14
|
+
skaters: () => skaters_exports,
|
|
15
|
+
teams: () => teams_exports
|
|
19
16
|
});
|
|
20
17
|
|
|
21
|
-
// src/api/
|
|
22
|
-
var
|
|
23
|
-
__export(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
// src/api/edge-adv/goalies.ts
|
|
19
|
+
var goalies_exports = {};
|
|
20
|
+
__export(goalies_exports, {
|
|
21
|
+
compare: () => compare,
|
|
22
|
+
leaders: () => leaders,
|
|
23
|
+
player: () => player,
|
|
24
|
+
saveLocation: () => saveLocation,
|
|
25
|
+
savePercentage: () => savePercentage,
|
|
26
|
+
savePercentage5v5: () => savePercentage5v5,
|
|
27
|
+
top10: () => top10
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
// src/config/env.ts
|
|
@@ -314,16 +315,13 @@ var ErrorHandler = class {
|
|
|
314
315
|
};
|
|
315
316
|
new ErrorHandler();
|
|
316
317
|
|
|
317
|
-
// src/client/types.ts
|
|
318
|
-
var API_BASE_URLS = {
|
|
319
|
-
"edge-adv": "https://api-web.nhle.com/v1",
|
|
320
|
-
"edge-stats": "https://api.nhle.com/stats/rest",
|
|
321
|
-
default: "https://api-web.nhle.com/v1"
|
|
322
|
-
};
|
|
323
|
-
|
|
324
318
|
// src/client/index.ts
|
|
319
|
+
var BASE_URLS = {
|
|
320
|
+
gamecenter: "https://api-web.nhle.com/v1",
|
|
321
|
+
edgeStats: "https://api.nhle.com/stats/rest"
|
|
322
|
+
};
|
|
325
323
|
var DEFAULT_CONFIG = {
|
|
326
|
-
baseUrl:
|
|
324
|
+
baseUrl: BASE_URLS.gamecenter,
|
|
327
325
|
timeout: envConfig.timeout,
|
|
328
326
|
headers: {
|
|
329
327
|
Accept: "application/json"
|
|
@@ -340,11 +338,7 @@ var NHLClient = class {
|
|
|
340
338
|
*/
|
|
341
339
|
constructor(baseURL, errorConfig) {
|
|
342
340
|
this.config = { ...DEFAULT_CONFIG };
|
|
343
|
-
if (baseURL
|
|
344
|
-
this.config.baseUrl = API_BASE_URLS[baseURL];
|
|
345
|
-
} else if (baseURL) {
|
|
346
|
-
this.config.baseUrl = baseURL;
|
|
347
|
-
}
|
|
341
|
+
if (baseURL) this.config.baseUrl = baseURL;
|
|
348
342
|
this.errorHandler = new ErrorHandler(errorConfig);
|
|
349
343
|
}
|
|
350
344
|
/**
|
|
@@ -391,14 +385,14 @@ var NHLClient = class {
|
|
|
391
385
|
endpoint: url
|
|
392
386
|
});
|
|
393
387
|
this.errorHandler.log(error);
|
|
394
|
-
return {
|
|
388
|
+
return { success: false, error };
|
|
395
389
|
}
|
|
396
|
-
return { data: await response.json(),
|
|
390
|
+
return { data: await response.json(), success: true };
|
|
397
391
|
} catch (error) {
|
|
398
392
|
clearTimeout(timeoutId);
|
|
399
393
|
if (error instanceof NHLError) {
|
|
400
394
|
this.errorHandler.log(error);
|
|
401
|
-
return {
|
|
395
|
+
return { success: false, error };
|
|
402
396
|
}
|
|
403
397
|
let nhlError;
|
|
404
398
|
if (error instanceof Error && error.name === "AbortError") {
|
|
@@ -416,7 +410,7 @@ var NHLClient = class {
|
|
|
416
410
|
});
|
|
417
411
|
}
|
|
418
412
|
this.errorHandler.log(nhlError);
|
|
419
|
-
return {
|
|
413
|
+
return { success: false, error: nhlError };
|
|
420
414
|
}
|
|
421
415
|
}
|
|
422
416
|
/**
|
|
@@ -430,45 +424,8 @@ var NHLClient = class {
|
|
|
430
424
|
function createNHLClient(baseURL, errorConfig) {
|
|
431
425
|
return new NHLClient(baseURL, errorConfig);
|
|
432
426
|
}
|
|
433
|
-
var nhlClient = createNHLClient(
|
|
434
|
-
createNHLClient(
|
|
435
|
-
var client_default = nhlClient;
|
|
436
|
-
|
|
437
|
-
// src/utils/date.ts
|
|
438
|
-
var NHL_TIMEZONE = "America/New_York";
|
|
439
|
-
var getDate = (date) => new Intl.DateTimeFormat("en-CA", {
|
|
440
|
-
timeZone: NHL_TIMEZONE,
|
|
441
|
-
year: "numeric",
|
|
442
|
-
month: "2-digit",
|
|
443
|
-
day: "2-digit"
|
|
444
|
-
}).format(date);
|
|
445
|
-
var getCurrentDate = () => getDate(/* @__PURE__ */ new Date());
|
|
446
|
-
var getYear = (date) => new Intl.DateTimeFormat("en-CA", {
|
|
447
|
-
timeZone: NHL_TIMEZONE,
|
|
448
|
-
year: "numeric"
|
|
449
|
-
}).format(date);
|
|
450
|
-
var getCurrentYear = () => getYear(/* @__PURE__ */ new Date());
|
|
451
|
-
var getSeason = (date) => {
|
|
452
|
-
const format = new Intl.DateTimeFormat("en-CA", {
|
|
453
|
-
timeZone: NHL_TIMEZONE,
|
|
454
|
-
year: "numeric",
|
|
455
|
-
month: "numeric"
|
|
456
|
-
}).formatToParts(date instanceof Date ? date : new Date(date));
|
|
457
|
-
const month = format.find((part) => part.type === "month")?.value;
|
|
458
|
-
const year = format.find((part) => part.type === "year")?.value;
|
|
459
|
-
if (!year) {
|
|
460
|
-
throw new Error("Invalid date provided, could not extract year");
|
|
461
|
-
}
|
|
462
|
-
if (month && parseInt(month, 10) < 7) {
|
|
463
|
-
console.log(month, parseInt(month, 10) < 7);
|
|
464
|
-
return `${parseInt(year, 10) - 1}${year}`;
|
|
465
|
-
}
|
|
466
|
-
return `${year}${parseInt(year, 10) + 1}`;
|
|
467
|
-
};
|
|
468
|
-
var getCurrentSeason = () => getSeason(/* @__PURE__ */ new Date());
|
|
469
|
-
/* @__PURE__ */ new Date(
|
|
470
|
-
`${getCurrentSeason().slice(4, 8)}-06-30`
|
|
471
|
-
);
|
|
427
|
+
var nhlClient = createNHLClient(BASE_URLS.gamecenter);
|
|
428
|
+
createNHLClient(BASE_URLS.edgeStats);
|
|
472
429
|
|
|
473
430
|
// src/constants/edge-adv.ts
|
|
474
431
|
var edge_adv_exports = {};
|
|
@@ -960,6 +917,41 @@ var TEAM_ID_RANGE = { MIN: 1, MAX: 59 };
|
|
|
960
917
|
// src/constants/index.ts
|
|
961
918
|
var EDGE = { ...edge_adv_exports, ...edge_stats_exports };
|
|
962
919
|
|
|
920
|
+
// src/utils/date.ts
|
|
921
|
+
var NHL_TIMEZONE = "America/New_York";
|
|
922
|
+
var getDate = (date) => new Intl.DateTimeFormat("en-CA", {
|
|
923
|
+
timeZone: NHL_TIMEZONE,
|
|
924
|
+
year: "numeric",
|
|
925
|
+
month: "2-digit",
|
|
926
|
+
day: "2-digit"
|
|
927
|
+
}).format(date);
|
|
928
|
+
var getCurrentDate = () => getDate(/* @__PURE__ */ new Date());
|
|
929
|
+
var getYear = (date) => new Intl.DateTimeFormat("en-CA", {
|
|
930
|
+
timeZone: NHL_TIMEZONE,
|
|
931
|
+
year: "numeric"
|
|
932
|
+
}).format(date);
|
|
933
|
+
var getCurrentYear = () => getYear(/* @__PURE__ */ new Date());
|
|
934
|
+
var getSeason = (date) => {
|
|
935
|
+
const format = new Intl.DateTimeFormat("en-CA", {
|
|
936
|
+
timeZone: NHL_TIMEZONE,
|
|
937
|
+
year: "numeric",
|
|
938
|
+
month: "numeric"
|
|
939
|
+
}).formatToParts(date instanceof Date ? date : new Date(date));
|
|
940
|
+
const month = format.find((part) => part.type === "month")?.value;
|
|
941
|
+
const year = format.find((part) => part.type === "year")?.value;
|
|
942
|
+
if (!year) {
|
|
943
|
+
throw new Error("Invalid date provided, could not extract year");
|
|
944
|
+
}
|
|
945
|
+
if (month && parseInt(month, 10) < 7) {
|
|
946
|
+
return `${parseInt(year, 10) - 1}${year}`;
|
|
947
|
+
}
|
|
948
|
+
return `${year}${parseInt(year, 10) + 1}`;
|
|
949
|
+
};
|
|
950
|
+
var getCurrentSeason = () => getSeason(/* @__PURE__ */ new Date());
|
|
951
|
+
/* @__PURE__ */ new Date(
|
|
952
|
+
`${getCurrentSeason().slice(4, 8)}-06-30`
|
|
953
|
+
);
|
|
954
|
+
|
|
963
955
|
// src/utils/schemas.ts
|
|
964
956
|
function isParseError(value) {
|
|
965
957
|
return value instanceof type.errors;
|
|
@@ -1038,27 +1030,27 @@ var PlayerId = type("number").atLeast(nhl_exports.PLAYER_ID_RANGE.MIN).atMost(nh
|
|
|
1038
1030
|
return v >= nhl_exports.PLAYER_ID_RANGE.MIN && v <= nhl_exports.PLAYER_ID_RANGE.MAX;
|
|
1039
1031
|
})
|
|
1040
1032
|
).pipe((v) => v.toString()).describe("a valid NHL player ID");
|
|
1041
|
-
type.enumerated(
|
|
1033
|
+
var SaveLocationCategory = type.enumerated(
|
|
1042
1034
|
...Object.keys(
|
|
1043
1035
|
EDGE.SaveLocationCategoryEnum
|
|
1044
1036
|
)
|
|
1045
1037
|
).pipe((v) => EDGE.SaveLocationCategoryEnum[v]);
|
|
1046
|
-
type.enumerated(
|
|
1038
|
+
var ShotLocationSort = type.enumerated(
|
|
1047
1039
|
...Object.keys(
|
|
1048
1040
|
EDGE.ShotLocationSortEnum
|
|
1049
1041
|
)
|
|
1050
1042
|
).pipe((v) => EDGE.ShotLocationSortEnum[v]);
|
|
1051
|
-
type.enumerated(
|
|
1043
|
+
var SaveLocationSort = type.enumerated(
|
|
1052
1044
|
...Object.keys(
|
|
1053
1045
|
EDGE.SaveLocationSortEnum
|
|
1054
1046
|
)
|
|
1055
1047
|
).pipe((v) => EDGE.SaveLocationSortEnum[v]);
|
|
1056
|
-
type.enumerated(
|
|
1048
|
+
var SavePercentage5v5Sort = type.enumerated(
|
|
1057
1049
|
...Object.keys(
|
|
1058
1050
|
EDGE.SavePercentage5v5SortEnum
|
|
1059
1051
|
)
|
|
1060
1052
|
).pipe((v) => EDGE.SavePercentage5v5SortEnum[v]);
|
|
1061
|
-
type.enumerated(
|
|
1053
|
+
var SavePercentageSort = type.enumerated(
|
|
1062
1054
|
...Object.keys(
|
|
1063
1055
|
EDGE.SavePercentageSortEnum
|
|
1064
1056
|
)
|
|
@@ -1073,27 +1065,27 @@ var SkatersStrength = type.enumerated(
|
|
|
1073
1065
|
EDGE.SkatersStrengthEnum
|
|
1074
1066
|
)
|
|
1075
1067
|
).pipe((v) => EDGE.SkatersStrengthEnum[v]);
|
|
1076
|
-
type.enumerated(
|
|
1068
|
+
var ShotSpeedSort = type.enumerated(
|
|
1077
1069
|
...Object.keys(
|
|
1078
1070
|
EDGE.ShotSpeedSortEnum
|
|
1079
1071
|
)
|
|
1080
1072
|
).pipe((v) => EDGE.ShotSpeedSortEnum[v]);
|
|
1081
|
-
type.enumerated(
|
|
1073
|
+
var SkatingSpeedSort = type.enumerated(
|
|
1082
1074
|
...Object.keys(
|
|
1083
1075
|
EDGE.SkatingSpeedSortEnum
|
|
1084
1076
|
)
|
|
1085
1077
|
).pipe((v) => EDGE.SkatingSpeedSortEnum[v]);
|
|
1086
|
-
type.enumerated(
|
|
1078
|
+
var SkatingDistanceSort = type.enumerated(
|
|
1087
1079
|
...Object.keys(
|
|
1088
1080
|
EDGE.SkatingDistanceSortEnum
|
|
1089
1081
|
)
|
|
1090
1082
|
);
|
|
1091
|
-
type.enumerated(
|
|
1083
|
+
var ShotLocationCategory = type.enumerated(
|
|
1092
1084
|
...Object.keys(
|
|
1093
1085
|
EDGE.ShotLocationCategoryEnum
|
|
1094
1086
|
)
|
|
1095
1087
|
).pipe((v) => EDGE.ShotLocationCategoryEnum[v]);
|
|
1096
|
-
type.enumerated(
|
|
1088
|
+
var ZoneTimeSort = type.enumerated(
|
|
1097
1089
|
...Object.keys(
|
|
1098
1090
|
EDGE.ZoneTimeSortEnum
|
|
1099
1091
|
)
|
|
@@ -1104,14 +1096,14 @@ var BaseParams = type({
|
|
|
1104
1096
|
(v) => v ?? nhl_exports.GameTypeEnum.REG
|
|
1105
1097
|
)
|
|
1106
1098
|
});
|
|
1107
|
-
BaseParams.merge({
|
|
1099
|
+
var PlayerParams = BaseParams.merge({
|
|
1108
1100
|
playerId: PlayerId,
|
|
1109
1101
|
season: Season
|
|
1110
1102
|
});
|
|
1111
|
-
BaseParams.merge({
|
|
1103
|
+
var TeamParams = BaseParams.merge({
|
|
1112
1104
|
teamId: TeamId
|
|
1113
1105
|
});
|
|
1114
|
-
BaseParams.merge({
|
|
1106
|
+
var top10Params = BaseParams.merge({
|
|
1115
1107
|
position: PositionFilter.default("ALL"),
|
|
1116
1108
|
strength: SkatersStrength.default("ALL")
|
|
1117
1109
|
});
|
|
@@ -1144,85 +1136,791 @@ var ScheduleParams = type({
|
|
|
1144
1136
|
});
|
|
1145
1137
|
|
|
1146
1138
|
// src/utils/utils.ts
|
|
1147
|
-
function
|
|
1148
|
-
let
|
|
1139
|
+
function resolvePath(template, params) {
|
|
1140
|
+
let resolvedPath = template;
|
|
1149
1141
|
for (const [key, value] of Object.entries(params)) {
|
|
1150
1142
|
if (value === void 0) continue;
|
|
1151
|
-
|
|
1143
|
+
resolvedPath = resolvedPath.replace(`{${key}}`, String(value));
|
|
1152
1144
|
}
|
|
1153
|
-
return
|
|
1145
|
+
return resolvedPath;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
// src/api/edge-adv/paths.ts
|
|
1149
|
+
var goaliesPaths = {
|
|
1150
|
+
/** Goalie detail page. */
|
|
1151
|
+
player: "edge/goalie-detail/{playerId}/{season}/{gameType}",
|
|
1152
|
+
/** Goalie comparison data. */
|
|
1153
|
+
compare: "edge/goalie-comparison/{playerId}/{season}/{gameType}",
|
|
1154
|
+
/** Goalie leaders landing page. */
|
|
1155
|
+
leaders: "edge/goalie-landing/{season}/{gameType}",
|
|
1156
|
+
/** Goalie 5v5 save percentage statistics. */
|
|
1157
|
+
savePercentage5v5: "edge/goalie-5v5-detail/{playerId}/{season}/{gameType}",
|
|
1158
|
+
/** Goalie save percentage statistics. */
|
|
1159
|
+
savePercentage: "edge/goalie-save-percentage-detail/{playerId}/{season}/{gameType}",
|
|
1160
|
+
/** Goalie shot location analysis. */
|
|
1161
|
+
saveLocation: "edge/goalie-shot-location-detail/{playerId}/{season}/{gameType}",
|
|
1162
|
+
/** Goalie top 10 leaders. */
|
|
1163
|
+
top10: {
|
|
1164
|
+
/** Top 10 goalies by save percentage. */
|
|
1165
|
+
SavePercentage: "edge/goalie-5v5-top-10/{sortBy}/{season}/{gameType}",
|
|
1166
|
+
/** Top 10 goalies by 5v5 save percentage. */
|
|
1167
|
+
SavePercentage5v5: "edge/goalie-edge-save-pctg-top-10/{sortBy}/{season}/{gameType}",
|
|
1168
|
+
/** Top 10 goalies by shot location. */
|
|
1169
|
+
SaveLocation: "edge/goalie-shot-location-top-10/{category}/{sortBy}/{season}/{gameType}"
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
var skatersPaths = {
|
|
1173
|
+
/** Skater detail page. */
|
|
1174
|
+
player: "skater-detail/{playerId}/{season}/{gameType}",
|
|
1175
|
+
/** Skater comparison data. */
|
|
1176
|
+
compare: "skater-comparison/{playerId}/{season}/{gameType}",
|
|
1177
|
+
/** Skater leaders landing page. */
|
|
1178
|
+
leaders: "skater-landing/{season}/{gameType}",
|
|
1179
|
+
/** Skater shot location analysis. */
|
|
1180
|
+
shotLocation: "skater-shot-location-detail/{playerId}/{season}/{gameType}",
|
|
1181
|
+
/** Skater shot speed analysis. */
|
|
1182
|
+
shotSpeed: "skater-shot-speed-detail/{playerId}/{season}/{gameType}",
|
|
1183
|
+
/** Skater skating distance analysis. */
|
|
1184
|
+
skatingDistance: "skater-skating-distance-detail/{playerId}/{season}/{gameType}",
|
|
1185
|
+
/** Skater skating speed analysis. */
|
|
1186
|
+
skatingSpeed: "skater-skating-speed-detail/{playerId}/{season}/{gameType}",
|
|
1187
|
+
/** Skater zone time analysis. */
|
|
1188
|
+
zoneTime: "skater-zone-time/{playerId}/{season}/{gameType}",
|
|
1189
|
+
/** Skater top 10 leaders. */
|
|
1190
|
+
top10: {
|
|
1191
|
+
/** Top 10 skaters by shot location. */
|
|
1192
|
+
shotLocation: "skater-shot-location-top-10/{position}/{category}/{sortBy}/{season}/{gameType}",
|
|
1193
|
+
/** Top 10 skaters by shot speed. */
|
|
1194
|
+
shotSpeed: "skater-shot-speed-top-10/{position}/{sortBy}/{season}/{gameType}",
|
|
1195
|
+
/** Top 10 skaters by skating distance. */
|
|
1196
|
+
skatingDistance: "skater-distance-top-10/{position}/{strength}/{sortBy}/{season}/{gameType}",
|
|
1197
|
+
/** Top 10 skaters by skating speed. */
|
|
1198
|
+
skatingSpeed: "skater-speed-top-10/{position}/{sortBy}/{season}/{gameType}",
|
|
1199
|
+
/** Top 10 skaters by zone time. */
|
|
1200
|
+
zoneTime: "skater-zone-time-top-10/{position}/{strength}/{sortBy}/{season}/{gameType}"
|
|
1201
|
+
}
|
|
1202
|
+
};
|
|
1203
|
+
var teamsPaths = {
|
|
1204
|
+
/** Team statistics detail page. */
|
|
1205
|
+
stats: "edge/team-comparison/{teamId}/{season}/{gameType}",
|
|
1206
|
+
/** Team comparison data. */
|
|
1207
|
+
compare: "edge/team-detail/{teamId}/{season}/{gameType}",
|
|
1208
|
+
/** Team leaders landing page. */
|
|
1209
|
+
leaders: "edge/team-landing/{season}/{gameType}",
|
|
1210
|
+
/** Team shot location analysis. */
|
|
1211
|
+
shotLocation: "edge/team-shot-location-detail/{teamId}/{season}/{gameType}",
|
|
1212
|
+
/** Team shot speed analysis. */
|
|
1213
|
+
shotSpeed: "edge/team-shot-location-top-10/{position}/{category}/{sortBy}/{season}/{gameType}",
|
|
1214
|
+
/** Team skating distance analysis. */
|
|
1215
|
+
skatingDistance: "edge/team-shot-speed-detail/{teamId}/{season}/{gameType}",
|
|
1216
|
+
/** Team skating speed analysis. */
|
|
1217
|
+
skatingSpeed: "edge/team-shot-speed-top-10/{position}/{sortBy}/{season}/{gameType}",
|
|
1218
|
+
/** Team zone time analysis. */
|
|
1219
|
+
zoneTime: "edge/team-skating-distance-detail/{teamId}/{season}/{gameType}",
|
|
1220
|
+
/** Team top 10 leaders. */
|
|
1221
|
+
top10: {
|
|
1222
|
+
/** Top 10 teams by shot location. */
|
|
1223
|
+
shotLocation: "edge/team-skating-distance-top-10/{position}/{strength}/{sortBy}/{season}/{gameType}",
|
|
1224
|
+
/** Top 10 teams by shot speed. */
|
|
1225
|
+
shotSpeed: "edge/team-skating-speed-detail/{teamId}/{season}/{gameType}",
|
|
1226
|
+
/** Top 10 teams by skating distance. */
|
|
1227
|
+
skatingDistance: "edge/team-skating-speed-top-10/{position}/{sortBy}/{season}/{gameType}",
|
|
1228
|
+
/** Top 10 teams by skating speed. */
|
|
1229
|
+
skatingSpeed: "edge/team-zone-time-details/{teamId}/{season}/{gameType}",
|
|
1230
|
+
/** Top 10 teams by zone time. */
|
|
1231
|
+
zoneTime: "edge/team-zone-time-top-10/{strength}/{sortBy}/{season}/{gameType}"
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
var summaryPaths = {
|
|
1235
|
+
/** By the numbers summary. */
|
|
1236
|
+
byTheNumbers: "edge/by-the-numbers/now"
|
|
1237
|
+
};
|
|
1238
|
+
|
|
1239
|
+
// src/api/edge-adv/goalies.ts
|
|
1240
|
+
async function player(playerId, season, gameType) {
|
|
1241
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1242
|
+
if (isParseError(parsed))
|
|
1243
|
+
return Promise.reject(
|
|
1244
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1245
|
+
endpoint: goaliesPaths.player
|
|
1246
|
+
})
|
|
1247
|
+
);
|
|
1248
|
+
const path = resolvePath(goaliesPaths.player, parsed);
|
|
1249
|
+
return nhlClient.get(path);
|
|
1250
|
+
}
|
|
1251
|
+
async function compare(playerId, season, gameType) {
|
|
1252
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1253
|
+
if (isParseError(parsed))
|
|
1254
|
+
return Promise.reject(
|
|
1255
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1256
|
+
endpoint: goaliesPaths.compare
|
|
1257
|
+
})
|
|
1258
|
+
);
|
|
1259
|
+
const path = resolvePath(goaliesPaths.compare, parsed);
|
|
1260
|
+
return nhlClient.get(path);
|
|
1261
|
+
}
|
|
1262
|
+
async function leaders(season, gameType) {
|
|
1263
|
+
const parsed = BaseParams({ season, gameType });
|
|
1264
|
+
if (isParseError(parsed))
|
|
1265
|
+
return Promise.reject(
|
|
1266
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1267
|
+
endpoint: goaliesPaths.leaders
|
|
1268
|
+
})
|
|
1269
|
+
);
|
|
1270
|
+
const path = resolvePath(goaliesPaths.leaders, parsed);
|
|
1271
|
+
return nhlClient.get(path);
|
|
1272
|
+
}
|
|
1273
|
+
async function savePercentage5v5(playerId, season, gameType) {
|
|
1274
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1275
|
+
if (isParseError(parsed))
|
|
1276
|
+
return Promise.reject(
|
|
1277
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1278
|
+
endpoint: goaliesPaths.savePercentage5v5
|
|
1279
|
+
})
|
|
1280
|
+
);
|
|
1281
|
+
const path = resolvePath(goaliesPaths.savePercentage5v5, parsed);
|
|
1282
|
+
return nhlClient.get(path);
|
|
1283
|
+
}
|
|
1284
|
+
async function savePercentage(playerId, season, gameType) {
|
|
1285
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1286
|
+
if (isParseError(parsed))
|
|
1287
|
+
return Promise.reject(
|
|
1288
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1289
|
+
endpoint: goaliesPaths.savePercentage
|
|
1290
|
+
})
|
|
1291
|
+
);
|
|
1292
|
+
const path = resolvePath(goaliesPaths.savePercentage, parsed);
|
|
1293
|
+
return nhlClient.get(path);
|
|
1294
|
+
}
|
|
1295
|
+
async function saveLocation(playerId, season, gameType) {
|
|
1296
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1297
|
+
if (isParseError(parsed))
|
|
1298
|
+
return Promise.reject(
|
|
1299
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1300
|
+
endpoint: goaliesPaths.saveLocation
|
|
1301
|
+
})
|
|
1302
|
+
);
|
|
1303
|
+
const path = resolvePath(goaliesPaths.saveLocation, parsed);
|
|
1304
|
+
return nhlClient.get(path);
|
|
1305
|
+
}
|
|
1306
|
+
var top10 = {
|
|
1307
|
+
savePercentage: top10SavePercentage,
|
|
1308
|
+
savePercentage5v5: top10SavePercentage5v5,
|
|
1309
|
+
saveLocation: top10SaveLocation
|
|
1310
|
+
};
|
|
1311
|
+
async function top10SavePercentage(season, gameType, sortBy) {
|
|
1312
|
+
const Parser = BaseParams.merge({
|
|
1313
|
+
sortBy: SavePercentageSort.default("GAMES")
|
|
1314
|
+
});
|
|
1315
|
+
const parsed = Parser({ season, gameType, sortBy });
|
|
1316
|
+
if (isParseError(parsed))
|
|
1317
|
+
return Promise.reject(
|
|
1318
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1319
|
+
endpoint: goaliesPaths.top10.SavePercentage
|
|
1320
|
+
})
|
|
1321
|
+
);
|
|
1322
|
+
const path = resolvePath(goaliesPaths.top10.SavePercentage, parsed);
|
|
1323
|
+
return nhlClient.get(path);
|
|
1324
|
+
}
|
|
1325
|
+
async function top10SavePercentage5v5(season, gameType, sortBy) {
|
|
1326
|
+
const Parser = BaseParams.merge({
|
|
1327
|
+
sortBy: SavePercentage5v5Sort.default("5v5-SV%")
|
|
1328
|
+
});
|
|
1329
|
+
const parsed = Parser({ season, gameType, sortBy });
|
|
1330
|
+
if (isParseError(parsed))
|
|
1331
|
+
return Promise.reject(
|
|
1332
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1333
|
+
endpoint: goaliesPaths.top10.SavePercentage5v5
|
|
1334
|
+
})
|
|
1335
|
+
);
|
|
1336
|
+
const path = resolvePath(goaliesPaths.top10.SavePercentage5v5, parsed);
|
|
1337
|
+
return nhlClient.get(path);
|
|
1338
|
+
}
|
|
1339
|
+
async function top10SaveLocation(season, gameType, category, sortBy) {
|
|
1340
|
+
const Parser = BaseParams.merge({
|
|
1341
|
+
category: SaveLocationCategory.default("SV%"),
|
|
1342
|
+
sortBy: SaveLocationSort.default("ALL")
|
|
1343
|
+
});
|
|
1344
|
+
const parsed = Parser({
|
|
1345
|
+
season,
|
|
1346
|
+
gameType,
|
|
1347
|
+
category,
|
|
1348
|
+
sortBy
|
|
1349
|
+
});
|
|
1350
|
+
if (isParseError(parsed))
|
|
1351
|
+
return Promise.reject(
|
|
1352
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1353
|
+
endpoint: goaliesPaths.top10.SaveLocation
|
|
1354
|
+
})
|
|
1355
|
+
);
|
|
1356
|
+
const path = resolvePath(goaliesPaths.top10.SaveLocation, parsed);
|
|
1357
|
+
return nhlClient.get(path);
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
// src/api/edge-adv/skaters.ts
|
|
1361
|
+
var skaters_exports = {};
|
|
1362
|
+
__export(skaters_exports, {
|
|
1363
|
+
comparison: () => comparison,
|
|
1364
|
+
detail: () => detail,
|
|
1365
|
+
leaders: () => leaders2,
|
|
1366
|
+
shotLocation: () => shotLocation,
|
|
1367
|
+
shotSpeed: () => shotSpeed,
|
|
1368
|
+
skatingDistance: () => skatingDistance,
|
|
1369
|
+
skatingSpeed: () => skatingSpeed,
|
|
1370
|
+
top10: () => top102,
|
|
1371
|
+
zoneTime: () => zoneTime
|
|
1372
|
+
});
|
|
1373
|
+
async function detail(playerId, season, gameType) {
|
|
1374
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1375
|
+
if (isParseError(parsed))
|
|
1376
|
+
return Promise.reject(
|
|
1377
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1378
|
+
endpoint: skatersPaths.player
|
|
1379
|
+
})
|
|
1380
|
+
);
|
|
1381
|
+
const path = resolvePath(skatersPaths.player, parsed);
|
|
1382
|
+
return nhlClient.get(path);
|
|
1383
|
+
}
|
|
1384
|
+
async function shotLocation(playerId, season, gameType) {
|
|
1385
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1386
|
+
if (isParseError(parsed))
|
|
1387
|
+
return Promise.reject(
|
|
1388
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1389
|
+
endpoint: skatersPaths.shotLocation
|
|
1390
|
+
})
|
|
1391
|
+
);
|
|
1392
|
+
const path = resolvePath(skatersPaths.shotLocation, parsed);
|
|
1393
|
+
return nhlClient.get(path);
|
|
1394
|
+
}
|
|
1395
|
+
async function shotSpeed(playerId, season, gameType) {
|
|
1396
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1397
|
+
if (isParseError(parsed))
|
|
1398
|
+
return Promise.reject(
|
|
1399
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1400
|
+
endpoint: skatersPaths.shotSpeed
|
|
1401
|
+
})
|
|
1402
|
+
);
|
|
1403
|
+
const path = resolvePath(skatersPaths.shotSpeed, parsed);
|
|
1404
|
+
return nhlClient.get(path);
|
|
1405
|
+
}
|
|
1406
|
+
async function skatingDistance(playerId, season, gameType) {
|
|
1407
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1408
|
+
if (isParseError(parsed))
|
|
1409
|
+
return Promise.reject(
|
|
1410
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1411
|
+
endpoint: skatersPaths.skatingDistance
|
|
1412
|
+
})
|
|
1413
|
+
);
|
|
1414
|
+
const path = resolvePath(skatersPaths.skatingDistance, parsed);
|
|
1415
|
+
return nhlClient.get(path);
|
|
1416
|
+
}
|
|
1417
|
+
async function skatingSpeed(playerId, season, gameType) {
|
|
1418
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1419
|
+
if (isParseError(parsed))
|
|
1420
|
+
return Promise.reject(
|
|
1421
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1422
|
+
endpoint: skatersPaths.skatingSpeed
|
|
1423
|
+
})
|
|
1424
|
+
);
|
|
1425
|
+
const path = resolvePath(skatersPaths.skatingSpeed, parsed);
|
|
1426
|
+
return nhlClient.get(path);
|
|
1427
|
+
}
|
|
1428
|
+
async function zoneTime(playerId, season, gameType) {
|
|
1429
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1430
|
+
if (isParseError(parsed))
|
|
1431
|
+
return Promise.reject(
|
|
1432
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1433
|
+
endpoint: skatersPaths.zoneTime
|
|
1434
|
+
})
|
|
1435
|
+
);
|
|
1436
|
+
const path = resolvePath(skatersPaths.zoneTime, parsed);
|
|
1437
|
+
return nhlClient.get(path);
|
|
1438
|
+
}
|
|
1439
|
+
async function comparison(playerId, season, gameType) {
|
|
1440
|
+
const parsed = PlayerParams({ playerId, season, gameType });
|
|
1441
|
+
if (isParseError(parsed))
|
|
1442
|
+
return Promise.reject(
|
|
1443
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1444
|
+
endpoint: skatersPaths.compare
|
|
1445
|
+
})
|
|
1446
|
+
);
|
|
1447
|
+
const path = resolvePath(skatersPaths.compare, parsed);
|
|
1448
|
+
return nhlClient.get(path);
|
|
1449
|
+
}
|
|
1450
|
+
async function leaders2(season, gameType) {
|
|
1451
|
+
const parsed = BaseParams({ season, gameType });
|
|
1452
|
+
if (isParseError(parsed))
|
|
1453
|
+
return Promise.reject(
|
|
1454
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1455
|
+
endpoint: skatersPaths.leaders
|
|
1456
|
+
})
|
|
1457
|
+
);
|
|
1458
|
+
const path = resolvePath(skatersPaths.leaders, parsed);
|
|
1459
|
+
return nhlClient.get(path);
|
|
1460
|
+
}
|
|
1461
|
+
var top102 = {
|
|
1462
|
+
distance: top10Distance,
|
|
1463
|
+
shotLocation: top10ShotLocation,
|
|
1464
|
+
shotSpeed: top10ShotSpeed,
|
|
1465
|
+
speed: top10Speed,
|
|
1466
|
+
zoneTime: top10ZoneTime
|
|
1467
|
+
};
|
|
1468
|
+
async function top10Distance(season, gameType, position, strength, sortBy) {
|
|
1469
|
+
const parsed = top10Params.merge({
|
|
1470
|
+
sortBy: SkatingDistanceSort.default("TOTAL")
|
|
1471
|
+
})({
|
|
1472
|
+
season,
|
|
1473
|
+
gameType,
|
|
1474
|
+
position,
|
|
1475
|
+
strength,
|
|
1476
|
+
sortBy
|
|
1477
|
+
});
|
|
1478
|
+
if (isParseError(parsed))
|
|
1479
|
+
return Promise.reject(
|
|
1480
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1481
|
+
endpoint: skatersPaths.top10.skatingDistance
|
|
1482
|
+
})
|
|
1483
|
+
);
|
|
1484
|
+
const path = resolvePath(skatersPaths.top10.skatingDistance, parsed);
|
|
1485
|
+
return nhlClient.get(path);
|
|
1486
|
+
}
|
|
1487
|
+
async function top10ShotLocation(season, gameType, position, category, sortBy) {
|
|
1488
|
+
const parsed = top10Params.merge({
|
|
1489
|
+
category: ShotLocationCategory.default("G"),
|
|
1490
|
+
sortBy: ShotLocationSort.default("ALL")
|
|
1491
|
+
})({
|
|
1492
|
+
season,
|
|
1493
|
+
gameType,
|
|
1494
|
+
position,
|
|
1495
|
+
category,
|
|
1496
|
+
sortBy
|
|
1497
|
+
});
|
|
1498
|
+
if (isParseError(parsed))
|
|
1499
|
+
return Promise.reject(
|
|
1500
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1501
|
+
endpoint: skatersPaths.top10.shotLocation
|
|
1502
|
+
})
|
|
1503
|
+
);
|
|
1504
|
+
const path = resolvePath(skatersPaths.top10.shotLocation, parsed);
|
|
1505
|
+
return nhlClient.get(path);
|
|
1506
|
+
}
|
|
1507
|
+
async function top10ShotSpeed(season, gameType, position, sortBy) {
|
|
1508
|
+
const parsed = top10Params.merge({
|
|
1509
|
+
sortBy: ShotSpeedSort.default("MAX")
|
|
1510
|
+
})({
|
|
1511
|
+
season,
|
|
1512
|
+
gameType,
|
|
1513
|
+
position,
|
|
1514
|
+
sortBy
|
|
1515
|
+
});
|
|
1516
|
+
if (isParseError(parsed))
|
|
1517
|
+
return Promise.reject(
|
|
1518
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1519
|
+
endpoint: skatersPaths.top10.shotSpeed
|
|
1520
|
+
})
|
|
1521
|
+
);
|
|
1522
|
+
const path = resolvePath(skatersPaths.top10.shotSpeed, parsed);
|
|
1523
|
+
return nhlClient.get(path);
|
|
1524
|
+
}
|
|
1525
|
+
async function top10Speed(season, gameType, position, sortBy) {
|
|
1526
|
+
const parsed = top10Params.merge({
|
|
1527
|
+
sortBy: SkatingSpeedSort.default("TOP")
|
|
1528
|
+
})({
|
|
1529
|
+
season,
|
|
1530
|
+
gameType,
|
|
1531
|
+
position,
|
|
1532
|
+
sortBy
|
|
1533
|
+
});
|
|
1534
|
+
if (isParseError(parsed))
|
|
1535
|
+
return Promise.reject(
|
|
1536
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1537
|
+
endpoint: skatersPaths.top10.skatingSpeed
|
|
1538
|
+
})
|
|
1539
|
+
);
|
|
1540
|
+
const path = resolvePath(skatersPaths.top10.skatingSpeed, parsed);
|
|
1541
|
+
return nhlClient.get(path);
|
|
1542
|
+
}
|
|
1543
|
+
async function top10ZoneTime(season, gameType, position, strength, sortBy) {
|
|
1544
|
+
const parsed = top10Params.merge({
|
|
1545
|
+
sortBy: ZoneTimeSort.default("OZ")
|
|
1546
|
+
})({
|
|
1547
|
+
season,
|
|
1548
|
+
gameType,
|
|
1549
|
+
position,
|
|
1550
|
+
strength,
|
|
1551
|
+
sortBy
|
|
1552
|
+
});
|
|
1553
|
+
if (isParseError(parsed))
|
|
1554
|
+
return Promise.reject(
|
|
1555
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1556
|
+
endpoint: skatersPaths.top10.zoneTime
|
|
1557
|
+
})
|
|
1558
|
+
);
|
|
1559
|
+
const path = resolvePath(skatersPaths.top10.zoneTime, parsed);
|
|
1560
|
+
return nhlClient.get(path);
|
|
1154
1561
|
}
|
|
1155
1562
|
|
|
1156
|
-
// src/api/
|
|
1157
|
-
|
|
1563
|
+
// src/api/edge-adv/summary.ts
|
|
1564
|
+
async function byTheNumbers() {
|
|
1565
|
+
return nhlClient.get(summaryPaths.byTheNumbers);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
// src/api/edge-adv/teams.ts
|
|
1569
|
+
var teams_exports = {};
|
|
1570
|
+
__export(teams_exports, {
|
|
1571
|
+
compare: () => compare2,
|
|
1572
|
+
leaders: () => leaders3,
|
|
1573
|
+
shotLocation: () => shotLocation2,
|
|
1574
|
+
shotSpeed: () => shotSpeed2,
|
|
1575
|
+
skatingDistance: () => skatingDistance2,
|
|
1576
|
+
skatingSpeed: () => skatingSpeed2,
|
|
1577
|
+
stats: () => stats,
|
|
1578
|
+
top10: () => top103,
|
|
1579
|
+
zoneTime: () => zoneTime2
|
|
1580
|
+
});
|
|
1581
|
+
async function stats(teamId, season, gameType) {
|
|
1582
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1583
|
+
if (isParseError(parsed))
|
|
1584
|
+
return Promise.reject(
|
|
1585
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1586
|
+
endpoint: teamsPaths.stats
|
|
1587
|
+
})
|
|
1588
|
+
);
|
|
1589
|
+
const path = resolvePath(teamsPaths.stats, parsed);
|
|
1590
|
+
return nhlClient.get(path);
|
|
1591
|
+
}
|
|
1592
|
+
async function compare2(teamId, season, gameType) {
|
|
1593
|
+
gameType ??= "REG";
|
|
1594
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1595
|
+
if (isParseError(parsed))
|
|
1596
|
+
return Promise.reject(
|
|
1597
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1598
|
+
endpoint: teamsPaths.compare
|
|
1599
|
+
})
|
|
1600
|
+
);
|
|
1601
|
+
const path = resolvePath(teamsPaths.compare, parsed);
|
|
1602
|
+
return nhlClient.get(path);
|
|
1603
|
+
}
|
|
1604
|
+
async function leaders3(season, gameType) {
|
|
1605
|
+
const parsed = BaseParams({ season, gameType });
|
|
1606
|
+
if (isParseError(parsed))
|
|
1607
|
+
return Promise.reject(
|
|
1608
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1609
|
+
endpoint: teamsPaths.leaders
|
|
1610
|
+
})
|
|
1611
|
+
);
|
|
1612
|
+
const path = resolvePath(teamsPaths.leaders, parsed);
|
|
1613
|
+
return nhlClient.get(path);
|
|
1614
|
+
}
|
|
1615
|
+
async function shotLocation2(teamId, season, gameType) {
|
|
1616
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1617
|
+
if (isParseError(parsed))
|
|
1618
|
+
return Promise.reject(
|
|
1619
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1620
|
+
endpoint: teamsPaths.shotLocation
|
|
1621
|
+
})
|
|
1622
|
+
);
|
|
1623
|
+
const path = resolvePath(teamsPaths.shotLocation, parsed);
|
|
1624
|
+
return nhlClient.get(path);
|
|
1625
|
+
}
|
|
1626
|
+
async function shotSpeed2(teamId, season, gameType) {
|
|
1627
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1628
|
+
if (isParseError(parsed))
|
|
1629
|
+
return Promise.reject(
|
|
1630
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1631
|
+
endpoint: teamsPaths.shotSpeed
|
|
1632
|
+
})
|
|
1633
|
+
);
|
|
1634
|
+
const path = resolvePath(teamsPaths.shotSpeed, parsed);
|
|
1635
|
+
return nhlClient.get(path);
|
|
1636
|
+
}
|
|
1637
|
+
async function skatingDistance2(teamId, season, gameType) {
|
|
1638
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1639
|
+
if (isParseError(parsed))
|
|
1640
|
+
return Promise.reject(
|
|
1641
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1642
|
+
endpoint: teamsPaths.skatingDistance
|
|
1643
|
+
})
|
|
1644
|
+
);
|
|
1645
|
+
const path = resolvePath(teamsPaths.skatingDistance, parsed);
|
|
1646
|
+
return nhlClient.get(path);
|
|
1647
|
+
}
|
|
1648
|
+
async function skatingSpeed2(teamId, season, gameType) {
|
|
1649
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1650
|
+
if (isParseError(parsed))
|
|
1651
|
+
return Promise.reject(
|
|
1652
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1653
|
+
endpoint: teamsPaths.skatingSpeed
|
|
1654
|
+
})
|
|
1655
|
+
);
|
|
1656
|
+
const path = resolvePath(teamsPaths.skatingSpeed, parsed);
|
|
1657
|
+
return nhlClient.get(path);
|
|
1658
|
+
}
|
|
1659
|
+
async function zoneTime2(teamId, season, gameType) {
|
|
1660
|
+
const parsed = TeamParams({ teamId, season, gameType });
|
|
1661
|
+
if (isParseError(parsed))
|
|
1662
|
+
return Promise.reject(
|
|
1663
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1664
|
+
endpoint: teamsPaths.zoneTime
|
|
1665
|
+
})
|
|
1666
|
+
);
|
|
1667
|
+
const path = resolvePath(teamsPaths.zoneTime, parsed);
|
|
1668
|
+
return nhlClient.get(path);
|
|
1669
|
+
}
|
|
1670
|
+
var top103 = {
|
|
1671
|
+
shotLocation: top10ShotLocation2,
|
|
1672
|
+
shotSpeed: top10ShotSpeed2,
|
|
1673
|
+
skatingDistance: top10SkatingDistance,
|
|
1674
|
+
skatingSpeed: top10SkatingSpeed,
|
|
1675
|
+
zoneTime: top10ZoneTime2
|
|
1676
|
+
};
|
|
1677
|
+
async function top10ShotLocation2(season, gameType, position, category, sortBy) {
|
|
1678
|
+
const Parser = BaseParams.merge({
|
|
1679
|
+
position: PositionFilter.default("ALL"),
|
|
1680
|
+
category: ShotLocationCategory.default("G"),
|
|
1681
|
+
sortBy: ShotLocationSort.default("ALL")
|
|
1682
|
+
});
|
|
1683
|
+
const parsed = Parser({
|
|
1684
|
+
season,
|
|
1685
|
+
gameType,
|
|
1686
|
+
position,
|
|
1687
|
+
category,
|
|
1688
|
+
sortBy
|
|
1689
|
+
});
|
|
1690
|
+
if (isParseError(parsed))
|
|
1691
|
+
return Promise.reject(
|
|
1692
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1693
|
+
endpoint: teamsPaths.shotLocation
|
|
1694
|
+
})
|
|
1695
|
+
);
|
|
1696
|
+
const path = resolvePath(teamsPaths.top10.shotLocation, parsed);
|
|
1697
|
+
return nhlClient.get(path);
|
|
1698
|
+
}
|
|
1699
|
+
async function top10ShotSpeed2(season, gameType, position, sortBy) {
|
|
1700
|
+
const Parser = BaseParams.merge({
|
|
1701
|
+
position: PositionFilter.default("ALL"),
|
|
1702
|
+
sortBy: ShotSpeedSort.default("MAX")
|
|
1703
|
+
});
|
|
1704
|
+
const parsed = Parser({
|
|
1705
|
+
season,
|
|
1706
|
+
gameType,
|
|
1707
|
+
position,
|
|
1708
|
+
sortBy
|
|
1709
|
+
});
|
|
1710
|
+
if (isParseError(parsed))
|
|
1711
|
+
return Promise.reject(
|
|
1712
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1713
|
+
endpoint: teamsPaths.shotSpeed
|
|
1714
|
+
})
|
|
1715
|
+
);
|
|
1716
|
+
const path = resolvePath(teamsPaths.top10.shotSpeed, parsed);
|
|
1717
|
+
return nhlClient.get(path);
|
|
1718
|
+
}
|
|
1719
|
+
async function top10SkatingDistance(season, gameType, position, strength, sortBy) {
|
|
1720
|
+
const Parser = BaseParams.merge({
|
|
1721
|
+
position: PositionFilter.default("ALL"),
|
|
1722
|
+
strength: SkatersStrength.default("ALL"),
|
|
1723
|
+
sortBy: SkatingDistanceSort.default("TOTAL")
|
|
1724
|
+
});
|
|
1725
|
+
const parsed = Parser({
|
|
1726
|
+
season,
|
|
1727
|
+
gameType,
|
|
1728
|
+
position,
|
|
1729
|
+
strength,
|
|
1730
|
+
sortBy
|
|
1731
|
+
});
|
|
1732
|
+
if (isParseError(parsed))
|
|
1733
|
+
return Promise.reject(
|
|
1734
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1735
|
+
endpoint: teamsPaths.skatingDistance
|
|
1736
|
+
})
|
|
1737
|
+
);
|
|
1738
|
+
const path = resolvePath(teamsPaths.top10.skatingDistance, parsed);
|
|
1739
|
+
return nhlClient.get(path);
|
|
1740
|
+
}
|
|
1741
|
+
async function top10SkatingSpeed(season, gameType, position, sortBy) {
|
|
1742
|
+
const Parser = BaseParams.merge({
|
|
1743
|
+
position: PositionFilter.default("ALL"),
|
|
1744
|
+
sortBy: SkatingSpeedSort.default("TOP")
|
|
1745
|
+
});
|
|
1746
|
+
const parsed = Parser({
|
|
1747
|
+
season,
|
|
1748
|
+
gameType,
|
|
1749
|
+
position,
|
|
1750
|
+
sortBy
|
|
1751
|
+
});
|
|
1752
|
+
if (isParseError(parsed))
|
|
1753
|
+
return Promise.reject(
|
|
1754
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1755
|
+
endpoint: teamsPaths.skatingSpeed
|
|
1756
|
+
})
|
|
1757
|
+
);
|
|
1758
|
+
const path = resolvePath(teamsPaths.top10.skatingSpeed, parsed);
|
|
1759
|
+
return nhlClient.get(path);
|
|
1760
|
+
}
|
|
1761
|
+
async function top10ZoneTime2(season, gameType, strength, sortBy) {
|
|
1762
|
+
const Parser = BaseParams.merge({
|
|
1763
|
+
strength: SkatersStrength.default("ALL"),
|
|
1764
|
+
sortBy: ZoneTimeSort.default("OZ")
|
|
1765
|
+
});
|
|
1766
|
+
const parsed = Parser({
|
|
1767
|
+
season,
|
|
1768
|
+
gameType,
|
|
1769
|
+
strength,
|
|
1770
|
+
sortBy
|
|
1771
|
+
});
|
|
1772
|
+
if (isParseError(parsed))
|
|
1773
|
+
return Promise.reject(
|
|
1774
|
+
new NHLError(parsed.summary, "VALIDATION", {
|
|
1775
|
+
endpoint: teamsPaths.zoneTime
|
|
1776
|
+
})
|
|
1777
|
+
);
|
|
1778
|
+
const path = resolvePath(teamsPaths.top10.zoneTime, parsed);
|
|
1779
|
+
return nhlClient.get(path);
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
// src/api/gamecenter/index.ts
|
|
1783
|
+
var gamecenter_exports = {};
|
|
1784
|
+
__export(gamecenter_exports, {
|
|
1785
|
+
draft: () => draft_exports,
|
|
1786
|
+
game: () => game_exports,
|
|
1787
|
+
misc: () => misc_exports,
|
|
1788
|
+
player: () => player_exports,
|
|
1789
|
+
score: () => score,
|
|
1790
|
+
scoreboard: () => scoreboard,
|
|
1791
|
+
team: () => team_exports
|
|
1792
|
+
});
|
|
1793
|
+
|
|
1794
|
+
// src/api/gamecenter/draft.ts
|
|
1795
|
+
var draft_exports = {};
|
|
1796
|
+
__export(draft_exports, {
|
|
1797
|
+
picks: () => picks,
|
|
1798
|
+
rankings: () => rankings,
|
|
1799
|
+
tracker: () => tracker
|
|
1800
|
+
});
|
|
1801
|
+
|
|
1802
|
+
// src/api/gamecenter/paths.ts
|
|
1803
|
+
var teamPaths = {
|
|
1804
|
+
/** Team roster seasons. */
|
|
1158
1805
|
rosterSeasons: "roster-season/{team}",
|
|
1806
|
+
/** Team roster for a specific season. */
|
|
1159
1807
|
roster: "roster/{team}/{season}",
|
|
1808
|
+
/** Team prospects. */
|
|
1160
1809
|
prospects: "prospects/{team}",
|
|
1810
|
+
/** Team club statistics for a specific season and game type. */
|
|
1161
1811
|
clubStats: "club-stats/{team}/{season}/{gameType}",
|
|
1812
|
+
/** Team club statistics summary for a season. */
|
|
1162
1813
|
clubStatsSeason: "club-stats-season/{team}",
|
|
1814
|
+
/** League standings for a specific date. */
|
|
1163
1815
|
standings: "standings/{date}",
|
|
1816
|
+
/** League standings summary for a season. */
|
|
1164
1817
|
standingsSeason: "standings-season",
|
|
1818
|
+
/** Team schedule data. */
|
|
1165
1819
|
clubSchedule: {
|
|
1820
|
+
/** Team schedule for a season. */
|
|
1166
1821
|
season: "club-schedule-season/{team}/{season}",
|
|
1822
|
+
/** Team schedule for a specific month. */
|
|
1167
1823
|
month: "club-schedule/{team}/month/{month}",
|
|
1824
|
+
/** Team schedule for a specific week. */
|
|
1168
1825
|
week: "club-schedule/{team}/week/{date}"
|
|
1169
1826
|
}
|
|
1170
1827
|
};
|
|
1171
|
-
var
|
|
1828
|
+
var scorePaths = {
|
|
1829
|
+
/** Game scores for a specific date. */
|
|
1172
1830
|
score: "score/{date}",
|
|
1831
|
+
/** Scoreboard data. */
|
|
1173
1832
|
scoreboard: {
|
|
1833
|
+
/** Current scoreboard. */
|
|
1174
1834
|
now: "scoreboard/now",
|
|
1835
|
+
/** Scoreboard for a specific team. */
|
|
1175
1836
|
byTeam: "scoreboard/{team}/now",
|
|
1837
|
+
/** Scoreboard for a specific date. */
|
|
1176
1838
|
byDate: "scoreboard/{date}"
|
|
1177
1839
|
}
|
|
1178
1840
|
};
|
|
1179
|
-
var
|
|
1841
|
+
var playerPaths = {
|
|
1842
|
+
/** Player landing page data. */
|
|
1180
1843
|
landing: "player/{playerId}/landing",
|
|
1844
|
+
/** Player game log for a season and game type. */
|
|
1181
1845
|
gameLog: "player/{playerId}/game-log/{season}/{gameType}",
|
|
1846
|
+
/** Current player spotlight. */
|
|
1182
1847
|
spotlight: "player-spotlight",
|
|
1848
|
+
/** Player statistics leaders. */
|
|
1183
1849
|
statsLeaders: {
|
|
1850
|
+
/** Skater statistics leaders. */
|
|
1184
1851
|
skaters: "skater-stats-leaders/{season}/{gameType}",
|
|
1852
|
+
/** Goalie statistics leaders. */
|
|
1185
1853
|
goalies: "goalie-stats-leaders/{season}/{gameType}"
|
|
1186
1854
|
},
|
|
1855
|
+
/** Player search functionality. */
|
|
1187
1856
|
playerSearch: "https://search.d3.nhle.com/api/v1/search/player"
|
|
1188
1857
|
};
|
|
1189
|
-
var
|
|
1858
|
+
var miscPaths = {
|
|
1859
|
+
/** Current season information. */
|
|
1190
1860
|
season: "season",
|
|
1861
|
+
/** Playoff series metadata for a specific year and series. */
|
|
1191
1862
|
metaPlayoffSeries: "meta/playoff-series/{year}/{seriesLetter}",
|
|
1863
|
+
/** Game metadata. */
|
|
1192
1864
|
metaGame: "meta/game/{gameId}",
|
|
1865
|
+
/** Location lookup by postal code. */
|
|
1193
1866
|
postalLookup: "postal-lookup/{postalCode}",
|
|
1867
|
+
/** Location information. */
|
|
1194
1868
|
location: "location",
|
|
1869
|
+
/** Partner game for a specific country. */
|
|
1195
1870
|
partnerGame: "partner-game/{countryCode}/now"
|
|
1196
1871
|
};
|
|
1197
|
-
var
|
|
1872
|
+
var gamePaths = {
|
|
1873
|
+
/** Game schedule for a specific date. */
|
|
1198
1874
|
schedule: "schedule/{date}",
|
|
1875
|
+
/** Game schedule calendar for a specific date. */
|
|
1199
1876
|
scheduleCalendar: "schedule-calendar/{date}",
|
|
1877
|
+
/** Playoff bracket for a specific year. */
|
|
1200
1878
|
playoffBracket: "playoff-bracket/{year}",
|
|
1201
|
-
|
|
1879
|
+
/** Playoff series carousel for a season. */
|
|
1880
|
+
playoffSeries: "playoff-series/carousel/{season}",
|
|
1881
|
+
/** Playoff series schedule. */
|
|
1202
1882
|
playoffSeriesSchedule: "schedule/playoff-series/{season}/{seriesLetter}",
|
|
1883
|
+
/** Game center data with multiple views. */
|
|
1203
1884
|
gamecenter: {
|
|
1885
|
+
/** Play-by-play data for a game. */
|
|
1204
1886
|
playByPlay: "gamecenter/{gameId}/play-by-play",
|
|
1887
|
+
/** Right rail reports for a game. */
|
|
1205
1888
|
reports: "gamecenter/{gameId}/right-rail",
|
|
1889
|
+
/** Game landing page. */
|
|
1206
1890
|
landing: "gamecenter/{gameId}/landing",
|
|
1891
|
+
/** Game box score. */
|
|
1207
1892
|
boxscore: "gamecenter/{gameId}/boxscore"
|
|
1208
1893
|
},
|
|
1894
|
+
/** Web Stat Center (WSC) data. */
|
|
1209
1895
|
wsc: {
|
|
1896
|
+
/** Game story from WSC. */
|
|
1210
1897
|
gameStory: "wsc/game-story/{gameId}",
|
|
1898
|
+
/** Play-by-play from WSC. */
|
|
1211
1899
|
playByPlay: "wsc/play-by-play/{gameId}"
|
|
1212
1900
|
},
|
|
1901
|
+
/** PPT replay data. */
|
|
1213
1902
|
pptReplay: {
|
|
1903
|
+
/** Goal replay. */
|
|
1214
1904
|
goal: "ppt-replay/goal/{gameId}/{eventId}",
|
|
1905
|
+
/** Event replay. */
|
|
1215
1906
|
event: "ppt-replay/{gameId}/{eventId}"
|
|
1216
1907
|
},
|
|
1908
|
+
/** Where to watch information. */
|
|
1217
1909
|
whereToWatch: "where-to-watch",
|
|
1910
|
+
/** Network TV schedule for a specific date. */
|
|
1218
1911
|
networkTVSchedule: "network/tv-schedule/{date}"
|
|
1219
1912
|
};
|
|
1220
|
-
var
|
|
1913
|
+
var draftPaths = {
|
|
1914
|
+
/** Draft picks data. */
|
|
1221
1915
|
draftPicks: {
|
|
1916
|
+
/** Draft picks by year and round. */
|
|
1222
1917
|
byYearAndRound: "draft/picks/{year}/{round}",
|
|
1918
|
+
/** All draft picks for a year. */
|
|
1223
1919
|
byYear: "draft/picks/{year}/all"
|
|
1224
1920
|
},
|
|
1921
|
+
/** Draft rankings for a year and type. */
|
|
1225
1922
|
draftRankings: "draft/rankings/{year}/{type}",
|
|
1923
|
+
/** Current draft tracker. */
|
|
1226
1924
|
draftTracker: "draft-tracker/picks/now"
|
|
1227
1925
|
};
|
|
1228
1926
|
|
|
@@ -1231,18 +1929,22 @@ async function picks(year, round) {
|
|
|
1231
1929
|
const parsed = DraftParams({ year, round });
|
|
1232
1930
|
if (isParseError(parsed)) {
|
|
1233
1931
|
return {
|
|
1234
|
-
|
|
1932
|
+
success: false,
|
|
1235
1933
|
error: new ValidationError(parsed.summary, {
|
|
1236
|
-
endpoint:
|
|
1934
|
+
endpoint: draftPaths.draftPicks.byYearAndRound
|
|
1237
1935
|
})
|
|
1238
1936
|
};
|
|
1239
1937
|
}
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1938
|
+
let path = "";
|
|
1939
|
+
if (parsed.year && !parsed.round) {
|
|
1940
|
+
path = resolvePath(draftPaths.draftPicks.byYear, parsed);
|
|
1941
|
+
} else {
|
|
1942
|
+
path = resolvePath(draftPaths.draftPicks.byYearAndRound, parsed);
|
|
1943
|
+
}
|
|
1944
|
+
return nhlClient.get(path);
|
|
1243
1945
|
}
|
|
1244
1946
|
async function tracker() {
|
|
1245
|
-
return
|
|
1947
|
+
return nhlClient.get(draftPaths.draftTracker);
|
|
1246
1948
|
}
|
|
1247
1949
|
function rankings(year) {
|
|
1248
1950
|
const DraftRankingsEnum = {
|
|
@@ -1255,18 +1957,14 @@ function rankings(year) {
|
|
|
1255
1957
|
const parsedYear = Year(year ?? getCurrentYear());
|
|
1256
1958
|
if (isParseError(parsedYear)) {
|
|
1257
1959
|
return {
|
|
1258
|
-
|
|
1960
|
+
success: false,
|
|
1259
1961
|
error: new ValidationError(parsedYear.summary, {
|
|
1260
|
-
endpoint:
|
|
1962
|
+
endpoint: draftPaths.draftRankings
|
|
1261
1963
|
})
|
|
1262
1964
|
};
|
|
1263
1965
|
}
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
year: parsedYear,
|
|
1267
|
-
type: type2
|
|
1268
|
-
})
|
|
1269
|
-
);
|
|
1966
|
+
const path = resolvePath(draftPaths.draftRankings, { year: parsedYear, type: type2 });
|
|
1967
|
+
return nhlClient.get(path);
|
|
1270
1968
|
};
|
|
1271
1969
|
return {
|
|
1272
1970
|
/**
|
|
@@ -1295,7 +1993,7 @@ function rankings(year) {
|
|
|
1295
1993
|
*/
|
|
1296
1994
|
all: async () => {
|
|
1297
1995
|
const unwrapAPIResponse = (apiResponse) => {
|
|
1298
|
-
if (apiResponse.
|
|
1996
|
+
if (apiResponse.success) {
|
|
1299
1997
|
return apiResponse.data;
|
|
1300
1998
|
}
|
|
1301
1999
|
throw apiResponse.error;
|
|
@@ -1309,13 +2007,13 @@ function rankings(year) {
|
|
|
1309
2007
|
try {
|
|
1310
2008
|
const dataOnly = response.map((r) => unwrapAPIResponse(r));
|
|
1311
2009
|
const newResponse = {
|
|
1312
|
-
|
|
2010
|
+
success: true,
|
|
1313
2011
|
data: dataOnly
|
|
1314
2012
|
};
|
|
1315
2013
|
return newResponse;
|
|
1316
2014
|
} catch (error) {
|
|
1317
2015
|
return {
|
|
1318
|
-
|
|
2016
|
+
success: false,
|
|
1319
2017
|
error
|
|
1320
2018
|
};
|
|
1321
2019
|
}
|
|
@@ -1344,57 +2042,57 @@ async function playByPlay(gameId) {
|
|
|
1344
2042
|
const parsedGameId = GameId(gameId);
|
|
1345
2043
|
if (isParseError(parsedGameId)) {
|
|
1346
2044
|
return {
|
|
1347
|
-
|
|
2045
|
+
success: false,
|
|
1348
2046
|
error: new ValidationError(parsedGameId.summary, {
|
|
1349
|
-
endpoint:
|
|
2047
|
+
endpoint: gamePaths.gamecenter.playByPlay
|
|
1350
2048
|
})
|
|
1351
2049
|
};
|
|
1352
2050
|
}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
);
|
|
2051
|
+
const path = resolvePath(gamePaths.gamecenter.playByPlay, {
|
|
2052
|
+
gameId: parsedGameId
|
|
2053
|
+
});
|
|
2054
|
+
return nhlClient.get(path);
|
|
1356
2055
|
}
|
|
1357
2056
|
async function reports(gameId) {
|
|
1358
2057
|
const parsedGameId = GameId(gameId);
|
|
1359
2058
|
if (isParseError(parsedGameId)) {
|
|
1360
2059
|
return {
|
|
1361
|
-
|
|
2060
|
+
success: false,
|
|
1362
2061
|
error: new ValidationError(parsedGameId.summary, {
|
|
1363
|
-
endpoint:
|
|
2062
|
+
endpoint: gamePaths.gamecenter.reports
|
|
1364
2063
|
})
|
|
1365
2064
|
};
|
|
1366
2065
|
}
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
);
|
|
2066
|
+
const path = resolvePath(gamePaths.gamecenter.reports, { gameId: parsedGameId });
|
|
2067
|
+
return nhlClient.get(path);
|
|
1370
2068
|
}
|
|
1371
2069
|
async function landing(gameId) {
|
|
1372
2070
|
const parsedGameId = GameId(gameId);
|
|
1373
2071
|
if (isParseError(parsedGameId)) {
|
|
1374
2072
|
return {
|
|
1375
|
-
|
|
2073
|
+
success: false,
|
|
1376
2074
|
error: new ValidationError(parsedGameId.summary, {
|
|
1377
|
-
endpoint:
|
|
2075
|
+
endpoint: gamePaths.gamecenter.landing
|
|
1378
2076
|
})
|
|
1379
2077
|
};
|
|
1380
2078
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
);
|
|
2079
|
+
const path = resolvePath(gamePaths.gamecenter.landing, { gameId: parsedGameId });
|
|
2080
|
+
return nhlClient.get(path);
|
|
1384
2081
|
}
|
|
1385
2082
|
async function boxscore(gameId) {
|
|
1386
2083
|
const parsedGameId = GameId(gameId);
|
|
1387
2084
|
if (isParseError(parsedGameId)) {
|
|
1388
2085
|
return {
|
|
1389
|
-
|
|
2086
|
+
success: false,
|
|
1390
2087
|
error: new ValidationError(parsedGameId.summary, {
|
|
1391
|
-
endpoint:
|
|
2088
|
+
endpoint: gamePaths.gamecenter.boxscore
|
|
1392
2089
|
})
|
|
1393
2090
|
};
|
|
1394
2091
|
}
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
);
|
|
2092
|
+
const path = resolvePath(gamePaths.gamecenter.boxscore, {
|
|
2093
|
+
gameId: parsedGameId
|
|
2094
|
+
});
|
|
2095
|
+
return nhlClient.get(path);
|
|
1398
2096
|
}
|
|
1399
2097
|
var wsc = {
|
|
1400
2098
|
gameStory: wscGameStory,
|
|
@@ -1404,29 +2102,27 @@ async function wscGameStory(gameId) {
|
|
|
1404
2102
|
const parsedGameId = GameId(gameId);
|
|
1405
2103
|
if (isParseError(parsedGameId)) {
|
|
1406
2104
|
return {
|
|
1407
|
-
|
|
2105
|
+
success: false,
|
|
1408
2106
|
error: new ValidationError(parsedGameId.summary, {
|
|
1409
|
-
endpoint:
|
|
2107
|
+
endpoint: gamePaths.wsc.gameStory
|
|
1410
2108
|
})
|
|
1411
2109
|
};
|
|
1412
2110
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
);
|
|
2111
|
+
const path = resolvePath(gamePaths.wsc.gameStory, { gameId: parsedGameId });
|
|
2112
|
+
return nhlClient.get(path);
|
|
1416
2113
|
}
|
|
1417
2114
|
async function wscPlayByPlay(gameId) {
|
|
1418
2115
|
const parsedGameId = GameId(gameId);
|
|
1419
2116
|
if (isParseError(parsedGameId)) {
|
|
1420
2117
|
return {
|
|
1421
|
-
|
|
2118
|
+
success: false,
|
|
1422
2119
|
error: new ValidationError(parsedGameId.summary, {
|
|
1423
|
-
endpoint:
|
|
2120
|
+
endpoint: gamePaths.wsc.playByPlay
|
|
1424
2121
|
})
|
|
1425
2122
|
};
|
|
1426
2123
|
}
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
);
|
|
2124
|
+
const path = resolvePath(gamePaths.wsc.playByPlay, { gameId: parsedGameId });
|
|
2125
|
+
return nhlClient.get(path);
|
|
1430
2126
|
}
|
|
1431
2127
|
var pptReplay = {
|
|
1432
2128
|
goal: pptReplayGoal,
|
|
@@ -1436,77 +2132,79 @@ async function pptReplayGoal(gameId, eventId) {
|
|
|
1436
2132
|
const parsed = GameIdAndEventId({ gameId, eventId });
|
|
1437
2133
|
if (isParseError(parsed)) {
|
|
1438
2134
|
return {
|
|
1439
|
-
|
|
2135
|
+
success: false,
|
|
1440
2136
|
error: new ValidationError(parsed.summary, {
|
|
1441
|
-
endpoint:
|
|
2137
|
+
endpoint: gamePaths.pptReplay.goal
|
|
1442
2138
|
})
|
|
1443
2139
|
};
|
|
1444
2140
|
}
|
|
1445
|
-
|
|
2141
|
+
const path = resolvePath(gamePaths.pptReplay.goal, { gameId, eventId });
|
|
2142
|
+
return nhlClient.get(path);
|
|
1446
2143
|
}
|
|
1447
2144
|
async function pptReplayEvent(gameId, eventId) {
|
|
1448
2145
|
const parsed = GameIdAndEventId({ gameId, eventId });
|
|
1449
2146
|
if (isParseError(parsed)) {
|
|
1450
2147
|
return {
|
|
1451
|
-
|
|
2148
|
+
success: false,
|
|
1452
2149
|
error: new ValidationError(parsed.summary, {
|
|
1453
|
-
endpoint:
|
|
2150
|
+
endpoint: gamePaths.pptReplay.event
|
|
1454
2151
|
})
|
|
1455
2152
|
};
|
|
1456
2153
|
}
|
|
1457
|
-
|
|
2154
|
+
const path = resolvePath(gamePaths.pptReplay.event, { gameId, eventId });
|
|
2155
|
+
return nhlClient.get(path);
|
|
1458
2156
|
}
|
|
1459
2157
|
async function schedule(date) {
|
|
1460
2158
|
const parsedDate = NHLDate(date ?? getCurrentDate());
|
|
1461
2159
|
if (isParseError(parsedDate)) {
|
|
1462
2160
|
return {
|
|
1463
|
-
|
|
2161
|
+
success: false,
|
|
1464
2162
|
error: new ValidationError(parsedDate.summary, {
|
|
1465
|
-
endpoint:
|
|
2163
|
+
endpoint: gamePaths.schedule
|
|
1466
2164
|
})
|
|
1467
2165
|
};
|
|
1468
2166
|
}
|
|
1469
|
-
|
|
2167
|
+
const path = resolvePath(gamePaths.schedule, { date: parsedDate });
|
|
2168
|
+
return nhlClient.get(path);
|
|
1470
2169
|
}
|
|
1471
2170
|
async function scheduleCalendar(date) {
|
|
1472
2171
|
const parsedDate = NHLDate(date);
|
|
1473
2172
|
if (isParseError(parsedDate)) {
|
|
1474
2173
|
return {
|
|
1475
|
-
|
|
2174
|
+
success: false,
|
|
1476
2175
|
error: new ValidationError(parsedDate.summary, {
|
|
1477
|
-
endpoint:
|
|
2176
|
+
endpoint: gamePaths.scheduleCalendar
|
|
1478
2177
|
})
|
|
1479
2178
|
};
|
|
1480
2179
|
}
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
);
|
|
2180
|
+
const path = resolvePath(gamePaths.scheduleCalendar, { date: parsedDate });
|
|
2181
|
+
return nhlClient.get(path);
|
|
1484
2182
|
}
|
|
1485
2183
|
async function playoffBracket(year) {
|
|
1486
2184
|
const parsedYear = Year(year ?? getCurrentYear());
|
|
1487
2185
|
if (isParseError(parsedYear)) {
|
|
1488
2186
|
return {
|
|
1489
|
-
|
|
2187
|
+
success: false,
|
|
1490
2188
|
error: new ValidationError(parsedYear.summary, {
|
|
1491
|
-
endpoint:
|
|
2189
|
+
endpoint: gamePaths.playoffBracket
|
|
1492
2190
|
})
|
|
1493
2191
|
};
|
|
1494
2192
|
}
|
|
1495
|
-
|
|
2193
|
+
const path = resolvePath(gamePaths.playoffBracket, { year: parsedYear });
|
|
2194
|
+
return nhlClient.get(path);
|
|
1496
2195
|
}
|
|
1497
2196
|
async function playoffSeries(season) {
|
|
1498
2197
|
const parsedSeason = Season(season ?? getCurrentSeason());
|
|
1499
2198
|
if (isParseError(parsedSeason)) {
|
|
1500
2199
|
return {
|
|
1501
|
-
|
|
2200
|
+
success: false,
|
|
1502
2201
|
error: new ValidationError(parsedSeason.summary, {
|
|
1503
|
-
endpoint:
|
|
2202
|
+
endpoint: gamePaths.playoffSeries
|
|
1504
2203
|
})
|
|
1505
2204
|
};
|
|
1506
2205
|
}
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
);
|
|
2206
|
+
const path = resolvePath(gamePaths.playoffSeries, { season: parsedSeason });
|
|
2207
|
+
return nhlClient.get(path);
|
|
1510
2208
|
}
|
|
1511
2209
|
async function playoffSeriesSchedule(seriesLetter, season) {
|
|
1512
2210
|
const parsed = SeriesAndSeasonParams({
|
|
@@ -1515,30 +2213,31 @@ async function playoffSeriesSchedule(seriesLetter, season) {
|
|
|
1515
2213
|
});
|
|
1516
2214
|
if (isParseError(parsed)) {
|
|
1517
2215
|
return {
|
|
1518
|
-
|
|
2216
|
+
success: false,
|
|
1519
2217
|
error: new ValidationError(parsed.summary, {
|
|
1520
|
-
endpoint:
|
|
2218
|
+
endpoint: gamePaths.playoffSeriesSchedule
|
|
1521
2219
|
})
|
|
1522
2220
|
};
|
|
1523
2221
|
}
|
|
1524
|
-
|
|
2222
|
+
const path = resolvePath(gamePaths.playoffSeriesSchedule, parsed);
|
|
2223
|
+
return nhlClient.get(path);
|
|
1525
2224
|
}
|
|
1526
2225
|
async function whereToWatch() {
|
|
1527
|
-
|
|
2226
|
+
const path = resolvePath(gamePaths.whereToWatch, {});
|
|
2227
|
+
return nhlClient.get(path);
|
|
1528
2228
|
}
|
|
1529
2229
|
async function networkTVSchedule(date) {
|
|
1530
2230
|
const parsedDate = NHLDate(date ?? getCurrentDate());
|
|
1531
2231
|
if (isParseError(parsedDate)) {
|
|
1532
2232
|
return {
|
|
1533
|
-
|
|
2233
|
+
success: false,
|
|
1534
2234
|
error: new ValidationError(parsedDate.summary, {
|
|
1535
|
-
endpoint:
|
|
2235
|
+
endpoint: gamePaths.networkTVSchedule
|
|
1536
2236
|
})
|
|
1537
2237
|
};
|
|
1538
2238
|
}
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
);
|
|
2239
|
+
const path = resolvePath(gamePaths.networkTVSchedule, { date: parsedDate });
|
|
2240
|
+
return nhlClient.get(path);
|
|
1542
2241
|
}
|
|
1543
2242
|
|
|
1544
2243
|
// src/api/gamecenter/misc.ts
|
|
@@ -1551,7 +2250,7 @@ __export(misc_exports, {
|
|
|
1551
2250
|
seasons: () => seasons
|
|
1552
2251
|
});
|
|
1553
2252
|
async function seasons() {
|
|
1554
|
-
return
|
|
2253
|
+
return nhlClient.get(miscPaths.season);
|
|
1555
2254
|
}
|
|
1556
2255
|
var meta = {
|
|
1557
2256
|
game: metaGame,
|
|
@@ -1561,56 +2260,60 @@ async function metaGame(gameId) {
|
|
|
1561
2260
|
const parsedGameId = GameId(gameId);
|
|
1562
2261
|
if (isParseError(parsedGameId)) {
|
|
1563
2262
|
return {
|
|
1564
|
-
|
|
2263
|
+
success: false,
|
|
1565
2264
|
error: new ValidationError(parsedGameId.summary, {
|
|
1566
|
-
endpoint:
|
|
2265
|
+
endpoint: miscPaths.metaGame
|
|
1567
2266
|
})
|
|
1568
2267
|
};
|
|
1569
2268
|
}
|
|
1570
|
-
|
|
2269
|
+
const path = resolvePath(miscPaths.metaGame, { gameId: parsedGameId });
|
|
2270
|
+
return nhlClient.get(path);
|
|
1571
2271
|
}
|
|
1572
2272
|
async function metaPlayoffSeries(seriesLetter, year) {
|
|
1573
2273
|
const parsed = SeriesParams({ year, seriesLetter });
|
|
1574
2274
|
if (isParseError(parsed)) {
|
|
1575
2275
|
return {
|
|
1576
|
-
|
|
2276
|
+
success: false,
|
|
1577
2277
|
error: new ValidationError(parsed.summary, {
|
|
1578
|
-
endpoint:
|
|
2278
|
+
endpoint: miscPaths.metaPlayoffSeries
|
|
1579
2279
|
})
|
|
1580
2280
|
};
|
|
1581
2281
|
}
|
|
1582
|
-
|
|
2282
|
+
const path = resolvePath(miscPaths.metaPlayoffSeries, parsed);
|
|
2283
|
+
return nhlClient.get(path);
|
|
1583
2284
|
}
|
|
1584
2285
|
async function postalLookup(postalCode) {
|
|
1585
2286
|
const parsedPostalCode = PostalCode(postalCode);
|
|
1586
2287
|
if (isParseError(parsedPostalCode)) {
|
|
1587
2288
|
return {
|
|
1588
|
-
|
|
2289
|
+
success: false,
|
|
1589
2290
|
error: new ValidationError(parsedPostalCode.summary, {
|
|
1590
|
-
endpoint:
|
|
2291
|
+
endpoint: miscPaths.postalLookup
|
|
1591
2292
|
})
|
|
1592
2293
|
};
|
|
1593
2294
|
}
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
);
|
|
2295
|
+
const path = resolvePath(miscPaths.postalLookup, {
|
|
2296
|
+
postalCode: parsedPostalCode
|
|
2297
|
+
});
|
|
2298
|
+
return nhlClient.get(path);
|
|
1597
2299
|
}
|
|
1598
2300
|
async function location() {
|
|
1599
|
-
return
|
|
2301
|
+
return nhlClient.get(miscPaths.location);
|
|
1600
2302
|
}
|
|
1601
2303
|
async function partnerGame(countryCode) {
|
|
1602
2304
|
const parsedCountryCode = CountryCode(countryCode);
|
|
1603
2305
|
if (isParseError(parsedCountryCode)) {
|
|
1604
2306
|
return {
|
|
1605
|
-
|
|
2307
|
+
success: false,
|
|
1606
2308
|
error: new ValidationError(parsedCountryCode.summary, {
|
|
1607
|
-
endpoint:
|
|
2309
|
+
endpoint: miscPaths.partnerGame
|
|
1608
2310
|
})
|
|
1609
2311
|
};
|
|
1610
2312
|
}
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
);
|
|
2313
|
+
const path = resolvePath(miscPaths.partnerGame, {
|
|
2314
|
+
countryCode: parsedCountryCode
|
|
2315
|
+
});
|
|
2316
|
+
return nhlClient.get(path);
|
|
1614
2317
|
}
|
|
1615
2318
|
|
|
1616
2319
|
// src/api/gamecenter/player.ts
|
|
@@ -1622,21 +2325,20 @@ __export(player_exports, {
|
|
|
1622
2325
|
spotlight: () => spotlight,
|
|
1623
2326
|
statsLeaders: () => statsLeaders
|
|
1624
2327
|
});
|
|
1625
|
-
var nhlPlayerSearch = createNHLClient(
|
|
2328
|
+
var nhlPlayerSearch = createNHLClient(playerPaths.playerSearch);
|
|
1626
2329
|
var searchUrlParams = { culture: "en", q: "" };
|
|
1627
2330
|
async function landing2(playerId) {
|
|
1628
2331
|
const parsedPlayerId = PlayerId(playerId);
|
|
1629
2332
|
if (isParseError(parsedPlayerId)) {
|
|
1630
2333
|
return {
|
|
1631
|
-
|
|
2334
|
+
success: false,
|
|
1632
2335
|
error: new ValidationError(parsedPlayerId.summary, {
|
|
1633
|
-
endpoint:
|
|
2336
|
+
endpoint: playerPaths.landing
|
|
1634
2337
|
})
|
|
1635
2338
|
};
|
|
1636
2339
|
}
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
);
|
|
2340
|
+
const path = resolvePath(playerPaths.landing, { playerId: parsedPlayerId });
|
|
2341
|
+
return nhlClient.get(path);
|
|
1640
2342
|
}
|
|
1641
2343
|
async function gameLog(playerId, season, gameType) {
|
|
1642
2344
|
const Parser = BaseParams.merge({
|
|
@@ -1645,16 +2347,17 @@ async function gameLog(playerId, season, gameType) {
|
|
|
1645
2347
|
const parsed = Parser({ playerId, season, gameType });
|
|
1646
2348
|
if (isParseError(parsed)) {
|
|
1647
2349
|
return {
|
|
1648
|
-
|
|
2350
|
+
success: false,
|
|
1649
2351
|
error: new ValidationError(parsed.summary, {
|
|
1650
|
-
endpoint:
|
|
2352
|
+
endpoint: playerPaths.gameLog
|
|
1651
2353
|
})
|
|
1652
2354
|
};
|
|
1653
2355
|
}
|
|
1654
|
-
|
|
2356
|
+
const path = resolvePath(playerPaths.gameLog, parsed);
|
|
2357
|
+
return nhlClient.get(path);
|
|
1655
2358
|
}
|
|
1656
2359
|
async function spotlight() {
|
|
1657
|
-
return
|
|
2360
|
+
return nhlClient.get(playerPaths.spotlight);
|
|
1658
2361
|
}
|
|
1659
2362
|
async function search(query) {
|
|
1660
2363
|
return nhlPlayerSearch.get("", {
|
|
@@ -1670,25 +2373,27 @@ async function statsLeadersSkaters(season, gameType) {
|
|
|
1670
2373
|
const parsed = BaseParams({ season, gameType });
|
|
1671
2374
|
if (isParseError(parsed)) {
|
|
1672
2375
|
return {
|
|
1673
|
-
|
|
2376
|
+
success: false,
|
|
1674
2377
|
error: new ValidationError(parsed.summary, {
|
|
1675
|
-
endpoint:
|
|
2378
|
+
endpoint: playerPaths.statsLeaders.skaters
|
|
1676
2379
|
})
|
|
1677
2380
|
};
|
|
1678
2381
|
}
|
|
1679
|
-
|
|
2382
|
+
const path = resolvePath(playerPaths.statsLeaders.skaters, parsed);
|
|
2383
|
+
return nhlClient.get(path);
|
|
1680
2384
|
}
|
|
1681
2385
|
async function statsLeadersGoalies(season, gameType) {
|
|
1682
2386
|
const parsed = BaseParams({ season, gameType });
|
|
1683
2387
|
if (isParseError(parsed)) {
|
|
1684
2388
|
return {
|
|
1685
|
-
|
|
2389
|
+
success: false,
|
|
1686
2390
|
error: new ValidationError(parsed.summary, {
|
|
1687
|
-
endpoint:
|
|
2391
|
+
endpoint: playerPaths.statsLeaders.goalies
|
|
1688
2392
|
})
|
|
1689
2393
|
};
|
|
1690
2394
|
}
|
|
1691
|
-
|
|
2395
|
+
const path = resolvePath(playerPaths.statsLeaders.goalies, parsed);
|
|
2396
|
+
return nhlClient.get(path);
|
|
1692
2397
|
}
|
|
1693
2398
|
|
|
1694
2399
|
// src/api/gamecenter/score.ts
|
|
@@ -1696,44 +2401,43 @@ async function score(date) {
|
|
|
1696
2401
|
const parsed = NHLDate(date ?? getCurrentDate());
|
|
1697
2402
|
if (isParseError(parsed)) {
|
|
1698
2403
|
return {
|
|
1699
|
-
|
|
2404
|
+
success: false,
|
|
1700
2405
|
error: new ValidationError(parsed.summary, {
|
|
1701
|
-
endpoint:
|
|
2406
|
+
endpoint: scorePaths.score
|
|
1702
2407
|
})
|
|
1703
2408
|
};
|
|
1704
2409
|
}
|
|
1705
|
-
|
|
2410
|
+
const path = resolvePath(scorePaths.score, { date: parsed });
|
|
2411
|
+
return nhlClient.get(path);
|
|
1706
2412
|
}
|
|
1707
2413
|
async function scoreboard() {
|
|
1708
|
-
return
|
|
2414
|
+
return nhlClient.get(scorePaths.scoreboard.now);
|
|
1709
2415
|
}
|
|
1710
2416
|
scoreboard.team = async (team) => {
|
|
1711
2417
|
const parsed = TeamAbbrev(team);
|
|
1712
2418
|
if (isParseError(parsed)) {
|
|
1713
2419
|
return {
|
|
1714
|
-
|
|
2420
|
+
success: false,
|
|
1715
2421
|
error: new ValidationError(parsed.summary, {
|
|
1716
|
-
endpoint:
|
|
2422
|
+
endpoint: scorePaths.scoreboard.byTeam
|
|
1717
2423
|
})
|
|
1718
2424
|
};
|
|
1719
2425
|
}
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
);
|
|
2426
|
+
const path = resolvePath(scorePaths.scoreboard.byTeam, { team: parsed });
|
|
2427
|
+
return nhlClient.get(path);
|
|
1723
2428
|
};
|
|
1724
2429
|
scoreboard.date = async (date) => {
|
|
1725
2430
|
const parsed = NHLDate(date);
|
|
1726
2431
|
if (isParseError(parsed)) {
|
|
1727
2432
|
return {
|
|
1728
|
-
|
|
2433
|
+
success: false,
|
|
1729
2434
|
error: new ValidationError(parsed.summary, {
|
|
1730
|
-
endpoint:
|
|
2435
|
+
endpoint: scorePaths.scoreboard.byDate
|
|
1731
2436
|
})
|
|
1732
2437
|
};
|
|
1733
2438
|
}
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
);
|
|
2439
|
+
const path = resolvePath(scorePaths.scoreboard.byDate, { date: parsed });
|
|
2440
|
+
return nhlClient.get(path);
|
|
1737
2441
|
};
|
|
1738
2442
|
|
|
1739
2443
|
// src/api/gamecenter/team.ts
|
|
@@ -1745,122 +2449,131 @@ __export(team_exports, {
|
|
|
1745
2449
|
schedule: () => schedule2,
|
|
1746
2450
|
standings: () => standings,
|
|
1747
2451
|
standingsSeason: () => standingsSeason,
|
|
1748
|
-
stats: () =>
|
|
2452
|
+
stats: () => stats2,
|
|
1749
2453
|
statsSeason: () => statsSeason
|
|
1750
2454
|
});
|
|
1751
2455
|
async function rosterSeasons(team) {
|
|
1752
2456
|
const parsed = TeamAbbrev(team);
|
|
1753
2457
|
if (isParseError(parsed)) {
|
|
1754
2458
|
return {
|
|
1755
|
-
|
|
2459
|
+
success: false,
|
|
1756
2460
|
error: new ValidationError(parsed.summary, {
|
|
1757
|
-
endpoint:
|
|
2461
|
+
endpoint: teamPaths.rosterSeasons
|
|
1758
2462
|
})
|
|
1759
2463
|
};
|
|
1760
2464
|
}
|
|
1761
|
-
|
|
2465
|
+
const path = resolvePath(teamPaths.rosterSeasons, { team: parsed });
|
|
2466
|
+
return nhlClient.get(path);
|
|
1762
2467
|
}
|
|
1763
2468
|
async function roster(team, season) {
|
|
1764
2469
|
const parsed = TeamAndSeasonParams({ team, season });
|
|
1765
2470
|
if (isParseError(parsed)) {
|
|
1766
2471
|
return {
|
|
1767
|
-
|
|
2472
|
+
success: false,
|
|
1768
2473
|
error: new ValidationError(parsed.summary, {
|
|
1769
|
-
endpoint:
|
|
2474
|
+
endpoint: teamPaths.roster
|
|
1770
2475
|
})
|
|
1771
2476
|
};
|
|
1772
2477
|
}
|
|
1773
|
-
|
|
2478
|
+
const path = resolvePath(teamPaths.roster, parsed);
|
|
2479
|
+
return nhlClient.get(path);
|
|
1774
2480
|
}
|
|
1775
2481
|
async function prospects(team) {
|
|
1776
2482
|
const parsed = TeamAbbrev(team);
|
|
1777
2483
|
if (isParseError(parsed)) {
|
|
1778
2484
|
return {
|
|
1779
|
-
|
|
2485
|
+
success: false,
|
|
1780
2486
|
error: new ValidationError(parsed.summary, {
|
|
1781
|
-
endpoint:
|
|
2487
|
+
endpoint: teamPaths.prospects
|
|
1782
2488
|
})
|
|
1783
2489
|
};
|
|
1784
2490
|
}
|
|
1785
|
-
|
|
2491
|
+
const path = resolvePath(teamPaths.prospects, { team: parsed });
|
|
2492
|
+
return nhlClient.get(path);
|
|
1786
2493
|
}
|
|
1787
|
-
async function
|
|
2494
|
+
async function stats2(team, season, gameType) {
|
|
1788
2495
|
const Parser = BaseParams.merge({
|
|
1789
2496
|
team: TeamAbbrev
|
|
1790
2497
|
});
|
|
1791
2498
|
const parsed = Parser({ team, season, gameType });
|
|
1792
2499
|
if (isParseError(parsed)) {
|
|
1793
2500
|
return {
|
|
1794
|
-
|
|
2501
|
+
success: false,
|
|
1795
2502
|
error: new ValidationError(parsed.summary, {
|
|
1796
|
-
endpoint:
|
|
2503
|
+
endpoint: teamPaths.clubStats
|
|
1797
2504
|
})
|
|
1798
2505
|
};
|
|
1799
2506
|
}
|
|
1800
|
-
|
|
2507
|
+
const path = resolvePath(teamPaths.clubStats, parsed);
|
|
2508
|
+
return nhlClient.get(path);
|
|
1801
2509
|
}
|
|
1802
2510
|
async function statsSeason(team) {
|
|
1803
2511
|
const parsed = TeamAbbrev(team);
|
|
1804
2512
|
if (isParseError(parsed)) {
|
|
1805
2513
|
return {
|
|
1806
|
-
|
|
2514
|
+
success: false,
|
|
1807
2515
|
error: new ValidationError(parsed.summary, {
|
|
1808
|
-
endpoint:
|
|
2516
|
+
endpoint: teamPaths.clubStatsSeason
|
|
1809
2517
|
})
|
|
1810
2518
|
};
|
|
1811
2519
|
}
|
|
1812
|
-
|
|
2520
|
+
const path = resolvePath(teamPaths.clubStatsSeason, { team: parsed });
|
|
2521
|
+
return nhlClient.get(path);
|
|
1813
2522
|
}
|
|
1814
2523
|
async function standings(date) {
|
|
1815
2524
|
const parsed = NHLDate(date ?? getCurrentDate());
|
|
1816
2525
|
if (isParseError(parsed)) {
|
|
1817
2526
|
return {
|
|
1818
|
-
|
|
2527
|
+
success: false,
|
|
1819
2528
|
error: new ValidationError(parsed.summary, {
|
|
1820
|
-
endpoint:
|
|
2529
|
+
endpoint: teamPaths.standings
|
|
1821
2530
|
})
|
|
1822
2531
|
};
|
|
1823
2532
|
}
|
|
1824
|
-
|
|
2533
|
+
const path = resolvePath(teamPaths.standings, { date: parsed });
|
|
2534
|
+
return nhlClient.get(path);
|
|
1825
2535
|
}
|
|
1826
2536
|
async function standingsSeason() {
|
|
1827
|
-
return
|
|
2537
|
+
return nhlClient.get(teamPaths.standingsSeason);
|
|
1828
2538
|
}
|
|
1829
2539
|
async function scheduleWeek(team, date) {
|
|
1830
2540
|
const parsed = ScheduleParams({ team, date, month: void 0 });
|
|
1831
2541
|
if (isParseError(parsed)) {
|
|
1832
2542
|
return {
|
|
1833
|
-
|
|
2543
|
+
success: false,
|
|
1834
2544
|
error: new ValidationError(parsed.summary, {
|
|
1835
|
-
endpoint:
|
|
2545
|
+
endpoint: teamPaths.clubSchedule.week
|
|
1836
2546
|
})
|
|
1837
2547
|
};
|
|
1838
2548
|
}
|
|
1839
|
-
|
|
2549
|
+
const path = resolvePath(teamPaths.clubSchedule.week, parsed);
|
|
2550
|
+
return nhlClient.get(path);
|
|
1840
2551
|
}
|
|
1841
2552
|
async function scheduleMonth(team, date) {
|
|
1842
2553
|
const parsed = ScheduleParams({ team, month: date, date: void 0 });
|
|
1843
2554
|
if (isParseError(parsed)) {
|
|
1844
2555
|
return {
|
|
1845
|
-
|
|
2556
|
+
success: false,
|
|
1846
2557
|
error: new ValidationError(parsed.summary, {
|
|
1847
|
-
endpoint:
|
|
2558
|
+
endpoint: teamPaths.clubSchedule.month
|
|
1848
2559
|
})
|
|
1849
2560
|
};
|
|
1850
2561
|
}
|
|
1851
|
-
|
|
2562
|
+
const path = resolvePath(teamPaths.clubSchedule.month, parsed);
|
|
2563
|
+
return nhlClient.get(path);
|
|
1852
2564
|
}
|
|
1853
2565
|
async function scheduleSeason(team, season) {
|
|
1854
2566
|
const parsed = TeamAndSeasonParams({ team, season });
|
|
1855
2567
|
if (isParseError(parsed)) {
|
|
1856
2568
|
return {
|
|
1857
|
-
|
|
2569
|
+
success: false,
|
|
1858
2570
|
error: new ValidationError(parsed.summary, {
|
|
1859
|
-
endpoint:
|
|
2571
|
+
endpoint: teamPaths.clubSchedule.season
|
|
1860
2572
|
})
|
|
1861
2573
|
};
|
|
1862
2574
|
}
|
|
1863
|
-
|
|
2575
|
+
const path = resolvePath(teamPaths.clubSchedule.season, parsed);
|
|
2576
|
+
return nhlClient.get(path);
|
|
1864
2577
|
}
|
|
1865
2578
|
var schedule2 = {
|
|
1866
2579
|
season: scheduleSeason,
|
|
@@ -1868,6 +2581,6 @@ var schedule2 = {
|
|
|
1868
2581
|
month: scheduleMonth
|
|
1869
2582
|
};
|
|
1870
2583
|
|
|
1871
|
-
export { EDGE, nhl_exports as NHL, envConfig, gamecenter_exports as gc, logEnvConfig };
|
|
2584
|
+
export { EDGE, nhl_exports as NHL, edge_adv_exports2 as adv, envConfig, gamecenter_exports as gc, logEnvConfig };
|
|
1872
2585
|
//# sourceMappingURL=index.js.map
|
|
1873
2586
|
//# sourceMappingURL=index.js.map
|