/*
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"
)

// Linger please
var (
	_ context.Context
)

type GameApiService service

/*
GameApiService Get game boxscore.
This endpoint allows you to pull a boxscore
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiBoxscoreOpts - Optional Parameters:
     * @param "Timecode" (optional.String) -  Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "InclusiveTimecode" (optional.Bool) -  True to include plays that happen before or at the specified timecode
     * @param "NumPlayers" (optional.Int32) -  Number of top player game scores to show. Default is 3.
     * @param "NoTies" (optional.Bool) -  If set to false, will show all players tied for the last spot in the game scores list.
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
@return models.BaseballBoxscoreRestObject
*/

type GameApiBoxscoreOpts struct {
	Timecode          optional.String
	Fields            optional.Interface
	InclusiveTimecode optional.Bool
	NumPlayers        optional.Int32
	NoTies            optional.Bool
	Accent            optional.Bool
}

func (a *GameApiService) Boxscore(ctx context.Context, gamePk int32, localVarOptionals *GameApiBoxscoreOpts) (models.BaseballBoxscoreRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.BaseballBoxscoreRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.Timecode.IsSet() {
		localVarQueryParams.Add("timecode", parameterToString(localVarOptionals.Timecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.InclusiveTimecode.IsSet() {
		localVarQueryParams.Add("inclusiveTimecode", parameterToString(localVarOptionals.InclusiveTimecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.NumPlayers.IsSet() {
		localVarQueryParams.Add("numPlayers", parameterToString(localVarOptionals.NumPlayers.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.NoTies.IsSet() {
		localVarQueryParams.Add("noTies", parameterToString(localVarOptionals.NoTies.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.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{"application/json;charset=UTF-8"}

	// 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.BaseballBoxscoreRestObject
			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
}

/*
GameApiService Get game color feed.
This API can return very large payloads.  It is STRONGLY recommended that clients ask for diffs and use \&quot;Accept-Encoding: gzip\&quot; header.
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiColorFeedOpts - Optional Parameters:
     * @param "Timecode" (optional.String) -  Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type GameApiColorFeedOpts struct {
	Timecode optional.String
	Fields   optional.Interface
}

func (a *GameApiService) ColorFeed(ctx context.Context, gamePk int32, localVarOptionals *GameApiColorFeedOpts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

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

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

	if localVarOptionals != nil && localVarOptionals.Timecode.IsSet() {
		localVarQueryParams.Add("timecode", parameterToString(localVarOptionals.Timecode.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{"application/json;charset=UTF-8"}

	// 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 string
			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
}

/*
GameApiService Retrieve all of the color timestamps for a game.
This can be used for replaying games.  Endpoint returns all of the timecodes that can be used with diffs for /v1/game/{game_pk}/feed/color
  - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  - @param gamePk Unique Primary Key Representing a Game

@return []string
*/
func (a *GameApiService) ColorTimestamps(ctx context.Context, gamePk int32) ([]string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue []string
	)

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

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

	// 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{"application/json;charset=UTF-8"}

	// 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 []string
			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
}

/*
GameApiService Retrieve all content for a game.
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk
 * @param optional nil or *GameApiContentOpts - Optional Parameters:
     * @param "HighlightLimit" (optional.Int32) -  Number of results to return
@return models.GameContentRestObject
*/

type GameApiContentOpts struct {
	HighlightLimit optional.Int32
}

func (a *GameApiService) Content(ctx context.Context, gamePk int32, localVarOptionals *GameApiContentOpts) (models.GameContentRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.GameContentRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.HighlightLimit.IsSet() {
		localVarQueryParams.Add("highlightLimit", parameterToString(localVarOptionals.HighlightLimit.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{"application/json;charset=UTF-8"}

	// 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.GameContentRestObject
			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
}

/*
GameApiService View a game change log
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param optional nil or *GameApiCurrentGameStats1Opts - Optional Parameters:
     * @param "UpdatedSince" (optional.Time) -  Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "SportIds" (optional.Interface of []int32) -  Comma delimited list of top level organizations of a sport
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "GameTypes" (optional.Interface of []models.GameTypeEnum) -  Comma delimited list of type of Game. Available types in /api/v1/gameTypes
     * @param "Season" (optional.String) -  Season of play
     * @param "GamePks" (optional.Interface of []int32) -  Comma delimited list of unique primary keys
     * @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 "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.ScheduleRestObject
*/

type GameApiCurrentGameStats1Opts struct {
	UpdatedSince optional.Time
	SportId      optional.Int32
	SportIds     optional.Interface
	GameType     optional.Interface
	GameTypes    optional.Interface
	Season       optional.String
	GamePks      optional.Interface
	Limit        optional.Int32
	Offset       optional.Int32
	Fields       optional.Interface
}

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

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

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

	if localVarOptionals != nil && localVarOptionals.UpdatedSince.IsSet() {
		localVarQueryParams.Add("updatedSince", parameterToString(localVarOptionals.UpdatedSince.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
		localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameTypes.IsSet() {
		localVarQueryParams.Add("gameTypes", parameterToString(localVarOptionals.GameTypes.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GamePks.IsSet() {
		localVarQueryParams.Add("gamePks", parameterToString(localVarOptionals.GamePks.Value(), "multi"))
	}
	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.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.ScheduleRestObject
			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
}

/*
GameApiService Get the context metrics for this game based on its current state
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiGetGameContextMetricsOpts - Optional Parameters:
     * @param "Timecode" (optional.String) -  Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.BaseballGameContextRestObject
*/

type GameApiGetGameContextMetricsOpts struct {
	Timecode optional.String
	Fields   optional.Interface
}

func (a *GameApiService) GetGameContextMetrics(ctx context.Context, gamePk int32, localVarOptionals *GameApiGetGameContextMetricsOpts) (models.BaseballGameContextRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.BaseballGameContextRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/contextMetrics"
	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.Timecode.IsSet() {
		localVarQueryParams.Add("timecode", parameterToString(localVarOptionals.Timecode.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.BaseballGameContextRestObject
			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
}

/*
GameApiService Get game info with metrics
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiGetGameWithMetricsOpts - Optional Parameters:
     * @param "Timecode" (optional.String) -  Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
     * @param "InclusiveTimecode" (optional.Bool) -  True to include plays that happen before or at the specified timecode
     * @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
@return models.BaseballGameRestObject
*/

type GameApiGetGameWithMetricsOpts struct {
	Timecode          optional.String
	InclusiveTimecode optional.Bool
	Fields            optional.Interface
	Accent            optional.Bool
}

func (a *GameApiService) GetGameWithMetrics(ctx context.Context, gamePk int32, localVarOptionals *GameApiGetGameWithMetricsOpts) (models.BaseballGameRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.BaseballGameRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/withMetrics"
	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.Timecode.IsSet() {
		localVarQueryParams.Add("timecode", parameterToString(localVarOptionals.Timecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.InclusiveTimecode.IsSet() {
		localVarQueryParams.Add("inclusiveTimecode", parameterToString(localVarOptionals.InclusiveTimecode.Value(), ""))
	}
	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(), ""))
	}
	// 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.BaseballGameRestObject
			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
}

/*
GameApiService Get the win probability for this game
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiGetWinProbabilityOpts - Optional Parameters:
     * @param "Timecode" (optional.String) -  Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "InclusiveTimecode" (optional.Bool) -  True to include plays that happen before or at the specified timecode
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
@return []models.BaseballPlayRestObject
*/

type GameApiGetWinProbabilityOpts struct {
	Timecode          optional.String
	Fields            optional.Interface
	InclusiveTimecode optional.Bool
	Accent            optional.Bool
}

func (a *GameApiService) GetWinProbability(ctx context.Context, gamePk int32, localVarOptionals *GameApiGetWinProbabilityOpts) ([]models.BaseballPlayRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue []models.BaseballPlayRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/winProbability"
	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.Timecode.IsSet() {
		localVarQueryParams.Add("timecode", parameterToString(localVarOptionals.Timecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.InclusiveTimecode.IsSet() {
		localVarQueryParams.Add("inclusiveTimecode", parameterToString(localVarOptionals.InclusiveTimecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.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.BaseballPlayRestObject
			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
}

/*
GameApiService Get game linescore
This endpoint allows you to pull the linescore for a game
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiLinescoreOpts - Optional Parameters:
     * @param "Timecode" (optional.String) -  Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "InclusiveTimecode" (optional.Bool) -  True to include plays that happen before or at the specified timecode
@return models.BaseballLinescoreRestObject
*/

type GameApiLinescoreOpts struct {
	Timecode          optional.String
	Fields            optional.Interface
	InclusiveTimecode optional.Bool
}

func (a *GameApiService) Linescore(ctx context.Context, gamePk int32, localVarOptionals *GameApiLinescoreOpts) (models.BaseballLinescoreRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.BaseballLinescoreRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.Timecode.IsSet() {
		localVarQueryParams.Add("timecode", parameterToString(localVarOptionals.Timecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.InclusiveTimecode.IsSet() {
		localVarQueryParams.Add("inclusiveTimecode", parameterToString(localVarOptionals.InclusiveTimecode.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{"application/json;charset=UTF-8"}

	// 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.BaseballLinescoreRestObject
			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
}

/*
GameApiService Get live game status diffPatch.
This endpoint allows comparison of game files and shows any differences/discrepancies between the two&lt;br/&gt;&lt;br/&gt;&lt;b&gt;Diff/Patch System:&lt;/b&gt; startTimecode and endTimecode can be used for getting diffs.&lt;br/&gt;Expected usage:  &lt;br/&gt; 1) Request full payload by not passing startTimecode or endTimecode.  This will return the most recent game state.&lt;br/&gt; 2) Find the latest timecode in this response.  &lt;br/&gt; 3) Wait X seconds&lt;br/&gt; 4) Use the timecode from 2 as the startTimecode.  This will give you a diff of everything that has happened since startTimecode.  &lt;br/&gt; 5) If no data is returned, wait X seconds and do the same request.  &lt;br/&gt; 6) If data is returned, get a new timeStamp from the response, and use that for the next call as startTimecode.
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiLiveGameDiffPatchV1Opts - Optional Parameters:
     * @param "StartTimecode" (optional.String) -  Start time code will give you everything since that time. Format: MMDDYYYY_HHMMSS
     * @param "EndTimecode" (optional.String) -  End time code will give you a snapshot at that specific time. Format: MMDDYYYY_HHMMSS
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
@return string
*/

type GameApiLiveGameDiffPatchV1Opts struct {
	StartTimecode optional.String
	EndTimecode   optional.String
	Accent        optional.Bool
}

func (a *GameApiService) LiveGameDiffPatchV1(ctx context.Context, gamePk int32, localVarOptionals *GameApiLiveGameDiffPatchV1Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

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

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

	if localVarOptionals != nil && localVarOptionals.StartTimecode.IsSet() {
		localVarQueryParams.Add("startTimecode", parameterToString(localVarOptionals.StartTimecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EndTimecode.IsSet() {
		localVarQueryParams.Add("endTimecode", parameterToString(localVarOptionals.EndTimecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.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{"application/json;charset=UTF-8"}

	// 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 string
			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
}

/*
GameApiService Get live game status.
This API can return very large payloads.  It is STRONGLY recommended that clients ask for diffs and use \&quot;Accept-Encoding: gzip\&quot; header.
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiLiveGameV1Opts - Optional Parameters:
     * @param "Timecode" (optional.String) -  Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "InclusiveTimecode" (optional.Bool) -  True to include plays that happen before or at the specified timecode
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
@return models.BaseballGameRestObject
*/

type GameApiLiveGameV1Opts struct {
	Timecode          optional.String
	Fields            optional.Interface
	InclusiveTimecode optional.Bool
	Accent            optional.Bool
}

func (a *GameApiService) LiveGameV1(ctx context.Context, gamePk int32, localVarOptionals *GameApiLiveGameV1Opts) (models.BaseballGameRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.BaseballGameRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.Timecode.IsSet() {
		localVarQueryParams.Add("timecode", parameterToString(localVarOptionals.Timecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.InclusiveTimecode.IsSet() {
		localVarQueryParams.Add("inclusiveTimecode", parameterToString(localVarOptionals.InclusiveTimecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.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{"application/json;charset=UTF-8"}

	// 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.BaseballGameRestObject
			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
}

/*
GameApiService Retrieve all of the play timestamps for a game.
This can be used for replaying games.  Endpoint returns all of the timecodes that can be used with diffs for /v1/game/{game_pk}/feed/live
  - @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  - @param gamePk Unique Primary Key Representing a Game

@return string
*/
func (a *GameApiService) LiveTimestampv11(ctx context.Context, gamePk int32) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

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

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

	// 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{"application/json;charset=UTF-8"}

	// 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 string
			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
}

/*
GameApiService Get game play By Play
This endpoint allows you to pull the play by play of a game
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePk Unique Primary Key Representing a Game
 * @param optional nil or *GameApiPlayByPlayOpts - Optional Parameters:
     * @param "Timecode" (optional.String) -  Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "InclusiveTimecode" (optional.Bool) -  True to include plays that happen before or at the specified timecode
     * @param "Accent" (optional.Bool) -  Boolean value to specify wanting a person&#x27;s name with accents or without
@return models.BaseballPlayByPlayRestObject
*/

type GameApiPlayByPlayOpts struct {
	Timecode          optional.String
	Fields            optional.Interface
	InclusiveTimecode optional.Bool
	Accent            optional.Bool
}

func (a *GameApiService) PlayByPlay(ctx context.Context, gamePk int32, localVarOptionals *GameApiPlayByPlayOpts) (models.BaseballPlayByPlayRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.BaseballPlayByPlayRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.Timecode.IsSet() {
		localVarQueryParams.Add("timecode", parameterToString(localVarOptionals.Timecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.InclusiveTimecode.IsSet() {
		localVarQueryParams.Add("inclusiveTimecode", parameterToString(localVarOptionals.InclusiveTimecode.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
		localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.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{"application/json;charset=UTF-8"}

	// 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.BaseballPlayByPlayRestObject
			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
}
