@bp1222/stats-api 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,6 @@
1
- "use strict";
2
1
  var __defProp = Object.defineProperty;
3
2
  var __defProps = Object.defineProperties;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -20,19 +17,6 @@ var __spreadValues = (a, b) => {
20
17
  return a;
21
18
  };
22
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
- var __export = (target, all) => {
24
- for (var name in all)
25
- __defProp(target, name, { get: all[name], enumerable: true });
26
- };
27
- var __copyProps = (to, from, except, desc) => {
28
- if (from && typeof from === "object" || typeof from === "function") {
29
- for (let key of __getOwnPropNames(from))
30
- if (!__hasOwnProp.call(to, key) && key !== except)
31
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
- }
33
- return to;
34
- };
35
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
20
  var __async = (__this, __arguments, generator) => {
37
21
  return new Promise((resolve, reject) => {
38
22
  var fulfilled = (value) => {
@@ -54,247 +38,6 @@ var __async = (__this, __arguments, generator) => {
54
38
  });
55
39
  };
56
40
 
57
- // src/index.ts
58
- var index_exports = {};
59
- __export(index_exports, {
60
- BASE_PATH: () => BASE_PATH,
61
- BaseAPI: () => BaseAPI,
62
- BattingStatsFromJSON: () => BattingStatsFromJSON,
63
- BattingStatsFromJSONTyped: () => BattingStatsFromJSONTyped,
64
- BattingStatsToJSON: () => BattingStatsToJSON,
65
- BattingStatsToJSONTyped: () => BattingStatsToJSONTyped,
66
- BlobApiResponse: () => BlobApiResponse,
67
- BoxscoreFromJSON: () => BoxscoreFromJSON,
68
- BoxscoreFromJSONTyped: () => BoxscoreFromJSONTyped,
69
- BoxscoreTeamFromJSON: () => BoxscoreTeamFromJSON,
70
- BoxscoreTeamFromJSONTyped: () => BoxscoreTeamFromJSONTyped,
71
- BoxscoreTeamToJSON: () => BoxscoreTeamToJSON,
72
- BoxscoreTeamToJSONTyped: () => BoxscoreTeamToJSONTyped,
73
- BoxscoreTeamsFromJSON: () => BoxscoreTeamsFromJSON,
74
- BoxscoreTeamsFromJSONTyped: () => BoxscoreTeamsFromJSONTyped,
75
- BoxscoreTeamsToJSON: () => BoxscoreTeamsToJSON,
76
- BoxscoreTeamsToJSONTyped: () => BoxscoreTeamsToJSONTyped,
77
- BoxscoreToJSON: () => BoxscoreToJSON,
78
- BoxscoreToJSONTyped: () => BoxscoreToJSONTyped,
79
- COLLECTION_FORMATS: () => COLLECTION_FORMATS,
80
- Configuration: () => Configuration,
81
- DefaultConfig: () => DefaultConfig,
82
- DivisionFromJSON: () => DivisionFromJSON,
83
- DivisionFromJSONTyped: () => DivisionFromJSONTyped,
84
- DivisionStandingsFromJSON: () => DivisionStandingsFromJSON,
85
- DivisionStandingsFromJSONTyped: () => DivisionStandingsFromJSONTyped,
86
- DivisionStandingsListFromJSON: () => DivisionStandingsListFromJSON,
87
- DivisionStandingsListFromJSONTyped: () => DivisionStandingsListFromJSONTyped,
88
- DivisionStandingsListToJSON: () => DivisionStandingsListToJSON,
89
- DivisionStandingsListToJSONTyped: () => DivisionStandingsListToJSONTyped,
90
- DivisionStandingsToJSON: () => DivisionStandingsToJSON,
91
- DivisionStandingsToJSONTyped: () => DivisionStandingsToJSONTyped,
92
- DivisionToJSON: () => DivisionToJSON,
93
- DivisionToJSONTyped: () => DivisionToJSONTyped,
94
- FetchError: () => FetchError,
95
- FieldingStatsFromJSON: () => FieldingStatsFromJSON,
96
- FieldingStatsFromJSONTyped: () => FieldingStatsFromJSONTyped,
97
- FieldingStatsToJSON: () => FieldingStatsToJSON,
98
- FieldingStatsToJSONTyped: () => FieldingStatsToJSONTyped,
99
- GameFromJSON: () => GameFromJSON,
100
- GameFromJSONTyped: () => GameFromJSONTyped,
101
- GameOfficialFromJSON: () => GameOfficialFromJSON,
102
- GameOfficialFromJSONTyped: () => GameOfficialFromJSONTyped,
103
- GameOfficialToJSON: () => GameOfficialToJSON,
104
- GameOfficialToJSONTyped: () => GameOfficialToJSONTyped,
105
- GameStatusCode: () => GameStatusCode,
106
- GameStatusCodeFromJSON: () => GameStatusCodeFromJSON,
107
- GameStatusCodeFromJSONTyped: () => GameStatusCodeFromJSONTyped,
108
- GameStatusCodeToJSON: () => GameStatusCodeToJSON,
109
- GameStatusCodeToJSONTyped: () => GameStatusCodeToJSONTyped,
110
- GameStatusFromJSON: () => GameStatusFromJSON,
111
- GameStatusFromJSONTyped: () => GameStatusFromJSONTyped,
112
- GameStatusToJSON: () => GameStatusToJSON,
113
- GameStatusToJSONTyped: () => GameStatusToJSONTyped,
114
- GameTeamFromJSON: () => GameTeamFromJSON,
115
- GameTeamFromJSONTyped: () => GameTeamFromJSONTyped,
116
- GameTeamToJSON: () => GameTeamToJSON,
117
- GameTeamToJSONTyped: () => GameTeamToJSONTyped,
118
- GameTeamsFromJSON: () => GameTeamsFromJSON,
119
- GameTeamsFromJSONTyped: () => GameTeamsFromJSONTyped,
120
- GameTeamsToJSON: () => GameTeamsToJSON,
121
- GameTeamsToJSONTyped: () => GameTeamsToJSONTyped,
122
- GameToJSON: () => GameToJSON,
123
- GameToJSONTyped: () => GameToJSONTyped,
124
- GameType: () => GameType,
125
- GameTypeFromJSON: () => GameTypeFromJSON,
126
- GameTypeFromJSONTyped: () => GameTypeFromJSONTyped,
127
- GameTypeToJSON: () => GameTypeToJSON,
128
- GameTypeToJSONTyped: () => GameTypeToJSONTyped,
129
- InningFromJSON: () => InningFromJSON,
130
- InningFromJSONTyped: () => InningFromJSONTyped,
131
- InningToJSON: () => InningToJSON,
132
- InningToJSONTyped: () => InningToJSONTyped,
133
- JSONApiResponse: () => JSONApiResponse,
134
- LeagueDatesFromJSON: () => LeagueDatesFromJSON,
135
- LeagueDatesFromJSONTyped: () => LeagueDatesFromJSONTyped,
136
- LeagueDatesToJSON: () => LeagueDatesToJSON,
137
- LeagueDatesToJSONTyped: () => LeagueDatesToJSONTyped,
138
- LeagueFromJSON: () => LeagueFromJSON,
139
- LeagueFromJSONTyped: () => LeagueFromJSONTyped,
140
- LeagueRecordFromJSON: () => LeagueRecordFromJSON,
141
- LeagueRecordFromJSONTyped: () => LeagueRecordFromJSONTyped,
142
- LeagueRecordToJSON: () => LeagueRecordToJSON,
143
- LeagueRecordToJSONTyped: () => LeagueRecordToJSONTyped,
144
- LeagueToJSON: () => LeagueToJSON,
145
- LeagueToJSONTyped: () => LeagueToJSONTyped,
146
- LinescoreFromJSON: () => LinescoreFromJSON,
147
- LinescoreFromJSONTyped: () => LinescoreFromJSONTyped,
148
- LinescoreTeamFromJSON: () => LinescoreTeamFromJSON,
149
- LinescoreTeamFromJSONTyped: () => LinescoreTeamFromJSONTyped,
150
- LinescoreTeamToJSON: () => LinescoreTeamToJSON,
151
- LinescoreTeamToJSONTyped: () => LinescoreTeamToJSONTyped,
152
- LinescoreTeamsFromJSON: () => LinescoreTeamsFromJSON,
153
- LinescoreTeamsFromJSONTyped: () => LinescoreTeamsFromJSONTyped,
154
- LinescoreTeamsToJSON: () => LinescoreTeamsToJSON,
155
- LinescoreTeamsToJSONTyped: () => LinescoreTeamsToJSONTyped,
156
- LinescoreToJSON: () => LinescoreToJSON,
157
- LinescoreToJSONTyped: () => LinescoreToJSONTyped,
158
- MlbApi: () => MlbApi,
159
- OfficialFromJSON: () => OfficialFromJSON,
160
- OfficialFromJSONTyped: () => OfficialFromJSONTyped,
161
- OfficialToJSON: () => OfficialToJSON,
162
- OfficialToJSONTyped: () => OfficialToJSONTyped,
163
- PitchingStatsFromJSON: () => PitchingStatsFromJSON,
164
- PitchingStatsFromJSONTyped: () => PitchingStatsFromJSONTyped,
165
- PitchingStatsToJSON: () => PitchingStatsToJSON,
166
- PitchingStatsToJSONTyped: () => PitchingStatsToJSONTyped,
167
- PlayerFromJSON: () => PlayerFromJSON,
168
- PlayerFromJSONTyped: () => PlayerFromJSONTyped,
169
- PlayerGameStatusFromJSON: () => PlayerGameStatusFromJSON,
170
- PlayerGameStatusFromJSONTyped: () => PlayerGameStatusFromJSONTyped,
171
- PlayerGameStatusToJSON: () => PlayerGameStatusToJSON,
172
- PlayerGameStatusToJSONTyped: () => PlayerGameStatusToJSONTyped,
173
- PlayerPersonFromJSON: () => PlayerPersonFromJSON,
174
- PlayerPersonFromJSONTyped: () => PlayerPersonFromJSONTyped,
175
- PlayerPersonToJSON: () => PlayerPersonToJSON,
176
- PlayerPersonToJSONTyped: () => PlayerPersonToJSONTyped,
177
- PlayerPositionFromJSON: () => PlayerPositionFromJSON,
178
- PlayerPositionFromJSONTyped: () => PlayerPositionFromJSONTyped,
179
- PlayerPositionToJSON: () => PlayerPositionToJSON,
180
- PlayerPositionToJSONTyped: () => PlayerPositionToJSONTyped,
181
- PlayerSeasonStatsFromJSON: () => PlayerSeasonStatsFromJSON,
182
- PlayerSeasonStatsFromJSONTyped: () => PlayerSeasonStatsFromJSONTyped,
183
- PlayerSeasonStatsToJSON: () => PlayerSeasonStatsToJSON,
184
- PlayerSeasonStatsToJSONTyped: () => PlayerSeasonStatsToJSONTyped,
185
- PlayerStatsFromJSON: () => PlayerStatsFromJSON,
186
- PlayerStatsFromJSONTyped: () => PlayerStatsFromJSONTyped,
187
- PlayerStatsToJSON: () => PlayerStatsToJSON,
188
- PlayerStatsToJSONTyped: () => PlayerStatsToJSONTyped,
189
- PlayerStatusFromJSON: () => PlayerStatusFromJSON,
190
- PlayerStatusFromJSONTyped: () => PlayerStatusFromJSONTyped,
191
- PlayerStatusToJSON: () => PlayerStatusToJSON,
192
- PlayerStatusToJSONTyped: () => PlayerStatusToJSONTyped,
193
- PlayerToJSON: () => PlayerToJSON,
194
- PlayerToJSONTyped: () => PlayerToJSONTyped,
195
- PositionFromJSON: () => PositionFromJSON,
196
- PositionFromJSONTyped: () => PositionFromJSONTyped,
197
- PositionToJSON: () => PositionToJSON,
198
- PositionToJSONTyped: () => PositionToJSONTyped,
199
- RecordFromJSON: () => RecordFromJSON,
200
- RecordFromJSONTyped: () => RecordFromJSONTyped,
201
- RecordToJSON: () => RecordToJSON,
202
- RecordToJSONTyped: () => RecordToJSONTyped,
203
- RequiredError: () => RequiredError,
204
- ResponseError: () => ResponseError,
205
- ScheduleDayFromJSON: () => ScheduleDayFromJSON,
206
- ScheduleDayFromJSONTyped: () => ScheduleDayFromJSONTyped,
207
- ScheduleDayToJSON: () => ScheduleDayToJSON,
208
- ScheduleDayToJSONTyped: () => ScheduleDayToJSONTyped,
209
- ScheduleFromJSON: () => ScheduleFromJSON,
210
- ScheduleFromJSONTyped: () => ScheduleFromJSONTyped,
211
- ScheduleToJSON: () => ScheduleToJSON,
212
- ScheduleToJSONTyped: () => ScheduleToJSONTyped,
213
- SeasonFromJSON: () => SeasonFromJSON,
214
- SeasonFromJSONTyped: () => SeasonFromJSONTyped,
215
- SeasonToJSON: () => SeasonToJSON,
216
- SeasonToJSONTyped: () => SeasonToJSONTyped,
217
- SeasonsFromJSON: () => SeasonsFromJSON,
218
- SeasonsFromJSONTyped: () => SeasonsFromJSONTyped,
219
- SeasonsToJSON: () => SeasonsToJSON,
220
- SeasonsToJSONTyped: () => SeasonsToJSONTyped,
221
- SportFromJSON: () => SportFromJSON,
222
- SportFromJSONTyped: () => SportFromJSONTyped,
223
- SportToJSON: () => SportToJSON,
224
- SportToJSONTyped: () => SportToJSONTyped,
225
- StreakFromJSON: () => StreakFromJSON,
226
- StreakFromJSONTyped: () => StreakFromJSONTyped,
227
- StreakStreakTypeEnum: () => StreakStreakTypeEnum,
228
- StreakToJSON: () => StreakToJSON,
229
- StreakToJSONTyped: () => StreakToJSONTyped,
230
- TeamFromJSON: () => TeamFromJSON,
231
- TeamFromJSONTyped: () => TeamFromJSONTyped2,
232
- TeamStatsFromJSON: () => TeamStatsFromJSON,
233
- TeamStatsFromJSONTyped: () => TeamStatsFromJSONTyped,
234
- TeamStatsToJSON: () => TeamStatsToJSON,
235
- TeamStatsToJSONTyped: () => TeamStatsToJSONTyped,
236
- TeamToJSON: () => TeamToJSON,
237
- TeamToJSONTyped: () => TeamToJSONTyped2,
238
- TeamsFromJSON: () => TeamsFromJSON,
239
- TeamsFromJSONTyped: () => TeamsFromJSONTyped,
240
- TeamsToJSON: () => TeamsToJSON,
241
- TeamsToJSONTyped: () => TeamsToJSONTyped,
242
- TextApiResponse: () => TextApiResponse,
243
- VenueFromJSON: () => VenueFromJSON,
244
- VenueFromJSONTyped: () => VenueFromJSONTyped,
245
- VenueToJSON: () => VenueToJSON,
246
- VenueToJSONTyped: () => VenueToJSONTyped,
247
- VoidApiResponse: () => VoidApiResponse,
248
- canConsumeForm: () => canConsumeForm,
249
- exists: () => exists,
250
- instanceOfBattingStats: () => instanceOfBattingStats,
251
- instanceOfBoxscore: () => instanceOfBoxscore,
252
- instanceOfBoxscoreTeam: () => instanceOfBoxscoreTeam,
253
- instanceOfBoxscoreTeams: () => instanceOfBoxscoreTeams,
254
- instanceOfDivision: () => instanceOfDivision,
255
- instanceOfDivisionStandings: () => instanceOfDivisionStandings,
256
- instanceOfDivisionStandingsList: () => instanceOfDivisionStandingsList,
257
- instanceOfFieldingStats: () => instanceOfFieldingStats,
258
- instanceOfGame: () => instanceOfGame,
259
- instanceOfGameOfficial: () => instanceOfGameOfficial,
260
- instanceOfGameStatus: () => instanceOfGameStatus,
261
- instanceOfGameStatusCode: () => instanceOfGameStatusCode,
262
- instanceOfGameTeam: () => instanceOfGameTeam,
263
- instanceOfGameTeams: () => instanceOfGameTeams,
264
- instanceOfGameType: () => instanceOfGameType,
265
- instanceOfInning: () => instanceOfInning,
266
- instanceOfLeague: () => instanceOfLeague,
267
- instanceOfLeagueDates: () => instanceOfLeagueDates,
268
- instanceOfLeagueRecord: () => instanceOfLeagueRecord,
269
- instanceOfLinescore: () => instanceOfLinescore,
270
- instanceOfLinescoreTeam: () => instanceOfLinescoreTeam,
271
- instanceOfLinescoreTeams: () => instanceOfLinescoreTeams,
272
- instanceOfOfficial: () => instanceOfOfficial,
273
- instanceOfPitchingStats: () => instanceOfPitchingStats,
274
- instanceOfPlayer: () => instanceOfPlayer,
275
- instanceOfPlayerGameStatus: () => instanceOfPlayerGameStatus,
276
- instanceOfPlayerPerson: () => instanceOfPlayerPerson,
277
- instanceOfPlayerPosition: () => instanceOfPlayerPosition,
278
- instanceOfPlayerSeasonStats: () => instanceOfPlayerSeasonStats,
279
- instanceOfPlayerStats: () => instanceOfPlayerStats,
280
- instanceOfPlayerStatus: () => instanceOfPlayerStatus,
281
- instanceOfPosition: () => instanceOfPosition,
282
- instanceOfRecord: () => instanceOfRecord,
283
- instanceOfSchedule: () => instanceOfSchedule,
284
- instanceOfScheduleDay: () => instanceOfScheduleDay,
285
- instanceOfSeason: () => instanceOfSeason,
286
- instanceOfSeasons: () => instanceOfSeasons,
287
- instanceOfSport: () => instanceOfSport,
288
- instanceOfStreak: () => instanceOfStreak,
289
- instanceOfTeam: () => instanceOfTeam,
290
- instanceOfTeamStats: () => instanceOfTeamStats,
291
- instanceOfTeams: () => instanceOfTeams,
292
- instanceOfVenue: () => instanceOfVenue,
293
- mapValues: () => mapValues,
294
- querystring: () => querystring
295
- });
296
- module.exports = __toCommonJS(index_exports);
297
-
298
41
  // src/runtime.ts
299
42
  var BASE_PATH = "https://statsapi.mlb.com/api".replace(/\/+$/, "");
300
43
  var Configuration = class {
@@ -541,10 +284,11 @@ function exists(json, key) {
541
284
  return value !== null && value !== void 0;
542
285
  }
543
286
  function mapValues(data, fn) {
544
- return Object.keys(data).reduce(
545
- (acc, key) => __spreadProps(__spreadValues({}, acc), { [key]: fn(data[key]) }),
546
- {}
547
- );
287
+ const result = {};
288
+ for (const key of Object.keys(data)) {
289
+ result[key] = fn(data[key]);
290
+ }
291
+ return result;
548
292
  }
549
293
  function canConsumeForm(consumes) {
550
294
  for (const consume of consumes) {
@@ -1841,6 +1585,7 @@ function DivisionStandingsToJSONTyped(value, ignoreDiscriminator = false) {
1841
1585
 
1842
1586
  // src/models/DivisionStandingsList.ts
1843
1587
  function instanceOfDivisionStandingsList(value) {
1588
+ if (!("records" in value) || value["records"] === void 0) return false;
1844
1589
  return true;
1845
1590
  }
1846
1591
  function DivisionStandingsListFromJSON(json) {
@@ -1851,7 +1596,7 @@ function DivisionStandingsListFromJSONTyped(json, ignoreDiscriminator) {
1851
1596
  return json;
1852
1597
  }
1853
1598
  return {
1854
- "records": json["records"] == null ? void 0 : json["records"].map(DivisionStandingsFromJSON)
1599
+ "records": json["records"].map(DivisionStandingsFromJSON)
1855
1600
  };
1856
1601
  }
1857
1602
  function DivisionStandingsListToJSON(json) {
@@ -1862,7 +1607,35 @@ function DivisionStandingsListToJSONTyped(value, ignoreDiscriminator = false) {
1862
1607
  return value;
1863
1608
  }
1864
1609
  return {
1865
- "records": value["records"] == null ? void 0 : value["records"].map(DivisionStandingsToJSON)
1610
+ "records": value["records"].map(DivisionStandingsToJSON)
1611
+ };
1612
+ }
1613
+
1614
+ // src/models/Divisions.ts
1615
+ function instanceOfDivisions(value) {
1616
+ if (!("divisions" in value) || value["divisions"] === void 0) return false;
1617
+ return true;
1618
+ }
1619
+ function DivisionsFromJSON(json) {
1620
+ return DivisionsFromJSONTyped(json, false);
1621
+ }
1622
+ function DivisionsFromJSONTyped(json, ignoreDiscriminator) {
1623
+ if (json == null) {
1624
+ return json;
1625
+ }
1626
+ return {
1627
+ "divisions": json["divisions"].map(DivisionFromJSON)
1628
+ };
1629
+ }
1630
+ function DivisionsToJSON(json) {
1631
+ return DivisionsToJSONTyped(json, false);
1632
+ }
1633
+ function DivisionsToJSONTyped(value, ignoreDiscriminator = false) {
1634
+ if (value == null) {
1635
+ return value;
1636
+ }
1637
+ return {
1638
+ "divisions": value["divisions"].map(DivisionToJSON)
1866
1639
  };
1867
1640
  }
1868
1641
 
@@ -2146,6 +1919,10 @@ function GameToJSONTyped(value, ignoreDiscriminator = false) {
2146
1919
 
2147
1920
  // src/models/LinescoreTeam.ts
2148
1921
  function instanceOfLinescoreTeam(value) {
1922
+ if (!("runs" in value) || value["runs"] === void 0) return false;
1923
+ if (!("hits" in value) || value["hits"] === void 0) return false;
1924
+ if (!("errors" in value) || value["errors"] === void 0) return false;
1925
+ if (!("leftOnBase" in value) || value["leftOnBase"] === void 0) return false;
2149
1926
  return true;
2150
1927
  }
2151
1928
  function LinescoreTeamFromJSON(json) {
@@ -2156,10 +1933,10 @@ function LinescoreTeamFromJSONTyped(json, ignoreDiscriminator) {
2156
1933
  return json;
2157
1934
  }
2158
1935
  return {
2159
- "runs": json["runs"] == null ? void 0 : json["runs"],
2160
- "hits": json["hits"] == null ? void 0 : json["hits"],
2161
- "errors": json["errors"] == null ? void 0 : json["errors"],
2162
- "leftOnBase": json["leftOnBase"] == null ? void 0 : json["leftOnBase"]
1936
+ "runs": json["runs"],
1937
+ "hits": json["hits"],
1938
+ "errors": json["errors"],
1939
+ "leftOnBase": json["leftOnBase"]
2163
1940
  };
2164
1941
  }
2165
1942
  function LinescoreTeamToJSON(json) {
@@ -2179,6 +1956,10 @@ function LinescoreTeamToJSONTyped(value, ignoreDiscriminator = false) {
2179
1956
 
2180
1957
  // src/models/Inning.ts
2181
1958
  function instanceOfInning(value) {
1959
+ if (!("num" in value) || value["num"] === void 0) return false;
1960
+ if (!("ordinalNum" in value) || value["ordinalNum"] === void 0) return false;
1961
+ if (!("home" in value) || value["home"] === void 0) return false;
1962
+ if (!("away" in value) || value["away"] === void 0) return false;
2182
1963
  return true;
2183
1964
  }
2184
1965
  function InningFromJSON(json) {
@@ -2189,10 +1970,10 @@ function InningFromJSONTyped(json, ignoreDiscriminator) {
2189
1970
  return json;
2190
1971
  }
2191
1972
  return {
2192
- "num": json["num"] == null ? void 0 : json["num"],
2193
- "ordinalNum": json["ordinalNum"] == null ? void 0 : json["ordinalNum"],
2194
- "home": json["home"] == null ? void 0 : LinescoreTeamFromJSON(json["home"]),
2195
- "away": json["away"] == null ? void 0 : LinescoreTeamFromJSON(json["away"])
1973
+ "num": json["num"],
1974
+ "ordinalNum": json["ordinalNum"],
1975
+ "home": LinescoreTeamFromJSON(json["home"]),
1976
+ "away": LinescoreTeamFromJSON(json["away"])
2196
1977
  };
2197
1978
  }
2198
1979
  function InningToJSON(json) {
@@ -2210,8 +1991,38 @@ function InningToJSONTyped(value, ignoreDiscriminator = false) {
2210
1991
  };
2211
1992
  }
2212
1993
 
1994
+ // src/models/Leagues.ts
1995
+ function instanceOfLeagues(value) {
1996
+ if (!("leagues" in value) || value["leagues"] === void 0) return false;
1997
+ return true;
1998
+ }
1999
+ function LeaguesFromJSON(json) {
2000
+ return LeaguesFromJSONTyped(json, false);
2001
+ }
2002
+ function LeaguesFromJSONTyped(json, ignoreDiscriminator) {
2003
+ if (json == null) {
2004
+ return json;
2005
+ }
2006
+ return {
2007
+ "leagues": json["leagues"].map(LeagueFromJSON)
2008
+ };
2009
+ }
2010
+ function LeaguesToJSON(json) {
2011
+ return LeaguesToJSONTyped(json, false);
2012
+ }
2013
+ function LeaguesToJSONTyped(value, ignoreDiscriminator = false) {
2014
+ if (value == null) {
2015
+ return value;
2016
+ }
2017
+ return {
2018
+ "leagues": value["leagues"].map(LeagueToJSON)
2019
+ };
2020
+ }
2021
+
2213
2022
  // src/models/LinescoreTeams.ts
2214
2023
  function instanceOfLinescoreTeams(value) {
2024
+ if (!("away" in value) || value["away"] === void 0) return false;
2025
+ if (!("home" in value) || value["home"] === void 0) return false;
2215
2026
  return true;
2216
2027
  }
2217
2028
  function LinescoreTeamsFromJSON(json) {
@@ -2222,8 +2033,8 @@ function LinescoreTeamsFromJSONTyped(json, ignoreDiscriminator) {
2222
2033
  return json;
2223
2034
  }
2224
2035
  return {
2225
- "away": json["away"] == null ? void 0 : LinescoreTeamFromJSON(json["away"]),
2226
- "home": json["home"] == null ? void 0 : LinescoreTeamFromJSON(json["home"])
2036
+ "away": LinescoreTeamFromJSON(json["away"]),
2037
+ "home": LinescoreTeamFromJSON(json["home"])
2227
2038
  };
2228
2039
  }
2229
2040
  function LinescoreTeamsToJSON(json) {
@@ -2241,6 +2052,10 @@ function LinescoreTeamsToJSONTyped(value, ignoreDiscriminator = false) {
2241
2052
 
2242
2053
  // src/models/Linescore.ts
2243
2054
  function instanceOfLinescore(value) {
2055
+ if (!("teams" in value) || value["teams"] === void 0) return false;
2056
+ if (!("balls" in value) || value["balls"] === void 0) return false;
2057
+ if (!("strikes" in value) || value["strikes"] === void 0) return false;
2058
+ if (!("outs" in value) || value["outs"] === void 0) return false;
2244
2059
  return true;
2245
2060
  }
2246
2061
  function LinescoreFromJSON(json) {
@@ -2258,10 +2073,10 @@ function LinescoreFromJSONTyped(json, ignoreDiscriminator) {
2258
2073
  "isTopInning": json["isTopInning"] == null ? void 0 : json["isTopInning"],
2259
2074
  "scheduledInnings": json["scheduledInnings"] == null ? void 0 : json["scheduledInnings"],
2260
2075
  "innings": json["innings"] == null ? void 0 : json["innings"].map(InningFromJSON),
2261
- "teams": json["teams"] == null ? void 0 : LinescoreTeamsFromJSON(json["teams"]),
2262
- "balls": json["balls"] == null ? void 0 : json["balls"],
2263
- "strikes": json["strikes"] == null ? void 0 : json["strikes"],
2264
- "outs": json["outs"] == null ? void 0 : json["outs"]
2076
+ "teams": LinescoreTeamsFromJSON(json["teams"]),
2077
+ "balls": json["balls"],
2078
+ "strikes": json["strikes"],
2079
+ "outs": json["outs"]
2265
2080
  };
2266
2081
  }
2267
2082
  function LinescoreToJSON(json) {
@@ -2438,6 +2253,7 @@ function SeasonToJSONTyped(value, ignoreDiscriminator = false) {
2438
2253
 
2439
2254
  // src/models/Seasons.ts
2440
2255
  function instanceOfSeasons(value) {
2256
+ if (!("seasons" in value) || value["seasons"] === void 0) return false;
2441
2257
  return true;
2442
2258
  }
2443
2259
  function SeasonsFromJSON(json) {
@@ -2448,7 +2264,7 @@ function SeasonsFromJSONTyped(json, ignoreDiscriminator) {
2448
2264
  return json;
2449
2265
  }
2450
2266
  return {
2451
- "seasons": json["seasons"] == null ? void 0 : json["seasons"].map(SeasonFromJSON)
2267
+ "seasons": json["seasons"].map(SeasonFromJSON)
2452
2268
  };
2453
2269
  }
2454
2270
  function SeasonsToJSON(json) {
@@ -2459,12 +2275,13 @@ function SeasonsToJSONTyped(value, ignoreDiscriminator = false) {
2459
2275
  return value;
2460
2276
  }
2461
2277
  return {
2462
- "seasons": value["seasons"] == null ? void 0 : value["seasons"].map(SeasonToJSON)
2278
+ "seasons": value["seasons"].map(SeasonToJSON)
2463
2279
  };
2464
2280
  }
2465
2281
 
2466
2282
  // src/models/Teams.ts
2467
2283
  function instanceOfTeams(value) {
2284
+ if (!("teams" in value) || value["teams"] === void 0) return false;
2468
2285
  return true;
2469
2286
  }
2470
2287
  function TeamsFromJSON(json) {
@@ -2475,7 +2292,7 @@ function TeamsFromJSONTyped(json, ignoreDiscriminator) {
2475
2292
  return json;
2476
2293
  }
2477
2294
  return {
2478
- "teams": json["teams"] == null ? void 0 : json["teams"].map(TeamFromJSON)
2295
+ "teams": json["teams"].map(TeamFromJSON)
2479
2296
  };
2480
2297
  }
2481
2298
  function TeamsToJSON(json) {
@@ -2486,7 +2303,7 @@ function TeamsToJSONTyped(value, ignoreDiscriminator = false) {
2486
2303
  return value;
2487
2304
  }
2488
2305
  return {
2489
- "teams": value["teams"] == null ? void 0 : value["teams"].map(TeamToJSON)
2306
+ "teams": value["teams"].map(TeamToJSON)
2490
2307
  };
2491
2308
  }
2492
2309
 
@@ -2542,7 +2359,7 @@ var MlbApi = class extends BaseAPI {
2542
2359
  }
2543
2360
  const queryParameters = {};
2544
2361
  if (requestParameters["fields"] != null) {
2545
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2362
+ queryParameters["fields"] = requestParameters["fields"];
2546
2363
  }
2547
2364
  const headerParameters = {};
2548
2365
  const response = yield this.request({
@@ -2564,6 +2381,96 @@ var MlbApi = class extends BaseAPI {
2564
2381
  return yield response.value();
2565
2382
  });
2566
2383
  }
2384
+ /**
2385
+ * Returns Divisions
2386
+ * Retrieves Divisions
2387
+ */
2388
+ getDivisionsRaw(requestParameters, initOverrides) {
2389
+ return __async(this, null, function* () {
2390
+ if (requestParameters["sportId"] == null) {
2391
+ throw new RequiredError(
2392
+ "sportId",
2393
+ 'Required parameter "sportId" was null or undefined when calling getDivisions().'
2394
+ );
2395
+ }
2396
+ if (requestParameters["season"] == null) {
2397
+ throw new RequiredError(
2398
+ "season",
2399
+ 'Required parameter "season" was null or undefined when calling getDivisions().'
2400
+ );
2401
+ }
2402
+ const queryParameters = {};
2403
+ if (requestParameters["sportId"] != null) {
2404
+ queryParameters["sportId"] = requestParameters["sportId"];
2405
+ }
2406
+ if (requestParameters["season"] != null) {
2407
+ queryParameters["season"] = requestParameters["season"];
2408
+ }
2409
+ const headerParameters = {};
2410
+ const response = yield this.request({
2411
+ path: `/v1/divisions`,
2412
+ method: "GET",
2413
+ headers: headerParameters,
2414
+ query: queryParameters
2415
+ }, initOverrides);
2416
+ return new JSONApiResponse(response, (jsonValue) => DivisionsFromJSON(jsonValue));
2417
+ });
2418
+ }
2419
+ /**
2420
+ * Returns Divisions
2421
+ * Retrieves Divisions
2422
+ */
2423
+ getDivisions(requestParameters, initOverrides) {
2424
+ return __async(this, null, function* () {
2425
+ const response = yield this.getDivisionsRaw(requestParameters, initOverrides);
2426
+ return yield response.value();
2427
+ });
2428
+ }
2429
+ /**
2430
+ * Returns Leagues
2431
+ * Retrieves Leagues
2432
+ */
2433
+ getLeaguesRaw(requestParameters, initOverrides) {
2434
+ return __async(this, null, function* () {
2435
+ if (requestParameters["sportId"] == null) {
2436
+ throw new RequiredError(
2437
+ "sportId",
2438
+ 'Required parameter "sportId" was null or undefined when calling getLeagues().'
2439
+ );
2440
+ }
2441
+ if (requestParameters["season"] == null) {
2442
+ throw new RequiredError(
2443
+ "season",
2444
+ 'Required parameter "season" was null or undefined when calling getLeagues().'
2445
+ );
2446
+ }
2447
+ const queryParameters = {};
2448
+ if (requestParameters["sportId"] != null) {
2449
+ queryParameters["sportId"] = requestParameters["sportId"];
2450
+ }
2451
+ if (requestParameters["season"] != null) {
2452
+ queryParameters["season"] = requestParameters["season"];
2453
+ }
2454
+ const headerParameters = {};
2455
+ const response = yield this.request({
2456
+ path: `/v1/leagues`,
2457
+ method: "GET",
2458
+ headers: headerParameters,
2459
+ query: queryParameters
2460
+ }, initOverrides);
2461
+ return new JSONApiResponse(response, (jsonValue) => LeaguesFromJSON(jsonValue));
2462
+ });
2463
+ }
2464
+ /**
2465
+ * Returns Leagues
2466
+ * Retrieves Leagues
2467
+ */
2468
+ getLeagues(requestParameters, initOverrides) {
2469
+ return __async(this, null, function* () {
2470
+ const response = yield this.getLeaguesRaw(requestParameters, initOverrides);
2471
+ return yield response.value();
2472
+ });
2473
+ }
2567
2474
  /**
2568
2475
  * Returns Linescore
2569
2476
  * Retrieves linescore
@@ -2578,7 +2485,7 @@ var MlbApi = class extends BaseAPI {
2578
2485
  }
2579
2486
  const queryParameters = {};
2580
2487
  if (requestParameters["fields"] != null) {
2581
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2488
+ queryParameters["fields"] = requestParameters["fields"];
2582
2489
  }
2583
2490
  const headerParameters = {};
2584
2491
  const response = yield this.request({
@@ -2613,6 +2520,9 @@ var MlbApi = class extends BaseAPI {
2613
2520
  );
2614
2521
  }
2615
2522
  const queryParameters = {};
2523
+ if (requestParameters["gamePk"] != null) {
2524
+ queryParameters["gamePk"] = requestParameters["gamePk"];
2525
+ }
2616
2526
  if (requestParameters["sportId"] != null) {
2617
2527
  queryParameters["sportId"] = requestParameters["sportId"];
2618
2528
  }
@@ -2629,7 +2539,7 @@ var MlbApi = class extends BaseAPI {
2629
2539
  queryParameters["endDate"] = requestParameters["endDate"];
2630
2540
  }
2631
2541
  if (requestParameters["fields"] != null) {
2632
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2542
+ queryParameters["fields"] = requestParameters["fields"];
2633
2543
  }
2634
2544
  if (requestParameters["hydrate"] != null) {
2635
2545
  queryParameters["hydrate"] = requestParameters["hydrate"];
@@ -2731,7 +2641,7 @@ var MlbApi = class extends BaseAPI {
2731
2641
  queryParameters["date"] = requestParameters["date"];
2732
2642
  }
2733
2643
  if (requestParameters["fields"] != null) {
2734
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2644
+ queryParameters["fields"] = requestParameters["fields"];
2735
2645
  }
2736
2646
  if (requestParameters["hydrate"] != null) {
2737
2647
  queryParameters["hydrate"] = requestParameters["hydrate"];
@@ -2784,6 +2694,12 @@ var MlbApi = class extends BaseAPI {
2784
2694
  if (requestParameters["leagueIds"] != null) {
2785
2695
  queryParameters["leagueIds"] = requestParameters["leagueIds"];
2786
2696
  }
2697
+ if (requestParameters["fields"] != null) {
2698
+ queryParameters["fields"] = requestParameters["fields"];
2699
+ }
2700
+ if (requestParameters["hydrate"] != null) {
2701
+ queryParameters["hydrate"] = requestParameters["hydrate"];
2702
+ }
2787
2703
  const headerParameters = {};
2788
2704
  const response = yield this.request({
2789
2705
  path: `/v1/teams`,
@@ -2805,8 +2721,7 @@ var MlbApi = class extends BaseAPI {
2805
2721
  });
2806
2722
  }
2807
2723
  };
2808
- // Annotate the CommonJS export names for ESM import in node:
2809
- 0 && (module.exports = {
2724
+ export {
2810
2725
  BASE_PATH,
2811
2726
  BaseAPI,
2812
2727
  BattingStatsFromJSON,
@@ -2841,6 +2756,10 @@ var MlbApi = class extends BaseAPI {
2841
2756
  DivisionStandingsToJSONTyped,
2842
2757
  DivisionToJSON,
2843
2758
  DivisionToJSONTyped,
2759
+ DivisionsFromJSON,
2760
+ DivisionsFromJSONTyped,
2761
+ DivisionsToJSON,
2762
+ DivisionsToJSONTyped,
2844
2763
  FetchError,
2845
2764
  FieldingStatsFromJSON,
2846
2765
  FieldingStatsFromJSONTyped,
@@ -2893,6 +2812,10 @@ var MlbApi = class extends BaseAPI {
2893
2812
  LeagueRecordToJSONTyped,
2894
2813
  LeagueToJSON,
2895
2814
  LeagueToJSONTyped,
2815
+ LeaguesFromJSON,
2816
+ LeaguesFromJSONTyped,
2817
+ LeaguesToJSON,
2818
+ LeaguesToJSONTyped,
2896
2819
  LinescoreFromJSON,
2897
2820
  LinescoreFromJSONTyped,
2898
2821
  LinescoreTeamFromJSON,
@@ -2978,13 +2901,13 @@ var MlbApi = class extends BaseAPI {
2978
2901
  StreakToJSON,
2979
2902
  StreakToJSONTyped,
2980
2903
  TeamFromJSON,
2981
- TeamFromJSONTyped,
2904
+ TeamFromJSONTyped2 as TeamFromJSONTyped,
2982
2905
  TeamStatsFromJSON,
2983
2906
  TeamStatsFromJSONTyped,
2984
2907
  TeamStatsToJSON,
2985
2908
  TeamStatsToJSONTyped,
2986
2909
  TeamToJSON,
2987
- TeamToJSONTyped,
2910
+ TeamToJSONTyped2 as TeamToJSONTyped,
2988
2911
  TeamsFromJSON,
2989
2912
  TeamsFromJSONTyped,
2990
2913
  TeamsToJSON,
@@ -3004,6 +2927,7 @@ var MlbApi = class extends BaseAPI {
3004
2927
  instanceOfDivision,
3005
2928
  instanceOfDivisionStandings,
3006
2929
  instanceOfDivisionStandingsList,
2930
+ instanceOfDivisions,
3007
2931
  instanceOfFieldingStats,
3008
2932
  instanceOfGame,
3009
2933
  instanceOfGameOfficial,
@@ -3016,6 +2940,7 @@ var MlbApi = class extends BaseAPI {
3016
2940
  instanceOfLeague,
3017
2941
  instanceOfLeagueDates,
3018
2942
  instanceOfLeagueRecord,
2943
+ instanceOfLeagues,
3019
2944
  instanceOfLinescore,
3020
2945
  instanceOfLinescoreTeam,
3021
2946
  instanceOfLinescoreTeams,
@@ -3042,4 +2967,4 @@ var MlbApi = class extends BaseAPI {
3042
2967
  instanceOfVenue,
3043
2968
  mapValues,
3044
2969
  querystring
3045
- });
2970
+ };