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