@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.
package/dist/index.js CHANGED
@@ -1,6 +1,9 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
5
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
9
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -17,6 +20,19 @@ var __spreadValues = (a, b) => {
17
20
  return a;
18
21
  };
19
22
  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);
20
36
  var __async = (__this, __arguments, generator) => {
21
37
  return new Promise((resolve, reject) => {
22
38
  var fulfilled = (value) => {
@@ -38,6 +54,257 @@ var __async = (__this, __arguments, generator) => {
38
54
  });
39
55
  };
40
56
 
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
+ DivisionsFromJSON: () => DivisionsFromJSON,
95
+ DivisionsFromJSONTyped: () => DivisionsFromJSONTyped,
96
+ DivisionsToJSON: () => DivisionsToJSON,
97
+ DivisionsToJSONTyped: () => DivisionsToJSONTyped,
98
+ FetchError: () => FetchError,
99
+ FieldingStatsFromJSON: () => FieldingStatsFromJSON,
100
+ FieldingStatsFromJSONTyped: () => FieldingStatsFromJSONTyped,
101
+ FieldingStatsToJSON: () => FieldingStatsToJSON,
102
+ FieldingStatsToJSONTyped: () => FieldingStatsToJSONTyped,
103
+ GameFromJSON: () => GameFromJSON,
104
+ GameFromJSONTyped: () => GameFromJSONTyped,
105
+ GameOfficialFromJSON: () => GameOfficialFromJSON,
106
+ GameOfficialFromJSONTyped: () => GameOfficialFromJSONTyped,
107
+ GameOfficialToJSON: () => GameOfficialToJSON,
108
+ GameOfficialToJSONTyped: () => GameOfficialToJSONTyped,
109
+ GameStatusCode: () => GameStatusCode,
110
+ GameStatusCodeFromJSON: () => GameStatusCodeFromJSON,
111
+ GameStatusCodeFromJSONTyped: () => GameStatusCodeFromJSONTyped,
112
+ GameStatusCodeToJSON: () => GameStatusCodeToJSON,
113
+ GameStatusCodeToJSONTyped: () => GameStatusCodeToJSONTyped,
114
+ GameStatusFromJSON: () => GameStatusFromJSON,
115
+ GameStatusFromJSONTyped: () => GameStatusFromJSONTyped,
116
+ GameStatusToJSON: () => GameStatusToJSON,
117
+ GameStatusToJSONTyped: () => GameStatusToJSONTyped,
118
+ GameTeamFromJSON: () => GameTeamFromJSON,
119
+ GameTeamFromJSONTyped: () => GameTeamFromJSONTyped,
120
+ GameTeamToJSON: () => GameTeamToJSON,
121
+ GameTeamToJSONTyped: () => GameTeamToJSONTyped,
122
+ GameTeamsFromJSON: () => GameTeamsFromJSON,
123
+ GameTeamsFromJSONTyped: () => GameTeamsFromJSONTyped,
124
+ GameTeamsToJSON: () => GameTeamsToJSON,
125
+ GameTeamsToJSONTyped: () => GameTeamsToJSONTyped,
126
+ GameToJSON: () => GameToJSON,
127
+ GameToJSONTyped: () => GameToJSONTyped,
128
+ GameType: () => GameType,
129
+ GameTypeFromJSON: () => GameTypeFromJSON,
130
+ GameTypeFromJSONTyped: () => GameTypeFromJSONTyped,
131
+ GameTypeToJSON: () => GameTypeToJSON,
132
+ GameTypeToJSONTyped: () => GameTypeToJSONTyped,
133
+ InningFromJSON: () => InningFromJSON,
134
+ InningFromJSONTyped: () => InningFromJSONTyped,
135
+ InningToJSON: () => InningToJSON,
136
+ InningToJSONTyped: () => InningToJSONTyped,
137
+ JSONApiResponse: () => JSONApiResponse,
138
+ LeagueDatesFromJSON: () => LeagueDatesFromJSON,
139
+ LeagueDatesFromJSONTyped: () => LeagueDatesFromJSONTyped,
140
+ LeagueDatesToJSON: () => LeagueDatesToJSON,
141
+ LeagueDatesToJSONTyped: () => LeagueDatesToJSONTyped,
142
+ LeagueFromJSON: () => LeagueFromJSON,
143
+ LeagueFromJSONTyped: () => LeagueFromJSONTyped,
144
+ LeagueRecordFromJSON: () => LeagueRecordFromJSON,
145
+ LeagueRecordFromJSONTyped: () => LeagueRecordFromJSONTyped,
146
+ LeagueRecordToJSON: () => LeagueRecordToJSON,
147
+ LeagueRecordToJSONTyped: () => LeagueRecordToJSONTyped,
148
+ LeagueToJSON: () => LeagueToJSON,
149
+ LeagueToJSONTyped: () => LeagueToJSONTyped,
150
+ LeaguesFromJSON: () => LeaguesFromJSON,
151
+ LeaguesFromJSONTyped: () => LeaguesFromJSONTyped,
152
+ LeaguesToJSON: () => LeaguesToJSON,
153
+ LeaguesToJSONTyped: () => LeaguesToJSONTyped,
154
+ LinescoreFromJSON: () => LinescoreFromJSON,
155
+ LinescoreFromJSONTyped: () => LinescoreFromJSONTyped,
156
+ LinescoreTeamFromJSON: () => LinescoreTeamFromJSON,
157
+ LinescoreTeamFromJSONTyped: () => LinescoreTeamFromJSONTyped,
158
+ LinescoreTeamToJSON: () => LinescoreTeamToJSON,
159
+ LinescoreTeamToJSONTyped: () => LinescoreTeamToJSONTyped,
160
+ LinescoreTeamsFromJSON: () => LinescoreTeamsFromJSON,
161
+ LinescoreTeamsFromJSONTyped: () => LinescoreTeamsFromJSONTyped,
162
+ LinescoreTeamsToJSON: () => LinescoreTeamsToJSON,
163
+ LinescoreTeamsToJSONTyped: () => LinescoreTeamsToJSONTyped,
164
+ LinescoreToJSON: () => LinescoreToJSON,
165
+ LinescoreToJSONTyped: () => LinescoreToJSONTyped,
166
+ MlbApi: () => MlbApi,
167
+ OfficialFromJSON: () => OfficialFromJSON,
168
+ OfficialFromJSONTyped: () => OfficialFromJSONTyped,
169
+ OfficialToJSON: () => OfficialToJSON,
170
+ OfficialToJSONTyped: () => OfficialToJSONTyped,
171
+ PitchingStatsFromJSON: () => PitchingStatsFromJSON,
172
+ PitchingStatsFromJSONTyped: () => PitchingStatsFromJSONTyped,
173
+ PitchingStatsToJSON: () => PitchingStatsToJSON,
174
+ PitchingStatsToJSONTyped: () => PitchingStatsToJSONTyped,
175
+ PlayerFromJSON: () => PlayerFromJSON,
176
+ PlayerFromJSONTyped: () => PlayerFromJSONTyped,
177
+ PlayerGameStatusFromJSON: () => PlayerGameStatusFromJSON,
178
+ PlayerGameStatusFromJSONTyped: () => PlayerGameStatusFromJSONTyped,
179
+ PlayerGameStatusToJSON: () => PlayerGameStatusToJSON,
180
+ PlayerGameStatusToJSONTyped: () => PlayerGameStatusToJSONTyped,
181
+ PlayerPersonFromJSON: () => PlayerPersonFromJSON,
182
+ PlayerPersonFromJSONTyped: () => PlayerPersonFromJSONTyped,
183
+ PlayerPersonToJSON: () => PlayerPersonToJSON,
184
+ PlayerPersonToJSONTyped: () => PlayerPersonToJSONTyped,
185
+ PlayerPositionFromJSON: () => PlayerPositionFromJSON,
186
+ PlayerPositionFromJSONTyped: () => PlayerPositionFromJSONTyped,
187
+ PlayerPositionToJSON: () => PlayerPositionToJSON,
188
+ PlayerPositionToJSONTyped: () => PlayerPositionToJSONTyped,
189
+ PlayerSeasonStatsFromJSON: () => PlayerSeasonStatsFromJSON,
190
+ PlayerSeasonStatsFromJSONTyped: () => PlayerSeasonStatsFromJSONTyped,
191
+ PlayerSeasonStatsToJSON: () => PlayerSeasonStatsToJSON,
192
+ PlayerSeasonStatsToJSONTyped: () => PlayerSeasonStatsToJSONTyped,
193
+ PlayerStatsFromJSON: () => PlayerStatsFromJSON,
194
+ PlayerStatsFromJSONTyped: () => PlayerStatsFromJSONTyped,
195
+ PlayerStatsToJSON: () => PlayerStatsToJSON,
196
+ PlayerStatsToJSONTyped: () => PlayerStatsToJSONTyped,
197
+ PlayerStatusFromJSON: () => PlayerStatusFromJSON,
198
+ PlayerStatusFromJSONTyped: () => PlayerStatusFromJSONTyped,
199
+ PlayerStatusToJSON: () => PlayerStatusToJSON,
200
+ PlayerStatusToJSONTyped: () => PlayerStatusToJSONTyped,
201
+ PlayerToJSON: () => PlayerToJSON,
202
+ PlayerToJSONTyped: () => PlayerToJSONTyped,
203
+ PositionFromJSON: () => PositionFromJSON,
204
+ PositionFromJSONTyped: () => PositionFromJSONTyped,
205
+ PositionToJSON: () => PositionToJSON,
206
+ PositionToJSONTyped: () => PositionToJSONTyped,
207
+ RecordFromJSON: () => RecordFromJSON,
208
+ RecordFromJSONTyped: () => RecordFromJSONTyped,
209
+ RecordToJSON: () => RecordToJSON,
210
+ RecordToJSONTyped: () => RecordToJSONTyped,
211
+ RequiredError: () => RequiredError,
212
+ ResponseError: () => ResponseError,
213
+ ScheduleDayFromJSON: () => ScheduleDayFromJSON,
214
+ ScheduleDayFromJSONTyped: () => ScheduleDayFromJSONTyped,
215
+ ScheduleDayToJSON: () => ScheduleDayToJSON,
216
+ ScheduleDayToJSONTyped: () => ScheduleDayToJSONTyped,
217
+ ScheduleFromJSON: () => ScheduleFromJSON,
218
+ ScheduleFromJSONTyped: () => ScheduleFromJSONTyped,
219
+ ScheduleToJSON: () => ScheduleToJSON,
220
+ ScheduleToJSONTyped: () => ScheduleToJSONTyped,
221
+ SeasonFromJSON: () => SeasonFromJSON,
222
+ SeasonFromJSONTyped: () => SeasonFromJSONTyped,
223
+ SeasonToJSON: () => SeasonToJSON,
224
+ SeasonToJSONTyped: () => SeasonToJSONTyped,
225
+ SeasonsFromJSON: () => SeasonsFromJSON,
226
+ SeasonsFromJSONTyped: () => SeasonsFromJSONTyped,
227
+ SeasonsToJSON: () => SeasonsToJSON,
228
+ SeasonsToJSONTyped: () => SeasonsToJSONTyped,
229
+ SportFromJSON: () => SportFromJSON,
230
+ SportFromJSONTyped: () => SportFromJSONTyped,
231
+ SportToJSON: () => SportToJSON,
232
+ SportToJSONTyped: () => SportToJSONTyped,
233
+ StreakFromJSON: () => StreakFromJSON,
234
+ StreakFromJSONTyped: () => StreakFromJSONTyped,
235
+ StreakStreakTypeEnum: () => StreakStreakTypeEnum,
236
+ StreakToJSON: () => StreakToJSON,
237
+ StreakToJSONTyped: () => StreakToJSONTyped,
238
+ TeamFromJSON: () => TeamFromJSON,
239
+ TeamFromJSONTyped: () => TeamFromJSONTyped2,
240
+ TeamStatsFromJSON: () => TeamStatsFromJSON,
241
+ TeamStatsFromJSONTyped: () => TeamStatsFromJSONTyped,
242
+ TeamStatsToJSON: () => TeamStatsToJSON,
243
+ TeamStatsToJSONTyped: () => TeamStatsToJSONTyped,
244
+ TeamToJSON: () => TeamToJSON,
245
+ TeamToJSONTyped: () => TeamToJSONTyped2,
246
+ TeamsFromJSON: () => TeamsFromJSON,
247
+ TeamsFromJSONTyped: () => TeamsFromJSONTyped,
248
+ TeamsToJSON: () => TeamsToJSON,
249
+ TeamsToJSONTyped: () => TeamsToJSONTyped,
250
+ TextApiResponse: () => TextApiResponse,
251
+ VenueFromJSON: () => VenueFromJSON,
252
+ VenueFromJSONTyped: () => VenueFromJSONTyped,
253
+ VenueToJSON: () => VenueToJSON,
254
+ VenueToJSONTyped: () => VenueToJSONTyped,
255
+ VoidApiResponse: () => VoidApiResponse,
256
+ canConsumeForm: () => canConsumeForm,
257
+ exists: () => exists,
258
+ instanceOfBattingStats: () => instanceOfBattingStats,
259
+ instanceOfBoxscore: () => instanceOfBoxscore,
260
+ instanceOfBoxscoreTeam: () => instanceOfBoxscoreTeam,
261
+ instanceOfBoxscoreTeams: () => instanceOfBoxscoreTeams,
262
+ instanceOfDivision: () => instanceOfDivision,
263
+ instanceOfDivisionStandings: () => instanceOfDivisionStandings,
264
+ instanceOfDivisionStandingsList: () => instanceOfDivisionStandingsList,
265
+ instanceOfDivisions: () => instanceOfDivisions,
266
+ instanceOfFieldingStats: () => instanceOfFieldingStats,
267
+ instanceOfGame: () => instanceOfGame,
268
+ instanceOfGameOfficial: () => instanceOfGameOfficial,
269
+ instanceOfGameStatus: () => instanceOfGameStatus,
270
+ instanceOfGameStatusCode: () => instanceOfGameStatusCode,
271
+ instanceOfGameTeam: () => instanceOfGameTeam,
272
+ instanceOfGameTeams: () => instanceOfGameTeams,
273
+ instanceOfGameType: () => instanceOfGameType,
274
+ instanceOfInning: () => instanceOfInning,
275
+ instanceOfLeague: () => instanceOfLeague,
276
+ instanceOfLeagueDates: () => instanceOfLeagueDates,
277
+ instanceOfLeagueRecord: () => instanceOfLeagueRecord,
278
+ instanceOfLeagues: () => instanceOfLeagues,
279
+ instanceOfLinescore: () => instanceOfLinescore,
280
+ instanceOfLinescoreTeam: () => instanceOfLinescoreTeam,
281
+ instanceOfLinescoreTeams: () => instanceOfLinescoreTeams,
282
+ instanceOfOfficial: () => instanceOfOfficial,
283
+ instanceOfPitchingStats: () => instanceOfPitchingStats,
284
+ instanceOfPlayer: () => instanceOfPlayer,
285
+ instanceOfPlayerGameStatus: () => instanceOfPlayerGameStatus,
286
+ instanceOfPlayerPerson: () => instanceOfPlayerPerson,
287
+ instanceOfPlayerPosition: () => instanceOfPlayerPosition,
288
+ instanceOfPlayerSeasonStats: () => instanceOfPlayerSeasonStats,
289
+ instanceOfPlayerStats: () => instanceOfPlayerStats,
290
+ instanceOfPlayerStatus: () => instanceOfPlayerStatus,
291
+ instanceOfPosition: () => instanceOfPosition,
292
+ instanceOfRecord: () => instanceOfRecord,
293
+ instanceOfSchedule: () => instanceOfSchedule,
294
+ instanceOfScheduleDay: () => instanceOfScheduleDay,
295
+ instanceOfSeason: () => instanceOfSeason,
296
+ instanceOfSeasons: () => instanceOfSeasons,
297
+ instanceOfSport: () => instanceOfSport,
298
+ instanceOfStreak: () => instanceOfStreak,
299
+ instanceOfTeam: () => instanceOfTeam,
300
+ instanceOfTeamStats: () => instanceOfTeamStats,
301
+ instanceOfTeams: () => instanceOfTeams,
302
+ instanceOfVenue: () => instanceOfVenue,
303
+ mapValues: () => mapValues,
304
+ querystring: () => querystring
305
+ });
306
+ module.exports = __toCommonJS(index_exports);
307
+
41
308
  // src/runtime.ts
