/*
Copyright (C) 2025 filifa

This file is part of mlbstats.

mlbstats 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.

mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
*/

/*
 * Stats API Documentation
 *
 * Official API for Major League Baseball.
 *
 * API version: 2.0.0
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package api

import (
	"context"
	"fmt"
	"github.com/antihax/optional"
	"io/ioutil"
	"net/http"
	"net/url"
	"scm.dairydemon.net/filifa/mlbstats/api/models"
	"strings"
	"time"
)

// Linger please
var (
	_ context.Context
)

type PersonApiService service

/*
PersonApiService View a player&#x27;s awards
 * @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 optional nil or *PersonApiAwardOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.AwardsRestObject
*/

type PersonApiAwardOpts struct {
	Fields optional.Interface
}

func (a *PersonApiService) Award(ctx context.Context, personId int32, localVarOptionals *PersonApiAwardOpts) (models.AwardsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.AwardsRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people/{personId}/awards"
	localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", fmt.Sprintf("%v", personId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.AwardsRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
PersonApiService View a player&#x27;s change log
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param updatedSince Format: YYYY-MM-DDTHH:MM:SSZ
 * @param optional nil or *PersonApiCurrentGameStatsOpts - Optional Parameters:
     * @param "Limit" (optional.Int32) -  Number of results to return
     * @param "Offset" (optional.Int32) -  The pointer to start for a return set; used for pagination
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.PeopleRestObject
*/

type PersonApiCurrentGameStatsOpts struct {
	Limit  optional.Int32
	Offset optional.Int32
	Accent optional.Bool
	Fields optional.Interface
}

func (a *PersonApiService) CurrentGameStats(ctx context.Context, updatedSince time.Time, localVarOptionals *PersonApiCurrentGameStatsOpts) (models.PeopleRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.PeopleRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people/changes"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	localVarQueryParams.Add("updatedSince", parameterToString(updatedSince, ""))
	if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
		localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Offset.IsSet() {
		localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.PeopleRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
PersonApiService Get free agents
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param season Season of play
 * @param optional nil or *PersonApiFreeAgentsOpts - Optional Parameters:
     * @param "Order" (optional.Interface of SortOrderEnum) -  The order of sorting, ascending or descending
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
     * @param "Fields" (optional.Interface of []string) -
@return models.FreeAgentListRestObject
*/

type PersonApiFreeAgentsOpts struct {
	Order  optional.Interface
	Accent optional.Bool
	Fields optional.Interface
}

func (a *PersonApiService) FreeAgents(ctx context.Context, season string, localVarOptionals *PersonApiFreeAgentsOpts) (models.FreeAgentListRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.FreeAgentListRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people/freeAgents"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	localVarQueryParams.Add("season", parameterToString(season, ""))
	if localVarOptionals != nil && localVarOptionals.Order.IsSet() {
		localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.FreeAgentListRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
PersonApiService View a player
This endpoint allows you to pull the information of players
 * @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 optional nil or *PersonApiPersonOpts - Optional Parameters:
     * @param "PersonIds" (optional.Interface of []int32) -  Comma delimited list of person ID. Format: 1234, 2345
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
     * @param "Season" (optional.String) -  Season of play
     * @param "Group" (optional.Interface of []StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.PeopleRestObject
*/

type PersonApiPersonOpts struct {
	PersonIds optional.Interface
	Accent    optional.Bool
	Season    optional.String
	Group     optional.Interface
	Fields    optional.Interface
}

func (a *PersonApiService) Person(ctx context.Context, personId int32, localVarOptionals *PersonApiPersonOpts) (models.PeopleRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.PeopleRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people/{personId}"
	localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", fmt.Sprintf("%v", personId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.PersonIds.IsSet() {
		localVarQueryParams.Add("personIds", parameterToString(localVarOptionals.PersonIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Group.IsSet() {
		localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.PeopleRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
PersonApiService View a player
This endpoint allows you to pull the information of players
 * @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 optional nil or *PersonApiPerson1Opts - Optional Parameters:
     * @param "PersonIds" (optional.Interface of []int32) -  Comma delimited list of person ID. Format: 1234, 2345
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
     * @param "Season" (optional.String) -  Season of play
     * @param "Group" (optional.Interface of []StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.PeopleRestObject
*/

type PersonApiPerson1Opts struct {
	PersonIds optional.Interface
	Accent    optional.Bool
	Season    optional.String
	Group     optional.Interface
	Fields    optional.Interface
}

func (a *PersonApiService) Person1(ctx context.Context, personId int32, localVarOptionals *PersonApiPerson1Opts) (models.PeopleRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.PeopleRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people"
	localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", fmt.Sprintf("%v", personId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.PersonIds.IsSet() {
		localVarQueryParams.Add("personIds", parameterToString(localVarOptionals.PersonIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Group.IsSet() {
		localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.PeopleRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
PersonApiService View a player&#x27;s game 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
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *PersonApiPlayerGameStatsOpts - Optional Parameters:
     * @param "Group" (optional.Interface of []StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.StatsRestObject
*/

type PersonApiPlayerGameStatsOpts struct {
	Group  optional.Interface
	Fields optional.Interface
}

func (a *PersonApiService) PlayerGameStats(ctx context.Context, personId int32, gamePk int32, localVarOptionals *PersonApiPlayerGameStatsOpts) (models.StatsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.StatsRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people/{personId}/stats/game/{gamePk}"
	localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", fmt.Sprintf("%v", personId), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.Group.IsSet() {
		localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.StatsRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
PersonApiService Search for a player by name
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param optional nil or *PersonApiSearchOpts - Optional Parameters:
     * @param "Names" (optional.Interface of []string) -  Name a player uses
     * @param "PersonIds" (optional.Interface of []int32) -  Comma delimited list of person ID. Format: 1234, 2345
     * @param "SportIds" (optional.Interface of []int32) -  Comma delimited list of top level organizations of a sport
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "TeamIds" (optional.Interface of []int32) -  Comma delimited list of Unique Team identifiers
     * @param "LeagueListId" (optional.Interface of LeagueListsEnum) -  Unique League List Identifier
     * @param "Active" (optional.Bool) -  Whether or not a player is active
     * @param "Verified" (optional.Bool) -  Complete and confirmed all biographical data
     * @param "Rookie" (optional.Bool) -  Whether or not a player is a rookie
     * @param "Seasons" (optional.Interface of []string) -  Comma delimited list of Seasons of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
     * @param "Limit" (optional.Int32) -  Number of results to return
@return models.PeopleRestObject
*/

type PersonApiSearchOpts struct {
	Names        optional.Interface
	PersonIds    optional.Interface
	SportIds     optional.Interface
	LeagueIds    optional.Interface
	TeamIds      optional.Interface
	LeagueListId optional.Interface
	Active       optional.Bool
	Verified     optional.Bool
	Rookie       optional.Bool
	Seasons      optional.Interface
	Fields       optional.Interface
	Accent       optional.Bool
	Limit        optional.Int32
}

func (a *PersonApiService) Search(ctx context.Context, localVarOptionals *PersonApiSearchOpts) (models.PeopleRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.PeopleRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people/search"

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.Names.IsSet() {
		localVarQueryParams.Add("names", parameterToString(localVarOptionals.Names.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.PersonIds.IsSet() {
		localVarQueryParams.Add("personIds", parameterToString(localVarOptionals.PersonIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
		localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.TeamIds.IsSet() {
		localVarQueryParams.Add("teamIds", parameterToString(localVarOptionals.TeamIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueListId.IsSet() {
		localVarQueryParams.Add("leagueListId", parameterToString(localVarOptionals.LeagueListId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Active.IsSet() {
		localVarQueryParams.Add("active", parameterToString(localVarOptionals.Active.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Verified.IsSet() {
		localVarQueryParams.Add("verified", parameterToString(localVarOptionals.Verified.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Rookie.IsSet() {
		localVarQueryParams.Add("rookie", parameterToString(localVarOptionals.Rookie.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
		localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
		localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.PeopleRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
PersonApiService 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
 * @param stats Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
 * @param optional nil or *PersonApiStats3Opts - Optional Parameters:
     * @param "Group" (optional.Interface of []StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "Season" (optional.String) -  Season of play
     * @param "Seasons" (optional.Interface of []string) -  Comma delimited list of Seasons of play
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "OpposingTeamId" (optional.Int32) -  A unique identifier for the opposing team. Must be used with Team ID
     * @param "OpposingPlayerId" (optional.Int32) -  A unique identifier for the opposing team
     * @param "Metrics" (optional.Interface of []MetricType) -  Name of metric(s) for metric log stats.  Available metrics in /api/v1/metrics
     * @param "LeagueId" (optional.Int32) -  Unique League Identifier
     * @param "LeagueListId" (optional.Interface of LeagueListsEnum) -  Unique League List Identifier
     * @param "SitCodes" (optional.Interface of []string) -  Situation code for a given stat split.
     * @param "CombineSits" (optional.Bool) -  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
     * @param "StartDate" (optional.String) -  Start date for range of data (must be used with end date). Format: MM/DD/YYYY
     * @param "EndDate" (optional.String) -  End date for range of data (must be used with start date). Format: MM/DD/YYYY
     * @param "DaysBack" (optional.Int32) -  Returns results from the last &#x27;X&#x27; days (Starting from yesterday).
     * @param "GamesBack" (optional.Int32) -  Returns results from the last &#x27;X&#x27; games played.
     * @param "Limit" (optional.Int32) -  Number of results to return
     * @param "EventType" (optional.Interface of []EventType) -  Type of event
     * @param "PitchType" (optional.Interface of []string) -  Classification of pitch (fastball, curveball, etc...)
     * @param "HitTrajectory" (optional.Interface of []HitTrajectory) -  Trajectory of hit (line drive, fly ball, etc...)
     * @param "BatSide" (optional.String) -  Bat side of hitter
     * @param "GameType" (optional.Interface of []models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "GroupBy" (optional.Interface of []models.GroupByEnum) -  Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.StatsRestObject
*/

type PersonApiStats3Opts struct {
	Group            optional.Interface
	Season           optional.String
	Seasons          optional.Interface
	SportId          optional.Int32
	OpposingTeamId   optional.Int32
	OpposingPlayerId optional.Int32
	Metrics          optional.Interface
	LeagueId         optional.Int32
	LeagueListId     optional.Interface
	SitCodes         optional.Interface
	CombineSits      optional.Bool
	StartDate        optional.String
	EndDate          optional.String
	DaysBack         optional.Int32
	GamesBack        optional.Int32
	Limit            optional.Int32
	EventType        optional.Interface
	PitchType        optional.Interface
	HitTrajectory    optional.Interface
	BatSide          optional.String
	GameType         optional.Interface
	GroupBy          optional.Interface
	Accent           optional.Bool
	Fields           optional.Interface
}

func (a *PersonApiService) Stats3(ctx context.Context, personId int32, stats []models.StatType, localVarOptionals *PersonApiStats3Opts) (models.StatsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.StatsRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people/{personId}/stats"
	localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", fmt.Sprintf("%v", personId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	localVarQueryParams.Add("stats", parameterToString(stats, "multi"))
	if localVarOptionals != nil && localVarOptionals.Group.IsSet() {
		localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
		localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.OpposingTeamId.IsSet() {
		localVarQueryParams.Add("opposingTeamId", parameterToString(localVarOptionals.OpposingTeamId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.OpposingPlayerId.IsSet() {
		localVarQueryParams.Add("opposingPlayerId", parameterToString(localVarOptionals.OpposingPlayerId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Metrics.IsSet() {
		localVarQueryParams.Add("metrics", parameterToString(localVarOptionals.Metrics.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
		localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueListId.IsSet() {
		localVarQueryParams.Add("leagueListId", parameterToString(localVarOptionals.LeagueListId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SitCodes.IsSet() {
		localVarQueryParams.Add("sitCodes", parameterToString(localVarOptionals.SitCodes.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.CombineSits.IsSet() {
		localVarQueryParams.Add("combineSits", parameterToString(localVarOptionals.CombineSits.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.StartDate.IsSet() {
		localVarQueryParams.Add("startDate", parameterToString(localVarOptionals.StartDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EndDate.IsSet() {
		localVarQueryParams.Add("endDate", parameterToString(localVarOptionals.EndDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.DaysBack.IsSet() {
		localVarQueryParams.Add("daysBack", parameterToString(localVarOptionals.DaysBack.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GamesBack.IsSet() {
		localVarQueryParams.Add("gamesBack", parameterToString(localVarOptionals.GamesBack.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
		localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EventType.IsSet() {
		localVarQueryParams.Add("eventType", parameterToString(localVarOptionals.EventType.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.PitchType.IsSet() {
		localVarQueryParams.Add("pitchType", parameterToString(localVarOptionals.PitchType.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.HitTrajectory.IsSet() {
		localVarQueryParams.Add("hitTrajectory", parameterToString(localVarOptionals.HitTrajectory.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.BatSide.IsSet() {
		localVarQueryParams.Add("batSide", parameterToString(localVarOptionals.BatSide.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.GroupBy.IsSet() {
		localVarQueryParams.Add("groupBy", parameterToString(localVarOptionals.GroupBy.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.StatsRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
PersonApiService View a player&#x27;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
 * @param stats Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
 * @param optional nil or *PersonApiStatsMetricsOpts - Optional Parameters:
     * @param "Group" (optional.Interface of []StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "Season" (optional.String) -  Season of play
     * @param "Seasons" (optional.Interface of []string) -  Comma delimited list of Seasons of play
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "OpposingTeamId" (optional.Int32) -  A unique identifier for the opposing team. Must be used with Team ID
     * @param "OpposingPlayerId" (optional.Int32) -  A unique identifier for the opposing team
     * @param "Metrics" (optional.Interface of []MetricType) -  Name of metric(s) for metric log stats.  Available metrics in /api/v1/metrics
     * @param "LeagueId" (optional.Int32) -  Unique League Identifier
     * @param "LeagueListId" (optional.Interface of LeagueListsEnum) -  Unique League List Identifier
     * @param "SitCodes" (optional.Interface of []string) -  Situation code for a given stat split.
     * @param "CombineSits" (optional.Bool) -  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
     * @param "StartDate" (optional.String) -  Start date for range of data (must be used with end date). Format: MM/DD/YYYY
     * @param "EndDate" (optional.String) -  End date for range of data (must be used with start date). Format: MM/DD/YYYY
     * @param "DaysBack" (optional.Int32) -  Returns results from the last &#x27;X&#x27; days (Starting from yesterday).
     * @param "GamesBack" (optional.Int32) -  Returns results from the last &#x27;X&#x27; games played.
     * @param "Limit" (optional.Int32) -  Number of results to return
     * @param "EventType" (optional.Interface of []EventType) -  Type of event
     * @param "PitchType" (optional.Interface of []string) -  Classification of pitch (fastball, curveball, etc...)
     * @param "HitTrajectory" (optional.Interface of []HitTrajectory) -  Trajectory of hit (line drive, fly ball, etc...)
     * @param "BatSide" (optional.String) -  Bat side of hitter
     * @param "GameType" (optional.Interface of []models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "GroupBy" (optional.Interface of []models.GroupByEnum) -  Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.StatsRestObject
*/

type PersonApiStatsMetricsOpts struct {
	Group            optional.Interface
	Season           optional.String
	Seasons          optional.Interface
	SportId          optional.Int32
	OpposingTeamId   optional.Int32
	OpposingPlayerId optional.Int32
	Metrics          optional.Interface
	LeagueId         optional.Int32
	LeagueListId     optional.Interface
	SitCodes         optional.Interface
	CombineSits      optional.Bool
	StartDate        optional.String
	EndDate          optional.String
	DaysBack         optional.Int32
	GamesBack        optional.Int32
	Limit            optional.Int32
	EventType        optional.Interface
	PitchType        optional.Interface
	HitTrajectory    optional.Interface
	BatSide          optional.String
	GameType         optional.Interface
	GroupBy          optional.Interface
	Accent           optional.Bool
	Fields           optional.Interface
}

func (a *PersonApiService) StatsMetrics(ctx context.Context, personId int32, stats []models.StatType, localVarOptionals *PersonApiStatsMetricsOpts) (models.StatsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.StatsRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/people/{personId}/stats/metrics"
	localVarPath = strings.Replace(localVarPath, "{"+"personId"+"}", fmt.Sprintf("%v", personId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	localVarQueryParams.Add("stats", parameterToString(stats, "multi"))
	if localVarOptionals != nil && localVarOptionals.Group.IsSet() {
		localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
		localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.OpposingTeamId.IsSet() {
		localVarQueryParams.Add("opposingTeamId", parameterToString(localVarOptionals.OpposingTeamId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.OpposingPlayerId.IsSet() {
		localVarQueryParams.Add("opposingPlayerId", parameterToString(localVarOptionals.OpposingPlayerId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Metrics.IsSet() {
		localVarQueryParams.Add("metrics", parameterToString(localVarOptionals.Metrics.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
		localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueListId.IsSet() {
		localVarQueryParams.Add("leagueListId", parameterToString(localVarOptionals.LeagueListId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SitCodes.IsSet() {
		localVarQueryParams.Add("sitCodes", parameterToString(localVarOptionals.SitCodes.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.CombineSits.IsSet() {
		localVarQueryParams.Add("combineSits", parameterToString(localVarOptionals.CombineSits.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.StartDate.IsSet() {
		localVarQueryParams.Add("startDate", parameterToString(localVarOptionals.StartDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EndDate.IsSet() {
		localVarQueryParams.Add("endDate", parameterToString(localVarOptionals.EndDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.DaysBack.IsSet() {
		localVarQueryParams.Add("daysBack", parameterToString(localVarOptionals.DaysBack.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GamesBack.IsSet() {
		localVarQueryParams.Add("gamesBack", parameterToString(localVarOptionals.GamesBack.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
		localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EventType.IsSet() {
		localVarQueryParams.Add("eventType", parameterToString(localVarOptionals.EventType.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.PitchType.IsSet() {
		localVarQueryParams.Add("pitchType", parameterToString(localVarOptionals.PitchType.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.HitTrajectory.IsSet() {
		localVarQueryParams.Add("hitTrajectory", parameterToString(localVarOptionals.HitTrajectory.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.BatSide.IsSet() {
		localVarQueryParams.Add("batSide", parameterToString(localVarOptionals.BatSide.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.GroupBy.IsSet() {
		localVarQueryParams.Add("groupBy", parameterToString(localVarOptionals.GroupBy.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v models.StatsRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}
