@bp1222/stats-api 0.3.2 → 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.d.mts CHANGED
@@ -96,7 +96,9 @@ interface RequestOpts {
96
96
  }
97
97
  declare function querystring(params: HTTPQuery, prefix?: string): string;
98
98
  declare function exists(json: any, key: string): boolean;
99
- declare function mapValues(data: any, fn: (item: any) => any): {};
99
+ declare function mapValues(data: any, fn: (item: any) => any): {
100
+ [key: string]: any;
101
+ };
100
102
  declare function canConsumeForm(consumes: Consume[]): boolean;
101
103
  interface Consume {
102
104
  contentType: string;
@@ -633,7 +635,7 @@ declare function DivisionStandingsToJSON(json: any): DivisionStandings;
633
635
  declare function DivisionStandingsToJSONTyped(value?: DivisionStandings | null, ignoreDiscriminator?: boolean): any;
634
636
 
635
637
  interface DivisionStandingsList {
636
- records?: Array<DivisionStandings>;
638
+ records: Array<DivisionStandings>;
637
639
  }
638
640
  declare function instanceOfDivisionStandingsList(value: object): value is DivisionStandingsList;
639
641
  declare function DivisionStandingsListFromJSON(json: any): DivisionStandingsList;
@@ -641,6 +643,15 @@ declare function DivisionStandingsListFromJSONTyped(json: any, ignoreDiscriminat
641
643
  declare function DivisionStandingsListToJSON(json: any): DivisionStandingsList;
642
644
  declare function DivisionStandingsListToJSONTyped(value?: DivisionStandingsList | null, ignoreDiscriminator?: boolean): any;
643
645
 
646
+ interface Divisions {
647
+ divisions: Array<Division>;
648
+ }
649
+ declare function instanceOfDivisions(value: object): value is Divisions;
650
+ declare function DivisionsFromJSON(json: any): Divisions;
651
+ declare function DivisionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): Divisions;
652
+ declare function DivisionsToJSON(json: any): Divisions;
653
+ declare function DivisionsToJSONTyped(value?: Divisions | null, ignoreDiscriminator?: boolean): any;
654
+
644
655
  declare enum GameStatusCode {
645
656
  Final = "F",
646
657
  Postponed = "D",
@@ -751,10 +762,10 @@ declare function GameToJSON(json: any): Game;
751
762
  declare function GameToJSONTyped(value?: Game | null, ignoreDiscriminator?: boolean): any;
752
763
 
753
764
  interface LinescoreTeam {
754
- runs?: number;
755
- hits?: number;
756
- errors?: number;
757
- leftOnBase?: number;
765
+ runs: number;
766
+ hits: number;
767
+ errors: number;
768
+ leftOnBase: number;
758
769
  }
759
770
  declare function instanceOfLinescoreTeam(value: object): value is LinescoreTeam;
760
771
  declare function LinescoreTeamFromJSON(json: any): LinescoreTeam;
@@ -763,10 +774,10 @@ declare function LinescoreTeamToJSON(json: any): LinescoreTeam;
763
774
  declare function LinescoreTeamToJSONTyped(value?: LinescoreTeam | null, ignoreDiscriminator?: boolean): any;
764
775
 
765
776
  interface Inning {
766
- num?: number;
767
- ordinalNum?: string;
768
- home?: LinescoreTeam;
769
- away?: LinescoreTeam;
777
+ num: number;
778
+ ordinalNum: string;
779
+ home: LinescoreTeam;
780
+ away: LinescoreTeam;
770
781
  }
771
782
  declare function instanceOfInning(value: object): value is Inning;
772
783
  declare function InningFromJSON(json: any): Inning;
@@ -774,9 +785,18 @@ declare function InningFromJSONTyped(json: any, ignoreDiscriminator: boolean): I
774
785
  declare function InningToJSON(json: any): Inning;
775
786
  declare function InningToJSONTyped(value?: Inning | null, ignoreDiscriminator?: boolean): any;
776
787
 
788
+ interface Leagues {
789
+ leagues: Array<League>;
790
+ }
791
+ declare function instanceOfLeagues(value: object): value is Leagues;
792
+ declare function LeaguesFromJSON(json: any): Leagues;
793
+ declare function LeaguesFromJSONTyped(json: any, ignoreDiscriminator: boolean): Leagues;
794
+ declare function LeaguesToJSON(json: any): Leagues;
795
+ declare function LeaguesToJSONTyped(value?: Leagues | null, ignoreDiscriminator?: boolean): any;
796
+
777
797
  interface LinescoreTeams {
778
- away?: LinescoreTeam;
779
- home?: LinescoreTeam;
798
+ away: LinescoreTeam;
799
+ home: LinescoreTeam;
780
800
  }
781
801
  declare function instanceOfLinescoreTeams(value: object): value is LinescoreTeams;
782
802
  declare function LinescoreTeamsFromJSON(json: any): LinescoreTeams;
@@ -792,10 +812,10 @@ interface Linescore {
792
812
  isTopInning?: boolean;
793
813
  scheduledInnings?: number;
794
814
  innings?: Array<Inning>;
795
- teams?: LinescoreTeams;
796
- balls?: number;
797
- strikes?: number;
798
- outs?: number;
815
+ teams: LinescoreTeams;
816
+ balls: number;
817
+ strikes: number;
818
+ outs: number;
799
819
  }
800
820
  declare function instanceOfLinescore(value: object): value is Linescore;
801
821
  declare function LinescoreFromJSON(json: any): Linescore;
@@ -860,7 +880,7 @@ declare function SeasonToJSON(json: any): Season;
860
880
  declare function SeasonToJSONTyped(value?: Season | null, ignoreDiscriminator?: boolean): any;
861
881
 
862
882
  interface Seasons {
863
- seasons?: Array<Season>;
883
+ seasons: Array<Season>;
864
884
  }
865
885
  declare function instanceOfSeasons(value: object): value is Seasons;
866
886
  declare function SeasonsFromJSON(json: any): Seasons;
@@ -869,7 +889,7 @@ declare function SeasonsToJSON(json: any): Seasons;
869
889
  declare function SeasonsToJSONTyped(value?: Seasons | null, ignoreDiscriminator?: boolean): any;
870
890
 
871
891
  interface Teams {
872
- teams?: Array<Team>;
892
+ teams: Array<Team>;
873
893
  }
874
894
  declare function instanceOfTeams(value: object): value is Teams;
875
895
  declare function TeamsFromJSON(json: any): Teams;
@@ -884,12 +904,21 @@ interface GetBoxscoreRequest {
884
904
  gamePk: number;
885
905
  fields?: Array<string>;
886
906
  }
907
+ interface GetDivisionsRequest {
908
+ sportId: number;
909
+ season: string;
910
+ }
911
+ interface GetLeaguesRequest {
912
+ sportId: number;
913
+ season: string;
914
+ }
887
915
  interface GetLinescoreRequest {
888
916
  gamePk: number;
889
917
  fields?: Array<string>;
890
918
  }
891
919
  interface GetScheduleRequest {
892
920
  sportId: number;
921
+ gamePk?: number;
893
922
  teamId?: number;
894
923
  gameTypes?: Array<GameType>;
895
924
  startDate?: string;
@@ -913,12 +942,18 @@ interface GetTeamsRequest {
913
942
  sportId: number;
914
943
  season: string;
915
944
  leagueIds?: Array<number>;
945
+ fields?: Array<string>;
946
+ hydrate?: string;
916
947
  }
917
948
  declare class MlbApi extends BaseAPI {
918
949
  getAllSeasonsRaw(requestParameters: GetAllSeasonsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Seasons>>;
919
950
  getAllSeasons(requestParameters: GetAllSeasonsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Seasons>;
920
951
  getBoxscoreRaw(requestParameters: GetBoxscoreRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Boxscore>>;
921
952
  getBoxscore(requestParameters: GetBoxscoreRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Boxscore>;
953
+ getDivisionsRaw(requestParameters: GetDivisionsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Divisions>>;
954
+ getDivisions(requestParameters: GetDivisionsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Divisions>;
955
+ getLeaguesRaw(requestParameters: GetLeaguesRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Leagues>>;
956
+ getLeagues(requestParameters: GetLeaguesRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Leagues>;
922
957
  getLinescoreRaw(requestParameters: GetLinescoreRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Linescore>>;
923
958
  getLinescore(requestParameters: GetLinescoreRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Linescore>;
924
959
  getScheduleRaw(requestParameters: GetScheduleRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Schedule>>;
@@ -931,4 +966,4 @@ declare class MlbApi extends BaseAPI {
931
966
  getTeams(requestParameters: GetTeamsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Teams>;
932
967
  }
933
968
 
934
- export { type ApiResponse, BASE_PATH, BaseAPI, type BattingStats, BattingStatsFromJSON, BattingStatsFromJSONTyped, BattingStatsToJSON, BattingStatsToJSONTyped, BlobApiResponse, type Boxscore, BoxscoreFromJSON, BoxscoreFromJSONTyped, type BoxscoreTeam, BoxscoreTeamFromJSON, BoxscoreTeamFromJSONTyped, BoxscoreTeamToJSON, BoxscoreTeamToJSONTyped, type BoxscoreTeams, BoxscoreTeamsFromJSON, BoxscoreTeamsFromJSONTyped, BoxscoreTeamsToJSON, BoxscoreTeamsToJSONTyped, BoxscoreToJSON, BoxscoreToJSONTyped, COLLECTION_FORMATS, Configuration, type ConfigurationParameters, type Consume, DefaultConfig, type Division, DivisionFromJSON, DivisionFromJSONTyped, type DivisionStandings, DivisionStandingsFromJSON, DivisionStandingsFromJSONTyped, type DivisionStandingsList, DivisionStandingsListFromJSON, DivisionStandingsListFromJSONTyped, DivisionStandingsListToJSON, DivisionStandingsListToJSONTyped, DivisionStandingsToJSON, DivisionStandingsToJSONTyped, DivisionToJSON, DivisionToJSONTyped, type ErrorContext, type FetchAPI, FetchError, type FetchParams, type FieldingStats, FieldingStatsFromJSON, FieldingStatsFromJSONTyped, FieldingStatsToJSON, FieldingStatsToJSONTyped, type Game, GameFromJSON, GameFromJSONTyped, type GameOfficial, GameOfficialFromJSON, GameOfficialFromJSONTyped, GameOfficialToJSON, GameOfficialToJSONTyped, type GameStatus, GameStatusCode, GameStatusCodeFromJSON, GameStatusCodeFromJSONTyped, GameStatusCodeToJSON, GameStatusCodeToJSONTyped, GameStatusFromJSON, GameStatusFromJSONTyped, GameStatusToJSON, GameStatusToJSONTyped, type GameTeam, GameTeamFromJSON, GameTeamFromJSONTyped, GameTeamToJSON, GameTeamToJSONTyped, type GameTeams, GameTeamsFromJSON, GameTeamsFromJSONTyped, GameTeamsToJSON, GameTeamsToJSONTyped, GameToJSON, GameToJSONTyped, GameType, GameTypeFromJSON, GameTypeFromJSONTyped, GameTypeToJSON, GameTypeToJSONTyped, type GetAllSeasonsRequest, type GetBoxscoreRequest, type GetLinescoreRequest, type GetScheduleRequest, type GetSeasonRequest, type GetStandingsRequest, type GetTeamsRequest, type HTTPBody, type HTTPHeaders, type HTTPMethod, type HTTPQuery, type HTTPRequestInit, type InitOverrideFunction, type Inning, InningFromJSON, InningFromJSONTyped, InningToJSON, InningToJSONTyped, JSONApiResponse, type Json, type League, type LeagueDates, LeagueDatesFromJSON, LeagueDatesFromJSONTyped, LeagueDatesToJSON, LeagueDatesToJSONTyped, LeagueFromJSON, LeagueFromJSONTyped, type LeagueRecord, LeagueRecordFromJSON, LeagueRecordFromJSONTyped, LeagueRecordToJSON, LeagueRecordToJSONTyped, LeagueToJSON, LeagueToJSONTyped, type Linescore, LinescoreFromJSON, LinescoreFromJSONTyped, type LinescoreTeam, LinescoreTeamFromJSON, LinescoreTeamFromJSONTyped, LinescoreTeamToJSON, LinescoreTeamToJSONTyped, type LinescoreTeams, LinescoreTeamsFromJSON, LinescoreTeamsFromJSONTyped, LinescoreTeamsToJSON, LinescoreTeamsToJSONTyped, LinescoreToJSON, LinescoreToJSONTyped, type Middleware, MlbApi, type ModelPropertyNaming, type Official, OfficialFromJSON, OfficialFromJSONTyped, OfficialToJSON, OfficialToJSONTyped, type PitchingStats, PitchingStatsFromJSON, PitchingStatsFromJSONTyped, PitchingStatsToJSON, PitchingStatsToJSONTyped, type Player, PlayerFromJSON, PlayerFromJSONTyped, type PlayerGameStatus, PlayerGameStatusFromJSON, PlayerGameStatusFromJSONTyped, PlayerGameStatusToJSON, PlayerGameStatusToJSONTyped, type PlayerPerson, PlayerPersonFromJSON, PlayerPersonFromJSONTyped, PlayerPersonToJSON, PlayerPersonToJSONTyped, type PlayerPosition, PlayerPositionFromJSON, PlayerPositionFromJSONTyped, PlayerPositionToJSON, PlayerPositionToJSONTyped, type PlayerSeasonStats, PlayerSeasonStatsFromJSON, PlayerSeasonStatsFromJSONTyped, PlayerSeasonStatsToJSON, PlayerSeasonStatsToJSONTyped, type PlayerStats, PlayerStatsFromJSON, PlayerStatsFromJSONTyped, PlayerStatsToJSON, PlayerStatsToJSONTyped, type PlayerStatus, PlayerStatusFromJSON, PlayerStatusFromJSONTyped, PlayerStatusToJSON, PlayerStatusToJSONTyped, PlayerToJSON, PlayerToJSONTyped, type Position, PositionFromJSON, PositionFromJSONTyped, PositionToJSON, PositionToJSONTyped, type Record, RecordFromJSON, RecordFromJSONTyped, RecordToJSON, RecordToJSONTyped, type RequestContext, type RequestOpts, RequiredError, type ResponseContext, ResponseError, type ResponseTransformer, type Schedule, type ScheduleDay, ScheduleDayFromJSON, ScheduleDayFromJSONTyped, ScheduleDayToJSON, ScheduleDayToJSONTyped, ScheduleFromJSON, ScheduleFromJSONTyped, ScheduleToJSON, ScheduleToJSONTyped, type Season, SeasonFromJSON, SeasonFromJSONTyped, SeasonToJSON, SeasonToJSONTyped, type Seasons, SeasonsFromJSON, SeasonsFromJSONTyped, SeasonsToJSON, SeasonsToJSONTyped, type Sport, SportFromJSON, SportFromJSONTyped, SportToJSON, SportToJSONTyped, type Streak, StreakFromJSON, StreakFromJSONTyped, StreakStreakTypeEnum, StreakToJSON, StreakToJSONTyped, type Team, TeamFromJSON, TeamFromJSONTyped, type TeamStats, TeamStatsFromJSON, TeamStatsFromJSONTyped, TeamStatsToJSON, TeamStatsToJSONTyped, TeamToJSON, TeamToJSONTyped, type Teams, TeamsFromJSON, TeamsFromJSONTyped, TeamsToJSON, TeamsToJSONTyped, TextApiResponse, type Venue, VenueFromJSON, VenueFromJSONTyped, VenueToJSON, VenueToJSONTyped, VoidApiResponse, canConsumeForm, exists, instanceOfBattingStats, instanceOfBoxscore, instanceOfBoxscoreTeam, instanceOfBoxscoreTeams, instanceOfDivision, instanceOfDivisionStandings, instanceOfDivisionStandingsList, instanceOfFieldingStats, instanceOfGame, instanceOfGameOfficial, instanceOfGameStatus, instanceOfGameStatusCode, instanceOfGameTeam, instanceOfGameTeams, instanceOfGameType, instanceOfInning, instanceOfLeague, instanceOfLeagueDates, instanceOfLeagueRecord, instanceOfLinescore, instanceOfLinescoreTeam, instanceOfLinescoreTeams, instanceOfOfficial, instanceOfPitchingStats, instanceOfPlayer, instanceOfPlayerGameStatus, instanceOfPlayerPerson, instanceOfPlayerPosition, instanceOfPlayerSeasonStats, instanceOfPlayerStats, instanceOfPlayerStatus, instanceOfPosition, instanceOfRecord, instanceOfSchedule, instanceOfScheduleDay, instanceOfSeason, instanceOfSeasons, instanceOfSport, instanceOfStreak, instanceOfTeam, instanceOfTeamStats, instanceOfTeams, instanceOfVenue, mapValues, querystring };
969
+ export { type ApiResponse, BASE_PATH, BaseAPI, type BattingStats, BattingStatsFromJSON, BattingStatsFromJSONTyped, BattingStatsToJSON, BattingStatsToJSONTyped, BlobApiResponse, type Boxscore, BoxscoreFromJSON, BoxscoreFromJSONTyped, type BoxscoreTeam, BoxscoreTeamFromJSON, BoxscoreTeamFromJSONTyped, BoxscoreTeamToJSON, BoxscoreTeamToJSONTyped, type BoxscoreTeams, BoxscoreTeamsFromJSON, BoxscoreTeamsFromJSONTyped, BoxscoreTeamsToJSON, BoxscoreTeamsToJSONTyped, BoxscoreToJSON, BoxscoreToJSONTyped, COLLECTION_FORMATS, Configuration, type ConfigurationParameters, type Consume, DefaultConfig, type Division, DivisionFromJSON, DivisionFromJSONTyped, type DivisionStandings, DivisionStandingsFromJSON, DivisionStandingsFromJSONTyped, type DivisionStandingsList, DivisionStandingsListFromJSON, DivisionStandingsListFromJSONTyped, DivisionStandingsListToJSON, DivisionStandingsListToJSONTyped, DivisionStandingsToJSON, DivisionStandingsToJSONTyped, DivisionToJSON, DivisionToJSONTyped, type Divisions, DivisionsFromJSON, DivisionsFromJSONTyped, DivisionsToJSON, DivisionsToJSONTyped, type ErrorContext, type FetchAPI, FetchError, type FetchParams, type FieldingStats, FieldingStatsFromJSON, FieldingStatsFromJSONTyped, FieldingStatsToJSON, FieldingStatsToJSONTyped, type Game, GameFromJSON, GameFromJSONTyped, type GameOfficial, GameOfficialFromJSON, GameOfficialFromJSONTyped, GameOfficialToJSON, GameOfficialToJSONTyped, type GameStatus, GameStatusCode, GameStatusCodeFromJSON, GameStatusCodeFromJSONTyped, GameStatusCodeToJSON, GameStatusCodeToJSONTyped, GameStatusFromJSON, GameStatusFromJSONTyped, GameStatusToJSON, GameStatusToJSONTyped, type GameTeam, GameTeamFromJSON, GameTeamFromJSONTyped, GameTeamToJSON, GameTeamToJSONTyped, type GameTeams, GameTeamsFromJSON, GameTeamsFromJSONTyped, GameTeamsToJSON, GameTeamsToJSONTyped, GameToJSON, GameToJSONTyped, GameType, GameTypeFromJSON, GameTypeFromJSONTyped, GameTypeToJSON, GameTypeToJSONTyped, type GetAllSeasonsRequest, type GetBoxscoreRequest, type GetDivisionsRequest, type GetLeaguesRequest, type GetLinescoreRequest, type GetScheduleRequest, type GetSeasonRequest, type GetStandingsRequest, type GetTeamsRequest, type HTTPBody, type HTTPHeaders, type HTTPMethod, type HTTPQuery, type HTTPRequestInit, type InitOverrideFunction, type Inning, InningFromJSON, InningFromJSONTyped, InningToJSON, InningToJSONTyped, JSONApiResponse, type Json, type League, type LeagueDates, LeagueDatesFromJSON, LeagueDatesFromJSONTyped, LeagueDatesToJSON, LeagueDatesToJSONTyped, LeagueFromJSON, LeagueFromJSONTyped, type LeagueRecord, LeagueRecordFromJSON, LeagueRecordFromJSONTyped, LeagueRecordToJSON, LeagueRecordToJSONTyped, LeagueToJSON, LeagueToJSONTyped, type Leagues, LeaguesFromJSON, LeaguesFromJSONTyped, LeaguesToJSON, LeaguesToJSONTyped, type Linescore, LinescoreFromJSON, LinescoreFromJSONTyped, type LinescoreTeam, LinescoreTeamFromJSON, LinescoreTeamFromJSONTyped, LinescoreTeamToJSON, LinescoreTeamToJSONTyped, type LinescoreTeams, LinescoreTeamsFromJSON, LinescoreTeamsFromJSONTyped, LinescoreTeamsToJSON, LinescoreTeamsToJSONTyped, LinescoreToJSON, LinescoreToJSONTyped, type Middleware, MlbApi, type ModelPropertyNaming, type Official, OfficialFromJSON, OfficialFromJSONTyped, OfficialToJSON, OfficialToJSONTyped, type PitchingStats, PitchingStatsFromJSON, PitchingStatsFromJSONTyped, PitchingStatsToJSON, PitchingStatsToJSONTyped, type Player, PlayerFromJSON, PlayerFromJSONTyped, type PlayerGameStatus, PlayerGameStatusFromJSON, PlayerGameStatusFromJSONTyped, PlayerGameStatusToJSON, PlayerGameStatusToJSONTyped, type PlayerPerson, PlayerPersonFromJSON, PlayerPersonFromJSONTyped, PlayerPersonToJSON, PlayerPersonToJSONTyped, type PlayerPosition, PlayerPositionFromJSON, PlayerPositionFromJSONTyped, PlayerPositionToJSON, PlayerPositionToJSONTyped, type PlayerSeasonStats, PlayerSeasonStatsFromJSON, PlayerSeasonStatsFromJSONTyped, PlayerSeasonStatsToJSON, PlayerSeasonStatsToJSONTyped, type PlayerStats, PlayerStatsFromJSON, PlayerStatsFromJSONTyped, PlayerStatsToJSON, PlayerStatsToJSONTyped, type PlayerStatus, PlayerStatusFromJSON, PlayerStatusFromJSONTyped, PlayerStatusToJSON, PlayerStatusToJSONTyped, PlayerToJSON, PlayerToJSONTyped, type Position, PositionFromJSON, PositionFromJSONTyped, PositionToJSON, PositionToJSONTyped, type Record, RecordFromJSON, RecordFromJSONTyped, RecordToJSON, RecordToJSONTyped, type RequestContext, type RequestOpts, RequiredError, type ResponseContext, ResponseError, type ResponseTransformer, type Schedule, type ScheduleDay, ScheduleDayFromJSON, ScheduleDayFromJSONTyped, ScheduleDayToJSON, ScheduleDayToJSONTyped, ScheduleFromJSON, ScheduleFromJSONTyped, ScheduleToJSON, ScheduleToJSONTyped, type Season, SeasonFromJSON, SeasonFromJSONTyped, SeasonToJSON, SeasonToJSONTyped, type Seasons, SeasonsFromJSON, SeasonsFromJSONTyped, SeasonsToJSON, SeasonsToJSONTyped, type Sport, SportFromJSON, SportFromJSONTyped, SportToJSON, SportToJSONTyped, type Streak, StreakFromJSON, StreakFromJSONTyped, StreakStreakTypeEnum, StreakToJSON, StreakToJSONTyped, type Team, TeamFromJSON, TeamFromJSONTyped, type TeamStats, TeamStatsFromJSON, TeamStatsFromJSONTyped, TeamStatsToJSON, TeamStatsToJSONTyped, TeamToJSON, TeamToJSONTyped, type Teams, TeamsFromJSON, TeamsFromJSONTyped, TeamsToJSON, TeamsToJSONTyped, TextApiResponse, type Venue, VenueFromJSON, VenueFromJSONTyped, VenueToJSON, VenueToJSONTyped, VoidApiResponse, canConsumeForm, exists, instanceOfBattingStats, instanceOfBoxscore, instanceOfBoxscoreTeam, instanceOfBoxscoreTeams, instanceOfDivision, instanceOfDivisionStandings, instanceOfDivisionStandingsList, instanceOfDivisions, instanceOfFieldingStats, instanceOfGame, instanceOfGameOfficial, instanceOfGameStatus, instanceOfGameStatusCode, instanceOfGameTeam, instanceOfGameTeams, instanceOfGameType, instanceOfInning, instanceOfLeague, instanceOfLeagueDates, instanceOfLeagueRecord, instanceOfLeagues, instanceOfLinescore, instanceOfLinescoreTeam, instanceOfLinescoreTeams, instanceOfOfficial, instanceOfPitchingStats, instanceOfPlayer, instanceOfPlayerGameStatus, instanceOfPlayerPerson, instanceOfPlayerPosition, instanceOfPlayerSeasonStats, instanceOfPlayerStats, instanceOfPlayerStatus, instanceOfPosition, instanceOfRecord, instanceOfSchedule, instanceOfScheduleDay, instanceOfSeason, instanceOfSeasons, instanceOfSport, instanceOfStreak, instanceOfTeam, instanceOfTeamStats, instanceOfTeams, instanceOfVenue, mapValues, querystring };
package/dist/index.d.ts CHANGED
@@ -96,7 +96,9 @@ interface RequestOpts {
96
96
  }
97
97
  declare function querystring(params: HTTPQuery, prefix?: string): string;
98
98
  declare function exists(json: any, key: string): boolean;
99
- declare function mapValues(data: any, fn: (item: any) => any): {};
99
+ declare function mapValues(data: any, fn: (item: any) => any): {
100
+ [key: string]: any;
101
+ };
100
102
  declare function canConsumeForm(consumes: Consume[]): boolean;
101
103
  interface Consume {
102
104
  contentType: string;
@@ -633,7 +635,7 @@ declare function DivisionStandingsToJSON(json: any): DivisionStandings;
633
635
  declare function DivisionStandingsToJSONTyped(value?: DivisionStandings | null, ignoreDiscriminator?: boolean): any;
634
636
 
635
637
  interface DivisionStandingsList {
636
- records?: Array<DivisionStandings>;
638
+ records: Array<DivisionStandings>;
637
639
  }
638
640
  declare function instanceOfDivisionStandingsList(value: object): value is DivisionStandingsList;
639
641
  declare function DivisionStandingsListFromJSON(json: any): DivisionStandingsList;
@@ -641,6 +643,15 @@ declare function DivisionStandingsListFromJSONTyped(json: any, ignoreDiscriminat
641
643
  declare function DivisionStandingsListToJSON(json: any): DivisionStandingsList;
642
644
  declare function DivisionStandingsListToJSONTyped(value?: DivisionStandingsList | null, ignoreDiscriminator?: boolean): any;
643
645
 
646
+ interface Divisions {
647
+ divisions: Array<Division>;
648
+ }
649
+ declare function instanceOfDivisions(value: object): value is Divisions;
650
+ declare function DivisionsFromJSON(json: any): Divisions;
651
+ declare function DivisionsFromJSONTyped(json: any, ignoreDiscriminator: boolean): Divisions;
652
+ declare function DivisionsToJSON(json: any): Divisions;
653
+ declare function DivisionsToJSONTyped(value?: Divisions | null, ignoreDiscriminator?: boolean): any;
654
+
644
655
  declare enum GameStatusCode {
645
656
  Final = "F",
646
657
  Postponed = "D",
@@ -751,10 +762,10 @@ declare function GameToJSON(json: any): Game;
751
762
  declare function GameToJSONTyped(value?: Game | null, ignoreDiscriminator?: boolean): any;
752
763
 
753
764
  interface LinescoreTeam {
754
- runs?: number;
755
- hits?: number;
756
- errors?: number;
757
- leftOnBase?: number;
765
+ runs: number;
766
+ hits: number;
767
+ errors: number;
768
+ leftOnBase: number;
758
769
  }
759
770
  declare function instanceOfLinescoreTeam(value: object): value is LinescoreTeam;
760
771
  declare function LinescoreTeamFromJSON(json: any): LinescoreTeam;
@@ -763,10 +774,10 @@ declare function LinescoreTeamToJSON(json: any): LinescoreTeam;
763
774
  declare function LinescoreTeamToJSONTyped(value?: LinescoreTeam | null, ignoreDiscriminator?: boolean): any;
764
775
 
765
776
  interface Inning {
766
- num?: number;
767
- ordinalNum?: string;
768
- home?: LinescoreTeam;
769
- away?: LinescoreTeam;
777
+ num: number;
778
+ ordinalNum: string;
779
+ home: LinescoreTeam;
780
+ away: LinescoreTeam;
770
781
  }
771
782
  declare function instanceOfInning(value: object): value is Inning;
772
783
  declare function InningFromJSON(json: any): Inning;
@@ -774,9 +785,18 @@ declare function InningFromJSONTyped(json: any, ignoreDiscriminator: boolean): I
774
785
  declare function InningToJSON(json: any): Inning;
775
786
  declare function InningToJSONTyped(value?: Inning | null, ignoreDiscriminator?: boolean): any;
776
787
 
788
+ interface Leagues {
789
+ leagues: Array<League>;
790
+ }
791
+ declare function instanceOfLeagues(value: object): value is Leagues;
792
+ declare function LeaguesFromJSON(json: any): Leagues;
793
+ declare function LeaguesFromJSONTyped(json: any, ignoreDiscriminator: boolean): Leagues;
794
+ declare function LeaguesToJSON(json: any): Leagues;
795
+ declare function LeaguesToJSONTyped(value?: Leagues | null, ignoreDiscriminator?: boolean): any;
796
+
777
797
  interface LinescoreTeams {
778
- away?: LinescoreTeam;
779
- home?: LinescoreTeam;
798
+ away: LinescoreTeam;
799
+ home: LinescoreTeam;
780
800
  }
781
801
  declare function instanceOfLinescoreTeams(value: object): value is LinescoreTeams;
782
802
  declare function LinescoreTeamsFromJSON(json: any): LinescoreTeams;
@@ -792,10 +812,10 @@ interface Linescore {
792
812
  isTopInning?: boolean;
793
813
  scheduledInnings?: number;
794
814
  innings?: Array<Inning>;
795
- teams?: LinescoreTeams;
796
- balls?: number;
797
- strikes?: number;
798
- outs?: number;
815
+ teams: LinescoreTeams;
816
+ balls: number;
817
+ strikes: number;
818
+ outs: number;
799
819
  }
800
820
  declare function instanceOfLinescore(value: object): value is Linescore;
801
821
  declare function LinescoreFromJSON(json: any): Linescore;
@@ -860,7 +880,7 @@ declare function SeasonToJSON(json: any): Season;
860
880
  declare function SeasonToJSONTyped(value?: Season | null, ignoreDiscriminator?: boolean): any;
861
881
 
862
882
  interface Seasons {
863
- seasons?: Array<Season>;
883
+ seasons: Array<Season>;
864
884
  }
865
885
  declare function instanceOfSeasons(value: object): value is Seasons;
866
886
  declare function SeasonsFromJSON(json: any): Seasons;
@@ -869,7 +889,7 @@ declare function SeasonsToJSON(json: any): Seasons;
869
889
  declare function SeasonsToJSONTyped(value?: Seasons | null, ignoreDiscriminator?: boolean): any;
870
890
 
871
891
  interface Teams {
872
- teams?: Array<Team>;
892
+ teams: Array<Team>;
873
893
  }
874
894
  declare function instanceOfTeams(value: object): value is Teams;
875
895
  declare function TeamsFromJSON(json: any): Teams;
@@ -884,12 +904,21 @@ interface GetBoxscoreRequest {
884
904
  gamePk: number;
885
905
  fields?: Array<string>;
886
906
  }
907
+ interface GetDivisionsRequest {
908
+ sportId: number;
909
+ season: string;
910
+ }
911
+ interface GetLeaguesRequest {
912
+ sportId: number;
913
+ season: string;
914
+ }
887
915
  interface GetLinescoreRequest {
888
916
  gamePk: number;
889
917
  fields?: Array<string>;
890
918
  }
891
919
  interface GetScheduleRequest {
892
920
  sportId: number;
921
+ gamePk?: number;
893
922
  teamId?: number;
894
923
  gameTypes?: Array<GameType>;
895
924
  startDate?: string;
@@ -913,12 +942,18 @@ interface GetTeamsRequest {
913
942
  sportId: number;
914
943
  season: string;
915
944
  leagueIds?: Array<number>;
945
+ fields?: Array<string>;
946
+ hydrate?: string;
916
947
  }
917
948
  declare class MlbApi extends BaseAPI {
918
949
  getAllSeasonsRaw(requestParameters: GetAllSeasonsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Seasons>>;
919
950
  getAllSeasons(requestParameters: GetAllSeasonsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Seasons>;
920
951
  getBoxscoreRaw(requestParameters: GetBoxscoreRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Boxscore>>;
921
952
  getBoxscore(requestParameters: GetBoxscoreRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Boxscore>;
953
+ getDivisionsRaw(requestParameters: GetDivisionsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Divisions>>;
954
+ getDivisions(requestParameters: GetDivisionsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Divisions>;
955
+ getLeaguesRaw(requestParameters: GetLeaguesRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Leagues>>;
956
+ getLeagues(requestParameters: GetLeaguesRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Leagues>;
922
957
  getLinescoreRaw(requestParameters: GetLinescoreRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Linescore>>;
923
958
  getLinescore(requestParameters: GetLinescoreRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Linescore>;
924
959
  getScheduleRaw(requestParameters: GetScheduleRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<ApiResponse<Schedule>>;
@@ -931,4 +966,4 @@ declare class MlbApi extends BaseAPI {
931
966
  getTeams(requestParameters: GetTeamsRequest, initOverrides?: RequestInit | InitOverrideFunction): Promise<Teams>;
932
967
  }
933
968
 
934
- export { type ApiResponse, BASE_PATH, BaseAPI, type BattingStats, BattingStatsFromJSON, BattingStatsFromJSONTyped, BattingStatsToJSON, BattingStatsToJSONTyped, BlobApiResponse, type Boxscore, BoxscoreFromJSON, BoxscoreFromJSONTyped, type BoxscoreTeam, BoxscoreTeamFromJSON, BoxscoreTeamFromJSONTyped, BoxscoreTeamToJSON, BoxscoreTeamToJSONTyped, type BoxscoreTeams, BoxscoreTeamsFromJSON, BoxscoreTeamsFromJSONTyped, BoxscoreTeamsToJSON, BoxscoreTeamsToJSONTyped, BoxscoreToJSON, BoxscoreToJSONTyped, COLLECTION_FORMATS, Configuration, type ConfigurationParameters, type Consume, DefaultConfig, type Division, DivisionFromJSON, DivisionFromJSONTyped, type DivisionStandings, DivisionStandingsFromJSON, DivisionStandingsFromJSONTyped, type DivisionStandingsList, DivisionStandingsListFromJSON, DivisionStandingsListFromJSONTyped, DivisionStandingsListToJSON, DivisionStandingsListToJSONTyped, DivisionStandingsToJSON, DivisionStandingsToJSONTyped, DivisionToJSON, DivisionToJSONTyped, type ErrorContext, type FetchAPI, FetchError, type FetchParams, type FieldingStats, FieldingStatsFromJSON, FieldingStatsFromJSONTyped, FieldingStatsToJSON, FieldingStatsToJSONTyped, type Game, GameFromJSON, GameFromJSONTyped, type GameOfficial, GameOfficialFromJSON, GameOfficialFromJSONTyped, GameOfficialToJSON, GameOfficialToJSONTyped, type GameStatus, GameStatusCode, GameStatusCodeFromJSON, GameStatusCodeFromJSONTyped, GameStatusCodeToJSON, GameStatusCodeToJSONTyped, GameStatusFromJSON, GameStatusFromJSONTyped, GameStatusToJSON, GameStatusToJSONTyped, type GameTeam, GameTeamFromJSON, GameTeamFromJSONTyped, GameTeamToJSON, GameTeamToJSONTyped, type GameTeams, GameTeamsFromJSON, GameTeamsFromJSONTyped, GameTeamsToJSON, GameTeamsToJSONTyped, GameToJSON, GameToJSONTyped, GameType, GameTypeFromJSON, GameTypeFromJSONTyped, GameTypeToJSON, GameTypeToJSONTyped, type GetAllSeasonsRequest, type GetBoxscoreRequest, type GetLinescoreRequest, type GetScheduleRequest, type GetSeasonRequest, type GetStandingsRequest, type GetTeamsRequest, type HTTPBody, type HTTPHeaders, type HTTPMethod, type HTTPQuery, type HTTPRequestInit, type InitOverrideFunction, type Inning, InningFromJSON, InningFromJSONTyped, InningToJSON, InningToJSONTyped, JSONApiResponse, type Json, type League, type LeagueDates, LeagueDatesFromJSON, LeagueDatesFromJSONTyped, LeagueDatesToJSON, LeagueDatesToJSONTyped, LeagueFromJSON, LeagueFromJSONTyped, type LeagueRecord, LeagueRecordFromJSON, LeagueRecordFromJSONTyped, LeagueRecordToJSON, LeagueRecordToJSONTyped, LeagueToJSON, LeagueToJSONTyped, type Linescore, LinescoreFromJSON, LinescoreFromJSONTyped, type LinescoreTeam, LinescoreTeamFromJSON, LinescoreTeamFromJSONTyped, LinescoreTeamToJSON, LinescoreTeamToJSONTyped, type LinescoreTeams, LinescoreTeamsFromJSON, LinescoreTeamsFromJSONTyped, LinescoreTeamsToJSON, LinescoreTeamsToJSONTyped, LinescoreToJSON, LinescoreToJSONTyped, type Middleware, MlbApi, type ModelPropertyNaming, type Official, OfficialFromJSON, OfficialFromJSONTyped, OfficialToJSON, OfficialToJSONTyped, type PitchingStats, PitchingStatsFromJSON, PitchingStatsFromJSONTyped, PitchingStatsToJSON, PitchingStatsToJSONTyped, type Player, PlayerFromJSON, PlayerFromJSONTyped, type PlayerGameStatus, PlayerGameStatusFromJSON, PlayerGameStatusFromJSONTyped, PlayerGameStatusToJSON, PlayerGameStatusToJSONTyped, type PlayerPerson, PlayerPersonFromJSON, PlayerPersonFromJSONTyped, PlayerPersonToJSON, PlayerPersonToJSONTyped, type PlayerPosition, PlayerPositionFromJSON, PlayerPositionFromJSONTyped, PlayerPositionToJSON, PlayerPositionToJSONTyped, type PlayerSeasonStats, PlayerSeasonStatsFromJSON, PlayerSeasonStatsFromJSONTyped, PlayerSeasonStatsToJSON, PlayerSeasonStatsToJSONTyped, type PlayerStats, PlayerStatsFromJSON, PlayerStatsFromJSONTyped, PlayerStatsToJSON, PlayerStatsToJSONTyped, type PlayerStatus, PlayerStatusFromJSON, PlayerStatusFromJSONTyped, PlayerStatusToJSON, PlayerStatusToJSONTyped, PlayerToJSON, PlayerToJSONTyped, type Position, PositionFromJSON, PositionFromJSONTyped, PositionToJSON, PositionToJSONTyped, type Record, RecordFromJSON, RecordFromJSONTyped, RecordToJSON, RecordToJSONTyped, type RequestContext, type RequestOpts, RequiredError, type ResponseContext, ResponseError, type ResponseTransformer, type Schedule, type ScheduleDay, ScheduleDayFromJSON, ScheduleDayFromJSONTyped, ScheduleDayToJSON, ScheduleDayToJSONTyped, ScheduleFromJSON, ScheduleFromJSONTyped, ScheduleToJSON, ScheduleToJSONTyped, type Season, SeasonFromJSON, SeasonFromJSONTyped, SeasonToJSON, SeasonToJSONTyped, type Seasons, SeasonsFromJSON, SeasonsFromJSONTyped, SeasonsToJSON, SeasonsToJSONTyped, type Sport, SportFromJSON, SportFromJSONTyped, SportToJSON, SportToJSONTyped, type Streak, StreakFromJSON, StreakFromJSONTyped, StreakStreakTypeEnum, StreakToJSON, StreakToJSONTyped, type Team, TeamFromJSON, TeamFromJSONTyped, type TeamStats, TeamStatsFromJSON, TeamStatsFromJSONTyped, TeamStatsToJSON, TeamStatsToJSONTyped, TeamToJSON, TeamToJSONTyped, type Teams, TeamsFromJSON, TeamsFromJSONTyped, TeamsToJSON, TeamsToJSONTyped, TextApiResponse, type Venue, VenueFromJSON, VenueFromJSONTyped, VenueToJSON, VenueToJSONTyped, VoidApiResponse, canConsumeForm, exists, instanceOfBattingStats, instanceOfBoxscore, instanceOfBoxscoreTeam, instanceOfBoxscoreTeams, instanceOfDivision, instanceOfDivisionStandings, instanceOfDivisionStandingsList, instanceOfFieldingStats, instanceOfGame, instanceOfGameOfficial, instanceOfGameStatus, instanceOfGameStatusCode, instanceOfGameTeam, instanceOfGameTeams, instanceOfGameType, instanceOfInning, instanceOfLeague, instanceOfLeagueDates, instanceOfLeagueRecord, instanceOfLinescore, instanceOfLinescoreTeam, instanceOfLinescoreTeams, instanceOfOfficial, instanceOfPitchingStats, instanceOfPlayer, instanceOfPlayerGameStatus, instanceOfPlayerPerson, instanceOfPlayerPosition, instanceOfPlayerSeasonStats, instanceOfPlayerStats, instanceOfPlayerStatus, instanceOfPosition, instanceOfRecord, instanceOfSchedule, instanceOfScheduleDay, instanceOfSeason, instanceOfSeasons, instanceOfSport, instanceOfStreak, instanceOfTeam, instanceOfTeamStats, instanceOfTeams, instanceOfVenue, mapValues, querystring };
969
+ export { type ApiResponse, BASE_PATH, BaseAPI, type BattingStats, BattingStatsFromJSON, BattingStatsFromJSONTyped, BattingStatsToJSON, BattingStatsToJSONTyped, BlobApiResponse, type Boxscore, BoxscoreFromJSON, BoxscoreFromJSONTyped, type BoxscoreTeam, BoxscoreTeamFromJSON, BoxscoreTeamFromJSONTyped, BoxscoreTeamToJSON, BoxscoreTeamToJSONTyped, type BoxscoreTeams, BoxscoreTeamsFromJSON, BoxscoreTeamsFromJSONTyped, BoxscoreTeamsToJSON, BoxscoreTeamsToJSONTyped, BoxscoreToJSON, BoxscoreToJSONTyped, COLLECTION_FORMATS, Configuration, type ConfigurationParameters, type Consume, DefaultConfig, type Division, DivisionFromJSON, DivisionFromJSONTyped, type DivisionStandings, DivisionStandingsFromJSON, DivisionStandingsFromJSONTyped, type DivisionStandingsList, DivisionStandingsListFromJSON, DivisionStandingsListFromJSONTyped, DivisionStandingsListToJSON, DivisionStandingsListToJSONTyped, DivisionStandingsToJSON, DivisionStandingsToJSONTyped, DivisionToJSON, DivisionToJSONTyped, type Divisions, DivisionsFromJSON, DivisionsFromJSONTyped, DivisionsToJSON, DivisionsToJSONTyped, type ErrorContext, type FetchAPI, FetchError, type FetchParams, type FieldingStats, FieldingStatsFromJSON, FieldingStatsFromJSONTyped, FieldingStatsToJSON, FieldingStatsToJSONTyped, type Game, GameFromJSON, GameFromJSONTyped, type GameOfficial, GameOfficialFromJSON, GameOfficialFromJSONTyped, GameOfficialToJSON, GameOfficialToJSONTyped, type GameStatus, GameStatusCode, GameStatusCodeFromJSON, GameStatusCodeFromJSONTyped, GameStatusCodeToJSON, GameStatusCodeToJSONTyped, GameStatusFromJSON, GameStatusFromJSONTyped, GameStatusToJSON, GameStatusToJSONTyped, type GameTeam, GameTeamFromJSON, GameTeamFromJSONTyped, GameTeamToJSON, GameTeamToJSONTyped, type GameTeams, GameTeamsFromJSON, GameTeamsFromJSONTyped, GameTeamsToJSON, GameTeamsToJSONTyped, GameToJSON, GameToJSONTyped, GameType, GameTypeFromJSON, GameTypeFromJSONTyped, GameTypeToJSON, GameTypeToJSONTyped, type GetAllSeasonsRequest, type GetBoxscoreRequest, type GetDivisionsRequest, type GetLeaguesRequest, type GetLinescoreRequest, type GetScheduleRequest, type GetSeasonRequest, type GetStandingsRequest, type GetTeamsRequest, type HTTPBody, type HTTPHeaders, type HTTPMethod, type HTTPQuery, type HTTPRequestInit, type InitOverrideFunction, type Inning, InningFromJSON, InningFromJSONTyped, InningToJSON, InningToJSONTyped, JSONApiResponse, type Json, type League, type LeagueDates, LeagueDatesFromJSON, LeagueDatesFromJSONTyped, LeagueDatesToJSON, LeagueDatesToJSONTyped, LeagueFromJSON, LeagueFromJSONTyped, type LeagueRecord, LeagueRecordFromJSON, LeagueRecordFromJSONTyped, LeagueRecordToJSON, LeagueRecordToJSONTyped, LeagueToJSON, LeagueToJSONTyped, type Leagues, LeaguesFromJSON, LeaguesFromJSONTyped, LeaguesToJSON, LeaguesToJSONTyped, type Linescore, LinescoreFromJSON, LinescoreFromJSONTyped, type LinescoreTeam, LinescoreTeamFromJSON, LinescoreTeamFromJSONTyped, LinescoreTeamToJSON, LinescoreTeamToJSONTyped, type LinescoreTeams, LinescoreTeamsFromJSON, LinescoreTeamsFromJSONTyped, LinescoreTeamsToJSON, LinescoreTeamsToJSONTyped, LinescoreToJSON, LinescoreToJSONTyped, type Middleware, MlbApi, type ModelPropertyNaming, type Official, OfficialFromJSON, OfficialFromJSONTyped, OfficialToJSON, OfficialToJSONTyped, type PitchingStats, PitchingStatsFromJSON, PitchingStatsFromJSONTyped, PitchingStatsToJSON, PitchingStatsToJSONTyped, type Player, PlayerFromJSON, PlayerFromJSONTyped, type PlayerGameStatus, PlayerGameStatusFromJSON, PlayerGameStatusFromJSONTyped, PlayerGameStatusToJSON, PlayerGameStatusToJSONTyped, type PlayerPerson, PlayerPersonFromJSON, PlayerPersonFromJSONTyped, PlayerPersonToJSON, PlayerPersonToJSONTyped, type PlayerPosition, PlayerPositionFromJSON, PlayerPositionFromJSONTyped, PlayerPositionToJSON, PlayerPositionToJSONTyped, type PlayerSeasonStats, PlayerSeasonStatsFromJSON, PlayerSeasonStatsFromJSONTyped, PlayerSeasonStatsToJSON, PlayerSeasonStatsToJSONTyped, type PlayerStats, PlayerStatsFromJSON, PlayerStatsFromJSONTyped, PlayerStatsToJSON, PlayerStatsToJSONTyped, type PlayerStatus, PlayerStatusFromJSON, PlayerStatusFromJSONTyped, PlayerStatusToJSON, PlayerStatusToJSONTyped, PlayerToJSON, PlayerToJSONTyped, type Position, PositionFromJSON, PositionFromJSONTyped, PositionToJSON, PositionToJSONTyped, type Record, RecordFromJSON, RecordFromJSONTyped, RecordToJSON, RecordToJSONTyped, type RequestContext, type RequestOpts, RequiredError, type ResponseContext, ResponseError, type ResponseTransformer, type Schedule, type ScheduleDay, ScheduleDayFromJSON, ScheduleDayFromJSONTyped, ScheduleDayToJSON, ScheduleDayToJSONTyped, ScheduleFromJSON, ScheduleFromJSONTyped, ScheduleToJSON, ScheduleToJSONTyped, type Season, SeasonFromJSON, SeasonFromJSONTyped, SeasonToJSON, SeasonToJSONTyped, type Seasons, SeasonsFromJSON, SeasonsFromJSONTyped, SeasonsToJSON, SeasonsToJSONTyped, type Sport, SportFromJSON, SportFromJSONTyped, SportToJSON, SportToJSONTyped, type Streak, StreakFromJSON, StreakFromJSONTyped, StreakStreakTypeEnum, StreakToJSON, StreakToJSONTyped, type Team, TeamFromJSON, TeamFromJSONTyped, type TeamStats, TeamStatsFromJSON, TeamStatsFromJSONTyped, TeamStatsToJSON, TeamStatsToJSONTyped, TeamToJSON, TeamToJSONTyped, type Teams, TeamsFromJSON, TeamsFromJSONTyped, TeamsToJSON, TeamsToJSONTyped, TextApiResponse, type Venue, VenueFromJSON, VenueFromJSONTyped, VenueToJSON, VenueToJSONTyped, VoidApiResponse, canConsumeForm, exists, instanceOfBattingStats, instanceOfBoxscore, instanceOfBoxscoreTeam, instanceOfBoxscoreTeams, instanceOfDivision, instanceOfDivisionStandings, instanceOfDivisionStandingsList, instanceOfDivisions, instanceOfFieldingStats, instanceOfGame, instanceOfGameOfficial, instanceOfGameStatus, instanceOfGameStatusCode, instanceOfGameTeam, instanceOfGameTeams, instanceOfGameType, instanceOfInning, instanceOfLeague, instanceOfLeagueDates, instanceOfLeagueRecord, instanceOfLeagues, instanceOfLinescore, instanceOfLinescoreTeam, instanceOfLinescoreTeams, instanceOfOfficial, instanceOfPitchingStats, instanceOfPlayer, instanceOfPlayerGameStatus, instanceOfPlayerPerson, instanceOfPlayerPosition, instanceOfPlayerSeasonStats, instanceOfPlayerStats, instanceOfPlayerStatus, instanceOfPosition, instanceOfRecord, instanceOfSchedule, instanceOfScheduleDay, instanceOfSeason, instanceOfSeasons, instanceOfSport, instanceOfStreak, instanceOfTeam, instanceOfTeamStats, instanceOfTeams, instanceOfVenue, mapValues, querystring };
package/dist/index.js CHANGED
@@ -91,6 +91,10 @@ __export(index_exports, {
91
91
  DivisionStandingsToJSONTyped: () => DivisionStandingsToJSONTyped,
92
92
  DivisionToJSON: () => DivisionToJSON,
93
93
  DivisionToJSONTyped: () => DivisionToJSONTyped,
94
+ DivisionsFromJSON: () => DivisionsFromJSON,
95
+ DivisionsFromJSONTyped: () => DivisionsFromJSONTyped,
96
+ DivisionsToJSON: () => DivisionsToJSON,
97
+ DivisionsToJSONTyped: () => DivisionsToJSONTyped,
94
98
  FetchError: () => FetchError,
95
99
  FieldingStatsFromJSON: () => FieldingStatsFromJSON,
96
100
  FieldingStatsFromJSONTyped: () => FieldingStatsFromJSONTyped,
@@ -143,6 +147,10 @@ __export(index_exports, {
143
147
  LeagueRecordToJSONTyped: () => LeagueRecordToJSONTyped,
144
148
  LeagueToJSON: () => LeagueToJSON,
145
149
  LeagueToJSONTyped: () => LeagueToJSONTyped,
150
+ LeaguesFromJSON: () => LeaguesFromJSON,
151
+ LeaguesFromJSONTyped: () => LeaguesFromJSONTyped,
152
+ LeaguesToJSON: () => LeaguesToJSON,
153
+ LeaguesToJSONTyped: () => LeaguesToJSONTyped,
146
154
  LinescoreFromJSON: () => LinescoreFromJSON,
147
155
  LinescoreFromJSONTyped: () => LinescoreFromJSONTyped,
148
156
  LinescoreTeamFromJSON: () => LinescoreTeamFromJSON,
@@ -254,6 +262,7 @@ __export(index_exports, {
254
262
  instanceOfDivision: () => instanceOfDivision,
255
263
  instanceOfDivisionStandings: () => instanceOfDivisionStandings,
256
264
  instanceOfDivisionStandingsList: () => instanceOfDivisionStandingsList,
265
+ instanceOfDivisions: () => instanceOfDivisions,
257
266
  instanceOfFieldingStats: () => instanceOfFieldingStats,
258
267
  instanceOfGame: () => instanceOfGame,
259
268
  instanceOfGameOfficial: () => instanceOfGameOfficial,
@@ -266,6 +275,7 @@ __export(index_exports, {
266
275
  instanceOfLeague: () => instanceOfLeague,
267
276
  instanceOfLeagueDates: () => instanceOfLeagueDates,
268
277
  instanceOfLeagueRecord: () => instanceOfLeagueRecord,
278
+ instanceOfLeagues: () => instanceOfLeagues,
269
279
  instanceOfLinescore: () => instanceOfLinescore,
270
280
  instanceOfLinescoreTeam: () => instanceOfLinescoreTeam,
271
281
  instanceOfLinescoreTeams: () => instanceOfLinescoreTeams,
@@ -541,10 +551,11 @@ function exists(json, key) {
541
551
  return value !== null && value !== void 0;
542
552
  }
543
553
  function mapValues(data, fn) {
544
- return Object.keys(data).reduce(
545
- (acc, key) => __spreadProps(__spreadValues({}, acc), { [key]: fn(data[key]) }),
546
- {}
547
- );
554
+ const result = {};
555
+ for (const key of Object.keys(data)) {
556
+ result[key] = fn(data[key]);
557
+ }
558
+ return result;
548
559
  }
549
560
  function canConsumeForm(consumes) {
550
561
  for (const consume of consumes) {
@@ -1841,6 +1852,7 @@ function DivisionStandingsToJSONTyped(value, ignoreDiscriminator = false) {
1841
1852
 
1842
1853
  // src/models/DivisionStandingsList.ts
1843
1854
  function instanceOfDivisionStandingsList(value) {
1855
+ if (!("records" in value) || value["records"] === void 0) return false;
1844
1856
  return true;
1845
1857
  }
1846
1858
  function DivisionStandingsListFromJSON(json) {
@@ -1851,7 +1863,7 @@ function DivisionStandingsListFromJSONTyped(json, ignoreDiscriminator) {
1851
1863
  return json;
1852
1864
  }
1853
1865
  return {
1854
- "records": json["records"] == null ? void 0 : json["records"].map(DivisionStandingsFromJSON)
1866
+ "records": json["records"].map(DivisionStandingsFromJSON)
1855
1867
  };
1856
1868
  }
1857
1869
  function DivisionStandingsListToJSON(json) {
@@ -1862,7 +1874,35 @@ function DivisionStandingsListToJSONTyped(value, ignoreDiscriminator = false) {
1862
1874
  return value;
1863
1875
  }
1864
1876
  return {
1865
- "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)
1866
1906
  };
1867
1907
  }
1868
1908
 
@@ -2146,6 +2186,10 @@ function GameToJSONTyped(value, ignoreDiscriminator = false) {
2146
2186
 
2147
2187
  // src/models/LinescoreTeam.ts
2148
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;
2149
2193
  return true;
2150
2194
  }
2151
2195
  function LinescoreTeamFromJSON(json) {
@@ -2156,10 +2200,10 @@ function LinescoreTeamFromJSONTyped(json, ignoreDiscriminator) {
2156
2200
  return json;
2157
2201
  }
2158
2202
  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"]
2203
+ "runs": json["runs"],
2204
+ "hits": json["hits"],
2205
+ "errors": json["errors"],
2206
+ "leftOnBase": json["leftOnBase"]
2163
2207
  };
2164
2208
  }
2165
2209
  function LinescoreTeamToJSON(json) {
@@ -2179,6 +2223,10 @@ function LinescoreTeamToJSONTyped(value, ignoreDiscriminator = false) {
2179
2223
 
2180
2224
  // src/models/Inning.ts
2181
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;
2182
2230
  return true;
2183
2231
  }
2184
2232
  function InningFromJSON(json) {
@@ -2189,10 +2237,10 @@ function InningFromJSONTyped(json, ignoreDiscriminator) {
2189
2237
  return json;
2190
2238
  }
2191
2239
  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"])
2240
+ "num": json["num"],
2241
+ "ordinalNum": json["ordinalNum"],
2242
+ "home": LinescoreTeamFromJSON(json["home"]),
2243
+ "away": LinescoreTeamFromJSON(json["away"])
2196
2244
  };
2197
2245
  }
2198
2246
  function InningToJSON(json) {
@@ -2210,8 +2258,38 @@ function InningToJSONTyped(value, ignoreDiscriminator = false) {
2210
2258
  };
2211
2259
  }
2212
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
+
2213
2289
  // src/models/LinescoreTeams.ts
2214
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;
2215
2293
  return true;
2216
2294
  }
2217
2295
  function LinescoreTeamsFromJSON(json) {
@@ -2222,8 +2300,8 @@ function LinescoreTeamsFromJSONTyped(json, ignoreDiscriminator) {
2222
2300
  return json;
2223
2301
  }
2224
2302
  return {
2225
- "away": json["away"] == null ? void 0 : LinescoreTeamFromJSON(json["away"]),
2226
- "home": json["home"] == null ? void 0 : LinescoreTeamFromJSON(json["home"])
2303
+ "away": LinescoreTeamFromJSON(json["away"]),
2304
+ "home": LinescoreTeamFromJSON(json["home"])
2227
2305
  };
2228
2306
  }
2229
2307
  function LinescoreTeamsToJSON(json) {
@@ -2241,6 +2319,10 @@ function LinescoreTeamsToJSONTyped(value, ignoreDiscriminator = false) {
2241
2319
 
2242
2320
  // src/models/Linescore.ts
2243
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;
2244
2326
  return true;
2245
2327
  }
2246
2328
  function LinescoreFromJSON(json) {
@@ -2258,10 +2340,10 @@ function LinescoreFromJSONTyped(json, ignoreDiscriminator) {
2258
2340
  "isTopInning": json["isTopInning"] == null ? void 0 : json["isTopInning"],
2259
2341
  "scheduledInnings": json["scheduledInnings"] == null ? void 0 : json["scheduledInnings"],
2260
2342
  "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"]
2343
+ "teams": LinescoreTeamsFromJSON(json["teams"]),
2344
+ "balls": json["balls"],
2345
+ "strikes": json["strikes"],
2346
+ "outs": json["outs"]
2265
2347
  };
2266
2348
  }
2267
2349
  function LinescoreToJSON(json) {
@@ -2438,6 +2520,7 @@ function SeasonToJSONTyped(value, ignoreDiscriminator = false) {
2438
2520
 
2439
2521
  // src/models/Seasons.ts
2440
2522
  function instanceOfSeasons(value) {
2523
+ if (!("seasons" in value) || value["seasons"] === void 0) return false;
2441
2524
  return true;
2442
2525
  }
2443
2526
  function SeasonsFromJSON(json) {
@@ -2448,7 +2531,7 @@ function SeasonsFromJSONTyped(json, ignoreDiscriminator) {
2448
2531
  return json;
2449
2532
  }
2450
2533
  return {
2451
- "seasons": json["seasons"] == null ? void 0 : json["seasons"].map(SeasonFromJSON)
2534
+ "seasons": json["seasons"].map(SeasonFromJSON)
2452
2535
  };
2453
2536
  }
2454
2537
  function SeasonsToJSON(json) {
@@ -2459,12 +2542,13 @@ function SeasonsToJSONTyped(value, ignoreDiscriminator = false) {
2459
2542
  return value;
2460
2543
  }
2461
2544
  return {
2462
- "seasons": value["seasons"] == null ? void 0 : value["seasons"].map(SeasonToJSON)
2545
+ "seasons": value["seasons"].map(SeasonToJSON)
2463
2546
  };
2464
2547
  }
2465
2548
 
2466
2549
  // src/models/Teams.ts
2467
2550
  function instanceOfTeams(value) {
2551
+ if (!("teams" in value) || value["teams"] === void 0) return false;
2468
2552
  return true;
2469
2553
  }
2470
2554
  function TeamsFromJSON(json) {
@@ -2475,7 +2559,7 @@ function TeamsFromJSONTyped(json, ignoreDiscriminator) {
2475
2559
  return json;
2476
2560
  }
2477
2561
  return {
2478
- "teams": json["teams"] == null ? void 0 : json["teams"].map(TeamFromJSON)
2562
+ "teams": json["teams"].map(TeamFromJSON)
2479
2563
  };
2480
2564
  }
2481
2565
  function TeamsToJSON(json) {
@@ -2486,7 +2570,7 @@ function TeamsToJSONTyped(value, ignoreDiscriminator = false) {
2486
2570
  return value;
2487
2571
  }
2488
2572
  return {
2489
- "teams": value["teams"] == null ? void 0 : value["teams"].map(TeamToJSON)
2573
+ "teams": value["teams"].map(TeamToJSON)
2490
2574
  };
2491
2575
  }
2492
2576
 
@@ -2542,7 +2626,7 @@ var MlbApi = class extends BaseAPI {
2542
2626
  }
2543
2627
  const queryParameters = {};
2544
2628
  if (requestParameters["fields"] != null) {
2545
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2629
+ queryParameters["fields"] = requestParameters["fields"];
2546
2630
  }
2547
2631
  const headerParameters = {};
2548
2632
  const response = yield this.request({
@@ -2564,6 +2648,96 @@ var MlbApi = class extends BaseAPI {
2564
2648
  return yield response.value();
2565
2649
  });
2566
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
+ }
2567
2741
  /**
2568
2742
  * Returns Linescore
2569
2743
  * Retrieves linescore
@@ -2578,7 +2752,7 @@ var MlbApi = class extends BaseAPI {
2578
2752
  }
2579
2753
  const queryParameters = {};
2580
2754
  if (requestParameters["fields"] != null) {
2581
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2755
+ queryParameters["fields"] = requestParameters["fields"];
2582
2756
  }
2583
2757
  const headerParameters = {};
2584
2758
  const response = yield this.request({
@@ -2613,6 +2787,9 @@ var MlbApi = class extends BaseAPI {
2613
2787
  );
2614
2788
  }
2615
2789
  const queryParameters = {};
2790
+ if (requestParameters["gamePk"] != null) {
2791
+ queryParameters["gamePk"] = requestParameters["gamePk"];
2792
+ }
2616
2793
  if (requestParameters["sportId"] != null) {
2617
2794
  queryParameters["sportId"] = requestParameters["sportId"];
2618
2795
  }
@@ -2629,7 +2806,7 @@ var MlbApi = class extends BaseAPI {
2629
2806
  queryParameters["endDate"] = requestParameters["endDate"];
2630
2807
  }
2631
2808
  if (requestParameters["fields"] != null) {
2632
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2809
+ queryParameters["fields"] = requestParameters["fields"];
2633
2810
  }
2634
2811
  if (requestParameters["hydrate"] != null) {
2635
2812
  queryParameters["hydrate"] = requestParameters["hydrate"];
@@ -2731,7 +2908,7 @@ var MlbApi = class extends BaseAPI {
2731
2908
  queryParameters["date"] = requestParameters["date"];
2732
2909
  }
2733
2910
  if (requestParameters["fields"] != null) {
2734
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2911
+ queryParameters["fields"] = requestParameters["fields"];
2735
2912
  }
2736
2913
  if (requestParameters["hydrate"] != null) {
2737
2914
  queryParameters["hydrate"] = requestParameters["hydrate"];
@@ -2784,6 +2961,12 @@ var MlbApi = class extends BaseAPI {
2784
2961
  if (requestParameters["leagueIds"] != null) {
2785
2962
  queryParameters["leagueIds"] = requestParameters["leagueIds"];
2786
2963
  }
2964
+ if (requestParameters["fields"] != null) {
2965
+ queryParameters["fields"] = requestParameters["fields"];
2966
+ }
2967
+ if (requestParameters["hydrate"] != null) {
2968
+ queryParameters["hydrate"] = requestParameters["hydrate"];
2969
+ }
2787
2970
  const headerParameters = {};
2788
2971
  const response = yield this.request({
2789
2972
  path: `/v1/teams`,
@@ -2841,6 +3024,10 @@ var MlbApi = class extends BaseAPI {
2841
3024
  DivisionStandingsToJSONTyped,
2842
3025
  DivisionToJSON,
2843
3026
  DivisionToJSONTyped,
3027
+ DivisionsFromJSON,
3028
+ DivisionsFromJSONTyped,
3029
+ DivisionsToJSON,
3030
+ DivisionsToJSONTyped,
2844
3031
  FetchError,
2845
3032
  FieldingStatsFromJSON,
2846
3033
  FieldingStatsFromJSONTyped,
@@ -2893,6 +3080,10 @@ var MlbApi = class extends BaseAPI {
2893
3080
  LeagueRecordToJSONTyped,
2894
3081
  LeagueToJSON,
2895
3082
  LeagueToJSONTyped,
3083
+ LeaguesFromJSON,
3084
+ LeaguesFromJSONTyped,
3085
+ LeaguesToJSON,
3086
+ LeaguesToJSONTyped,
2896
3087
  LinescoreFromJSON,
2897
3088
  LinescoreFromJSONTyped,
2898
3089
  LinescoreTeamFromJSON,
@@ -3004,6 +3195,7 @@ var MlbApi = class extends BaseAPI {
3004
3195
  instanceOfDivision,
3005
3196
  instanceOfDivisionStandings,
3006
3197
  instanceOfDivisionStandingsList,
3198
+ instanceOfDivisions,
3007
3199
  instanceOfFieldingStats,
3008
3200
  instanceOfGame,
3009
3201
  instanceOfGameOfficial,
@@ -3016,6 +3208,7 @@ var MlbApi = class extends BaseAPI {
3016
3208
  instanceOfLeague,
3017
3209
  instanceOfLeagueDates,
3018
3210
  instanceOfLeagueRecord,
3211
+ instanceOfLeagues,
3019
3212
  instanceOfLinescore,
3020
3213
  instanceOfLinescoreTeam,
3021
3214
  instanceOfLinescoreTeams,
package/dist/index.mjs CHANGED
@@ -284,10 +284,11 @@ function exists(json, key) {
284
284
  return value !== null && value !== void 0;
285
285
  }
286
286
  function mapValues(data, fn) {
287
- return Object.keys(data).reduce(
288
- (acc, key) => __spreadProps(__spreadValues({}, acc), { [key]: fn(data[key]) }),
289
- {}
290
- );
287
+ const result = {};
288
+ for (const key of Object.keys(data)) {
289
+ result[key] = fn(data[key]);
290
+ }
291
+ return result;
291
292
  }
292
293
  function canConsumeForm(consumes) {
293
294
  for (const consume of consumes) {
@@ -1584,6 +1585,7 @@ function DivisionStandingsToJSONTyped(value, ignoreDiscriminator = false) {
1584
1585
 
1585
1586
  // src/models/DivisionStandingsList.ts
1586
1587
  function instanceOfDivisionStandingsList(value) {
1588
+ if (!("records" in value) || value["records"] === void 0) return false;
1587
1589
  return true;
1588
1590
  }
1589
1591
  function DivisionStandingsListFromJSON(json) {
@@ -1594,7 +1596,7 @@ function DivisionStandingsListFromJSONTyped(json, ignoreDiscriminator) {
1594
1596
  return json;
1595
1597
  }
1596
1598
  return {
1597
- "records": json["records"] == null ? void 0 : json["records"].map(DivisionStandingsFromJSON)
1599
+ "records": json["records"].map(DivisionStandingsFromJSON)
1598
1600
  };
1599
1601
  }
1600
1602
  function DivisionStandingsListToJSON(json) {
@@ -1605,7 +1607,35 @@ function DivisionStandingsListToJSONTyped(value, ignoreDiscriminator = false) {
1605
1607
  return value;
1606
1608
  }
1607
1609
  return {
1608
- "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)
1609
1639
  };
1610
1640
  }
1611
1641
 
@@ -1889,6 +1919,10 @@ function GameToJSONTyped(value, ignoreDiscriminator = false) {
1889
1919
 
1890
1920
  // src/models/LinescoreTeam.ts
1891
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;
1892
1926
  return true;
1893
1927
  }
1894
1928
  function LinescoreTeamFromJSON(json) {
@@ -1899,10 +1933,10 @@ function LinescoreTeamFromJSONTyped(json, ignoreDiscriminator) {
1899
1933
  return json;
1900
1934
  }
1901
1935
  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"]
1936
+ "runs": json["runs"],
1937
+ "hits": json["hits"],
1938
+ "errors": json["errors"],
1939
+ "leftOnBase": json["leftOnBase"]
1906
1940
  };
1907
1941
  }
1908
1942
  function LinescoreTeamToJSON(json) {
@@ -1922,6 +1956,10 @@ function LinescoreTeamToJSONTyped(value, ignoreDiscriminator = false) {
1922
1956
 
1923
1957
  // src/models/Inning.ts
1924
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;
1925
1963
  return true;
1926
1964
  }
1927
1965
  function InningFromJSON(json) {
@@ -1932,10 +1970,10 @@ function InningFromJSONTyped(json, ignoreDiscriminator) {
1932
1970
  return json;
1933
1971
  }
1934
1972
  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"])
1973
+ "num": json["num"],
1974
+ "ordinalNum": json["ordinalNum"],
1975
+ "home": LinescoreTeamFromJSON(json["home"]),
1976
+ "away": LinescoreTeamFromJSON(json["away"])
1939
1977
  };
1940
1978
  }
1941
1979
  function InningToJSON(json) {
@@ -1953,8 +1991,38 @@ function InningToJSONTyped(value, ignoreDiscriminator = false) {
1953
1991
  };
1954
1992
  }
1955
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
+
1956
2022
  // src/models/LinescoreTeams.ts
1957
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;
1958
2026
  return true;
1959
2027
  }
1960
2028
  function LinescoreTeamsFromJSON(json) {
@@ -1965,8 +2033,8 @@ function LinescoreTeamsFromJSONTyped(json, ignoreDiscriminator) {
1965
2033
  return json;
1966
2034
  }
1967
2035
  return {
1968
- "away": json["away"] == null ? void 0 : LinescoreTeamFromJSON(json["away"]),
1969
- "home": json["home"] == null ? void 0 : LinescoreTeamFromJSON(json["home"])
2036
+ "away": LinescoreTeamFromJSON(json["away"]),
2037
+ "home": LinescoreTeamFromJSON(json["home"])
1970
2038
  };
1971
2039
  }
1972
2040
  function LinescoreTeamsToJSON(json) {
@@ -1984,6 +2052,10 @@ function LinescoreTeamsToJSONTyped(value, ignoreDiscriminator = false) {
1984
2052
 
1985
2053
  // src/models/Linescore.ts
1986
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;
1987
2059
  return true;
1988
2060
  }
1989
2061
  function LinescoreFromJSON(json) {
@@ -2001,10 +2073,10 @@ function LinescoreFromJSONTyped(json, ignoreDiscriminator) {
2001
2073
  "isTopInning": json["isTopInning"] == null ? void 0 : json["isTopInning"],
2002
2074
  "scheduledInnings": json["scheduledInnings"] == null ? void 0 : json["scheduledInnings"],
2003
2075
  "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"]
2076
+ "teams": LinescoreTeamsFromJSON(json["teams"]),
2077
+ "balls": json["balls"],
2078
+ "strikes": json["strikes"],
2079
+ "outs": json["outs"]
2008
2080
  };
2009
2081
  }
2010
2082
  function LinescoreToJSON(json) {
@@ -2181,6 +2253,7 @@ function SeasonToJSONTyped(value, ignoreDiscriminator = false) {
2181
2253
 
2182
2254
  // src/models/Seasons.ts
2183
2255
  function instanceOfSeasons(value) {
2256
+ if (!("seasons" in value) || value["seasons"] === void 0) return false;
2184
2257
  return true;
2185
2258
  }
2186
2259
  function SeasonsFromJSON(json) {
@@ -2191,7 +2264,7 @@ function SeasonsFromJSONTyped(json, ignoreDiscriminator) {
2191
2264
  return json;
2192
2265
  }
2193
2266
  return {
2194
- "seasons": json["seasons"] == null ? void 0 : json["seasons"].map(SeasonFromJSON)
2267
+ "seasons": json["seasons"].map(SeasonFromJSON)
2195
2268
  };
2196
2269
  }
2197
2270
  function SeasonsToJSON(json) {
@@ -2202,12 +2275,13 @@ function SeasonsToJSONTyped(value, ignoreDiscriminator = false) {
2202
2275
  return value;
2203
2276
  }
2204
2277
  return {
2205
- "seasons": value["seasons"] == null ? void 0 : value["seasons"].map(SeasonToJSON)
2278
+ "seasons": value["seasons"].map(SeasonToJSON)
2206
2279
  };
2207
2280
  }
2208
2281
 
2209
2282
  // src/models/Teams.ts
2210
2283
  function instanceOfTeams(value) {
2284
+ if (!("teams" in value) || value["teams"] === void 0) return false;
2211
2285
  return true;
2212
2286
  }
2213
2287
  function TeamsFromJSON(json) {
@@ -2218,7 +2292,7 @@ function TeamsFromJSONTyped(json, ignoreDiscriminator) {
2218
2292
  return json;
2219
2293
  }
2220
2294
  return {
2221
- "teams": json["teams"] == null ? void 0 : json["teams"].map(TeamFromJSON)
2295
+ "teams": json["teams"].map(TeamFromJSON)
2222
2296
  };
2223
2297
  }
2224
2298
  function TeamsToJSON(json) {
@@ -2229,7 +2303,7 @@ function TeamsToJSONTyped(value, ignoreDiscriminator = false) {
2229
2303
  return value;
2230
2304
  }
2231
2305
  return {
2232
- "teams": value["teams"] == null ? void 0 : value["teams"].map(TeamToJSON)
2306
+ "teams": value["teams"].map(TeamToJSON)
2233
2307
  };
2234
2308
  }
2235
2309
 
@@ -2285,7 +2359,7 @@ var MlbApi = class extends BaseAPI {
2285
2359
  }
2286
2360
  const queryParameters = {};
2287
2361
  if (requestParameters["fields"] != null) {
2288
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2362
+ queryParameters["fields"] = requestParameters["fields"];
2289
2363
  }
2290
2364
  const headerParameters = {};
2291
2365
  const response = yield this.request({
@@ -2307,6 +2381,96 @@ var MlbApi = class extends BaseAPI {
2307
2381
  return yield response.value();
2308
2382
  });
2309
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
+ }
2310
2474
  /**
2311
2475
  * Returns Linescore
2312
2476
  * Retrieves linescore
@@ -2321,7 +2485,7 @@ var MlbApi = class extends BaseAPI {
2321
2485
  }
2322
2486
  const queryParameters = {};
2323
2487
  if (requestParameters["fields"] != null) {
2324
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2488
+ queryParameters["fields"] = requestParameters["fields"];
2325
2489
  }
2326
2490
  const headerParameters = {};
2327
2491
  const response = yield this.request({
@@ -2356,6 +2520,9 @@ var MlbApi = class extends BaseAPI {
2356
2520
  );
2357
2521
  }
2358
2522
  const queryParameters = {};
2523
+ if (requestParameters["gamePk"] != null) {
2524
+ queryParameters["gamePk"] = requestParameters["gamePk"];
2525
+ }
2359
2526
  if (requestParameters["sportId"] != null) {
2360
2527
  queryParameters["sportId"] = requestParameters["sportId"];
2361
2528
  }
@@ -2372,7 +2539,7 @@ var MlbApi = class extends BaseAPI {
2372
2539
  queryParameters["endDate"] = requestParameters["endDate"];
2373
2540
  }
2374
2541
  if (requestParameters["fields"] != null) {
2375
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2542
+ queryParameters["fields"] = requestParameters["fields"];
2376
2543
  }
2377
2544
  if (requestParameters["hydrate"] != null) {
2378
2545
  queryParameters["hydrate"] = requestParameters["hydrate"];
@@ -2474,7 +2641,7 @@ var MlbApi = class extends BaseAPI {
2474
2641
  queryParameters["date"] = requestParameters["date"];
2475
2642
  }
2476
2643
  if (requestParameters["fields"] != null) {
2477
- queryParameters["fields"] = requestParameters["fields"].join(COLLECTION_FORMATS["csv"]);
2644
+ queryParameters["fields"] = requestParameters["fields"];
2478
2645
  }
2479
2646
  if (requestParameters["hydrate"] != null) {
2480
2647
  queryParameters["hydrate"] = requestParameters["hydrate"];
@@ -2527,6 +2694,12 @@ var MlbApi = class extends BaseAPI {
2527
2694
  if (requestParameters["leagueIds"] != null) {
2528
2695
  queryParameters["leagueIds"] = requestParameters["leagueIds"];
2529
2696
  }
2697
+ if (requestParameters["fields"] != null) {
2698
+ queryParameters["fields"] = requestParameters["fields"];
2699
+ }
2700
+ if (requestParameters["hydrate"] != null) {
2701
+ queryParameters["hydrate"] = requestParameters["hydrate"];
2702
+ }
2530
2703
  const headerParameters = {};
2531
2704
  const response = yield this.request({
2532
2705
  path: `/v1/teams`,
@@ -2583,6 +2756,10 @@ export {
2583
2756
  DivisionStandingsToJSONTyped,
2584
2757
  DivisionToJSON,
2585
2758
  DivisionToJSONTyped,
2759
+ DivisionsFromJSON,
2760
+ DivisionsFromJSONTyped,
2761
+ DivisionsToJSON,
2762
+ DivisionsToJSONTyped,
2586
2763
  FetchError,
2587
2764
  FieldingStatsFromJSON,
2588
2765
  FieldingStatsFromJSONTyped,
@@ -2635,6 +2812,10 @@ export {
2635
2812
  LeagueRecordToJSONTyped,
2636
2813
  LeagueToJSON,
2637
2814
  LeagueToJSONTyped,
2815
+ LeaguesFromJSON,
2816
+ LeaguesFromJSONTyped,
2817
+ LeaguesToJSON,
2818
+ LeaguesToJSONTyped,
2638
2819
  LinescoreFromJSON,
2639
2820
  LinescoreFromJSONTyped,
2640
2821
  LinescoreTeamFromJSON,
@@ -2746,6 +2927,7 @@ export {
2746
2927
  instanceOfDivision,
2747
2928
  instanceOfDivisionStandings,
2748
2929
  instanceOfDivisionStandingsList,
2930
+ instanceOfDivisions,
2749
2931
  instanceOfFieldingStats,
2750
2932
  instanceOfGame,
2751
2933
  instanceOfGameOfficial,
@@ -2758,6 +2940,7 @@ export {
2758
2940
  instanceOfLeague,
2759
2941
  instanceOfLeagueDates,
2760
2942
  instanceOfLeagueRecord,
2943
+ instanceOfLeagues,
2761
2944
  instanceOfLinescore,
2762
2945
  instanceOfLinescoreTeam,
2763
2946
  instanceOfLinescoreTeams,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bp1222/stats-api",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",