mlbstats/api/api_person.go

1684 lines
50 KiB
Go
Raw Normal View History

2025-04-06 04:55:01 +00:00
/*
2025-04-06 23:39:04 +00:00
Stats API Documentation
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
Official API for Major League Baseball.
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
API version: 2.0.0
2025-04-06 04:55:01 +00:00
*/
2025-04-06 23:39:04 +00:00
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
2025-04-06 04:55:01 +00:00
package api
import (
2025-04-06 23:39:04 +00:00
"bytes"
2025-04-06 04:55:01 +00:00
"context"
2025-04-06 23:39:04 +00:00
"io"
2025-04-06 04:55:01 +00:00
"net/http"
"net/url"
"strings"
)
2025-04-06 23:39:04 +00:00
// PersonAPIService PersonAPI service
type PersonAPIService service
type ApiAwardRequest struct {
ctx context.Context
ApiService *PersonAPIService
personId interface{}
fields *interface{}
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiAwardRequest) Fields(fields interface{}) ApiAwardRequest {
r.fields = &fields
return r
}
func (r ApiAwardRequest) Execute() (*http.Response, error) {
return r.ApiService.AwardExecute(r)
}
2025-04-06 04:55:01 +00:00
/*
2025-04-06 23:39:04 +00:00
Award View a player's awards
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param personId Unique Player Identifier. Format: 434538, 429665, etc
@return ApiAwardRequest
*/
func (a *PersonAPIService) Award(ctx context.Context, personId interface{}) ApiAwardRequest {
return ApiAwardRequest{
ApiService: a,
ctx: ctx,
personId: personId,
}
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) AwardExecute(r ApiAwardRequest) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.Award")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people/{personId}/awards"
localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", url.PathEscape(parameterValueToString(r.personId, "personId")), -1)
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
}
type ApiCurrentGameStatsRequest struct {
ctx context.Context
ApiService *PersonAPIService
updatedSince *interface{}
limit *interface{}
offset *interface{}
accent *interface{}
fields *interface{}
}
// Format: YYYY-MM-DDTHH:MM:SSZ
func (r ApiCurrentGameStatsRequest) UpdatedSince(updatedSince interface{}) ApiCurrentGameStatsRequest {
r.updatedSince = &updatedSince
return r
}
// Number of results to return
func (r ApiCurrentGameStatsRequest) Limit(limit interface{}) ApiCurrentGameStatsRequest {
r.limit = &limit
return r
}
// The pointer to start for a return set; used for pagination
func (r ApiCurrentGameStatsRequest) Offset(offset interface{}) ApiCurrentGameStatsRequest {
r.offset = &offset
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiCurrentGameStatsRequest) Accent(accent interface{}) ApiCurrentGameStatsRequest {
r.accent = &accent
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiCurrentGameStatsRequest) Fields(fields interface{}) ApiCurrentGameStatsRequest {
r.fields = &fields
return r
}
func (r ApiCurrentGameStatsRequest) Execute() (*http.Response, error) {
return r.ApiService.CurrentGameStatsExecute(r)
2025-04-06 04:55:01 +00:00
}
/*
2025-04-06 23:39:04 +00:00
CurrentGameStats View a player's change log
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiCurrentGameStatsRequest
*/
func (a *PersonAPIService) CurrentGameStats(ctx context.Context) ApiCurrentGameStatsRequest {
return ApiCurrentGameStatsRequest{
ApiService: a,
ctx: ctx,
}
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) CurrentGameStatsExecute(r ApiCurrentGameStatsRequest) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.CurrentGameStats")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people/changes"
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.updatedSince == nil {
return nil, reportError("updatedSince is required and must be specified")
}
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
parameterAddToHeaderOrQuery(localVarQueryParams, "updatedSince", r.updatedSince, "", "")
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
}
type ApiFreeAgentsRequest struct {
ctx context.Context
ApiService *PersonAPIService
season *interface{}
order *interface{}
accent *interface{}
fields *interface{}
}
// Season of play
func (r ApiFreeAgentsRequest) Season(season interface{}) ApiFreeAgentsRequest {
r.season = &season
return r
}
// The order of sorting, ascending or descending
func (r ApiFreeAgentsRequest) Order(order interface{}) ApiFreeAgentsRequest {
r.order = &order
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiFreeAgentsRequest) Accent(accent interface{}) ApiFreeAgentsRequest {
r.accent = &accent
return r
}
func (r ApiFreeAgentsRequest) Fields(fields interface{}) ApiFreeAgentsRequest {
r.fields = &fields
return r
}
func (r ApiFreeAgentsRequest) Execute() (*http.Response, error) {
return r.ApiService.FreeAgentsExecute(r)
2025-04-06 04:55:01 +00:00
}
/*
2025-04-06 23:39:04 +00:00
FreeAgents Get free agents
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiFreeAgentsRequest
*/
func (a *PersonAPIService) FreeAgents(ctx context.Context) ApiFreeAgentsRequest {
return ApiFreeAgentsRequest{
ApiService: a,
ctx: ctx,
}
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) FreeAgentsExecute(r ApiFreeAgentsRequest) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.FreeAgents")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people/freeAgents"
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.season == nil {
return nil, reportError("season is required and must be specified")
}
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
if r.order != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
}
type ApiPersonRequest struct {
ctx context.Context
ApiService *PersonAPIService
personId interface{}
personIds *interface{}
accent *interface{}
season *interface{}
group *interface{}
fields *interface{}
}
// Comma delimited list of person ID. Format: 1234, 2345
func (r ApiPersonRequest) PersonIds(personIds interface{}) ApiPersonRequest {
r.personIds = &personIds
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiPersonRequest) Accent(accent interface{}) ApiPersonRequest {
r.accent = &accent
return r
}
// Season of play
func (r ApiPersonRequest) Season(season interface{}) ApiPersonRequest {
r.season = &season
return r
}
// Category of statistic to return. Available types in /api/v1/statGroups
func (r ApiPersonRequest) Group(group interface{}) ApiPersonRequest {
r.group = &group
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiPersonRequest) Fields(fields interface{}) ApiPersonRequest {
r.fields = &fields
return r
}
func (r ApiPersonRequest) Execute() (*http.Response, error) {
return r.ApiService.PersonExecute(r)
2025-04-06 04:55:01 +00:00
}
/*
2025-04-06 23:39:04 +00:00
Person View a player
2025-04-06 04:55:01 +00:00
This endpoint allows you to pull the information of players
2025-04-06 23:39:04 +00:00
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param personId Unique Player Identifier. Format: 434538, 429665, etc
@return ApiPersonRequest
*/
func (a *PersonAPIService) Person(ctx context.Context, personId interface{}) ApiPersonRequest {
return ApiPersonRequest{
ApiService: a,
ctx: ctx,
personId: personId,
}
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) PersonExecute(r ApiPersonRequest) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.Person")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people/{personId}"
localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", url.PathEscape(parameterValueToString(r.personId, "personId")), -1)
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.personIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "personIds", r.personIds, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.group != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
}
type ApiPerson1Request struct {
ctx context.Context
ApiService *PersonAPIService
personId interface{}
personIds *interface{}
accent *interface{}
season *interface{}
group *interface{}
fields *interface{}
}
// Comma delimited list of person ID. Format: 1234, 2345
func (r ApiPerson1Request) PersonIds(personIds interface{}) ApiPerson1Request {
r.personIds = &personIds
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiPerson1Request) Accent(accent interface{}) ApiPerson1Request {
r.accent = &accent
return r
}
// Season of play
func (r ApiPerson1Request) Season(season interface{}) ApiPerson1Request {
r.season = &season
return r
}
// Category of statistic to return. Available types in /api/v1/statGroups
func (r ApiPerson1Request) Group(group interface{}) ApiPerson1Request {
r.group = &group
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiPerson1Request) Fields(fields interface{}) ApiPerson1Request {
r.fields = &fields
return r
}
func (r ApiPerson1Request) Execute() (*http.Response, error) {
return r.ApiService.Person1Execute(r)
2025-04-06 04:55:01 +00:00
}
/*
2025-04-06 23:39:04 +00:00
Person1 View a player
2025-04-06 04:55:01 +00:00
This endpoint allows you to pull the information of players
2025-04-06 23:39:04 +00:00
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param personId Unique Player Identifier. Format: 434538, 429665, etc
@return ApiPerson1Request
*/
func (a *PersonAPIService) Person1(ctx context.Context, personId interface{}) ApiPerson1Request {
return ApiPerson1Request{
ApiService: a,
ctx: ctx,
personId: personId,
}
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) Person1Execute(r ApiPerson1Request) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.Person1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people"
localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", url.PathEscape(parameterValueToString(r.personId, "personId")), -1)
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.personIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "personIds", r.personIds, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.group != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
}
type ApiPlayerGameStatsRequest struct {
ctx context.Context
ApiService *PersonAPIService
personId interface{}
gamePk interface{}
group *interface{}
fields *interface{}
}
// Category of statistic to return. Available types in /api/v1/statGroups
func (r ApiPlayerGameStatsRequest) Group(group interface{}) ApiPlayerGameStatsRequest {
r.group = &group
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiPlayerGameStatsRequest) Fields(fields interface{}) ApiPlayerGameStatsRequest {
r.fields = &fields
return r
}
func (r ApiPlayerGameStatsRequest) Execute() (*http.Response, error) {
return r.ApiService.PlayerGameStatsExecute(r)
2025-04-06 04:55:01 +00:00
}
/*
2025-04-06 23:39:04 +00:00
PlayerGameStats View a player's game stats
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param personId Unique Player Identifier. Format: 434538, 429665, etc
@param gamePk Unique Primary Key Representing a Game
@return ApiPlayerGameStatsRequest
*/
func (a *PersonAPIService) PlayerGameStats(ctx context.Context, personId interface{}, gamePk interface{}) ApiPlayerGameStatsRequest {
return ApiPlayerGameStatsRequest{
ApiService: a,
ctx: ctx,
personId: personId,
gamePk: gamePk,
}
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) PlayerGameStatsExecute(r ApiPlayerGameStatsRequest) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.PlayerGameStats")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people/{personId}/stats/game/{gamePk}"
localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", url.PathEscape(parameterValueToString(r.personId, "personId")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.group != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
}
type ApiSearchRequest struct {
ctx context.Context
ApiService *PersonAPIService
names *interface{}
personIds *interface{}
sportIds *interface{}
leagueIds *interface{}
teamIds *interface{}
leagueListId *interface{}
active *interface{}
verified *interface{}
rookie *interface{}
seasons *interface{}
fields *interface{}
accent *interface{}
limit *interface{}
}
// Name a player uses
func (r ApiSearchRequest) Names(names interface{}) ApiSearchRequest {
r.names = &names
return r
}
// Comma delimited list of person ID. Format: 1234, 2345
func (r ApiSearchRequest) PersonIds(personIds interface{}) ApiSearchRequest {
r.personIds = &personIds
return r
}
// Comma delimited list of top level organizations of a sport
func (r ApiSearchRequest) SportIds(sportIds interface{}) ApiSearchRequest {
r.sportIds = &sportIds
return r
}
// Comma delimited list of Unique league identifiers
func (r ApiSearchRequest) LeagueIds(leagueIds interface{}) ApiSearchRequest {
r.leagueIds = &leagueIds
return r
}
// Comma delimited list of Unique Team identifiers
func (r ApiSearchRequest) TeamIds(teamIds interface{}) ApiSearchRequest {
r.teamIds = &teamIds
return r
}
// Unique League List Identifier
func (r ApiSearchRequest) LeagueListId(leagueListId interface{}) ApiSearchRequest {
r.leagueListId = &leagueListId
return r
}
// Whether or not a player is active
func (r ApiSearchRequest) Active(active interface{}) ApiSearchRequest {
r.active = &active
return r
}
// Complete and confirmed all biographical data
func (r ApiSearchRequest) Verified(verified interface{}) ApiSearchRequest {
r.verified = &verified
return r
}
// Whether or not a player is a rookie
func (r ApiSearchRequest) Rookie(rookie interface{}) ApiSearchRequest {
r.rookie = &rookie
return r
}
// Comma delimited list of Seasons of play
func (r ApiSearchRequest) Seasons(seasons interface{}) ApiSearchRequest {
r.seasons = &seasons
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiSearchRequest) Fields(fields interface{}) ApiSearchRequest {
r.fields = &fields
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiSearchRequest) Accent(accent interface{}) ApiSearchRequest {
r.accent = &accent
return r
}
// Number of results to return
func (r ApiSearchRequest) Limit(limit interface{}) ApiSearchRequest {
r.limit = &limit
return r
}
func (r ApiSearchRequest) Execute() (*http.Response, error) {
return r.ApiService.SearchExecute(r)
2025-04-06 04:55:01 +00:00
}
/*
2025-04-06 23:39:04 +00:00
Search Search for a player by name
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiSearchRequest
2025-04-06 04:55:01 +00:00
*/
2025-04-06 23:39:04 +00:00
func (a *PersonAPIService) Search(ctx context.Context) ApiSearchRequest {
return ApiSearchRequest{
ApiService: a,
ctx: ctx,
}
}
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) SearchExecute(r ApiSearchRequest) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.Search")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people/search"
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.names != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "names", r.names, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.personIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "personIds", r.personIds, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.sportIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.leagueIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.teamIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.leagueListId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.active != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "active", r.active, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.verified != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "verified", r.verified, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.rookie != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "rookie", r.rookie, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.seasons != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
}
type ApiStats3Request struct {
ctx context.Context
ApiService *PersonAPIService
personId interface{}
stats *interface{}
group *interface{}
season *interface{}
seasons *interface{}
sportId *interface{}
opposingTeamId *interface{}
opposingPlayerId *interface{}
metrics *interface{}
leagueId *interface{}
leagueListId *interface{}
sitCodes *interface{}
combineSits *interface{}
startDate *interface{}
endDate *interface{}
daysBack *interface{}
gamesBack *interface{}
limit *interface{}
eventType *interface{}
pitchType *interface{}
hitTrajectory *interface{}
batSide *interface{}
gameType *interface{}
groupBy *interface{}
accent *interface{}
fields *interface{}
}
// Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
func (r ApiStats3Request) Stats(stats interface{}) ApiStats3Request {
r.stats = &stats
return r
}
// Category of statistic to return. Available types in /api/v1/statGroups
func (r ApiStats3Request) Group(group interface{}) ApiStats3Request {
r.group = &group
return r
}
// Season of play
func (r ApiStats3Request) Season(season interface{}) ApiStats3Request {
r.season = &season
return r
}
// Comma delimited list of Seasons of play
func (r ApiStats3Request) Seasons(seasons interface{}) ApiStats3Request {
r.seasons = &seasons
return r
}
// Top level organization of a sport
func (r ApiStats3Request) SportId(sportId interface{}) ApiStats3Request {
r.sportId = &sportId
return r
}
// A unique identifier for the opposing team. Must be used with Team ID
func (r ApiStats3Request) OpposingTeamId(opposingTeamId interface{}) ApiStats3Request {
r.opposingTeamId = &opposingTeamId
return r
}
// A unique identifier for the opposing team
func (r ApiStats3Request) OpposingPlayerId(opposingPlayerId interface{}) ApiStats3Request {
r.opposingPlayerId = &opposingPlayerId
return r
}
// Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics
func (r ApiStats3Request) Metrics(metrics interface{}) ApiStats3Request {
r.metrics = &metrics
return r
}
// Unique League Identifier
func (r ApiStats3Request) LeagueId(leagueId interface{}) ApiStats3Request {
r.leagueId = &leagueId
return r
}
// Unique League List Identifier
func (r ApiStats3Request) LeagueListId(leagueListId interface{}) ApiStats3Request {
r.leagueListId = &leagueListId
return r
}
// Situation code for a given stat split.
func (r ApiStats3Request) SitCodes(sitCodes interface{}) ApiStats3Request {
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 ApiStats3Request) CombineSits(combineSits interface{}) ApiStats3Request {
r.combineSits = &combineSits
return r
}
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
func (r ApiStats3Request) StartDate(startDate interface{}) ApiStats3Request {
r.startDate = &startDate
return r
}
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
func (r ApiStats3Request) EndDate(endDate interface{}) ApiStats3Request {
r.endDate = &endDate
return r
}
// Returns results from the last 'X' days (Starting from yesterday).
func (r ApiStats3Request) DaysBack(daysBack interface{}) ApiStats3Request {
r.daysBack = &daysBack
return r
}
// Returns results from the last 'X' games played.
func (r ApiStats3Request) GamesBack(gamesBack interface{}) ApiStats3Request {
r.gamesBack = &gamesBack
return r
}
// Number of results to return
func (r ApiStats3Request) Limit(limit interface{}) ApiStats3Request {
r.limit = &limit
return r
}
// Type of event
func (r ApiStats3Request) EventType(eventType interface{}) ApiStats3Request {
r.eventType = &eventType
return r
}
// Classification of pitch (fastball, curveball, etc...)
func (r ApiStats3Request) PitchType(pitchType interface{}) ApiStats3Request {
r.pitchType = &pitchType
return r
}
// Trajectory of hit (line drive, fly ball, etc...)
func (r ApiStats3Request) HitTrajectory(hitTrajectory interface{}) ApiStats3Request {
r.hitTrajectory = &hitTrajectory
return r
}
// Bat side of hitter
func (r ApiStats3Request) BatSide(batSide interface{}) ApiStats3Request {
r.batSide = &batSide
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiStats3Request) GameType(gameType interface{}) ApiStats3Request {
r.gameType = &gameType
return r
}
// Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP
func (r ApiStats3Request) GroupBy(groupBy interface{}) ApiStats3Request {
r.groupBy = &groupBy
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiStats3Request) Accent(accent interface{}) ApiStats3Request {
r.accent = &accent
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiStats3Request) Fields(fields interface{}) ApiStats3Request {
r.fields = &fields
return r
}
func (r ApiStats3Request) Execute() (*http.Response, error) {
return r.ApiService.Stats3Execute(r)
2025-04-06 04:55:01 +00:00
}
/*
2025-04-06 23:39:04 +00:00
Stats3 View a players stats
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param personId Unique Player Identifier. Format: 434538, 429665, etc
@return ApiStats3Request
2025-04-06 04:55:01 +00:00
*/
2025-04-06 23:39:04 +00:00
func (a *PersonAPIService) Stats3(ctx context.Context, personId interface{}) ApiStats3Request {
return ApiStats3Request{
ApiService: a,
ctx: ctx,
personId: personId,
}
}
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) Stats3Execute(r ApiStats3Request) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.Stats3")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people/{personId}/stats"
localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", url.PathEscape(parameterValueToString(r.personId, "personId")), -1)
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.stats == nil {
return nil, reportError("stats is required and must be specified")
}
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
if r.group != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.seasons != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.opposingTeamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.opposingPlayerId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingPlayerId", r.opposingPlayerId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.metrics != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "metrics", r.metrics, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.leagueListId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.sitCodes != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.combineSits != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "combineSits", r.combineSits, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.startDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.endDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.daysBack != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "daysBack", r.daysBack, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.gamesBack != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gamesBack", r.gamesBack, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.eventType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "eventType", r.eventType, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.pitchType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchType", r.pitchType, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.hitTrajectory != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "hitTrajectory", r.hitTrajectory, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.batSide != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "batSide", r.batSide, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.groupBy != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "groupBy", r.groupBy, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
}
type ApiStatsMetricsRequest struct {
ctx context.Context
ApiService *PersonAPIService
personId interface{}
stats *interface{}
group *interface{}
season *interface{}
seasons *interface{}
sportId *interface{}
opposingTeamId *interface{}
opposingPlayerId *interface{}
metrics *interface{}
leagueId *interface{}
leagueListId *interface{}
sitCodes *interface{}
combineSits *interface{}
startDate *interface{}
endDate *interface{}
daysBack *interface{}
gamesBack *interface{}
limit *interface{}
eventType *interface{}
pitchType *interface{}
hitTrajectory *interface{}
batSide *interface{}
gameType *interface{}
groupBy *interface{}
accent *interface{}
fields *interface{}
}
// Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
func (r ApiStatsMetricsRequest) Stats(stats interface{}) ApiStatsMetricsRequest {
r.stats = &stats
return r
}
// Category of statistic to return. Available types in /api/v1/statGroups
func (r ApiStatsMetricsRequest) Group(group interface{}) ApiStatsMetricsRequest {
r.group = &group
return r
}
// Season of play
func (r ApiStatsMetricsRequest) Season(season interface{}) ApiStatsMetricsRequest {
r.season = &season
return r
}
// Comma delimited list of Seasons of play
func (r ApiStatsMetricsRequest) Seasons(seasons interface{}) ApiStatsMetricsRequest {
r.seasons = &seasons
return r
}
// Top level organization of a sport
func (r ApiStatsMetricsRequest) SportId(sportId interface{}) ApiStatsMetricsRequest {
r.sportId = &sportId
return r
}
// A unique identifier for the opposing team. Must be used with Team ID
func (r ApiStatsMetricsRequest) OpposingTeamId(opposingTeamId interface{}) ApiStatsMetricsRequest {
r.opposingTeamId = &opposingTeamId
return r
}
// A unique identifier for the opposing team
func (r ApiStatsMetricsRequest) OpposingPlayerId(opposingPlayerId interface{}) ApiStatsMetricsRequest {
r.opposingPlayerId = &opposingPlayerId
return r
}
// Name of metric(s) for metric log stats. Available metrics in /api/v1/metrics
func (r ApiStatsMetricsRequest) Metrics(metrics interface{}) ApiStatsMetricsRequest {
r.metrics = &metrics
return r
}
// Unique League Identifier
func (r ApiStatsMetricsRequest) LeagueId(leagueId interface{}) ApiStatsMetricsRequest {
r.leagueId = &leagueId
return r
}
// Unique League List Identifier
func (r ApiStatsMetricsRequest) LeagueListId(leagueListId interface{}) ApiStatsMetricsRequest {
r.leagueListId = &leagueListId
return r
}
// Situation code for a given stat split.
func (r ApiStatsMetricsRequest) SitCodes(sitCodes interface{}) ApiStatsMetricsRequest {
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 ApiStatsMetricsRequest) CombineSits(combineSits interface{}) ApiStatsMetricsRequest {
r.combineSits = &combineSits
return r
}
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
func (r ApiStatsMetricsRequest) StartDate(startDate interface{}) ApiStatsMetricsRequest {
r.startDate = &startDate
return r
}
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
func (r ApiStatsMetricsRequest) EndDate(endDate interface{}) ApiStatsMetricsRequest {
r.endDate = &endDate
return r
}
// Returns results from the last 'X' days (Starting from yesterday).
func (r ApiStatsMetricsRequest) DaysBack(daysBack interface{}) ApiStatsMetricsRequest {
r.daysBack = &daysBack
return r
}
// Returns results from the last 'X' games played.
func (r ApiStatsMetricsRequest) GamesBack(gamesBack interface{}) ApiStatsMetricsRequest {
r.gamesBack = &gamesBack
return r
}
// Number of results to return
func (r ApiStatsMetricsRequest) Limit(limit interface{}) ApiStatsMetricsRequest {
r.limit = &limit
return r
}
// Type of event
func (r ApiStatsMetricsRequest) EventType(eventType interface{}) ApiStatsMetricsRequest {
r.eventType = &eventType
return r
}
// Classification of pitch (fastball, curveball, etc...)
func (r ApiStatsMetricsRequest) PitchType(pitchType interface{}) ApiStatsMetricsRequest {
r.pitchType = &pitchType
return r
}
// Trajectory of hit (line drive, fly ball, etc...)
func (r ApiStatsMetricsRequest) HitTrajectory(hitTrajectory interface{}) ApiStatsMetricsRequest {
r.hitTrajectory = &hitTrajectory
return r
}
// Bat side of hitter
func (r ApiStatsMetricsRequest) BatSide(batSide interface{}) ApiStatsMetricsRequest {
r.batSide = &batSide
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiStatsMetricsRequest) GameType(gameType interface{}) ApiStatsMetricsRequest {
r.gameType = &gameType
return r
}
// Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP
func (r ApiStatsMetricsRequest) GroupBy(groupBy interface{}) ApiStatsMetricsRequest {
r.groupBy = &groupBy
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiStatsMetricsRequest) Accent(accent interface{}) ApiStatsMetricsRequest {
r.accent = &accent
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiStatsMetricsRequest) Fields(fields interface{}) ApiStatsMetricsRequest {
r.fields = &fields
return r
}
func (r ApiStatsMetricsRequest) Execute() (*http.Response, error) {
return r.ApiService.StatsMetricsExecute(r)
2025-04-06 04:55:01 +00:00
}
/*
2025-04-06 23:39:04 +00:00
StatsMetrics View a player's stat metrics
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param personId Unique Player Identifier. Format: 434538, 429665, etc
@return ApiStatsMetricsRequest
2025-04-06 04:55:01 +00:00
*/
2025-04-06 23:39:04 +00:00
func (a *PersonAPIService) StatsMetrics(ctx context.Context, personId interface{}) ApiStatsMetricsRequest {
return ApiStatsMetricsRequest{
ApiService: a,
ctx: ctx,
personId: personId,
}
}
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
// Execute executes the request
func (a *PersonAPIService) StatsMetricsExecute(r ApiStatsMetricsRequest) (*http.Response, error) {
2025-04-06 04:55:01 +00:00
var (
2025-04-06 23:39:04 +00:00
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
2025-04-06 04:55:01 +00:00
)
2025-04-06 23:39:04 +00:00
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PersonAPIService.StatsMetrics")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/people/{personId}/stats/metrics"
localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", url.PathEscape(parameterValueToString(r.personId, "personId")), -1)
2025-04-06 04:55:01 +00:00
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
2025-04-06 23:39:04 +00:00
if r.stats == nil {
return nil, reportError("stats is required and must be specified")
}
2025-04-06 04:55:01 +00:00
2025-04-06 23:39:04 +00:00
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
if r.group != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.seasons != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.opposingTeamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.opposingPlayerId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingPlayerId", r.opposingPlayerId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.metrics != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "metrics", r.metrics, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.leagueListId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.sitCodes != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.combineSits != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "combineSits", r.combineSits, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.startDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.endDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.daysBack != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "daysBack", r.daysBack, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.gamesBack != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gamesBack", r.gamesBack, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.eventType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "eventType", r.eventType, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.pitchType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchType", r.pitchType, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.hitTrajectory != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "hitTrajectory", r.hitTrajectory, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.batSide != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "batSide", r.batSide, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.groupBy != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "groupBy", r.groupBy, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
2025-04-06 04:55:01 +00:00
}
// to determine the Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentTypes := []string{}
2025-04-06 04:55:01 +00:00
// set Content-Type header
2025-04-06 23:39:04 +00:00
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
2025-04-06 04:55:01 +00:00
}
// to determine the Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccepts := []string{}
2025-04-06 04:55:01 +00:00
// set Accept header
2025-04-06 23:39:04 +00:00
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return nil, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
2025-04-06 04:55:01 +00:00
if err != nil {
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, err
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
2025-04-06 04:55:01 +00:00
body: localVarBody,
2025-04-06 23:39:04 +00:00
error: localVarHTTPResponse.Status,
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, newErr
2025-04-06 04:55:01 +00:00
}
2025-04-06 23:39:04 +00:00
return localVarHTTPResponse, nil
2025-04-06 04:55:01 +00:00
}