3090 lines
97 KiB
Go
3090 lines
97 KiB
Go
/*
|
|
Copyright © 2025 filifa
|
|
|
|
This program is free software: you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
version.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
/*
|
|
Stats API Documentation
|
|
|
|
Official API for Major League Baseball.
|
|
|
|
API version: 2.0.0
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package api
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
)
|
|
|
|
// StatsAPIService StatsAPI service
|
|
type StatsAPIService service
|
|
|
|
type ApiBeastStatsRequest struct {
|
|
ctx context.Context
|
|
ApiService *StatsAPIService
|
|
group *interface{}
|
|
gamePks *interface{}
|
|
playIds *interface{}
|
|
seasons *interface{}
|
|
gameTypes *interface{}
|
|
date *interface{}
|
|
startDate *interface{}
|
|
endDate *interface{}
|
|
teamIds *interface{}
|
|
pitcherTeamIds *interface{}
|
|
batterTeamIds *interface{}
|
|
sportIds *interface{}
|
|
pitcherSportIds *interface{}
|
|
batterSportIds *interface{}
|
|
leagueIds *interface{}
|
|
pitcherLeagueIds *interface{}
|
|
batterLeagueIds *interface{}
|
|
divisionIds *interface{}
|
|
pitcherDivisionIds *interface{}
|
|
batterDivisionIds *interface{}
|
|
pitchersOnTeamIds *interface{}
|
|
battersOnTeamIds *interface{}
|
|
playerIds *interface{}
|
|
playerPool *interface{}
|
|
pitcherIds *interface{}
|
|
batterIds *interface{}
|
|
catcherIds *interface{}
|
|
firstBasemanIds *interface{}
|
|
secondBasemanIds *interface{}
|
|
thirdBasemanIds *interface{}
|
|
shortstopIds *interface{}
|
|
leftFielderIds *interface{}
|
|
centerFielderIds *interface{}
|
|
rightFielderIds *interface{}
|
|
runnerFirstIds *interface{}
|
|
runnerSecondIds *interface{}
|
|
runnerThirdIds *interface{}
|
|
venueIds *interface{}
|
|
pitchHand *interface{}
|
|
batSide *interface{}
|
|
pitchTypes *interface{}
|
|
pitchCodes *interface{}
|
|
eventTypes *interface{}
|
|
positions *interface{}
|
|
primaryPositions *interface{}
|
|
minPitchSpeed *interface{}
|
|
maxPitchSpeed *interface{}
|
|
minSpinRate *interface{}
|
|
maxSpinRate *interface{}
|
|
minExtension *interface{}
|
|
maxExtension *interface{}
|
|
minExitVelocityAgainst *interface{}
|
|
maxExitVelocityAgainst *interface{}
|
|
minLaunchAngleAgainst *interface{}
|
|
maxLaunchAngleAgainst *interface{}
|
|
minExitVelocity *interface{}
|
|
maxExitVelocity *interface{}
|
|
minLaunchAngle *interface{}
|
|
maxLaunchAngle *interface{}
|
|
minHomeRunDistance *interface{}
|
|
maxHomeRunDistance *interface{}
|
|
minHitDistance *interface{}
|
|
maxHitDistance *interface{}
|
|
minHangTime *interface{}
|
|
maxHangTime *interface{}
|
|
minHitProbability *interface{}
|
|
maxHitProbability *interface{}
|
|
minCatchProbability *interface{}
|
|
maxCatchProbability *interface{}
|
|
minAttackAngle *interface{}
|
|
maxAttackAngle *interface{}
|
|
minBatSpeed *interface{}
|
|
maxBatSpeed *interface{}
|
|
minHomeRunXBallparks *interface{}
|
|
maxHomeRunXBallparks *interface{}
|
|
isBarrel *interface{}
|
|
hitTrajectories *interface{}
|
|
limit *interface{}
|
|
offset *interface{}
|
|
groupBy *interface{}
|
|
compareOver *interface{}
|
|
sortStat *interface{}
|
|
sortModifier *interface{}
|
|
sortOrder *interface{}
|
|
percentile *interface{}
|
|
minOccurrences *interface{}
|
|
minPlateAppearances *interface{}
|
|
minInnings *interface{}
|
|
qualifierRate *interface{}
|
|
sitCodes *interface{}
|
|
showTotals *interface{}
|
|
includeNullMetrics *interface{}
|
|
statFields *interface{}
|
|
atBatNumbers *interface{}
|
|
pitchNumbers *interface{}
|
|
fields *interface{}
|
|
debug *interface{}
|
|
activeStatus *interface{}
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiBeastStatsRequest) Group(group interface{}) ApiBeastStatsRequest {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of unique primary keys
|
|
func (r ApiBeastStatsRequest) GamePks(gamePks interface{}) ApiBeastStatsRequest {
|
|
r.gamePks = &gamePks
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of unique play identifiers
|
|
func (r ApiBeastStatsRequest) PlayIds(playIds interface{}) ApiBeastStatsRequest {
|
|
r.playIds = &playIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Seasons of play
|
|
func (r ApiBeastStatsRequest) Seasons(seasons interface{}) ApiBeastStatsRequest {
|
|
r.seasons = &seasons
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiBeastStatsRequest) GameTypes(gameTypes interface{}) ApiBeastStatsRequest {
|
|
r.gameTypes = &gameTypes
|
|
return r
|
|
}
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
func (r ApiBeastStatsRequest) Date(date interface{}) ApiBeastStatsRequest {
|
|
r.date = &date
|
|
return r
|
|
}
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
func (r ApiBeastStatsRequest) StartDate(startDate interface{}) ApiBeastStatsRequest {
|
|
r.startDate = &startDate
|
|
return r
|
|
}
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
func (r ApiBeastStatsRequest) EndDate(endDate interface{}) ApiBeastStatsRequest {
|
|
r.endDate = &endDate
|
|
return r
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiBeastStatsRequest) TeamIds(teamIds interface{}) ApiBeastStatsRequest {
|
|
r.teamIds = &teamIds
|
|
return r
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiBeastStatsRequest) PitcherTeamIds(pitcherTeamIds interface{}) ApiBeastStatsRequest {
|
|
r.pitcherTeamIds = &pitcherTeamIds
|
|
return r
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiBeastStatsRequest) BatterTeamIds(batterTeamIds interface{}) ApiBeastStatsRequest {
|
|
r.batterTeamIds = &batterTeamIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiBeastStatsRequest) SportIds(sportIds interface{}) ApiBeastStatsRequest {
|
|
r.sportIds = &sportIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiBeastStatsRequest) PitcherSportIds(pitcherSportIds interface{}) ApiBeastStatsRequest {
|
|
r.pitcherSportIds = &pitcherSportIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiBeastStatsRequest) BatterSportIds(batterSportIds interface{}) ApiBeastStatsRequest {
|
|
r.batterSportIds = &batterSportIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiBeastStatsRequest) LeagueIds(leagueIds interface{}) ApiBeastStatsRequest {
|
|
r.leagueIds = &leagueIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiBeastStatsRequest) PitcherLeagueIds(pitcherLeagueIds interface{}) ApiBeastStatsRequest {
|
|
r.pitcherLeagueIds = &pitcherLeagueIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiBeastStatsRequest) BatterLeagueIds(batterLeagueIds interface{}) ApiBeastStatsRequest {
|
|
r.batterLeagueIds = &batterLeagueIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique League Identifiers
|
|
func (r ApiBeastStatsRequest) DivisionIds(divisionIds interface{}) ApiBeastStatsRequest {
|
|
r.divisionIds = &divisionIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique League Identifiers
|
|
func (r ApiBeastStatsRequest) PitcherDivisionIds(pitcherDivisionIds interface{}) ApiBeastStatsRequest {
|
|
r.pitcherDivisionIds = &pitcherDivisionIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique League Identifiers
|
|
func (r ApiBeastStatsRequest) BatterDivisionIds(batterDivisionIds interface{}) ApiBeastStatsRequest {
|
|
r.batterDivisionIds = &batterDivisionIds
|
|
return r
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiBeastStatsRequest) PitchersOnTeamIds(pitchersOnTeamIds interface{}) ApiBeastStatsRequest {
|
|
r.pitchersOnTeamIds = &pitchersOnTeamIds
|
|
return r
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiBeastStatsRequest) BattersOnTeamIds(battersOnTeamIds interface{}) ApiBeastStatsRequest {
|
|
r.battersOnTeamIds = &battersOnTeamIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) PlayerIds(playerIds interface{}) ApiBeastStatsRequest {
|
|
r.playerIds = &playerIds
|
|
return r
|
|
}
|
|
|
|
// Return \"ALL\" or only \"QUALIFIED\" players based on plate appearances.
|
|
func (r ApiBeastStatsRequest) PlayerPool(playerPool interface{}) ApiBeastStatsRequest {
|
|
r.playerPool = &playerPool
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) PitcherIds(pitcherIds interface{}) ApiBeastStatsRequest {
|
|
r.pitcherIds = &pitcherIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) BatterIds(batterIds interface{}) ApiBeastStatsRequest {
|
|
r.batterIds = &batterIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) CatcherIds(catcherIds interface{}) ApiBeastStatsRequest {
|
|
r.catcherIds = &catcherIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) FirstBasemanIds(firstBasemanIds interface{}) ApiBeastStatsRequest {
|
|
r.firstBasemanIds = &firstBasemanIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) SecondBasemanIds(secondBasemanIds interface{}) ApiBeastStatsRequest {
|
|
r.secondBasemanIds = &secondBasemanIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) ThirdBasemanIds(thirdBasemanIds interface{}) ApiBeastStatsRequest {
|
|
r.thirdBasemanIds = &thirdBasemanIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) ShortstopIds(shortstopIds interface{}) ApiBeastStatsRequest {
|
|
r.shortstopIds = &shortstopIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) LeftFielderIds(leftFielderIds interface{}) ApiBeastStatsRequest {
|
|
r.leftFielderIds = &leftFielderIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) CenterFielderIds(centerFielderIds interface{}) ApiBeastStatsRequest {
|
|
r.centerFielderIds = ¢erFielderIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) RightFielderIds(rightFielderIds interface{}) ApiBeastStatsRequest {
|
|
r.rightFielderIds = &rightFielderIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) RunnerFirstIds(runnerFirstIds interface{}) ApiBeastStatsRequest {
|
|
r.runnerFirstIds = &runnerFirstIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) RunnerSecondIds(runnerSecondIds interface{}) ApiBeastStatsRequest {
|
|
r.runnerSecondIds = &runnerSecondIds
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for a player
|
|
func (r ApiBeastStatsRequest) RunnerThirdIds(runnerThirdIds interface{}) ApiBeastStatsRequest {
|
|
r.runnerThirdIds = &runnerThirdIds
|
|
return r
|
|
}
|
|
|
|
// Unique Venue Identifier
|
|
func (r ApiBeastStatsRequest) VenueIds(venueIds interface{}) ApiBeastStatsRequest {
|
|
r.venueIds = &venueIds
|
|
return r
|
|
}
|
|
|
|
// Handedness of pitcher
|
|
func (r ApiBeastStatsRequest) PitchHand(pitchHand interface{}) ApiBeastStatsRequest {
|
|
r.pitchHand = &pitchHand
|
|
return r
|
|
}
|
|
|
|
// Bat side of hitter
|
|
func (r ApiBeastStatsRequest) BatSide(batSide interface{}) ApiBeastStatsRequest {
|
|
r.batSide = &batSide
|
|
return r
|
|
}
|
|
|
|
// Classification of pitch (fastball, curveball, etc...)
|
|
func (r ApiBeastStatsRequest) PitchTypes(pitchTypes interface{}) ApiBeastStatsRequest {
|
|
r.pitchTypes = &pitchTypes
|
|
return r
|
|
}
|
|
|
|
// Result of the pitch (ball, called strike, etc...)
|
|
func (r ApiBeastStatsRequest) PitchCodes(pitchCodes interface{}) ApiBeastStatsRequest {
|
|
r.pitchCodes = &pitchCodes
|
|
return r
|
|
}
|
|
|
|
// Type of event
|
|
func (r ApiBeastStatsRequest) EventTypes(eventTypes interface{}) ApiBeastStatsRequest {
|
|
r.eventTypes = &eventTypes
|
|
return r
|
|
}
|
|
|
|
// All of the details of a player's position
|
|
func (r ApiBeastStatsRequest) Positions(positions interface{}) ApiBeastStatsRequest {
|
|
r.positions = &positions
|
|
return r
|
|
}
|
|
|
|
// All of the details of a player's position
|
|
func (r ApiBeastStatsRequest) PrimaryPositions(primaryPositions interface{}) ApiBeastStatsRequest {
|
|
r.primaryPositions = &primaryPositions
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinPitchSpeed(minPitchSpeed interface{}) ApiBeastStatsRequest {
|
|
r.minPitchSpeed = &minPitchSpeed
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxPitchSpeed(maxPitchSpeed interface{}) ApiBeastStatsRequest {
|
|
r.maxPitchSpeed = &maxPitchSpeed
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinSpinRate(minSpinRate interface{}) ApiBeastStatsRequest {
|
|
r.minSpinRate = &minSpinRate
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxSpinRate(maxSpinRate interface{}) ApiBeastStatsRequest {
|
|
r.maxSpinRate = &maxSpinRate
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinExtension(minExtension interface{}) ApiBeastStatsRequest {
|
|
r.minExtension = &minExtension
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxExtension(maxExtension interface{}) ApiBeastStatsRequest {
|
|
r.maxExtension = &maxExtension
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinExitVelocityAgainst(minExitVelocityAgainst interface{}) ApiBeastStatsRequest {
|
|
r.minExitVelocityAgainst = &minExitVelocityAgainst
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxExitVelocityAgainst(maxExitVelocityAgainst interface{}) ApiBeastStatsRequest {
|
|
r.maxExitVelocityAgainst = &maxExitVelocityAgainst
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinLaunchAngleAgainst(minLaunchAngleAgainst interface{}) ApiBeastStatsRequest {
|
|
r.minLaunchAngleAgainst = &minLaunchAngleAgainst
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxLaunchAngleAgainst(maxLaunchAngleAgainst interface{}) ApiBeastStatsRequest {
|
|
r.maxLaunchAngleAgainst = &maxLaunchAngleAgainst
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinExitVelocity(minExitVelocity interface{}) ApiBeastStatsRequest {
|
|
r.minExitVelocity = &minExitVelocity
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxExitVelocity(maxExitVelocity interface{}) ApiBeastStatsRequest {
|
|
r.maxExitVelocity = &maxExitVelocity
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinLaunchAngle(minLaunchAngle interface{}) ApiBeastStatsRequest {
|
|
r.minLaunchAngle = &minLaunchAngle
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxLaunchAngle(maxLaunchAngle interface{}) ApiBeastStatsRequest {
|
|
r.maxLaunchAngle = &maxLaunchAngle
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinHomeRunDistance(minHomeRunDistance interface{}) ApiBeastStatsRequest {
|
|
r.minHomeRunDistance = &minHomeRunDistance
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxHomeRunDistance(maxHomeRunDistance interface{}) ApiBeastStatsRequest {
|
|
r.maxHomeRunDistance = &maxHomeRunDistance
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinHitDistance(minHitDistance interface{}) ApiBeastStatsRequest {
|
|
r.minHitDistance = &minHitDistance
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxHitDistance(maxHitDistance interface{}) ApiBeastStatsRequest {
|
|
r.maxHitDistance = &maxHitDistance
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinHangTime(minHangTime interface{}) ApiBeastStatsRequest {
|
|
r.minHangTime = &minHangTime
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxHangTime(maxHangTime interface{}) ApiBeastStatsRequest {
|
|
r.maxHangTime = &maxHangTime
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinHitProbability(minHitProbability interface{}) ApiBeastStatsRequest {
|
|
r.minHitProbability = &minHitProbability
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxHitProbability(maxHitProbability interface{}) ApiBeastStatsRequest {
|
|
r.maxHitProbability = &maxHitProbability
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinCatchProbability(minCatchProbability interface{}) ApiBeastStatsRequest {
|
|
r.minCatchProbability = &minCatchProbability
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxCatchProbability(maxCatchProbability interface{}) ApiBeastStatsRequest {
|
|
r.maxCatchProbability = &maxCatchProbability
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinAttackAngle(minAttackAngle interface{}) ApiBeastStatsRequest {
|
|
r.minAttackAngle = &minAttackAngle
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxAttackAngle(maxAttackAngle interface{}) ApiBeastStatsRequest {
|
|
r.maxAttackAngle = &maxAttackAngle
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinBatSpeed(minBatSpeed interface{}) ApiBeastStatsRequest {
|
|
r.minBatSpeed = &minBatSpeed
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxBatSpeed(maxBatSpeed interface{}) ApiBeastStatsRequest {
|
|
r.maxBatSpeed = &maxBatSpeed
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiBeastStatsRequest) MinHomeRunXBallparks(minHomeRunXBallparks interface{}) ApiBeastStatsRequest {
|
|
r.minHomeRunXBallparks = &minHomeRunXBallparks
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiBeastStatsRequest) MaxHomeRunXBallparks(maxHomeRunXBallparks interface{}) ApiBeastStatsRequest {
|
|
r.maxHomeRunXBallparks = &maxHomeRunXBallparks
|
|
return r
|
|
}
|
|
|
|
// Whether or not a play resulted in a barreled ball
|
|
func (r ApiBeastStatsRequest) IsBarrel(isBarrel interface{}) ApiBeastStatsRequest {
|
|
r.isBarrel = &isBarrel
|
|
return r
|
|
}
|
|
|
|
// Trajectory of hit (line drive, fly ball, etc...)
|
|
func (r ApiBeastStatsRequest) HitTrajectories(hitTrajectories interface{}) ApiBeastStatsRequest {
|
|
r.hitTrajectories = &hitTrajectories
|
|
return r
|
|
}
|
|
|
|
// Number of results to return
|
|
func (r ApiBeastStatsRequest) Limit(limit interface{}) ApiBeastStatsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
// The pointer to start for a return set; used for pagination
|
|
func (r ApiBeastStatsRequest) Offset(offset interface{}) ApiBeastStatsRequest {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
// Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP
|
|
func (r ApiBeastStatsRequest) GroupBy(groupBy interface{}) ApiBeastStatsRequest {
|
|
r.groupBy = &groupBy
|
|
return r
|
|
}
|
|
|
|
// Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP
|
|
func (r ApiBeastStatsRequest) CompareOver(compareOver interface{}) ApiBeastStatsRequest {
|
|
r.compareOver = &compareOver
|
|
return r
|
|
}
|
|
|
|
// Baseball stat to sort splits by.
|
|
func (r ApiBeastStatsRequest) SortStat(sortStat interface{}) ApiBeastStatsRequest {
|
|
r.sortStat = &sortStat
|
|
return r
|
|
}
|
|
|
|
// The prefix modifier for the sort stat. avg, min, max. I.E minExitVelocity, maxLaunchAngle, avgHitDistance
|
|
func (r ApiBeastStatsRequest) SortModifier(sortModifier interface{}) ApiBeastStatsRequest {
|
|
r.sortModifier = &sortModifier
|
|
return r
|
|
}
|
|
|
|
// The order of sorting, ascending or descending
|
|
func (r ApiBeastStatsRequest) SortOrder(sortOrder interface{}) ApiBeastStatsRequest {
|
|
r.sortOrder = &sortOrder
|
|
return r
|
|
}
|
|
|
|
// Only return averages above this percentile. used for best effort plays
|
|
func (r ApiBeastStatsRequest) Percentile(percentile interface{}) ApiBeastStatsRequest {
|
|
r.percentile = &percentile
|
|
return r
|
|
}
|
|
|
|
// Minimum occurrences to filter upon
|
|
func (r ApiBeastStatsRequest) MinOccurrences(minOccurrences interface{}) ApiBeastStatsRequest {
|
|
r.minOccurrences = &minOccurrences
|
|
return r
|
|
}
|
|
|
|
// Minimum occurrences to filter upon
|
|
func (r ApiBeastStatsRequest) MinPlateAppearances(minPlateAppearances interface{}) ApiBeastStatsRequest {
|
|
r.minPlateAppearances = &minPlateAppearances
|
|
return r
|
|
}
|
|
|
|
// Minimum occurrences to filter upon
|
|
func (r ApiBeastStatsRequest) MinInnings(minInnings interface{}) ApiBeastStatsRequest {
|
|
r.minInnings = &minInnings
|
|
return r
|
|
}
|
|
|
|
// Minimum occurrences to filter upon
|
|
func (r ApiBeastStatsRequest) QualifierRate(qualifierRate interface{}) ApiBeastStatsRequest {
|
|
r.qualifierRate = &qualifierRate
|
|
return r
|
|
}
|
|
|
|
// Situation code for a given stat split.
|
|
func (r ApiBeastStatsRequest) SitCodes(sitCodes interface{}) ApiBeastStatsRequest {
|
|
r.sitCodes = &sitCodes
|
|
return r
|
|
}
|
|
|
|
// Columns to return totals
|
|
func (r ApiBeastStatsRequest) ShowTotals(showTotals interface{}) ApiBeastStatsRequest {
|
|
r.showTotals = &showTotals
|
|
return r
|
|
}
|
|
|
|
// Show events with null metrics
|
|
func (r ApiBeastStatsRequest) IncludeNullMetrics(includeNullMetrics interface{}) ApiBeastStatsRequest {
|
|
r.includeNullMetrics = &includeNullMetrics
|
|
return r
|
|
}
|
|
|
|
// Baseball stat fields to populate
|
|
func (r ApiBeastStatsRequest) StatFields(statFields interface{}) ApiBeastStatsRequest {
|
|
r.statFields = &statFields
|
|
return r
|
|
}
|
|
|
|
// The at bat number of a given game. Format: 1, 2, 3, etc
|
|
func (r ApiBeastStatsRequest) AtBatNumbers(atBatNumbers interface{}) ApiBeastStatsRequest {
|
|
r.atBatNumbers = &atBatNumbers
|
|
return r
|
|
}
|
|
|
|
// The pitch number of a given game. Format: 1, 2, 3, etc
|
|
func (r ApiBeastStatsRequest) PitchNumbers(pitchNumbers interface{}) ApiBeastStatsRequest {
|
|
r.pitchNumbers = &pitchNumbers
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiBeastStatsRequest) Fields(fields interface{}) ApiBeastStatsRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiBeastStatsRequest) Debug(debug interface{}) ApiBeastStatsRequest {
|
|
r.debug = &debug
|
|
return r
|
|
}
|
|
|
|
// Whether or not a player is active
|
|
func (r ApiBeastStatsRequest) ActiveStatus(activeStatus interface{}) ApiBeastStatsRequest {
|
|
r.activeStatus = &activeStatus
|
|
return r
|
|
}
|
|
|
|
func (r ApiBeastStatsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.BeastStatsExecute(r)
|
|
}
|
|
|
|
/*
|
|
BeastStats View stats from search
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiBeastStatsRequest
|
|
*/
|
|
func (a *StatsAPIService) BeastStats(ctx context.Context) ApiBeastStatsRequest {
|
|
return ApiBeastStatsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *StatsAPIService) BeastStatsExecute(r ApiBeastStatsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StatsAPIService.BeastStats")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/stats/search"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.group == nil {
|
|
return nil, reportError("group is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
if r.gamePks != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePks", r.gamePks, "", "")
|
|
}
|
|
if r.playIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playIds", r.playIds, "", "")
|
|
}
|
|
if r.seasons != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
|
|
}
|
|
if r.gameTypes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameTypes", r.gameTypes, "", "")
|
|
}
|
|
if r.date != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
|
|
}
|
|
if r.startDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
|
}
|
|
if r.endDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
|
}
|
|
if r.teamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
|
}
|
|
if r.pitcherTeamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherTeamIds", r.pitcherTeamIds, "", "")
|
|
}
|
|
if r.batterTeamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterTeamIds", r.batterTeamIds, "", "")
|
|
}
|
|
if r.sportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
|
}
|
|
if r.pitcherSportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherSportIds", r.pitcherSportIds, "", "")
|
|
}
|
|
if r.batterSportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterSportIds", r.batterSportIds, "", "")
|
|
}
|
|
if r.leagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
|
}
|
|
if r.pitcherLeagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherLeagueIds", r.pitcherLeagueIds, "", "")
|
|
}
|
|
if r.batterLeagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterLeagueIds", r.batterLeagueIds, "", "")
|
|
}
|
|
if r.divisionIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "divisionIds", r.divisionIds, "", "")
|
|
}
|
|
if r.pitcherDivisionIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherDivisionIds", r.pitcherDivisionIds, "", "")
|
|
}
|
|
if r.batterDivisionIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterDivisionIds", r.batterDivisionIds, "", "")
|
|
}
|
|
if r.pitchersOnTeamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchersOnTeamIds", r.pitchersOnTeamIds, "", "")
|
|
}
|
|
if r.battersOnTeamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "battersOnTeamIds", r.battersOnTeamIds, "", "")
|
|
}
|
|
if r.playerIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playerIds", r.playerIds, "", "")
|
|
}
|
|
if r.playerPool != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playerPool", r.playerPool, "", "")
|
|
}
|
|
if r.pitcherIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherIds", r.pitcherIds, "", "")
|
|
}
|
|
if r.batterIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterIds", r.batterIds, "", "")
|
|
}
|
|
if r.catcherIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "catcherIds", r.catcherIds, "", "")
|
|
}
|
|
if r.firstBasemanIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "firstBasemanIds", r.firstBasemanIds, "", "")
|
|
}
|
|
if r.secondBasemanIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "secondBasemanIds", r.secondBasemanIds, "", "")
|
|
}
|
|
if r.thirdBasemanIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "thirdBasemanIds", r.thirdBasemanIds, "", "")
|
|
}
|
|
if r.shortstopIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "shortstopIds", r.shortstopIds, "", "")
|
|
}
|
|
if r.leftFielderIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leftFielderIds", r.leftFielderIds, "", "")
|
|
}
|
|
if r.centerFielderIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "centerFielderIds", r.centerFielderIds, "", "")
|
|
}
|
|
if r.rightFielderIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "rightFielderIds", r.rightFielderIds, "", "")
|
|
}
|
|
if r.runnerFirstIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "runnerFirstIds", r.runnerFirstIds, "", "")
|
|
}
|
|
if r.runnerSecondIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "runnerSecondIds", r.runnerSecondIds, "", "")
|
|
}
|
|
if r.runnerThirdIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "runnerThirdIds", r.runnerThirdIds, "", "")
|
|
}
|
|
if r.venueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "venueIds", r.venueIds, "", "")
|
|
}
|
|
if r.pitchHand != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchHand", r.pitchHand, "", "")
|
|
}
|
|
if r.batSide != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batSide", r.batSide, "", "")
|
|
}
|
|
if r.pitchTypes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchTypes", r.pitchTypes, "", "")
|
|
}
|
|
if r.pitchCodes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchCodes", r.pitchCodes, "", "")
|
|
}
|
|
if r.eventTypes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "eventTypes", r.eventTypes, "", "")
|
|
}
|
|
if r.positions != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "positions", r.positions, "", "")
|
|
}
|
|
if r.primaryPositions != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "primaryPositions", r.primaryPositions, "", "")
|
|
}
|
|
if r.minPitchSpeed != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minPitchSpeed", r.minPitchSpeed, "", "")
|
|
}
|
|
if r.maxPitchSpeed != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxPitchSpeed", r.maxPitchSpeed, "", "")
|
|
}
|
|
if r.minSpinRate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minSpinRate", r.minSpinRate, "", "")
|
|
}
|
|
if r.maxSpinRate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxSpinRate", r.maxSpinRate, "", "")
|
|
}
|
|
if r.minExtension != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minExtension", r.minExtension, "", "")
|
|
}
|
|
if r.maxExtension != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxExtension", r.maxExtension, "", "")
|
|
}
|
|
if r.minExitVelocityAgainst != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minExitVelocityAgainst", r.minExitVelocityAgainst, "", "")
|
|
}
|
|
if r.maxExitVelocityAgainst != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxExitVelocityAgainst", r.maxExitVelocityAgainst, "", "")
|
|
}
|
|
if r.minLaunchAngleAgainst != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minLaunchAngleAgainst", r.minLaunchAngleAgainst, "", "")
|
|
}
|
|
if r.maxLaunchAngleAgainst != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxLaunchAngleAgainst", r.maxLaunchAngleAgainst, "", "")
|
|
}
|
|
if r.minExitVelocity != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minExitVelocity", r.minExitVelocity, "", "")
|
|
}
|
|
if r.maxExitVelocity != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxExitVelocity", r.maxExitVelocity, "", "")
|
|
}
|
|
if r.minLaunchAngle != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minLaunchAngle", r.minLaunchAngle, "", "")
|
|
}
|
|
if r.maxLaunchAngle != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxLaunchAngle", r.maxLaunchAngle, "", "")
|
|
}
|
|
if r.minHomeRunDistance != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minHomeRunDistance", r.minHomeRunDistance, "", "")
|
|
}
|
|
if r.maxHomeRunDistance != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxHomeRunDistance", r.maxHomeRunDistance, "", "")
|
|
}
|
|
if r.minHitDistance != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minHitDistance", r.minHitDistance, "", "")
|
|
}
|
|
if r.maxHitDistance != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxHitDistance", r.maxHitDistance, "", "")
|
|
}
|
|
if r.minHangTime != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minHangTime", r.minHangTime, "", "")
|
|
}
|
|
if r.maxHangTime != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxHangTime", r.maxHangTime, "", "")
|
|
}
|
|
if r.minHitProbability != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minHitProbability", r.minHitProbability, "", "")
|
|
}
|
|
if r.maxHitProbability != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxHitProbability", r.maxHitProbability, "", "")
|
|
}
|
|
if r.minCatchProbability != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minCatchProbability", r.minCatchProbability, "", "")
|
|
}
|
|
if r.maxCatchProbability != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxCatchProbability", r.maxCatchProbability, "", "")
|
|
}
|
|
if r.minAttackAngle != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minAttackAngle", r.minAttackAngle, "", "")
|
|
}
|
|
if r.maxAttackAngle != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxAttackAngle", r.maxAttackAngle, "", "")
|
|
}
|
|
if r.minBatSpeed != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minBatSpeed", r.minBatSpeed, "", "")
|
|
}
|
|
if r.maxBatSpeed != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxBatSpeed", r.maxBatSpeed, "", "")
|
|
}
|
|
if r.minHomeRunXBallparks != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minHomeRunXBallparks", r.minHomeRunXBallparks, "", "")
|
|
}
|
|
if r.maxHomeRunXBallparks != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxHomeRunXBallparks", r.maxHomeRunXBallparks, "", "")
|
|
}
|
|
if r.isBarrel != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "isBarrel", r.isBarrel, "", "")
|
|
}
|
|
if r.hitTrajectories != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "hitTrajectories", r.hitTrajectories, "", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
|
|
}
|
|
if r.groupBy != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "groupBy", r.groupBy, "", "")
|
|
}
|
|
if r.compareOver != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "compareOver", r.compareOver, "", "")
|
|
}
|
|
if r.sortStat != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sortStat", r.sortStat, "", "")
|
|
}
|
|
if r.sortModifier != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sortModifier", r.sortModifier, "", "")
|
|
}
|
|
if r.sortOrder != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "", "")
|
|
}
|
|
if r.percentile != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "percentile", r.percentile, "", "")
|
|
}
|
|
if r.minOccurrences != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minOccurrences", r.minOccurrences, "", "")
|
|
}
|
|
if r.minPlateAppearances != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minPlateAppearances", r.minPlateAppearances, "", "")
|
|
}
|
|
if r.minInnings != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minInnings", r.minInnings, "", "")
|
|
}
|
|
if r.qualifierRate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "qualifierRate", r.qualifierRate, "", "")
|
|
}
|
|
if r.sitCodes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
|
|
}
|
|
if r.showTotals != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "showTotals", r.showTotals, "", "")
|
|
}
|
|
if r.includeNullMetrics != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "includeNullMetrics", r.includeNullMetrics, "", "")
|
|
}
|
|
if r.statFields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "statFields", r.statFields, "", "")
|
|
}
|
|
if r.atBatNumbers != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "atBatNumbers", r.atBatNumbers, "", "")
|
|
}
|
|
if r.pitchNumbers != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchNumbers", r.pitchNumbers, "", "")
|
|
}
|
|
if r.fields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
|
}
|
|
if r.debug != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "debug", r.debug, "", "")
|
|
}
|
|
if r.activeStatus != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "activeStatus", r.activeStatus, "", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type ApiGetOutsAboveAverageRequest struct {
|
|
ctx context.Context
|
|
ApiService *StatsAPIService
|
|
gamePk *interface{}
|
|
timecode *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
func (r ApiGetOutsAboveAverageRequest) GamePk(gamePk interface{}) ApiGetOutsAboveAverageRequest {
|
|
r.gamePk = &gamePk
|
|
return r
|
|
}
|
|
|
|
func (r ApiGetOutsAboveAverageRequest) Timecode(timecode interface{}) ApiGetOutsAboveAverageRequest {
|
|
r.timecode = &timecode
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiGetOutsAboveAverageRequest) Fields(fields interface{}) ApiGetOutsAboveAverageRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiGetOutsAboveAverageRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetOutsAboveAverageExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetOutsAboveAverage Get outs above average for the current batter
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiGetOutsAboveAverageRequest
|
|
*/
|
|
func (a *StatsAPIService) GetOutsAboveAverage(ctx context.Context) ApiGetOutsAboveAverageRequest {
|
|
return ApiGetOutsAboveAverageRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *StatsAPIService) GetOutsAboveAverageExecute(r ApiGetOutsAboveAverageRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StatsAPIService.GetOutsAboveAverage")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/stats/analytics/outsAboveAverage"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.gamePk == nil {
|
|
return nil, reportError("gamePk is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePk", r.gamePk, "", "")
|
|
if r.timecode != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
|
|
}
|
|
if r.fields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type ApiGetSprayChartRequest struct {
|
|
ctx context.Context
|
|
ApiService *StatsAPIService
|
|
gamePk *interface{}
|
|
timecode *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
func (r ApiGetSprayChartRequest) GamePk(gamePk interface{}) ApiGetSprayChartRequest {
|
|
r.gamePk = &gamePk
|
|
return r
|
|
}
|
|
|
|
func (r ApiGetSprayChartRequest) Timecode(timecode interface{}) ApiGetSprayChartRequest {
|
|
r.timecode = &timecode
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiGetSprayChartRequest) Fields(fields interface{}) ApiGetSprayChartRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiGetSprayChartRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetSprayChartExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetSprayChart Get the spray chart info for the current batter
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiGetSprayChartRequest
|
|
*/
|
|
func (a *StatsAPIService) GetSprayChart(ctx context.Context) ApiGetSprayChartRequest {
|
|
return ApiGetSprayChartRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *StatsAPIService) GetSprayChartExecute(r ApiGetSprayChartRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StatsAPIService.GetSprayChart")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/stats/analytics/sprayChart"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.gamePk == nil {
|
|
return nil, reportError("gamePk is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePk", r.gamePk, "", "")
|
|
if r.timecode != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
|
|
}
|
|
if r.fields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type ApiGetStolenBaseProbabilityRequest struct {
|
|
ctx context.Context
|
|
ApiService *StatsAPIService
|
|
gamePk *interface{}
|
|
timecode *interface{}
|
|
}
|
|
|
|
func (r ApiGetStolenBaseProbabilityRequest) GamePk(gamePk interface{}) ApiGetStolenBaseProbabilityRequest {
|
|
r.gamePk = &gamePk
|
|
return r
|
|
}
|
|
|
|
func (r ApiGetStolenBaseProbabilityRequest) Timecode(timecode interface{}) ApiGetStolenBaseProbabilityRequest {
|
|
r.timecode = &timecode
|
|
return r
|
|
}
|
|
|
|
func (r ApiGetStolenBaseProbabilityRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GetStolenBaseProbabilityExecute(r)
|
|
}
|
|
|
|
/*
|
|
GetStolenBaseProbability Get the probability of a hit for the given hit data
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiGetStolenBaseProbabilityRequest
|
|
*/
|
|
func (a *StatsAPIService) GetStolenBaseProbability(ctx context.Context) ApiGetStolenBaseProbabilityRequest {
|
|
return ApiGetStolenBaseProbabilityRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *StatsAPIService) GetStolenBaseProbabilityExecute(r ApiGetStolenBaseProbabilityRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StatsAPIService.GetStolenBaseProbability")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/stats/analytics/stolenBaseProbability"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.gamePk == nil {
|
|
return nil, reportError("gamePk is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePk", r.gamePk, "", "")
|
|
if r.timecode != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type ApiGroupedStatsRequest struct {
|
|
ctx context.Context
|
|
ApiService *StatsAPIService
|
|
stats *interface{}
|
|
group *interface{}
|
|
personId *interface{}
|
|
teamId *interface{}
|
|
teamIds *interface{}
|
|
gameType *interface{}
|
|
season *interface{}
|
|
seasons *interface{}
|
|
sportId *interface{}
|
|
sportIds *interface{}
|
|
leagueId *interface{}
|
|
leagueIds *interface{}
|
|
leagueListId *interface{}
|
|
metrics *interface{}
|
|
gamePk *interface{}
|
|
batterTeamId *interface{}
|
|
pitcherTeamId *interface{}
|
|
batterId *interface{}
|
|
pitcherId *interface{}
|
|
sitCodes *interface{}
|
|
combineSits *interface{}
|
|
opposingTeamId *interface{}
|
|
fields *interface{}
|
|
sortStat *interface{}
|
|
order *interface{}
|
|
playerPool *interface{}
|
|
position *interface{}
|
|
startDate *interface{}
|
|
endDate *interface{}
|
|
daysBack *interface{}
|
|
gamesBack *interface{}
|
|
excludeTradedPlayers *interface{}
|
|
offset *interface{}
|
|
limit *interface{}
|
|
statFields *interface{}
|
|
sortField *interface{}
|
|
}
|
|
|
|
// Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
|
|
func (r ApiGroupedStatsRequest) Stats(stats interface{}) ApiGroupedStatsRequest {
|
|
r.stats = &stats
|
|
return r
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiGroupedStatsRequest) Group(group interface{}) ApiGroupedStatsRequest {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiGroupedStatsRequest) PersonId(personId interface{}) ApiGroupedStatsRequest {
|
|
r.personId = &personId
|
|
return r
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiGroupedStatsRequest) TeamId(teamId interface{}) ApiGroupedStatsRequest {
|
|
r.teamId = &teamId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique Team identifiers
|
|
func (r ApiGroupedStatsRequest) TeamIds(teamIds interface{}) ApiGroupedStatsRequest {
|
|
r.teamIds = &teamIds
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiGroupedStatsRequest) GameType(gameType interface{}) ApiGroupedStatsRequest {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiGroupedStatsRequest) Season(season interface{}) ApiGroupedStatsRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Seasons of play
|
|
func (r ApiGroupedStatsRequest) Seasons(seasons interface{}) ApiGroupedStatsRequest {
|
|
r.seasons = &seasons
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiGroupedStatsRequest) SportId(sportId interface{}) ApiGroupedStatsRequest {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiGroupedStatsRequest) SportIds(sportIds interface{}) ApiGroupedStatsRequest {
|
|
r.sportIds = &sportIds
|
|
return r
|
|
}
|
|
|
|
// Unique League Identifier
|
|
func (r ApiGroupedStatsRequest) LeagueId(leagueId interface{}) ApiGroupedStatsRequest {
|
|
r.leagueId = &leagueId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiGroupedStatsRequest) LeagueIds(leagueIds interface{}) ApiGroupedStatsRequest {
|
|
r.leagueIds = &leagueIds
|
|
return r
|
|
}
|
|
|
|
// Unique League List Identifier
|
|
func (r ApiGroupedStatsRequest) LeagueListId(leagueListId interface{}) ApiGroupedStatsRequest {
|
|
r.leagueListId = &leagueListId
|
|
return r
|
|
}
|
|
|
|
// Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics
|
|
func (r ApiGroupedStatsRequest) Metrics(metrics interface{}) ApiGroupedStatsRequest {
|
|
r.metrics = &metrics
|
|
return r
|
|
}
|
|
|
|
// Unique Primary Key Representing a Game
|
|
func (r ApiGroupedStatsRequest) GamePk(gamePk interface{}) ApiGroupedStatsRequest {
|
|
r.gamePk = &gamePk
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the batter's team
|
|
func (r ApiGroupedStatsRequest) BatterTeamId(batterTeamId interface{}) ApiGroupedStatsRequest {
|
|
r.batterTeamId = &batterTeamId
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the pitcher's team
|
|
func (r ApiGroupedStatsRequest) PitcherTeamId(pitcherTeamId interface{}) ApiGroupedStatsRequest {
|
|
r.pitcherTeamId = &pitcherTeamId
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiGroupedStatsRequest) BatterId(batterId interface{}) ApiGroupedStatsRequest {
|
|
r.batterId = &batterId
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiGroupedStatsRequest) PitcherId(pitcherId interface{}) ApiGroupedStatsRequest {
|
|
r.pitcherId = &pitcherId
|
|
return r
|
|
}
|
|
|
|
// Situation code for a given stat split.
|
|
func (r ApiGroupedStatsRequest) SitCodes(sitCodes interface{}) ApiGroupedStatsRequest {
|
|
r.sitCodes = &sitCodes
|
|
return r
|
|
}
|
|
|
|
// If true, gathers stats where all of the situational criteria are met. If false, returns stats where any of the situational criteria are met. Default: false
|
|
func (r ApiGroupedStatsRequest) CombineSits(combineSits interface{}) ApiGroupedStatsRequest {
|
|
r.combineSits = &combineSits
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the opposing team. Must be used with Team ID
|
|
func (r ApiGroupedStatsRequest) OpposingTeamId(opposingTeamId interface{}) ApiGroupedStatsRequest {
|
|
r.opposingTeamId = &opposingTeamId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiGroupedStatsRequest) Fields(fields interface{}) ApiGroupedStatsRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
// Baseball stat to sort splits by.
|
|
func (r ApiGroupedStatsRequest) SortStat(sortStat interface{}) ApiGroupedStatsRequest {
|
|
r.sortStat = &sortStat
|
|
return r
|
|
}
|
|
|
|
// The order of sorting, ascending or descending
|
|
func (r ApiGroupedStatsRequest) Order(order interface{}) ApiGroupedStatsRequest {
|
|
r.order = &order
|
|
return r
|
|
}
|
|
|
|
// Return \"ALL\" or only \"QUALIFIED\" players based on plate appearances.
|
|
func (r ApiGroupedStatsRequest) PlayerPool(playerPool interface{}) ApiGroupedStatsRequest {
|
|
r.playerPool = &playerPool
|
|
return r
|
|
}
|
|
|
|
// Position number. Format: 1, 2, 3, etc
|
|
func (r ApiGroupedStatsRequest) Position(position interface{}) ApiGroupedStatsRequest {
|
|
r.position = &position
|
|
return r
|
|
}
|
|
|
|
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
|
|
func (r ApiGroupedStatsRequest) StartDate(startDate interface{}) ApiGroupedStatsRequest {
|
|
r.startDate = &startDate
|
|
return r
|
|
}
|
|
|
|
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
|
|
func (r ApiGroupedStatsRequest) EndDate(endDate interface{}) ApiGroupedStatsRequest {
|
|
r.endDate = &endDate
|
|
return r
|
|
}
|
|
|
|
// Returns results from the last 'X' days (Starting from yesterday).
|
|
func (r ApiGroupedStatsRequest) DaysBack(daysBack interface{}) ApiGroupedStatsRequest {
|
|
r.daysBack = &daysBack
|
|
return r
|
|
}
|
|
|
|
// Returns results from the last 'X' games played.
|
|
func (r ApiGroupedStatsRequest) GamesBack(gamesBack interface{}) ApiGroupedStatsRequest {
|
|
r.gamesBack = &gamesBack
|
|
return r
|
|
}
|
|
|
|
// Excludes players who have since been traded from the input team
|
|
func (r ApiGroupedStatsRequest) ExcludeTradedPlayers(excludeTradedPlayers interface{}) ApiGroupedStatsRequest {
|
|
r.excludeTradedPlayers = &excludeTradedPlayers
|
|
return r
|
|
}
|
|
|
|
// The pointer to start for a return set; used for pagination
|
|
func (r ApiGroupedStatsRequest) Offset(offset interface{}) ApiGroupedStatsRequest {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
// Number of results to return
|
|
func (r ApiGroupedStatsRequest) Limit(limit interface{}) ApiGroupedStatsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
// Baseball stat fields to populate
|
|
func (r ApiGroupedStatsRequest) StatFields(statFields interface{}) ApiGroupedStatsRequest {
|
|
r.statFields = &statFields
|
|
return r
|
|
}
|
|
|
|
// Baseball statField to sort on. If no statField is given, sortField defaults to BASIC. If 1 statField is given, that is the default sortField.
|
|
func (r ApiGroupedStatsRequest) SortField(sortField interface{}) ApiGroupedStatsRequest {
|
|
r.sortField = &sortField
|
|
return r
|
|
}
|
|
|
|
func (r ApiGroupedStatsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.GroupedStatsExecute(r)
|
|
}
|
|
|
|
/*
|
|
GroupedStats View grouped stats
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiGroupedStatsRequest
|
|
*/
|
|
func (a *StatsAPIService) GroupedStats(ctx context.Context) ApiGroupedStatsRequest {
|
|
return ApiGroupedStatsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *StatsAPIService) GroupedStatsExecute(r ApiGroupedStatsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StatsAPIService.GroupedStats")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/stats/grouped"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.stats == nil {
|
|
return nil, reportError("stats is required and must be specified")
|
|
}
|
|
if r.group == nil {
|
|
return nil, reportError("group is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
|
|
if r.personId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "personId", r.personId, "", "")
|
|
}
|
|
if r.teamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
|
|
}
|
|
if r.teamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
if r.gameType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
|
|
}
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.seasons != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.sportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
|
}
|
|
if r.leagueId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
|
|
}
|
|
if r.leagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
|
}
|
|
if r.leagueListId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
|
|
}
|
|
if r.metrics != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "metrics", r.metrics, "", "")
|
|
}
|
|
if r.gamePk != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePk", r.gamePk, "", "")
|
|
}
|
|
if r.batterTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterTeamId", r.batterTeamId, "", "")
|
|
}
|
|
if r.pitcherTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherTeamId", r.pitcherTeamId, "", "")
|
|
}
|
|
if r.batterId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterId", r.batterId, "", "")
|
|
}
|
|
if r.pitcherId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherId", r.pitcherId, "", "")
|
|
}
|
|
if r.sitCodes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
|
|
}
|
|
if r.combineSits != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "combineSits", r.combineSits, "", "")
|
|
}
|
|
if r.opposingTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
|
|
}
|
|
if r.fields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
|
}
|
|
if r.sortStat != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sortStat", r.sortStat, "", "")
|
|
}
|
|
if r.order != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "")
|
|
}
|
|
if r.playerPool != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playerPool", r.playerPool, "", "")
|
|
}
|
|
if r.position != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "position", r.position, "", "")
|
|
}
|
|
if r.startDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
|
}
|
|
if r.endDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
|
}
|
|
if r.daysBack != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "daysBack", r.daysBack, "", "")
|
|
}
|
|
if r.gamesBack != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamesBack", r.gamesBack, "", "")
|
|
}
|
|
if r.excludeTradedPlayers != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "excludeTradedPlayers", r.excludeTradedPlayers, "", "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
|
}
|
|
if r.statFields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "statFields", r.statFields, "", "")
|
|
}
|
|
if r.sortField != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sortField", r.sortField, "", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type ApiLeaders2Request struct {
|
|
ctx context.Context
|
|
ApiService *StatsAPIService
|
|
leaderCategories *interface{}
|
|
leaderGameTypes *interface{}
|
|
statGroup *interface{}
|
|
season *interface{}
|
|
expand *interface{}
|
|
sportId *interface{}
|
|
sportIds *interface{}
|
|
stats *interface{}
|
|
limit *interface{}
|
|
offset *interface{}
|
|
teamId *interface{}
|
|
teamIds *interface{}
|
|
leagueId *interface{}
|
|
leagueIds *interface{}
|
|
leagueListId *interface{}
|
|
playerPool *interface{}
|
|
statType *interface{}
|
|
playerActive *interface{}
|
|
position *interface{}
|
|
sitCodes *interface{}
|
|
opposingTeamId *interface{}
|
|
startDate *interface{}
|
|
endDate *interface{}
|
|
daysBack *interface{}
|
|
gamesBack *interface{}
|
|
groupBy *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
func (r ApiLeaders2Request) LeaderCategories(leaderCategories interface{}) ApiLeaders2Request {
|
|
r.leaderCategories = &leaderCategories
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) LeaderGameTypes(leaderGameTypes interface{}) ApiLeaders2Request {
|
|
r.leaderGameTypes = &leaderGameTypes
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) StatGroup(statGroup interface{}) ApiLeaders2Request {
|
|
r.statGroup = &statGroup
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) Season(season interface{}) ApiLeaders2Request {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) Expand(expand interface{}) ApiLeaders2Request {
|
|
r.expand = &expand
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) SportId(sportId interface{}) ApiLeaders2Request {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) SportIds(sportIds interface{}) ApiLeaders2Request {
|
|
r.sportIds = &sportIds
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) Stats(stats interface{}) ApiLeaders2Request {
|
|
r.stats = &stats
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) Limit(limit interface{}) ApiLeaders2Request {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) Offset(offset interface{}) ApiLeaders2Request {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) TeamId(teamId interface{}) ApiLeaders2Request {
|
|
r.teamId = &teamId
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) TeamIds(teamIds interface{}) ApiLeaders2Request {
|
|
r.teamIds = &teamIds
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) LeagueId(leagueId interface{}) ApiLeaders2Request {
|
|
r.leagueId = &leagueId
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) LeagueIds(leagueIds interface{}) ApiLeaders2Request {
|
|
r.leagueIds = &leagueIds
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) LeagueListId(leagueListId interface{}) ApiLeaders2Request {
|
|
r.leagueListId = &leagueListId
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) PlayerPool(playerPool interface{}) ApiLeaders2Request {
|
|
r.playerPool = &playerPool
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) StatType(statType interface{}) ApiLeaders2Request {
|
|
r.statType = &statType
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) PlayerActive(playerActive interface{}) ApiLeaders2Request {
|
|
r.playerActive = &playerActive
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) Position(position interface{}) ApiLeaders2Request {
|
|
r.position = &position
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) SitCodes(sitCodes interface{}) ApiLeaders2Request {
|
|
r.sitCodes = &sitCodes
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) OpposingTeamId(opposingTeamId interface{}) ApiLeaders2Request {
|
|
r.opposingTeamId = &opposingTeamId
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) StartDate(startDate interface{}) ApiLeaders2Request {
|
|
r.startDate = &startDate
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) EndDate(endDate interface{}) ApiLeaders2Request {
|
|
r.endDate = &endDate
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) DaysBack(daysBack interface{}) ApiLeaders2Request {
|
|
r.daysBack = &daysBack
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) GamesBack(gamesBack interface{}) ApiLeaders2Request {
|
|
r.gamesBack = &gamesBack
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) GroupBy(groupBy interface{}) ApiLeaders2Request {
|
|
r.groupBy = &groupBy
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) Fields(fields interface{}) ApiLeaders2Request {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders2Request) Execute() (*http.Response, error) {
|
|
return r.ApiService.Leaders2Execute(r)
|
|
}
|
|
|
|
/*
|
|
Leaders2 Get leaders for a statistic
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiLeaders2Request
|
|
*/
|
|
func (a *StatsAPIService) Leaders2(ctx context.Context) ApiLeaders2Request {
|
|
return ApiLeaders2Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *StatsAPIService) Leaders2Execute(r ApiLeaders2Request) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StatsAPIService.Leaders2")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/stats/leaders"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.leaderCategories != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leaderCategories", r.leaderCategories, "", "")
|
|
}
|
|
if r.leaderGameTypes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leaderGameTypes", r.leaderGameTypes, "", "")
|
|
}
|
|
if r.statGroup != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "statGroup", r.statGroup, "", "")
|
|
}
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.expand != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "expand", r.expand, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.sportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
|
}
|
|
if r.stats != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
|
|
}
|
|
if r.teamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
|
|
}
|
|
if r.teamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
|
}
|
|
if r.leagueId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
|
|
}
|
|
if r.leagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
|
}
|
|
if r.leagueListId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
|
|
}
|
|
if r.playerPool != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playerPool", r.playerPool, "", "")
|
|
}
|
|
if r.statType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "statType", r.statType, "", "")
|
|
}
|
|
if r.playerActive != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playerActive", r.playerActive, "", "")
|
|
}
|
|
if r.position != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "position", r.position, "", "")
|
|
}
|
|
if r.sitCodes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
|
|
}
|
|
if r.opposingTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
|
|
}
|
|
if r.startDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
|
}
|
|
if r.endDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
|
}
|
|
if r.daysBack != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "daysBack", r.daysBack, "", "")
|
|
}
|
|
if r.gamesBack != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamesBack", r.gamesBack, "", "")
|
|
}
|
|
if r.groupBy != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "groupBy", r.groupBy, "", "")
|
|
}
|
|
if r.fields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type ApiMetricStatsRequest struct {
|
|
ctx context.Context
|
|
ApiService *StatsAPIService
|
|
stats *interface{}
|
|
metrics *interface{}
|
|
personId *interface{}
|
|
personIds *interface{}
|
|
batterId *interface{}
|
|
pitcherId *interface{}
|
|
teamId *interface{}
|
|
group *interface{}
|
|
season *interface{}
|
|
seasons *interface{}
|
|
sportId *interface{}
|
|
opposingTeamId *interface{}
|
|
opposingPlayerId *interface{}
|
|
position *interface{}
|
|
eventType *interface{}
|
|
pitchType *interface{}
|
|
hitTrajectory *interface{}
|
|
batSide *interface{}
|
|
pitchHand *interface{}
|
|
venueId *interface{}
|
|
gamePk *interface{}
|
|
minValue *interface{}
|
|
maxValue *interface{}
|
|
percentile *interface{}
|
|
minOccurrences *interface{}
|
|
offset *interface{}
|
|
limit *interface{}
|
|
order *interface{}
|
|
date *interface{}
|
|
startDate *interface{}
|
|
endDate *interface{}
|
|
gameType *interface{}
|
|
batterTeamId *interface{}
|
|
pitcherTeamId *interface{}
|
|
fields *interface{}
|
|
debug *interface{}
|
|
}
|
|
|
|
// Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
|
|
func (r ApiMetricStatsRequest) Stats(stats interface{}) ApiMetricStatsRequest {
|
|
r.stats = &stats
|
|
return r
|
|
}
|
|
|
|
// Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics
|
|
func (r ApiMetricStatsRequest) Metrics(metrics interface{}) ApiMetricStatsRequest {
|
|
r.metrics = &metrics
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiMetricStatsRequest) PersonId(personId interface{}) ApiMetricStatsRequest {
|
|
r.personId = &personId
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiMetricStatsRequest) PersonIds(personIds interface{}) ApiMetricStatsRequest {
|
|
r.personIds = &personIds
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiMetricStatsRequest) BatterId(batterId interface{}) ApiMetricStatsRequest {
|
|
r.batterId = &batterId
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiMetricStatsRequest) PitcherId(pitcherId interface{}) ApiMetricStatsRequest {
|
|
r.pitcherId = &pitcherId
|
|
return r
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiMetricStatsRequest) TeamId(teamId interface{}) ApiMetricStatsRequest {
|
|
r.teamId = &teamId
|
|
return r
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiMetricStatsRequest) Group(group interface{}) ApiMetricStatsRequest {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiMetricStatsRequest) Season(season interface{}) ApiMetricStatsRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Seasons of play
|
|
func (r ApiMetricStatsRequest) Seasons(seasons interface{}) ApiMetricStatsRequest {
|
|
r.seasons = &seasons
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiMetricStatsRequest) SportId(sportId interface{}) ApiMetricStatsRequest {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the opposing team. Must be used with Team ID
|
|
func (r ApiMetricStatsRequest) OpposingTeamId(opposingTeamId interface{}) ApiMetricStatsRequest {
|
|
r.opposingTeamId = &opposingTeamId
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the opposing team
|
|
func (r ApiMetricStatsRequest) OpposingPlayerId(opposingPlayerId interface{}) ApiMetricStatsRequest {
|
|
r.opposingPlayerId = &opposingPlayerId
|
|
return r
|
|
}
|
|
|
|
// All of the details of a player's position
|
|
func (r ApiMetricStatsRequest) Position(position interface{}) ApiMetricStatsRequest {
|
|
r.position = &position
|
|
return r
|
|
}
|
|
|
|
// Type of event
|
|
func (r ApiMetricStatsRequest) EventType(eventType interface{}) ApiMetricStatsRequest {
|
|
r.eventType = &eventType
|
|
return r
|
|
}
|
|
|
|
// Classification of pitch (fastball, curveball, etc...)
|
|
func (r ApiMetricStatsRequest) PitchType(pitchType interface{}) ApiMetricStatsRequest {
|
|
r.pitchType = &pitchType
|
|
return r
|
|
}
|
|
|
|
// Trajectory of hit (line drive, fly ball, etc...)
|
|
func (r ApiMetricStatsRequest) HitTrajectory(hitTrajectory interface{}) ApiMetricStatsRequest {
|
|
r.hitTrajectory = &hitTrajectory
|
|
return r
|
|
}
|
|
|
|
// Bat side of hitter
|
|
func (r ApiMetricStatsRequest) BatSide(batSide interface{}) ApiMetricStatsRequest {
|
|
r.batSide = &batSide
|
|
return r
|
|
}
|
|
|
|
// Handedness of pitcher
|
|
func (r ApiMetricStatsRequest) PitchHand(pitchHand interface{}) ApiMetricStatsRequest {
|
|
r.pitchHand = &pitchHand
|
|
return r
|
|
}
|
|
|
|
// All of the details of a venue
|
|
func (r ApiMetricStatsRequest) VenueId(venueId interface{}) ApiMetricStatsRequest {
|
|
r.venueId = &venueId
|
|
return r
|
|
}
|
|
|
|
// Unique Primary Key Representing a Game
|
|
func (r ApiMetricStatsRequest) GamePk(gamePk interface{}) ApiMetricStatsRequest {
|
|
r.gamePk = &gamePk
|
|
return r
|
|
}
|
|
|
|
// Minimum value to filter on
|
|
func (r ApiMetricStatsRequest) MinValue(minValue interface{}) ApiMetricStatsRequest {
|
|
r.minValue = &minValue
|
|
return r
|
|
}
|
|
|
|
// Maximum value to filter on
|
|
func (r ApiMetricStatsRequest) MaxValue(maxValue interface{}) ApiMetricStatsRequest {
|
|
r.maxValue = &maxValue
|
|
return r
|
|
}
|
|
|
|
// Only return averages above this percentile. used for best effort plays
|
|
func (r ApiMetricStatsRequest) Percentile(percentile interface{}) ApiMetricStatsRequest {
|
|
r.percentile = &percentile
|
|
return r
|
|
}
|
|
|
|
// Minimum occurrences to filter upon
|
|
func (r ApiMetricStatsRequest) MinOccurrences(minOccurrences interface{}) ApiMetricStatsRequest {
|
|
r.minOccurrences = &minOccurrences
|
|
return r
|
|
}
|
|
|
|
// The pointer to start for a return set; used for pagination
|
|
func (r ApiMetricStatsRequest) Offset(offset interface{}) ApiMetricStatsRequest {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
// Number of results to return
|
|
func (r ApiMetricStatsRequest) Limit(limit interface{}) ApiMetricStatsRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
// The order of sorting, ascending or descending
|
|
func (r ApiMetricStatsRequest) Order(order interface{}) ApiMetricStatsRequest {
|
|
r.order = &order
|
|
return r
|
|
}
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
func (r ApiMetricStatsRequest) Date(date interface{}) ApiMetricStatsRequest {
|
|
r.date = &date
|
|
return r
|
|
}
|
|
|
|
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
|
|
func (r ApiMetricStatsRequest) StartDate(startDate interface{}) ApiMetricStatsRequest {
|
|
r.startDate = &startDate
|
|
return r
|
|
}
|
|
|
|
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
|
|
func (r ApiMetricStatsRequest) EndDate(endDate interface{}) ApiMetricStatsRequest {
|
|
r.endDate = &endDate
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiMetricStatsRequest) GameType(gameType interface{}) ApiMetricStatsRequest {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the batter's team
|
|
func (r ApiMetricStatsRequest) BatterTeamId(batterTeamId interface{}) ApiMetricStatsRequest {
|
|
r.batterTeamId = &batterTeamId
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the pitcher's team
|
|
func (r ApiMetricStatsRequest) PitcherTeamId(pitcherTeamId interface{}) ApiMetricStatsRequest {
|
|
r.pitcherTeamId = &pitcherTeamId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiMetricStatsRequest) Fields(fields interface{}) ApiMetricStatsRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiMetricStatsRequest) Debug(debug interface{}) ApiMetricStatsRequest {
|
|
r.debug = &debug
|
|
return r
|
|
}
|
|
|
|
func (r ApiMetricStatsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.MetricStatsExecute(r)
|
|
}
|
|
|
|
/*
|
|
MetricStats View metric stats
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiMetricStatsRequest
|
|
*/
|
|
func (a *StatsAPIService) MetricStats(ctx context.Context) ApiMetricStatsRequest {
|
|
return ApiMetricStatsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *StatsAPIService) MetricStatsExecute(r ApiMetricStatsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StatsAPIService.MetricStats")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/stats/metrics"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.stats == nil {
|
|
return nil, reportError("stats is required and must be specified")
|
|
}
|
|
if r.metrics == nil {
|
|
return nil, reportError("metrics is required and must be specified")
|
|
}
|
|
|
|
if r.personId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "personId", r.personId, "", "")
|
|
}
|
|
if r.personIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "personIds", r.personIds, "", "")
|
|
}
|
|
if r.batterId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterId", r.batterId, "", "")
|
|
}
|
|
if r.pitcherId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherId", r.pitcherId, "", "")
|
|
}
|
|
if r.teamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
|
|
if r.group != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
}
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.seasons != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.opposingTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
|
|
}
|
|
if r.opposingPlayerId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingPlayerId", r.opposingPlayerId, "", "")
|
|
}
|
|
if r.position != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "position", r.position, "", "")
|
|
}
|
|
if r.eventType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "eventType", r.eventType, "", "")
|
|
}
|
|
if r.pitchType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchType", r.pitchType, "", "")
|
|
}
|
|
if r.hitTrajectory != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "hitTrajectory", r.hitTrajectory, "", "")
|
|
}
|
|
if r.batSide != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batSide", r.batSide, "", "")
|
|
}
|
|
if r.pitchHand != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchHand", r.pitchHand, "", "")
|
|
}
|
|
if r.venueId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "venueId", r.venueId, "", "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "metrics", r.metrics, "", "")
|
|
if r.gamePk != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePk", r.gamePk, "", "")
|
|
}
|
|
if r.minValue != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minValue", r.minValue, "", "")
|
|
}
|
|
if r.maxValue != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "maxValue", r.maxValue, "", "")
|
|
}
|
|
if r.percentile != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "percentile", r.percentile, "", "")
|
|
}
|
|
if r.minOccurrences != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "minOccurrences", r.minOccurrences, "", "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
|
}
|
|
if r.order != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "")
|
|
}
|
|
if r.date != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
|
|
}
|
|
if r.startDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
|
}
|
|
if r.endDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
|
}
|
|
if r.gameType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
|
|
}
|
|
if r.batterTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterTeamId", r.batterTeamId, "", "")
|
|
}
|
|
if r.pitcherTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherTeamId", r.pitcherTeamId, "", "")
|
|
}
|
|
if r.fields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
|
}
|
|
if r.debug != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "debug", r.debug, "", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|
|
|
|
type ApiStats2Request struct {
|
|
ctx context.Context
|
|
ApiService *StatsAPIService
|
|
stats *interface{}
|
|
group *interface{}
|
|
personId *interface{}
|
|
teamId *interface{}
|
|
teamIds *interface{}
|
|
gameType *interface{}
|
|
season *interface{}
|
|
seasons *interface{}
|
|
sportId *interface{}
|
|
sportIds *interface{}
|
|
leagueId *interface{}
|
|
leagueIds *interface{}
|
|
leagueListId *interface{}
|
|
metrics *interface{}
|
|
gamePk *interface{}
|
|
batterTeamId *interface{}
|
|
pitcherTeamId *interface{}
|
|
batterId *interface{}
|
|
pitcherId *interface{}
|
|
sitCodes *interface{}
|
|
combineSits *interface{}
|
|
opposingTeamId *interface{}
|
|
fields *interface{}
|
|
sortStat *interface{}
|
|
order *interface{}
|
|
playerPool *interface{}
|
|
position *interface{}
|
|
startDate *interface{}
|
|
endDate *interface{}
|
|
daysBack *interface{}
|
|
gamesBack *interface{}
|
|
excludeTradedPlayers *interface{}
|
|
offset *interface{}
|
|
limit *interface{}
|
|
}
|
|
|
|
// Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
|
|
func (r ApiStats2Request) Stats(stats interface{}) ApiStats2Request {
|
|
r.stats = &stats
|
|
return r
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiStats2Request) Group(group interface{}) ApiStats2Request {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiStats2Request) PersonId(personId interface{}) ApiStats2Request {
|
|
r.personId = &personId
|
|
return r
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiStats2Request) TeamId(teamId interface{}) ApiStats2Request {
|
|
r.teamId = &teamId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique Team identifiers
|
|
func (r ApiStats2Request) TeamIds(teamIds interface{}) ApiStats2Request {
|
|
r.teamIds = &teamIds
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiStats2Request) GameType(gameType interface{}) ApiStats2Request {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiStats2Request) Season(season interface{}) ApiStats2Request {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Seasons of play
|
|
func (r ApiStats2Request) Seasons(seasons interface{}) ApiStats2Request {
|
|
r.seasons = &seasons
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiStats2Request) SportId(sportId interface{}) ApiStats2Request {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiStats2Request) SportIds(sportIds interface{}) ApiStats2Request {
|
|
r.sportIds = &sportIds
|
|
return r
|
|
}
|
|
|
|
// Unique League Identifier
|
|
func (r ApiStats2Request) LeagueId(leagueId interface{}) ApiStats2Request {
|
|
r.leagueId = &leagueId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiStats2Request) LeagueIds(leagueIds interface{}) ApiStats2Request {
|
|
r.leagueIds = &leagueIds
|
|
return r
|
|
}
|
|
|
|
// Unique League List Identifier
|
|
func (r ApiStats2Request) LeagueListId(leagueListId interface{}) ApiStats2Request {
|
|
r.leagueListId = &leagueListId
|
|
return r
|
|
}
|
|
|
|
// Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics
|
|
func (r ApiStats2Request) Metrics(metrics interface{}) ApiStats2Request {
|
|
r.metrics = &metrics
|
|
return r
|
|
}
|
|
|
|
// Unique Primary Key Representing a Game
|
|
func (r ApiStats2Request) GamePk(gamePk interface{}) ApiStats2Request {
|
|
r.gamePk = &gamePk
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the batter's team
|
|
func (r ApiStats2Request) BatterTeamId(batterTeamId interface{}) ApiStats2Request {
|
|
r.batterTeamId = &batterTeamId
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the pitcher's team
|
|
func (r ApiStats2Request) PitcherTeamId(pitcherTeamId interface{}) ApiStats2Request {
|
|
r.pitcherTeamId = &pitcherTeamId
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiStats2Request) BatterId(batterId interface{}) ApiStats2Request {
|
|
r.batterId = &batterId
|
|
return r
|
|
}
|
|
|
|
// Unique Player Identifier. Format: 434538, 429665, etc
|
|
func (r ApiStats2Request) PitcherId(pitcherId interface{}) ApiStats2Request {
|
|
r.pitcherId = &pitcherId
|
|
return r
|
|
}
|
|
|
|
// Situation code for a given stat split.
|
|
func (r ApiStats2Request) SitCodes(sitCodes interface{}) ApiStats2Request {
|
|
r.sitCodes = &sitCodes
|
|
return r
|
|
}
|
|
|
|
// If true, gathers stats where all of the situational criteria are met. If false, returns stats where any of the situational criteria are met. Default: false
|
|
func (r ApiStats2Request) CombineSits(combineSits interface{}) ApiStats2Request {
|
|
r.combineSits = &combineSits
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the opposing team. Must be used with Team ID
|
|
func (r ApiStats2Request) OpposingTeamId(opposingTeamId interface{}) ApiStats2Request {
|
|
r.opposingTeamId = &opposingTeamId
|
|
return r
|
|
}
|
|
|
|
func (r ApiStats2Request) Fields(fields interface{}) ApiStats2Request {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
// Baseball stat to sort splits by.
|
|
func (r ApiStats2Request) SortStat(sortStat interface{}) ApiStats2Request {
|
|
r.sortStat = &sortStat
|
|
return r
|
|
}
|
|
|
|
// The order of sorting, ascending or descending
|
|
func (r ApiStats2Request) Order(order interface{}) ApiStats2Request {
|
|
r.order = &order
|
|
return r
|
|
}
|
|
|
|
// Return \"ALL\" or only \"QUALIFIED\" players based on plate appearances.
|
|
func (r ApiStats2Request) PlayerPool(playerPool interface{}) ApiStats2Request {
|
|
r.playerPool = &playerPool
|
|
return r
|
|
}
|
|
|
|
// Position number. Format: 1, 2, 3, etc
|
|
func (r ApiStats2Request) Position(position interface{}) ApiStats2Request {
|
|
r.position = &position
|
|
return r
|
|
}
|
|
|
|
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
|
|
func (r ApiStats2Request) StartDate(startDate interface{}) ApiStats2Request {
|
|
r.startDate = &startDate
|
|
return r
|
|
}
|
|
|
|
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
|
|
func (r ApiStats2Request) EndDate(endDate interface{}) ApiStats2Request {
|
|
r.endDate = &endDate
|
|
return r
|
|
}
|
|
|
|
// Returns results from the last 'X' days (Starting from yesterday).
|
|
func (r ApiStats2Request) DaysBack(daysBack interface{}) ApiStats2Request {
|
|
r.daysBack = &daysBack
|
|
return r
|
|
}
|
|
|
|
// Returns results from the last 'X' games played.
|
|
func (r ApiStats2Request) GamesBack(gamesBack interface{}) ApiStats2Request {
|
|
r.gamesBack = &gamesBack
|
|
return r
|
|
}
|
|
|
|
// Excludes players who have since been traded from the input team
|
|
func (r ApiStats2Request) ExcludeTradedPlayers(excludeTradedPlayers interface{}) ApiStats2Request {
|
|
r.excludeTradedPlayers = &excludeTradedPlayers
|
|
return r
|
|
}
|
|
|
|
// The pointer to start for a return set; used for pagination
|
|
func (r ApiStats2Request) Offset(offset interface{}) ApiStats2Request {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
// Number of results to return
|
|
func (r ApiStats2Request) Limit(limit interface{}) ApiStats2Request {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r ApiStats2Request) Execute() (*http.Response, error) {
|
|
return r.ApiService.Stats2Execute(r)
|
|
}
|
|
|
|
/*
|
|
Stats2 View stats
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiStats2Request
|
|
*/
|
|
func (a *StatsAPIService) Stats2(ctx context.Context) ApiStats2Request {
|
|
return ApiStats2Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *StatsAPIService) Stats2Execute(r ApiStats2Request) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StatsAPIService.Stats2")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/stats"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.stats == nil {
|
|
return nil, reportError("stats is required and must be specified")
|
|
}
|
|
if r.group == nil {
|
|
return nil, reportError("group is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
|
|
if r.personId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "personId", r.personId, "", "")
|
|
}
|
|
if r.teamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
|
|
}
|
|
if r.teamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
if r.gameType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
|
|
}
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.seasons != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.sportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
|
}
|
|
if r.leagueId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
|
|
}
|
|
if r.leagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
|
}
|
|
if r.leagueListId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
|
|
}
|
|
if r.metrics != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "metrics", r.metrics, "", "")
|
|
}
|
|
if r.gamePk != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePk", r.gamePk, "", "")
|
|
}
|
|
if r.batterTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterTeamId", r.batterTeamId, "", "")
|
|
}
|
|
if r.pitcherTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherTeamId", r.pitcherTeamId, "", "")
|
|
}
|
|
if r.batterId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "batterId", r.batterId, "", "")
|
|
}
|
|
if r.pitcherId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherId", r.pitcherId, "", "")
|
|
}
|
|
if r.sitCodes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
|
|
}
|
|
if r.combineSits != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "combineSits", r.combineSits, "", "")
|
|
}
|
|
if r.opposingTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
|
|
}
|
|
if r.fields != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
|
}
|
|
if r.sortStat != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sortStat", r.sortStat, "", "")
|
|
}
|
|
if r.order != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "")
|
|
}
|
|
if r.playerPool != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playerPool", r.playerPool, "", "")
|
|
}
|
|
if r.position != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "position", r.position, "", "")
|
|
}
|
|
if r.startDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
|
}
|
|
if r.endDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
|
}
|
|
if r.daysBack != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "daysBack", r.daysBack, "", "")
|
|
}
|
|
if r.gamesBack != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamesBack", r.gamesBack, "", "")
|
|
}
|
|
if r.excludeTradedPlayers != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "excludeTradedPlayers", r.excludeTradedPlayers, "", "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarHTTPResponse, nil
|
|
}
|