Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions mlbstatsapi/models/game/gamedata/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,42 @@ class GameReview(MLBBaseModel):
home: ReviewInfo


class AbsChallengeInfo(MLBBaseModel):
"""
A class to represent ABS challenge info for each team in this game.

Attributes
----------
used_successful : int
How many successful ABS challenges were used.
used_failed : int
How many failed ABS challenges were used.
remaining : int
How many ABS challenges are remaining.
"""
used_successful: int = Field(alias="usedSuccessful")
used_failed: int = Field(alias="usedFailed")
remaining: int


class AbsChallenges(MLBBaseModel):
"""
A class to represent ABS challenge information for this game.

Attributes
----------
has_challenges : bool
If ABS challenges are available.
away : AbsChallengeInfo
Away team ABS challenge info.
home : AbsChallengeInfo
Home team ABS challenge info.
"""
has_challenges: bool = Field(alias="hasChallenges")
away: AbsChallengeInfo
home: AbsChallengeInfo


class GameFlags(MLBBaseModel):
"""
A class to represent the flags for this game.
Expand Down
7 changes: 4 additions & 3 deletions mlbstatsapi/models/game/gamedata/gamedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
GameWeather,
GameInfo,
GameReview,
AbsChallenges,
GameFlags,
GameProbablePitchers,
MoundVisits,
Expand Down Expand Up @@ -57,8 +58,8 @@ class GameData(MLBBaseModel):
Secondary data caster for this game.
mound_visits : MoundVisits
Mound visits for this game.
abs_challenges : List[dict]
ABS challenges for this game.
abs_challenges : AbsChallenges
ABS challenge information for this game.
"""
game: GameDataGame
datetime: GameDatetime
Expand All @@ -77,7 +78,7 @@ class GameData(MLBBaseModel):
official_scorer: Optional[Person] = Field(default=None, alias="officialScorer")
primary_data_caster: Optional[Person] = Field(default=None, alias="primaryDataCaster")
secondary_data_caster: Optional[Person] = Field(default=None, alias="secondaryDataCaster")
abs_challenges: Optional[List[dict]] = Field(default=None, alias="absChallenges")
abs_challenges: Optional[AbsChallenges] = Field(default=None, alias="absChallenges")

@model_validator(mode='before')
@classmethod
Expand Down