/*
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 AnalyticsApiService service

/*
AnalyticsApiService Get context metrics for a specific gamePk.
Returns a json file containing raw coordinate data and refined calculated metrics.&lt;br/&gt;&lt;br/&gt;This responses can be very large, so it is strongly recommended that you pass \&quot;Accept-Encoding: gzip\&quot; as a header to have the responses compressed.
 * @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 guid Unique identifier for a play within a game
 * @param optional nil or *AnalyticsApiContextMetricsOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return []models.CalculatedMetricRestObject
*/

type AnalyticsApiContextMetricsOpts struct {
	Fields optional.Interface
}

func (a *AnalyticsApiService) ContextMetrics(ctx context.Context, gamePk int32, guid string, localVarOptionals *AnalyticsApiContextMetricsOpts) ([]models.CalculatedMetricRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue []models.CalculatedMetricRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/{guid}/contextMetrics"
	localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"guid"+"}", fmt.Sprintf("%v", guid), -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{"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.CalculatedMetricRestObject
			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
}

/*
AnalyticsApiService Get a json file containing raw coordinate data and refined calculated metrics.
Returns a json file containing raw coordinate data and refined calculated metrics.&lt;br/&gt;&lt;br/&gt;This responses can be very large, so it is strongly recommended that you pass \&quot;Accept-Encoding: gzip\&quot; as a header to have the responses compressed.
 * @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 guid Unique identifier for a play within a game
 * @param optional nil or *AnalyticsApiContextMetricsWithAveragesOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return []models.CalculatedMetricRestObject
*/

type AnalyticsApiContextMetricsWithAveragesOpts struct {
	Fields optional.Interface
}

func (a *AnalyticsApiService) ContextMetricsWithAverages(ctx context.Context, gamePk int32, guid string, localVarOptionals *AnalyticsApiContextMetricsWithAveragesOpts) ([]models.CalculatedMetricRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue []models.CalculatedMetricRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/{guid}/contextMetricsAverages"
	localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"guid"+"}", fmt.Sprintf("%v", guid), -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{"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.CalculatedMetricRestObject
			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
}

/*
AnalyticsApiService Get a json file containing raw coordinate data and refined calculated metrics.
Returns a json file containing raw coordinate data and refined calculated metrics.&lt;br/&gt;&lt;br/&gt;This responses can be very large, so it is strongly recommended that you pass \&quot;Accept-Encoding: gzip\&quot; as a header to have the responses compressed.
 * @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 guid Unique identifier for a play within a game
 * @param optional nil or *AnalyticsApiContextMetricsWithAveragesPostOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return []models.CalculatedMetricRestObject
*/

type AnalyticsApiContextMetricsWithAveragesPostOpts struct {
	Fields optional.Interface
}

func (a *AnalyticsApiService) ContextMetricsWithAveragesPost(ctx context.Context, gamePk int32, guid string, localVarOptionals *AnalyticsApiContextMetricsWithAveragesPostOpts) ([]models.CalculatedMetricRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Post")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue []models.CalculatedMetricRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/{guid}/contextMetricsAverages"
	localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"guid"+"}", fmt.Sprintf("%v", guid), -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{"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.CalculatedMetricRestObject
			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
}

/*
AnalyticsApiService Get the GUIDs (plays) for a specific 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 *AnalyticsApiGameGuidsOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "GameModeId" (optional.Int32) -  Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live
     * @param "IsPitch" (optional.Bool) -  If there was a pitch
     * @param "IsHit" (optional.Bool) -  If there was a hit ball tracked
     * @param "IsPickoff" (optional.Bool) -  If there was a pickoff
     * @param "HasUpdates" (optional.Bool) -  True if updated by an auditor
     * @param "Since" (optional.Time) -  Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "UpdatedSince" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastPlayTime" (optional.Time) -  Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastMetricsUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastAuditUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastVideoUpdatedTime" (optional.Time) -  The last time SportyBot video was updated
@return []models.AnalyticsPlayMetadataRestObject
*/

type AnalyticsApiGameGuidsOpts struct {
	Fields                 optional.Interface
	GameModeId             optional.Int32
	IsPitch                optional.Bool
	IsHit                  optional.Bool
	IsPickoff              optional.Bool
	HasUpdates             optional.Bool
	Since                  optional.Time
	UpdatedSince           optional.Time
	LastPlayTime           optional.Time
	LastUpdatedTime        optional.Time
	LastMetricsUpdatedTime optional.Time
	LastAuditUpdatedTime   optional.Time
	LastVideoUpdatedTime   optional.Time
}

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

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/guids"
	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.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.GameModeId.IsSet() {
		localVarQueryParams.Add("gameModeId", parameterToString(localVarOptionals.GameModeId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsPitch.IsSet() {
		localVarQueryParams.Add("isPitch", parameterToString(localVarOptionals.IsPitch.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsHit.IsSet() {
		localVarQueryParams.Add("isHit", parameterToString(localVarOptionals.IsHit.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsPickoff.IsSet() {
		localVarQueryParams.Add("isPickoff", parameterToString(localVarOptionals.IsPickoff.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.HasUpdates.IsSet() {
		localVarQueryParams.Add("hasUpdates", parameterToString(localVarOptionals.HasUpdates.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Since.IsSet() {
		localVarQueryParams.Add("since", parameterToString(localVarOptionals.Since.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.UpdatedSince.IsSet() {
		localVarQueryParams.Add("updatedSince", parameterToString(localVarOptionals.UpdatedSince.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastPlayTime.IsSet() {
		localVarQueryParams.Add("lastPlayTime", parameterToString(localVarOptionals.LastPlayTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastUpdatedTime", parameterToString(localVarOptionals.LastUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastMetricsUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastMetricsUpdatedTime", parameterToString(localVarOptionals.LastMetricsUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastAuditUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastAuditUpdatedTime", parameterToString(localVarOptionals.LastAuditUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastVideoUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastVideoUpdatedTime", parameterToString(localVarOptionals.LastVideoUpdatedTime.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.AnalyticsPlayMetadataRestObject
			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
}

/*
AnalyticsApiService Get the GUIDs (plays) for a specific game.
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param optional nil or *AnalyticsApiGameGuidsFromPostgresRangeOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "GameModeId" (optional.Int32) -  Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live
     * @param "IsPitch" (optional.Bool) -  If there was a pitch
     * @param "IsHit" (optional.Bool) -  If there was a hit ball tracked
     * @param "IsPickoff" (optional.Bool) -  If there was a pickoff
     * @param "IsNonStatcast" (optional.Bool) -  If non statcast games need to be included
     * @param "GamedayType" (optional.String) -  Indicates the level of Gameday (tracking, play-by-play, linescore, etc...)
     * @param "HasUpdates" (optional.Bool) -  True if updated by an auditor
     * @param "LastPlayTime" (optional.Time) -  Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastMetricsUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastAuditUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastVideoUpdatedTime" (optional.Time) -  The last time SportyBot video was updated
     * @param "GameDate" (optional.String) -  Date of Game. Format: YYYY-MM-DD
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "TrackingSystemOwner" (optional.Interface of TrackingSystemOwner) -  Owner of the tracking system
     * @param "Season" (optional.String) -  Season of play
     * @param "SortBy" (optional.String) -  Sort the set of data by the specified field
     * @param "Limit" (optional.Int32) -  Number of results to return
     * @param "Offset" (optional.Int32) -  The pointer to start for a return set; used for pagination
@return models.AnalyticsPlayMetadataWrapperRestObject
*/

type AnalyticsApiGameGuidsFromPostgresRangeOpts struct {
	Fields                 optional.Interface
	GameModeId             optional.Int32
	IsPitch                optional.Bool
	IsHit                  optional.Bool
	IsPickoff              optional.Bool
	IsNonStatcast          optional.Bool
	GamedayType            optional.String
	HasUpdates             optional.Bool
	LastPlayTime           optional.Time
	LastUpdatedTime        optional.Time
	LastMetricsUpdatedTime optional.Time
	LastAuditUpdatedTime   optional.Time
	LastVideoUpdatedTime   optional.Time
	GameDate               optional.String
	SportId                optional.Int32
	GameType               optional.Interface
	TrackingSystemOwner    optional.Interface
	Season                 optional.String
	SortBy                 optional.String
	Limit                  optional.Int32
	Offset                 optional.Int32
}

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

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

	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"))
	}
	if localVarOptionals != nil && localVarOptionals.GameModeId.IsSet() {
		localVarQueryParams.Add("gameModeId", parameterToString(localVarOptionals.GameModeId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsPitch.IsSet() {
		localVarQueryParams.Add("isPitch", parameterToString(localVarOptionals.IsPitch.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsHit.IsSet() {
		localVarQueryParams.Add("isHit", parameterToString(localVarOptionals.IsHit.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsPickoff.IsSet() {
		localVarQueryParams.Add("isPickoff", parameterToString(localVarOptionals.IsPickoff.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsNonStatcast.IsSet() {
		localVarQueryParams.Add("isNonStatcast", parameterToString(localVarOptionals.IsNonStatcast.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GamedayType.IsSet() {
		localVarQueryParams.Add("gamedayType", parameterToString(localVarOptionals.GamedayType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.HasUpdates.IsSet() {
		localVarQueryParams.Add("hasUpdates", parameterToString(localVarOptionals.HasUpdates.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastPlayTime.IsSet() {
		localVarQueryParams.Add("lastPlayTime", parameterToString(localVarOptionals.LastPlayTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastUpdatedTime", parameterToString(localVarOptionals.LastUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastMetricsUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastMetricsUpdatedTime", parameterToString(localVarOptionals.LastMetricsUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastAuditUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastAuditUpdatedTime", parameterToString(localVarOptionals.LastAuditUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastVideoUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastVideoUpdatedTime", parameterToString(localVarOptionals.LastVideoUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameDate.IsSet() {
		localVarQueryParams.Add("gameDate", parameterToString(localVarOptionals.GameDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.TrackingSystemOwner.IsSet() {
		localVarQueryParams.Add("trackingSystemOwner", parameterToString(localVarOptionals.TrackingSystemOwner.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() {
		localVarQueryParams.Add("sortBy", parameterToString(localVarOptionals.SortBy.Value(), ""))
	}
	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(), ""))
	}
	// 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.AnalyticsPlayMetadataWrapperRestObject
			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
}

/*
AnalyticsApiService Get all games by updated date.
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param optional nil or *AnalyticsApiGameGuidsFromPostgresRangeByGameOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "GameModeId" (optional.Int32) -  Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live
     * @param "IsPitch" (optional.Bool) -  If there was a pitch
     * @param "IsHit" (optional.Bool) -  If there was a hit ball tracked
     * @param "IsPickoff" (optional.Bool) -  If there was a pickoff
     * @param "IsNonStatcast" (optional.Bool) -  If non statcast games need to be included
     * @param "GamedayType" (optional.String) -  Indicates the level of Gameday (tracking, play-by-play, linescore, etc...)
     * @param "HasUpdates" (optional.Bool) -  True if updated by an auditor
     * @param "LastPlayTime" (optional.Time) -  Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastVideoUpdatedTime" (optional.Time) -  The last time SportyBot video was updated
     * @param "LastUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastMetricsUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "LastAuditUpdatedTime" (optional.Time) -  Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ
     * @param "GameDate" (optional.String) -  Date of Game. Format: YYYY-MM-DD
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "Season" (optional.String) -  Season of play
     * @param "TrackingSystemOwner" (optional.Interface of TrackingSystemOwner) -  Owner of the tracking system
     * @param "SortBy" (optional.String) -  Sort the set of data by the specified field
     * @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 "ScheduleEventTypes" (optional.Interface of []ScheduleEventTypes) -  Comma delimited list of type of event types
@return models.AnalyticsGameMetadataWrapperRestObject
*/

type AnalyticsApiGameGuidsFromPostgresRangeByGameOpts struct {
	Fields                 optional.Interface
	GameModeId             optional.Int32
	IsPitch                optional.Bool
	IsHit                  optional.Bool
	IsPickoff              optional.Bool
	IsNonStatcast          optional.Bool
	GamedayType            optional.String
	HasUpdates             optional.Bool
	LastPlayTime           optional.Time
	LastVideoUpdatedTime   optional.Time
	LastUpdatedTime        optional.Time
	LastMetricsUpdatedTime optional.Time
	LastAuditUpdatedTime   optional.Time
	GameDate               optional.String
	SportId                optional.Int32
	GameType               optional.Interface
	Season                 optional.String
	TrackingSystemOwner    optional.Interface
	SortBy                 optional.String
	Limit                  optional.Int32
	Offset                 optional.Int32
	ScheduleEventTypes     optional.Interface
}

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

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

	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"))
	}
	if localVarOptionals != nil && localVarOptionals.GameModeId.IsSet() {
		localVarQueryParams.Add("gameModeId", parameterToString(localVarOptionals.GameModeId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsPitch.IsSet() {
		localVarQueryParams.Add("isPitch", parameterToString(localVarOptionals.IsPitch.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsHit.IsSet() {
		localVarQueryParams.Add("isHit", parameterToString(localVarOptionals.IsHit.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsPickoff.IsSet() {
		localVarQueryParams.Add("isPickoff", parameterToString(localVarOptionals.IsPickoff.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.IsNonStatcast.IsSet() {
		localVarQueryParams.Add("isNonStatcast", parameterToString(localVarOptionals.IsNonStatcast.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GamedayType.IsSet() {
		localVarQueryParams.Add("gamedayType", parameterToString(localVarOptionals.GamedayType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.HasUpdates.IsSet() {
		localVarQueryParams.Add("hasUpdates", parameterToString(localVarOptionals.HasUpdates.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastPlayTime.IsSet() {
		localVarQueryParams.Add("lastPlayTime", parameterToString(localVarOptionals.LastPlayTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastVideoUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastVideoUpdatedTime", parameterToString(localVarOptionals.LastVideoUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastUpdatedTime", parameterToString(localVarOptionals.LastUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastMetricsUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastMetricsUpdatedTime", parameterToString(localVarOptionals.LastMetricsUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LastAuditUpdatedTime.IsSet() {
		localVarQueryParams.Add("lastAuditUpdatedTime", parameterToString(localVarOptionals.LastAuditUpdatedTime.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameDate.IsSet() {
		localVarQueryParams.Add("gameDate", parameterToString(localVarOptionals.GameDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.TrackingSystemOwner.IsSet() {
		localVarQueryParams.Add("trackingSystemOwner", parameterToString(localVarOptionals.TrackingSystemOwner.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SortBy.IsSet() {
		localVarQueryParams.Add("sortBy", parameterToString(localVarOptionals.SortBy.Value(), ""))
	}
	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.ScheduleEventTypes.IsSet() {
		localVarQueryParams.Add("scheduleEventTypes", parameterToString(localVarOptionals.ScheduleEventTypes.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 models.AnalyticsGameMetadataWrapperRestObject
			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
}

/*
AnalyticsApiService Get the last pitch for a list of games
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param gamePks Unique Primary Key Representing a Game
 * @param optional nil or *AnalyticsApiGameLastPitchOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return []models.AnalyticsPlayMetadataRestObject
*/

type AnalyticsApiGameLastPitchOpts struct {
	Fields optional.Interface
}

func (a *AnalyticsApiService) GameLastPitch(ctx context.Context, gamePks []int32, localVarOptionals *AnalyticsApiGameLastPitchOpts) ([]models.AnalyticsPlayMetadataRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue []models.AnalyticsPlayMetadataRestObject
	)

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

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

	localVarQueryParams.Add("gamePks", parameterToString(gamePks, "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{"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.AnalyticsPlayMetadataRestObject
			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
}

/*
AnalyticsApiService Get if the play is a home run is each park for a specific play.
Returns a json file containing raw coordinate data and refined calculated metrics.&lt;br/&gt;&lt;br/&gt;This responses can be very large, so it is strongly recommended that you pass \&quot;Accept-Encoding: gzip\&quot; as a header to have the responses compressed.
 * @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 guid Unique identifier for a play within a game
 * @param isHomeRunParks
 * @param optional nil or *AnalyticsApiHomeRunBallparksOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.VenuesRestObject
*/

type AnalyticsApiHomeRunBallparksOpts struct {
	Fields optional.Interface
}

func (a *AnalyticsApiService) HomeRunBallparks(ctx context.Context, gamePk int32, guid string, isHomeRunParks bool, localVarOptionals *AnalyticsApiHomeRunBallparksOpts) (models.VenuesRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.VenuesRestObject
	)

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

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

	localVarQueryParams.Add("isHomeRunParks", parameterToString(isHomeRunParks, ""))
	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 models.VenuesRestObject
			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
}

/*
AnalyticsApiService Get Statcast data for a specific play.
Returns a json file containing raw coordinate data and refined calculated metrics.&lt;br/&gt;&lt;br/&gt;This responses can be very large, so it is strongly recommended that you pass \&quot;Accept-Encoding: gzip\&quot; as a header to have the responses compressed.
 * @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 guid Unique identifier for a play within a game
 * @param optional nil or *AnalyticsApiParsedJsonFormattedAnalyticsOpts - Optional Parameters:
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.AnalyticsRestObject
*/

type AnalyticsApiParsedJsonFormattedAnalyticsOpts struct {
	Fields optional.Interface
}

func (a *AnalyticsApiService) ParsedJsonFormattedAnalytics(ctx context.Context, gamePk int32, guid string, localVarOptionals *AnalyticsApiParsedJsonFormattedAnalyticsOpts) (models.AnalyticsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.AnalyticsRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/{guid}/analytics"
	localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"guid"+"}", fmt.Sprintf("%v", guid), -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{"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.AnalyticsRestObject
			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
}