42
309
  var BASE_PATH = "https://statsapi.mlb.com/api".replace(/\/+$/, "");
43
310
  var Configuration = class {
@@ -284,10 +551,11 @@ function exists(json, key) {
284
551
  return value !== null && value !== void 0;
285
552
  }
286
553
  function mapValues(data, fn) {
287
- return Object.keys(data).reduce(
288
- (acc, key) => __spreadProps(__spreadValues({}, acc), { [key]: fn(data[key]) }),
289
- {}
290
- );
554
+ const result = {};
555
+ for (const key of Object.keys(data)) {
556
+ result[key] = fn(data[key]);
557
+ }
558
+ return result;
291
559
  }
292
560
  function canConsumeForm(consumes) {
293
561
  for (const consume of consumes) {
@@ -1584,6 +1852,7 @@ function DivisionStandingsToJSONTyped(value, ignoreDiscriminator = false) {
1584
1852
 
1585
1853
  // src/models/DivisionStandingsList.ts
1586
1854
  function instanceOfDivisionStandingsList(value) {
1855
+ if (!("records" in value) || value["records"] === void 0) return false;
1587
1856
  return true;
1588
1857
  }
1589
1858
  function DivisionStandingsListFromJSON(json) {
@@ -1594,7 +1863,7 @@ function DivisionStandingsListFromJSONTyped(json, ignoreDiscriminator) {
1594
1863
  return json;
1595
1864
  }
1596
1865
  return {
1597
- "records": json["records"] == null ? void 0 : json["records"].map(DivisionStandingsFromJSON)
1866
+ "records": json["records"].map(DivisionStandingsFromJSON)
1598
1867
  };
1599
1868
  }
1600
1869
  function DivisionStandingsListToJSON(json) {
@@ -1605,7 +1874,35 @@ function DivisionStandingsListToJSONTyped(value, ignoreDiscriminator = false) {
1605
1874
  return value;
1606
1875
  }
1607
1876
  return {
1608
- "records": value["records"] == null ? void 0 : value["records"].map(DivisionStandingsToJSON)
1877
+ "records": value["records"].map(DivisionStandingsToJSON)
1878
+ };
1879
+ }
1880
+
1881
+ // src/models/Divisions.ts
1882
+ function instanceOfDivisions(value) {
1883
+ if (!("divisions" in value) || value["divisions"] === void 0) return false;
1884
+ return true;
1885
+ }
1886
+ function DivisionsFromJSON(json) {
1887
+ return DivisionsFromJSONTyped(json, false);
1888
+ }
1889
+ function DivisionsFromJSONTyped(json, ignoreDiscriminator) {
1890
+ if (json == null) {
1891
+ return json;
1892
+ }
1893
+ return {
1894
+ "divisions": json["divisions"].map(DivisionFromJSON)
1895
+ };
1896
+ }
1897
+ function DivisionsToJSON(json) {
1898
+ return DivisionsToJSONTyped(json, false);
1899
+ }
1900
+ function DivisionsToJSONTyped(value, ignoreDiscriminator = false) {
1901
+ if (value == null) {
1902
+ return value;
1903
+ }
1904
+ return {
1905
+ "divisions": value["divisions"].map(DivisionToJSON)
1609
1906
  };
1610
1907
  }
1611
1908
 
@@ -1889,6 +2186,10 @@ function GameToJSONTyped(value, ignoreDiscriminator = false) {
1889
2186
 
1890
2187
  // src/models/LinescoreTeam.ts
1891
2188
  function instanceOfLinescoreTeam(value) {
2189
+ if (!("runs" in value) || value["runs"] === void 0) return false;
2190
+ if (!("hits" in value) || value["hits"] === void 0) return false;
2191
+ if (!("errors" in value) || value["errors"] === void 0) return false;
2192
+ if (!("leftOnBase" in value) || value["leftOnBase"] === void 0) return false;
1892
2193
  return true;
1893
2194
  }
1894
2195
  function LinescoreTeamFromJSON(json) {
@@ -1899,10 +2200,10 @@ function LinescoreTeamFromJSONTyped(json, ignoreDiscriminator) {
1899
2200
  return json;
1900
2201
  }
1901
2202
  return {
1902
- "runs": json["runs"] == null ? void 0 : json["runs"],
1903
- "hits": json["hits"] == null ? void 0 : json["hits"],
1904
- "errors": json["errors"] == null ? void 0 : json["errors"],
1905
- "leftOnBase": json["leftOnBase"] == null ? void 0 : json["leftOnBase"]
2203
+ "runs": json["runs"],
2204
+ "hits": json["hits"],
2205
+ "errors": json["errors"],
2206
+ "leftOnBase": json["leftOnBase"]
1906
2207
  };
1907
2208
  }
1908
2209
  function LinescoreTeamToJSON(json) {
@@ -1922,6 +2223,10 @@ function LinescoreTeamToJSONTyped(value, ignoreDiscriminator = false) {
1922
2223
 
1923
2224
  // src/models/Inning.ts
1924
2225
  function instanceOfInning(value) {
2226
+ if (!("num" in value) || value["num"] === void 0) return false;
2227
+ if (!("ordinalNum" in value) || value["ordinalNum"] === void 0) return false;
2228
+ if (!("home" in value) || value["home"] === void 0) return false;
2229
+ if (!("away" in value) || value["away"] === void 0) return false;
1925
2230
  return true;
1926
2231
  }
1927
2232
  function InningFromJSON(json) {
@@ -1932,10 +2237,10 @@ function InningFromJSONTyped(json, ignoreDiscriminator) {
1932
2237
  return json;
1933
2238
  }
1934
2239
  return {
1935
- "num": json["num"] == null ? void 0 : json["num"],
1936
- "ordinalNum": json["ordinalNum"] == null ? void 0 : json["ordinalNum"],
1937
- "home": json["home"] == null ? void 0 : LinescoreTeamFromJSON(json["home"]),
1938
- "away": json["away"] == null ? void 0 : LinescoreTeamFromJSON(json["away"])
2240
+ "num": json["num"],
2241
+ "ordinalNum": json["ordinalNum"],
2242
+ "home": LinescoreTeamFromJSON(json["home"]),
2243
+ "away": LinescoreTeamFromJSON(json["away"])
1939
2244
  };
1940
2245
  }
1941
2246
  function InningToJSON(json) {
@@ -1953,8 +2258,38 @@ function InningToJSONTyped(value, ignoreDiscriminator = false) {
1953
2258
  };
1954
2259
  }
1955
2260
 
2261
+ // src/models/Leagues.ts
2262
+ function instanceOfLeagues(value) {
2263
+ if (!("leagues" in value) || value["leagues"] === void 0) return false;
2264
+ return true;
2265
+ }
2266
+ function LeaguesFromJSON(json) {
2267
+ return LeaguesFromJSONTyped(json, false);
2268
+ }
2269
+ function LeaguesFromJSONTyped(json, ignoreDiscriminator) {
2270
+ if (json == null) {
2271
+ return json;
2272
+ }
2273
+ return {
2274
+ "leagues": json["leagues"].map(LeagueFromJSON)
2275
+ };
2276
+ }
2277
+ function LeaguesToJSON(json) {
2278
+ return LeaguesToJSONTyped(json, false);
2279
+ }
2280
+ function LeaguesToJSONTyped(value, ignoreDiscriminator = false) {
2281
+ if (value == null) {
2282
+ return value;
2283
+ }
2284
+ return {
2285
+ "leagues": value["leagues"].map(LeagueToJSON)
2286
+ };
2287
+ }
2288
+
1956
2289
  // src/models/LinescoreTeams.ts
1957
2290
  function instanceOfLinescoreTeams(value) {
2291
+ if (!("away" in value) || value["away"] === void 0) return false;
2292
+ if (!("home" in value) || value["home"] === void 0) return false;
1958
2293
  return true;
1959
2294
  }
1960
2295
  function LinescoreTeamsFromJSON(json) {
@@ -1965,8 +2300,8 @@ function LinescoreTeamsFromJSONTyped(json, ignoreDiscriminator) {
1965
2300
  return json;
1966
2301
  }
1967
2302
  return {
1968
- "away": json["away"] == null ? void 0 : LinescoreTeamFromJSON(json["away"]),
1969
- "home": json["home"] == null ? void 0 : LinescoreTeamFromJSON(json["home"])
2303
+ "away": LinescoreTeamFromJSON(json["away"]),
2304
+ "home": LinescoreTeamFromJSON(json["home"])
1970
2305
  };
1971
2306
  }
1972
2307
  function LinescoreTeamsToJSON(json) {
@@ -1984,6 +2319,10 @@ function LinescoreTeamsToJSONTyped(value, ignoreDiscriminator = false) {
1984
2319
 
1985
2320
  // src/models/Linescore.ts
1986
2321
  function instanceOfLinescore(value) {
2322
+ if (!("teams" in value) || value["teams"] === void 0) return false;
2323
+ if (!("balls" in value) || value["balls"] === void 0) return false;
2324
+ if (!("strikes" in value) || value["strikes"] === void 0) return false;
2325
+ if (!("outs" in value) || value["outs"] === void 0) return false;
1987
2326
  return true;
1988
2327
  }
1989
2328
  function LinescoreFromJSON(json) {
@@ -2001,10 +2340,10 @@ function LinescoreFromJSONTyped(json, ignoreDiscriminator) {
2001
2340
  "isTopInning": json["isTopInning"] == null ? void 0 : json["isTopInning"],
2002
2341
  "scheduledInnings": json["scheduledInnings"] == null ? void 0 : json["scheduledInnings"],
2003
2342
  "innings": json["innings"] == null ? void 0 : json["innings"].map(InningFromJSON),
2004
- "teams": json["teams"] == null ? void 0 : LinescoreTeamsFromJSON(json["teams"]),
2005
- "balls": json["balls"] == null ? void 0 : json["balls"],
2006
- "strikes": json["strikes"] == null ? void 0 : json["strikes"],
2007
- "outs": json["outs"] == null ? void 0 : json["outs"]
2343
+ "teams": LinescoreTeamsFromJSON(json["teams"]),
2344
+ "balls": json["balls"],
2345
+ "strikes": json["strikes"],
2346
+ "outs": json["outs"]
2008
2347
  };
2009
2348
  }
2010
2349
  function LinescoreToJSON(json) {
@@ -2181,6 +2520,7 @@ function SeasonToJSONTyped(value, ignoreDiscriminator = false) {
2181
2520
 
2182
2521
  // src/models/Seasons.ts
2183
2522
  function instanceOfSeasons(value) {
2523
+ if (!("seasons" in value) || value["seasons"] === void 0) return false;
2184
2524
  return true;
2185
2525
  }
2186
2526
  function SeasonsFromJSON(json) {
@@ -2191,7 +2531,7 @@ function SeasonsFromJSONTyped(json, ignoreDiscriminator) {
2191
2531
  return json;
2192
2532
  }
2193
2533
  return {
2194
- "seasons": json["seasons"] == null ? void 0 : json["seasons"].map(SeasonFromJSON)
2534
+ "seasons": json["seasons"].map(SeasonFromJSON)
2195
2535
  };
2196
2536
  }
2197
2537
  function SeasonsToJSON(json) {
@@ -2202,12 +2542,13 @@ function SeasonsToJSONTyped(value, ignoreDiscriminator = false) {
2202
2542
  return value;
2203
2543
  }
2204
2544
  return {
2205
- "seasons": value["seasons"] == null ? void 0 : value["seasons"].map(SeasonToJSON)
2545
+ "seasons": value["seasons"].map(SeasonToJSON)
2206
2546
  };
2207
2547
  }
2208
2548
 
2209
2549
  // src/models/Teams.ts
2210
2550
  function instanceOfTeams(value) {
2551
+ if (!("teams" in value) || value["teams"] === void 0) return false;
2211
2552
  return true;
2212
2553
  }
2213
2554
  function TeamsFromJSON(json) {
@@ -2218,7 +2559,7 @@ function TeamsFromJSONTyped(json, ignoreDiscriminator) {
2218
2559
  return json;
2219
2560
  }
2220
2561
  return {
2221
- "teams": json["teams"] == null ? void 0 : json["teams"].map(TeamFromJSON)
2562
+ "teams": json["teams"].map(TeamFromJSON)
2222
2563
  };
2223
2564
  }
2224
2565
  function TeamsToJSON(json) {
@@ -2229,7 +2570,7 @@ function TeamsToJSONTyped(value, ignoreDiscriminator = false) {
2229
2570
  return value;
2230
2571
  }
2231
2572
  return {
2232
- "teams": value["teams"] == null ? void 0 : value["teams"].map(TeamToJSON)
2573
+ "teams": value["teams"].map(TeamToJSON)
2233
2574
  };
2234
2575
  }
2235
2576
 
@@ -2285,7 +2626,7 @@ var MlbApi = class extends BaseAPI {
2285
2626
  }
2286
2627
  const queryParameters = {};
2287
2628
  if (requestParameters["fields"] != null) {
2288
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2629
+ queryParameters["fields"] = requestParameters["fields"];
2289
2630
  }
2290
2631
  const headerParameters = {};
2291
2632
  const response = yield this.request({
@@ -2307,6 +2648,96 @@ var MlbApi = class extends BaseAPI {
2307
2648
  return yield response.value();
2308
2649
  });
2309
2650
  }
2651
+ /**
2652
+ * Returns Divisions
2653
+ * Retrieves Divisions
2654
+ */
2655
+ getDivisionsRaw(requestParameters, initOverrides) {
2656
+ return __async(this, null, function* () {
2657
+ if (requestParameters["sportId"] == null) {
2658
+ throw new RequiredError(
2659
+ "sportId",
2660
+ 'Required parameter "sportId" was null or undefined when calling getDivisions().'
2661
+ );
2662
+ }
2663
+ if (requestParameters["season"] == null) {
2664
+ throw new RequiredError(
2665
+ "season",
2666
+ 'Required parameter "season" was null or undefined when calling getDivisions().'
2667
+ );
2668
+ }
2669
+ const queryParameters = {};
2670
+ if (requestParameters["sportId"] != null) {
2671
+ queryParameters["sportId"] = requestParameters["sportId"];
2672
+ }
2673
+ if (requestParameters["season"] != null) {
2674
+ queryParameters["season"] = requestParameters["season"];
2675
+ }
2676
+ const headerParameters = {};
2677
+ const response = yield this.request({
2678
+ path: `/v1/divisions`,
2679
+ method: "GET",
2680
+ headers: headerParameters,
2681
+ query: queryParameters
2682
+ }, initOverrides);
2683
+ return new JSONApiResponse(response, (jsonValue) => DivisionsFromJSON(jsonValue));
2684
+ });
2685
+ }
2686
+ /**
2687
+ * Returns Divisions
2688
+ * Retrieves Divisions
2689
+ */
2690
+ getDivisions(requestParameters, initOverrides) {
2691
+ return __async(this, null, function* () {
2692
+ const response = yield this.getDivisionsRaw(requestParameters, initOverrides);
2693
+ return yield response.value();
2694
+ });
2695
+ }
2696
+ /**
2697
+ * Returns Leagues
2698
+ * Retrieves Leagues
2699
+ */
2700
+ getLeaguesRaw(requestParameters, initOverrides) {
2701
+ return __async(this, null, function* () {
2702
+ if (requestParameters["sportId"] == null) {
2703
+ throw new RequiredError(
2704
+ "sportId",
2705
+ 'Required parameter "sportId" was null or undefined when calling getLeagues().'
2706
+ );
2707
+ }
2708
+ if (requestParameters["season"] == null) {
2709
+ throw new RequiredError(
2710
+ "season",
2711
+ 'Required parameter "season" was null or undefined when calling getLeagues().'
2712
+ );
2713
+ }
2714
+ const queryParameters = {};
2715
+ if (requestParameters["sportId"] != null) {
2716
+ queryParameters["sportId"] = requestParameters["sportId"];
2717
+ }
2718
+ if (requestParameters["season"] != null) {
2719
+ queryParameters["season"] = requestParameters["season"];
2720
+ }
2721
+ const headerParameters = {};
2722
+ const response = yield this.request({
2723
+ path: `/v1/leagues`,
2724
+ method: "GET",
2725
+ headers: headerParameters,
2726
+ query: queryParameters
2727
+ }, initOverrides);
2728
+ return new JSONApiResponse(response, (jsonValue) => LeaguesFromJSON(jsonValue));
2729
+ });
2730
+ }
2731
+ /**
2732
+ * Returns Leagues
2733
+ * Retrieves Leagues
2734
+ */
2735
+ getLeagues(requestParameters, initOverrides) {
2736
+ return __async(this, null, function* () {
2737
+ const response = yield this.getLeaguesRaw(requestParameters, initOverrides);
2738
+ return yield response.value();
2739
+ });
2740
+ }
2310
2741
  /**
2311
2742
  * Returns Linescore
2312
2743
  * Retrieves linescore
@@ -2321,7 +2752,7 @@ var MlbApi = class extends BaseAPI {
2321
2752
  }
2322
2753
  const queryParameters = {};
2323
2754
  if (requestParameters["fields"] != null) {
2324
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2755
+ queryParameters["fields"] = requestParameters["fields"];
2325
2756
  }
2326
2757
  const headerParameters = {};
2327
2758
  const response = yield this.request({
@@ -2356,6 +2787,9 @@ var MlbApi = class extends BaseAPI {
2356
2787
  );
2357
2788
  }
2358
2789
  const queryParameters = {};
2790
+ if (requestParameters["gamePk"] != null) {
2791
+ queryParameters["gamePk"] = requestParameters["gamePk"];
2792
+ }
2359
2793
  if (requestParameters["sportId"] != null) {
2360
2794
  queryParameters["sportId"] = requestParameters["sportId"];
2361
2795
  }
@@ -2372,7 +2806,7 @@ var MlbApi = class extends BaseAPI {
2372
2806
  queryParameters["endDate"] = requestParameters["endDate"];
2373
2807
  }
2374
2808
  if (requestParameters["fields"] != null) {
2375
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2809
+ queryParameters["fields"] = requestParameters["fields"];
2376
2810
  }
2377
2811
  if (requestParameters["hydrate"] != null) {
2378
2812
  queryParameters["hydrate"] = requestParameters["hydrate"];
@@ -2474,7 +2908,7 @@ var MlbApi = class extends BaseAPI {
2474
2908
  queryParameters["date"] = requestParameters["date"];
2475
2909
  }
2476
2910
  if (requestParameters["fields"] != null) {
2477
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2911
+ queryParameters["fields"] = requestParameters["fields"];
2478
2912
  }
2479
2913
  if (requestParameters["hydrate"] != null) {
2480
2914
  queryParameters["hydrate"] = requestParameters["hydrate"];
@@ -2527,6 +2961,12 @@ var MlbApi = class extends BaseAPI {
2527
2961
  if (requestParameters["leagueIds"] != null) {
2528
2962
  queryParameters["leagueIds"] = requestParameters["leagueIds"];
2529
2963
  }
2964
+ if (requestParameters["fields"] != null) {
2965
+ queryParameters["fields"] = requestParameters["fields"];
2966
+ }
2967
+ if (requestParameters["hydrate"] != null) {
2968
+ queryParameters["hydrate"] = requestParameters["hydrate"];
2969
+ }
2530
2970
  const headerParameters = {};
2531
2971
  const response = yield this.request({
2532
2972
  path: `/v1/teams`,
@@ -2548,7 +2988,8 @@ var MlbApi = class extends BaseAPI {
2548
2988
  });
2549
2989
  }
2550
2990
  };
2551
- export {
2991
+ // Annotate the CommonJS export names for ESM import in node:
2992
+ 0 && (module.exports = {
2552
2993
  BASE_PATH,
2553
2994
  BaseAPI,
2554
2995
  BattingStatsFromJSON,
@@ -2583,6 +3024,10 @@ export {
2583
3024
  DivisionStandingsToJSONTyped,
2584
3025
  DivisionToJSON,
2585
3026
  DivisionToJSONTyped,
3027
+ DivisionsFromJSON,
3028
+ DivisionsFromJSONTyped,
3029
+ DivisionsToJSON,
3030
+ DivisionsToJSONTyped,
2586
3031
  FetchError,
2587
3032
  FieldingStatsFromJSON,
2588
3033
  FieldingStatsFromJSONTyped,
@@ -2635,6 +3080,10 @@ export {
2635
3080
  LeagueRecordToJSONTyped,
2636
3081
  LeagueToJSON,
2637
3082
  LeagueToJSONTyped,
3083
+ LeaguesFromJSON,
3084
+ LeaguesFromJSONTyped,
3085
+ LeaguesToJSON,
3086
+ LeaguesToJSONTyped,
2638
3087
  LinescoreFromJSON,
2639
3088
  LinescoreFromJSONTyped,
2640
3089
  LinescoreTeamFromJSON,
@@ -2720,13 +3169,13 @@ export {
2720
3169
  StreakToJSON,
2721
3170
  StreakToJSONTyped,
2722
3171
  TeamFromJSON,
2723
- TeamFromJSONTyped2 as TeamFromJSONTyped,
3172
+ TeamFromJSONTyped,
2724
3173
  TeamStatsFromJSON,
2725
3174
  TeamStatsFromJSONTyped,
2726
3175
  TeamStatsToJSON,
2727
3176
  TeamStatsToJSONTyped,
2728
3177
  TeamToJSON,
2729
- TeamToJSONTyped2 as TeamToJSONTyped,
3178
+ TeamToJSONTyped,
2730
3179
  TeamsFromJSON,
2731
3180
  TeamsFromJSONTyped,
2732
3181
  TeamsToJSON,
@@ -2746,6 +3195,7 @@ export {
2746
3195
  instanceOfDivision,
2747
3196
  instanceOfDivisionStandings,
2748
3197
  instanceOfDivisionStandingsList,
3198
+ instanceOfDivisions,
2749
3199
  instanceOfFieldingStats,
2750
3200
  instanceOfGame,
2751
3201
  instanceOfGameOfficial,
@@ -2758,6 +3208,7 @@ export {
2758
3208
  instanceOfLeague,
2759
3209
  instanceOfLeagueDates,
2760
3210
  instanceOfLeagueRecord,
3211
+ instanceOfLeagues,
2761
3212
  instanceOfLinescore,
2762
3213
  instanceOfLinescoreTeam,
2763
3214
  instanceOfLinescoreTeams,
@@ -2784,4 +3235,4 @@ export {
2784
3235
  instanceOfVenue,
2785
3236
  mapValues,
2786
3237
  querystring
2787
- };
3238
+ });