29 KiB
Go API client for api
Official API for Major League Baseball.
Overview
This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.
- API version: 2.0.0
- Package version: 1.0.0
- Generator version: 7.12.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
Installation
Install the following dependencies:
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
Put the package under your project folder and add the following in import:
import api "//"
To use a proxy, set the environment variable HTTP_PROXY
:
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
Configuration of Server URL
Default configuration comes with Servers
field that contains server objects as defined in the OpenAPI specification.
Select Server Configuration
For using other server than the one defined on index 0 set context value api.ContextServerIndex
of type int
.
ctx := context.WithValue(context.Background(), api.ContextServerIndex, 1)
Templated Server URL
Templated server URL is formatted using default variables from configuration or from context value api.ContextServerVariables
of type map[string]string
.
ctx := context.WithValue(context.Background(), api.ContextServerVariables, map[string]string{
"basePath": "v2",
})
Note, enum values are always validated and all unused variables are silently ignored.
URLs Configuration per Operation
Each operation can use different server URL defined using OperationServers
map in the Configuration
.
An operation is uniquely identified by "{classname}Service.{nickname}"
string.
Similar rules for overriding default operation server index and variables applies by using api.ContextOperationServerIndices
and api.ContextOperationServerVariables
context maps.
ctx := context.WithValue(context.Background(), api.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), api.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
Documentation for API Endpoints
All URIs are relative to http://localhost
Class | Method | HTTP request | Description |
---|---|---|---|
AnalyticsAPI | ContextMetrics | Get /api/v1/game/{gamePk}/{guid}/contextMetrics | Get context metrics for a specific gamePk. |
AnalyticsAPI | ContextMetricsWithAverages | Get /api/v1/game/{gamePk}/{guid}/contextMetricsAverages | Get a json file containing raw coordinate data and refined calculated metrics. |
AnalyticsAPI | ContextMetricsWithAveragesPost | Post /api/v1/game/{gamePk}/{guid}/contextMetricsAverages | Get a json file containing raw coordinate data and refined calculated metrics. |
AnalyticsAPI | GameGuids | Get /api/v1/game/{gamePk}/guids | Get the GUIDs (plays) for a specific game. |
AnalyticsAPI | GameGuidsFromPostgresRange | Get /api/v1/analytics/guids | Get the GUIDs (plays) for a specific game. |
AnalyticsAPI | GameGuidsFromPostgresRangeByGame | Get /api/v1/analytics/game | Get all games by updated date. |
AnalyticsAPI | GameLastPitch | Get /api/v1/game/lastPitch | Get the last pitch for a list of games |
AnalyticsAPI | HomeRunBallparks | Get /api/v1/game/{gamePk}/{guid}/homeRunBallparks | Get if the play is a home run is each park for a specific play. |
AnalyticsAPI | ParsedJsonFormattedAnalytics | Get /api/v1/game/{gamePk}/{guid}/analytics | Get Statcast data for a specific play. |
AttendanceAPI | GetTeamAttendance | Get /api/v1/attendance | Get team attendance |
AwardsAPI | AwardRecipients | Get /api/v1/awards/{awardId}/recipients | View recipients of an award |
AwardsAPI | Awards | Get /api/v1/awards | View awards info |
AwardsAPI | Awards1 | Get /api/v1/awards/{awardId} | View awards info |
BatTrackingAPI | BatTracking | Get /api/v1/batTracking/game/{gamePk}/{playId} | View Bat Tracking Data by playId and gameId |
BiomechanicsAPI | Biomechanical | Get /api/v1/game/{gamePk}/{playId}/analytics/biomechanics/{positionId} | View Biomechanical data by playId and gameId filtered by player positionId |
BroadcastAPI | GetAllBroadcasters | Get /api/v1/broadcasters | Get All Active Broadcasters |
BroadcastAPI | GetBroadcasts | Get /api/v1/broadcast | Get Broadcasters |
ConferenceAPI | Conferences | Get /api/v1/conferences | View conference info |
ConferenceAPI | Conferences1 | Get /api/v1/conferences/{conferenceId} | View conference info |
DivisionAPI | Divisions | Get /api/v1/divisions | Get division information |
DivisionAPI | Divisions1 | Get /api/v1/divisions/{divisionId} | Get division information |
DraftAPI | DraftPicks | Get /api/v1/draft | View MLB Drafted Players |
DraftAPI | DraftPicks1 | Get /api/v1/draft/{year} | View MLB Drafted Players |
DraftAPI | DraftProspects | Get /api/v1/draft/prospects | View MLB Draft Prospects |
DraftAPI | DraftProspects1 | Get /api/v1/draft/prospects/{year} | View MLB Draft Prospects |
DraftAPI | LatestDraftPicks | Get /api/v1/draft/{year}/latest | Get the last drafted player and the next 5 teams up to pick |
GameAPI | Boxscore | Get /api/v1/game/{game_pk}/boxscore | Get game boxscore. |
GameAPI | ColorFeed | Get /api/v1/game/{game_pk}/feed/color | Get game color feed. |
GameAPI | ColorTimestamps | Get /api/v1/game/{game_pk}/feed/color/timestamps | Retrieve all of the color timestamps for a game. |
GameAPI | Content | Get /api/v1/game/{game_pk}/content | Retrieve all content for a game. |
GameAPI | CurrentGameStats1 | Get /api/v1/game/changes | View a game change log |
GameAPI | GetGameContextMetrics | Get /api/v1/game/{gamePk}/contextMetrics | Get the context metrics for this game based on its current state |
GameAPI | GetGameWithMetrics | Get /api/v1/game/{gamePk}/withMetrics | Get game info with metrics |
GameAPI | GetWinProbability | Get /api/v1/game/{gamePk}/winProbability | Get the win probability for this game |
GameAPI | Linescore | Get /api/v1/game/{game_pk}/linescore | Get game linescore |
GameAPI | LiveGameDiffPatchV1 | Get /api/v1.1/game/{game_pk}/feed/live/diffPatch | Get live game status diffPatch. |
GameAPI | LiveGameV1 | Get /api/v1.1/game/{game_pk}/feed/live | Get live game status. |
GameAPI | LiveTimestampv11 | Get /api/v1.1/game/{game_pk}/feed/live/timestamps | Retrieve all of the play timestamps for a game. |
GameAPI | PlayByPlay | Get /api/v1/game/{game_pk}/playByPlay | Get game play By Play |
GamePaceAPI | GamePace | Get /api/v1/gamePace | View time of game info |
HighLowAPI | HighLow | Get /api/v1/highLow/{highLowType} | View high/low stats by player or team |
HighLowAPI | HighLowStats | Get /api/v1/highLow/types | View high/low stat types |
HomerunDerbyAPI | HomeRunDerbyBracket | Get /api/v1/homeRunDerby/{gamePk} | View a home run derby object |
HomerunDerbyAPI | HomeRunDerbyBracket1 | Get /api/v1/homeRunDerby | View a home run derby object |
HomerunDerbyAPI | HomeRunDerbyBracket2 | Get /api/v1/homeRunDerby/{gamePk}/bracket | View a home run derby object |
HomerunDerbyAPI | HomeRunDerbyBracket3 | Get /api/v1/homeRunDerby/bracket | View a home run derby object |
HomerunDerbyAPI | HomeRunDerbyMixedMode | Get /api/v1/homeRunDerby/{gamePk}/mixed | View home run derby mixed mode (Bracket/Pool combo) |
HomerunDerbyAPI | HomeRunDerbyMixedMode1 | Get /api/v1/homeRunDerby/mixed | View home run derby mixed mode (Bracket/Pool combo) |
HomerunDerbyAPI | HomeRunDerbyPool | Get /api/v1/homeRunDerby/{gamePk}/pool | View home run derby pool |
HomerunDerbyAPI | HomeRunDerbyPool1 | Get /api/v1/homeRunDerby/pool | View home run derby pool |
JobAPI | Datacasters | Get /api/v1/jobs/datacasters | Get datacaster jobs |
JobAPI | GetJobsByType | Get /api/v1/jobs | Get jobs by type |
JobAPI | OfficialScorers | Get /api/v1/jobs/officialScorers | Get official scorers |
JobAPI | UmpireSchedule | Get /api/v1/jobs/umpires/games/{umpireId} | Get umpires and associated game for umpireId |
JobAPI | Umpires | Get /api/v1/jobs/umpires | Get umpires |
LeagueAPI | AllStarBallot | Get /api/v1/league/allStarBallot | View al star ballot info |
LeagueAPI | AllStarBallot1 | Get /api/v1/league/{leagueId}/allStarBallot | View al star ballot info |
LeagueAPI | AllStarBallot2 | Get /api/v1/leagues/allStarBallot | View al star ballot info |
LeagueAPI | AllStarBallot3 | Get /api/v1/leagues/{leagueId}/allStarBallot | View al star ballot info |
LeagueAPI | AllStarFinalVote | Get /api/v1/league/{leagueId}/allStarFinalVote | View all star final vote info |
LeagueAPI | AllStarFinalVote1 | Get /api/v1/leagues/{leagueId}/allStarFinalVote | View all star final vote info |
LeagueAPI | AllStarWriteIns | Get /api/v1/league/{leagueId}/allStarWriteIns | View all star write ins info |
LeagueAPI | AllStarWriteIns1 | Get /api/v1/leagues/{leagueId}/allStarWriteIns | View all star write ins info |
LeagueAPI | League | Get /api/v1/league | View league info |
LeagueAPI | League1 | Get /api/v1/league/{leagueId} | View league info |
LeagueAPI | League2 | Get /api/v1/leagues | View league info |
LeagueAPI | League3 | Get /api/v1/leagues/{leagueId} | View league info |
MilestonesAPI | AchievementStatuses | Get /api/v1/achievementStatuses | View available achievementStatus options |
MilestonesAPI | MilestoneDurations | Get /api/v1/milestoneDurations | View available milestoneDurations options |
MilestonesAPI | MilestoneLookups | Get /api/v1/milestoneLookups | View available milestoneLookup options |
MilestonesAPI | MilestoneStatistics | Get /api/v1/milestoneStatistics | View available milestone statistics options |
MilestonesAPI | MilestoneTypes | Get /api/v1/milestoneTypes | View available milestoneType options |
MilestonesAPI | Milestones | Get /api/v1/milestones | View pending and achieved milestones. |
MiscAPI | AggregateSortEnum | Get /api/v1/sortModifiers | List all stat fields |
MiscAPI | BaseballStats | Get /api/v1/baseballStats | List all baseball stats |
MiscAPI | BroadcastAvailabilityTypes | Get /api/v1/broadcastAvailability | View broadcast availability options |
MiscAPI | CoachingVideoTypes | Get /api/v1/coachingVideoTypes | List all coaching video types |
MiscAPI | EventStatus | Get /api/v1/eventStatus | List all possible event status types |
MiscAPI | EventTypes | Get /api/v1/eventTypes | List all event types |
MiscAPI | FielderDetailTypes | Get /api/v1/fielderDetailTypes | List fielder detail types |
MiscAPI | FreeGameTypes | Get /api/v1/freeGameTypes | View free game types |
MiscAPI | GameStatus | Get /api/v1/gameStatus | List all status types |
MiscAPI | GameTypes | Get /api/v1/gameTypes | List all game types |
MiscAPI | GamedayTypes | Get /api/v1/gamedayTypes | List all gameday types |
MiscAPI | GetLookupValues | Get /api/v1/lookup/values/all | View all lookup values |
MiscAPI | GroupByTypes | Get /api/v1/groupByTypes | List groupBy types |
MiscAPI | HitTrajectories | Get /api/v1/hitTrajectories | List all hit trajectories |
MiscAPI | JobTypes | Get /api/v1/jobTypes | List all job types |
MiscAPI | Languages | Get /api/v1/languages | List all support languages |
MiscAPI | LeagueLeaderTypes | Get /api/v1/leagueLeaderTypes | List all possible player league leader types |
MiscAPI | LogicalEvents | Get /api/v1/logicalEvents | List all logical event types |
MiscAPI | MediaStateTypes | Get /api/v1/mediaState | View media state options |
MiscAPI | Metrics | Get /api/v1/metrics | List all possible metrics |
MiscAPI | MoundVisitTypes | Get /api/v1/moundVisitTypes | List all mound visit types |
MiscAPI | PerformerTypes | Get /api/v1/performerTypes | List all possible performer types |
MiscAPI | PitchCodes | Get /api/v1/pitchCodes | List all pitch codes |
MiscAPI | PitchTypes | Get /api/v1/pitchTypes | List all pitch classification types |
MiscAPI | Platforms | Get /api/v1/platforms | List all possible platforms |
MiscAPI | PlayerStatusCodes | Get /api/v1/playerStatusCodes | List all player status codes |
MiscAPI | Positions | Get /api/v1/positions | List all possible positions |
MiscAPI | ReviewReasons | Get /api/v1/reviewReasons | List all replay review reasons |
MiscAPI | RoofTypes | Get /api/v1/roofTypes | List all roof types |
MiscAPI | RosterTypes | Get /api/v1/rosterTypes | List all possible roster types |
MiscAPI | RuleSettings | Get /api/v1/ruleSettings | List all ruleSettings |
MiscAPI | RunnerDetailTypes | Get /api/v1/runnerDetailTypes | List runner detail types |
MiscAPI | ScheduleEventTypes | Get /api/v1/scheduleEventTypes | List all schedule event types |
MiscAPI | ScheduleTypes | Get /api/v1/scheduleTypes | List all possible schedule types |
MiscAPI | SitCodes | Get /api/v1/situationCodes | List all situation codes |
MiscAPI | Sky | Get /api/v1/sky | List all sky options |
MiscAPI | StandingsTypes | Get /api/v1/standingsTypes | List all standings types |
MiscAPI | StatFields | Get /api/v1/statFields | List all stat fields |
MiscAPI | StatGroups | Get /api/v1/statGroups | List all stat groups |
MiscAPI | StatSearchConfig | Get /api/v1/stats/search/config | Stats Search Config Endpoint |
MiscAPI | StatSearchGroupByTypes | Get /api/v1/stats/search/groupByTypes | List groupBy types |
MiscAPI | StatSearchParams | Get /api/v1/stats/search/params | List stat search parameters |
MiscAPI | StatSearchStats | Get /api/v1/stats/search/stats | List stat search stats |
MiscAPI | StatTypes | Get /api/v1/statTypes | List all stat types |
MiscAPI | StatcastPositionTypes | Get /api/v1/statcastPositionTypes | List all statcast position types |
MiscAPI | TrackingSoftwareVersions | Get /api/v1/trackingSoftwareVersions | List the tracking software versions and notes |
MiscAPI | TrackingSystemOwners | Get /api/v1/trackingSystemOwners | List all tracking system owners |
MiscAPI | TrackingVendors | Get /api/v1/trackingVendors | List all tracking vendors |
MiscAPI | TrackingVersions | Get /api/v1/trackingVersions | List all tracking versions |
MiscAPI | TransactionTypes | Get /api/v1/transactionTypes | List all transaction types |
MiscAPI | UpdateGameStatuses | Post /api/v1/gameStatus | Clear all status types |
MiscAPI | UpdateJobTypes | Post /api/v1/jobTypes | |
MiscAPI | VideoResolutionTypes | Get /api/v1/videoResolutionTypes | View video resolution options |
MiscAPI | ViolationTypes | Get /api/v1/violationTypes | View available violationType options |
MiscAPI | WeatherTrajectoryConfidences | Get /api/v1/weatherTrajectoryConfidences | List all weather trajectories |
MiscAPI | WindDirection | Get /api/v1/windDirection | List all wind direction options |
PersonAPI | Award | Get /api/v1/people/{personId}/awards | View a player's awards |
PersonAPI | CurrentGameStats | Get /api/v1/people/changes | View a player's change log |
PersonAPI | FreeAgents | Get /api/v1/people/freeAgents | Get free agents |
PersonAPI | Person | Get /api/v1/people/{personId} | View a player |
PersonAPI | Person1 | Get /api/v1/people | View a player |
PersonAPI | PlayerGameStats | Get /api/v1/people/{personId}/stats/game/{gamePk} | View a player's game stats |
PersonAPI | Search | Get /api/v1/people/search | Search for a player by name |
PersonAPI | Stats3 | Get /api/v1/people/{personId}/stats | View a players stats |
PersonAPI | StatsMetrics | Get /api/v1/people/{personId}/stats/metrics | View a player's stat metrics |
PredictionsAPI | GetProps | Get /api/v1/props/play/predictions | Get play-level predictions based on input scenarios |
PredictionsAPI | GetPropsAdjust | Get /api/v1/props/play/predictions/adjust | Get play-level predictions based on input scenarios |
ReviewsAPI | GetReviewInfo | Get /api/v1/review | Get review info |
ScheduleAPI | PostseasonSchedule | Get /api/v1/schedule/postseason | Get postseason schedule |
ScheduleAPI | PostseasonScheduleSeries | Get /api/v1/schedule/postseason/series | Get postseason series schedules |
ScheduleAPI | Schedule | Get /api/v1/schedule | View schedule info based on scheduleType. |
ScheduleAPI | Schedule1 | Get /api/v1/schedule/{scheduleType} | View schedule info based on scheduleType. |
ScheduleAPI | TieGames | Get /api/v1/schedule/games/tied | Get tied game schedules |
ScheduleAPI | TrackingEventsSchedule | Get /api/v1/schedule/trackingEvents | Get tracking event schedules |
ScheduleAPI | TuneIn | Get /api/v1/schedule/postseason/tuneIn | Get postseason TuneIn schedules |
SeasonAPI | AllSeasons | Get /api/v1/seasons/all | View all seasons |
SeasonAPI | Seasons | Get /api/v1/seasons | View season info |
SeasonAPI | Seasons1 | Get /api/v1/seasons/{seasonId} | View season info |
SkeletalAPI | SkeletalChunked | Get /api/v1/game/{gamePk}/{playId}/analytics/skeletalData/chunked | View Skeletal Data by playId and gameId chunked |
SkeletalAPI | SkeletalDataFileNames | Get /api/v1/game/{gamePk}/{playId}/analytics/skeletalData/files | View Skeletal Data by playId and gameId files |
SportsAPI | AllSportBallot | Get /api/v1/sports/{sportId}/allSportBallot | Get ALL MLB ballot for sport |
SportsAPI | SportPlayers | Get /api/v1/sports/{sportId}/players | Get all players for a sport level |
SportsAPI | Sports | Get /api/v1/sports | Get sports information |
SportsAPI | Sports1 | Get /api/v1/sports/{sportId} | Get sports information |
StandingsAPI | Standings | Get /api/v1/standings/{standingsType} | View standings for a league |
StandingsAPI | Standings1 | Get /api/v1/standings | View standings for a league |
StatsAPI | BeastStats | Get /api/v1/stats/search | View stats from search |
StatsAPI | GetOutsAboveAverage | Get /api/v1/stats/analytics/outsAboveAverage | Get outs above average for the current batter |
StatsAPI | GetSprayChart | Get /api/v1/stats/analytics/sprayChart | Get the spray chart info for the current batter |
StatsAPI | GetStolenBaseProbability | Get /api/v1/stats/analytics/stolenBaseProbability | Get the probability of a hit for the given hit data |
StatsAPI | GroupedStats | Get /api/v1/stats/grouped | View grouped stats |
StatsAPI | Leaders2 | Get /api/v1/stats/leaders | Get leaders for a statistic |
StatsAPI | MetricStats | Get /api/v1/stats/metrics | View metric stats |
StatsAPI | Stats2 | Get /api/v1/stats | View stats |
StreaksAPI | GetStreaks | Get /api/v1/streaks | View streaks |
StreaksAPI | StreakTypes | Get /api/v1/streaks/types | View streaks parameter options |
TeamsAPI | Affiliates | Get /api/v1/teams/{teamId}/affiliates | View team and affiliate teams |
TeamsAPI | Affiliates1 | Get /api/v1/teams/affiliates | View team and affiliate teams |
TeamsAPI | AllTeams | Get /api/v1/teams/{teamId}/history | View historical records for a list of teams |
TeamsAPI | AllTeams1 | Get /api/v1/teams/history | View historical records for a list of teams |
TeamsAPI | Alumni | Get /api/v1/teams/{teamId}/alumni | View all team alumni |
TeamsAPI | Coaches | Get /api/v1/teams/{teamId}/coaches | View all coaches for a team |
TeamsAPI | Leaders | Get /api/v1/teams/{teamId}/leaders | View team stat leaders |
TeamsAPI | Leaders1 | Get /api/v1/teams/stats/leaders | View leaders for team stats |
TeamsAPI | Personnel | Get /api/v1/teams/{teamId}/personnel | View all coaches for a team |
TeamsAPI | Roster | Get /api/v1/teams/{teamId}/roster | View a teams roster |
TeamsAPI | Roster1 | Get /api/v1/teams/{teamId}/roster/{rosterType} | View a teams roster |
TeamsAPI | Stats | Get /api/v1/teams/{teamId}/stats | View a teams stats |
TeamsAPI | Stats1 | Get /api/v1/teams/stats | View a teams stats |
TeamsAPI | Teams | Get /api/v1/teams | View info for all teams |
TeamsAPI | Teams1 | Get /api/v1/teams/{teamId} | View info for all teams |
TeamsAPI | UpdateAlumni | Post /api/v1/teams/{teamId}/alumni | |
TransactionsAPI | Transactions | Get /api/v1/transactions | View transaction info |
UniformsAPI | UniformsByGame | Get /api/v1/uniforms/game | View Game Uniform info |
UniformsAPI | UniformsByTeam | Get /api/v1/uniforms/team | View Team Uniform info |
VenuesAPI | Venues | Get /api/v1/venues | View venue info |
VenuesAPI | Venues1 | Get /api/v1/venues/{venueId} | View venue info |
WeatherAPI | WeatherBasic | Get /api/v1/weather/venues/{venueId}/basic | Get basic weather for a venue. |
WeatherAPI | WeatherDataBasedOnPlay | Get /api/v1/weather/game/{gamePk}/{playId} | Get the raw field weather data. |
WeatherAPI | WeatherForecast | Get /api/v1/weather/game/{gamePk}/forecast/{roofType} | Get the weather forecast for a game. |
WeatherAPI | WeatherFull | Get /api/v1/weather/venues/{venueId}/full | Get full weather for a venue. |
Documentation For Models
Documentation For Authorization
Endpoints do not require authorization.
Documentation for Utility Methods
Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:
PtrBool
PtrInt
PtrInt32
PtrInt64
PtrFloat
PtrFloat32
PtrFloat64
PtrString
PtrTime