mlbstats/api/api_game.go

1637 lines
52 KiB
Go

/*
Stats API Documentation
Official API for Major League Baseball.
API version: 2.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
"strings"
)
// GameAPIService GameAPI service
type GameAPIService service
type ApiBoxscoreRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
timecode *interface{}
fields *interface{}
inclusiveTimecode *interface{}
numPlayers *interface{}
noTies *interface{}
accent *interface{}
}
// Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
func (r ApiBoxscoreRequest) Timecode(timecode interface{}) ApiBoxscoreRequest {
r.timecode = &timecode
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiBoxscoreRequest) Fields(fields interface{}) ApiBoxscoreRequest {
r.fields = &fields
return r
}
// True to include plays that happen before or at the specified timecode
func (r ApiBoxscoreRequest) InclusiveTimecode(inclusiveTimecode interface{}) ApiBoxscoreRequest {
r.inclusiveTimecode = &inclusiveTimecode
return r
}
// Number of top player game scores to show. Default is 3.
func (r ApiBoxscoreRequest) NumPlayers(numPlayers interface{}) ApiBoxscoreRequest {
r.numPlayers = &numPlayers
return r
}
// If set to false, will show all players tied for the last spot in the game scores list.
func (r ApiBoxscoreRequest) NoTies(noTies interface{}) ApiBoxscoreRequest {
r.noTies = &noTies
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiBoxscoreRequest) Accent(accent interface{}) ApiBoxscoreRequest {
r.accent = &accent
return r
}
func (r ApiBoxscoreRequest) Execute() (*http.Response, error) {
return r.ApiService.BoxscoreExecute(r)
}
/*
Boxscore 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
@return ApiBoxscoreRequest
*/
func (a *GameAPIService) Boxscore(ctx context.Context, gamePk interface{}) ApiBoxscoreRequest {
return ApiBoxscoreRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) BoxscoreExecute(r ApiBoxscoreRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.Boxscore")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{game_pk}/boxscore"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.timecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if r.inclusiveTimecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "inclusiveTimecode", r.inclusiveTimecode, "", "")
}
if r.numPlayers != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "numPlayers", r.numPlayers, "", "")
}
if r.noTies != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "noTies", r.noTies, "", "")
}
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiColorFeedRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
timecode *interface{}
fields *interface{}
}
// Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
func (r ApiColorFeedRequest) Timecode(timecode interface{}) ApiColorFeedRequest {
r.timecode = &timecode
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiColorFeedRequest) Fields(fields interface{}) ApiColorFeedRequest {
r.fields = &fields
return r
}
func (r ApiColorFeedRequest) Execute() (*http.Response, error) {
return r.ApiService.ColorFeedExecute(r)
}
/*
ColorFeed Get game color feed.
This API can return very large payloads. It is STRONGLY recommended that clients ask for diffs and use "Accept-Encoding: gzip" 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
@return ApiColorFeedRequest
*/
func (a *GameAPIService) ColorFeed(ctx context.Context, gamePk interface{}) ApiColorFeedRequest {
return ApiColorFeedRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) ColorFeedExecute(r ApiColorFeedRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.ColorFeed")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{game_pk}/feed/color"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.timecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiColorTimestampsRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
}
func (r ApiColorTimestampsRequest) Execute() (*http.Response, error) {
return r.ApiService.ColorTimestampsExecute(r)
}
/*
ColorTimestamps 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 ApiColorTimestampsRequest
*/
func (a *GameAPIService) ColorTimestamps(ctx context.Context, gamePk interface{}) ApiColorTimestampsRequest {
return ApiColorTimestampsRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) ColorTimestampsExecute(r ApiColorTimestampsRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.ColorTimestamps")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{game_pk}/feed/color/timestamps"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "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{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiContentRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
highlightLimit *interface{}
}
// Number of results to return
func (r ApiContentRequest) HighlightLimit(highlightLimit interface{}) ApiContentRequest {
r.highlightLimit = &highlightLimit
return r
}
func (r ApiContentRequest) Execute() (*http.Response, error) {
return r.ApiService.ContentExecute(r)
}
/*
Content 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
@return ApiContentRequest
*/
func (a *GameAPIService) Content(ctx context.Context, gamePk interface{}) ApiContentRequest {
return ApiContentRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) ContentExecute(r ApiContentRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.Content")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{game_pk}/content"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.highlightLimit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "highlightLimit", r.highlightLimit, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiCurrentGameStats1Request struct {
ctx context.Context
ApiService *GameAPIService
updatedSince *interface{}
sportId *interface{}
sportIds *interface{}
gameType *interface{}
gameTypes *interface{}
season *interface{}
gamePks *interface{}
limit *interface{}
offset *interface{}
fields *interface{}
}
// Format: YYYY-MM-DDTHH:MM:SSZ
func (r ApiCurrentGameStats1Request) UpdatedSince(updatedSince interface{}) ApiCurrentGameStats1Request {
r.updatedSince = &updatedSince
return r
}
// Top level organization of a sport
func (r ApiCurrentGameStats1Request) SportId(sportId interface{}) ApiCurrentGameStats1Request {
r.sportId = &sportId
return r
}
// Comma delimited list of top level organizations of a sport
func (r ApiCurrentGameStats1Request) SportIds(sportIds interface{}) ApiCurrentGameStats1Request {
r.sportIds = &sportIds
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiCurrentGameStats1Request) GameType(gameType interface{}) ApiCurrentGameStats1Request {
r.gameType = &gameType
return r
}
// Comma delimited list of type of Game. Available types in /api/v1/gameTypes
func (r ApiCurrentGameStats1Request) GameTypes(gameTypes interface{}) ApiCurrentGameStats1Request {
r.gameTypes = &gameTypes
return r
}
// Season of play
func (r ApiCurrentGameStats1Request) Season(season interface{}) ApiCurrentGameStats1Request {
r.season = &season
return r
}
// Comma delimited list of unique primary keys
func (r ApiCurrentGameStats1Request) GamePks(gamePks interface{}) ApiCurrentGameStats1Request {
r.gamePks = &gamePks
return r
}
// Number of results to return
func (r ApiCurrentGameStats1Request) Limit(limit interface{}) ApiCurrentGameStats1Request {
r.limit = &limit
return r
}
// The pointer to start for a return set; used for pagination
func (r ApiCurrentGameStats1Request) Offset(offset interface{}) ApiCurrentGameStats1Request {
r.offset = &offset
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiCurrentGameStats1Request) Fields(fields interface{}) ApiCurrentGameStats1Request {
r.fields = &fields
return r
}
func (r ApiCurrentGameStats1Request) Execute() (*http.Response, error) {
return r.ApiService.CurrentGameStats1Execute(r)
}
/*
CurrentGameStats1 View a game change log
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiCurrentGameStats1Request
*/
func (a *GameAPIService) CurrentGameStats1(ctx context.Context) ApiCurrentGameStats1Request {
return ApiCurrentGameStats1Request{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *GameAPIService) CurrentGameStats1Execute(r ApiCurrentGameStats1Request) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.CurrentGameStats1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/changes"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.updatedSince != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "updatedSince", r.updatedSince, "", "")
}
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if r.sportIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
}
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if r.gameTypes != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameTypes", r.gameTypes, "", "")
}
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if r.gamePks != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePks", r.gamePks, "", "")
}
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
}
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiGetGameContextMetricsRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
timecode *interface{}
fields *interface{}
}
// Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
func (r ApiGetGameContextMetricsRequest) Timecode(timecode interface{}) ApiGetGameContextMetricsRequest {
r.timecode = &timecode
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetGameContextMetricsRequest) Fields(fields interface{}) ApiGetGameContextMetricsRequest {
r.fields = &fields
return r
}
func (r ApiGetGameContextMetricsRequest) Execute() (*http.Response, error) {
return r.ApiService.GetGameContextMetricsExecute(r)
}
/*
GetGameContextMetrics 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
@return ApiGetGameContextMetricsRequest
*/
func (a *GameAPIService) GetGameContextMetrics(ctx context.Context, gamePk interface{}) ApiGetGameContextMetricsRequest {
return ApiGetGameContextMetricsRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) GetGameContextMetricsExecute(r ApiGetGameContextMetricsRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.GetGameContextMetrics")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{gamePk}/contextMetrics"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.timecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiGetGameWithMetricsRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
timecode *interface{}
inclusiveTimecode *interface{}
fields *interface{}
accent *interface{}
}
// Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
func (r ApiGetGameWithMetricsRequest) Timecode(timecode interface{}) ApiGetGameWithMetricsRequest {
r.timecode = &timecode
return r
}
// True to include plays that happen before or at the specified timecode
func (r ApiGetGameWithMetricsRequest) InclusiveTimecode(inclusiveTimecode interface{}) ApiGetGameWithMetricsRequest {
r.inclusiveTimecode = &inclusiveTimecode
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetGameWithMetricsRequest) Fields(fields interface{}) ApiGetGameWithMetricsRequest {
r.fields = &fields
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiGetGameWithMetricsRequest) Accent(accent interface{}) ApiGetGameWithMetricsRequest {
r.accent = &accent
return r
}
func (r ApiGetGameWithMetricsRequest) Execute() (*http.Response, error) {
return r.ApiService.GetGameWithMetricsExecute(r)
}
/*
GetGameWithMetrics 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
@return ApiGetGameWithMetricsRequest
*/
func (a *GameAPIService) GetGameWithMetrics(ctx context.Context, gamePk interface{}) ApiGetGameWithMetricsRequest {
return ApiGetGameWithMetricsRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) GetGameWithMetricsExecute(r ApiGetGameWithMetricsRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.GetGameWithMetrics")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{gamePk}/withMetrics"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.timecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
}
if r.inclusiveTimecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "inclusiveTimecode", r.inclusiveTimecode, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiGetWinProbabilityRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
timecode *interface{}
fields *interface{}
inclusiveTimecode *interface{}
accent *interface{}
}
// Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
func (r ApiGetWinProbabilityRequest) Timecode(timecode interface{}) ApiGetWinProbabilityRequest {
r.timecode = &timecode
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetWinProbabilityRequest) Fields(fields interface{}) ApiGetWinProbabilityRequest {
r.fields = &fields
return r
}
// True to include plays that happen before or at the specified timecode
func (r ApiGetWinProbabilityRequest) InclusiveTimecode(inclusiveTimecode interface{}) ApiGetWinProbabilityRequest {
r.inclusiveTimecode = &inclusiveTimecode
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiGetWinProbabilityRequest) Accent(accent interface{}) ApiGetWinProbabilityRequest {
r.accent = &accent
return r
}
func (r ApiGetWinProbabilityRequest) Execute() (*http.Response, error) {
return r.ApiService.GetWinProbabilityExecute(r)
}
/*
GetWinProbability 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
@return ApiGetWinProbabilityRequest
*/
func (a *GameAPIService) GetWinProbability(ctx context.Context, gamePk interface{}) ApiGetWinProbabilityRequest {
return ApiGetWinProbabilityRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) GetWinProbabilityExecute(r ApiGetWinProbabilityRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.GetWinProbability")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{gamePk}/winProbability"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.timecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if r.inclusiveTimecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "inclusiveTimecode", r.inclusiveTimecode, "", "")
}
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiLinescoreRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
timecode *interface{}
fields *interface{}
inclusiveTimecode *interface{}
}
// Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
func (r ApiLinescoreRequest) Timecode(timecode interface{}) ApiLinescoreRequest {
r.timecode = &timecode
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiLinescoreRequest) Fields(fields interface{}) ApiLinescoreRequest {
r.fields = &fields
return r
}
// True to include plays that happen before or at the specified timecode
func (r ApiLinescoreRequest) InclusiveTimecode(inclusiveTimecode interface{}) ApiLinescoreRequest {
r.inclusiveTimecode = &inclusiveTimecode
return r
}
func (r ApiLinescoreRequest) Execute() (*http.Response, error) {
return r.ApiService.LinescoreExecute(r)
}
/*
Linescore 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
@return ApiLinescoreRequest
*/
func (a *GameAPIService) Linescore(ctx context.Context, gamePk interface{}) ApiLinescoreRequest {
return ApiLinescoreRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) LinescoreExecute(r ApiLinescoreRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.Linescore")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{game_pk}/linescore"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.timecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if r.inclusiveTimecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "inclusiveTimecode", r.inclusiveTimecode, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiLiveGameDiffPatchV1Request struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
startTimecode *interface{}
endTimecode *interface{}
accent *interface{}
}
// Start time code will give you everything since that time. Format: MMDDYYYY_HHMMSS
func (r ApiLiveGameDiffPatchV1Request) StartTimecode(startTimecode interface{}) ApiLiveGameDiffPatchV1Request {
r.startTimecode = &startTimecode
return r
}
// End time code will give you a snapshot at that specific time. Format: MMDDYYYY_HHMMSS
func (r ApiLiveGameDiffPatchV1Request) EndTimecode(endTimecode interface{}) ApiLiveGameDiffPatchV1Request {
r.endTimecode = &endTimecode
return r
}
// Boolean value to specify wanting a person's name with accents or without
func (r ApiLiveGameDiffPatchV1Request) Accent(accent interface{}) ApiLiveGameDiffPatchV1Request {
r.accent = &accent
return r
}
func (r ApiLiveGameDiffPatchV1Request) Execute() (*http.Response, error) {
return r.ApiService.LiveGameDiffPatchV1Execute(r)
}
/*
LiveGameDiffPatchV1 Get live game status diffPatch.
This endpoint allows comparison of game files and shows any differences/discrepancies between the two<br/><br/><b>Diff/Patch System:</b> startTimecode and endTimecode can be used for getting diffs.<br/>Expected usage: <br/> 1) Request full payload by not passing startTimecode or endTimecode. This will return the most recent game state.<br/> 2) Find the latest timecode in this response. <br/> 3) Wait X seconds<br/> 4) Use the timecode from 2 as the startTimecode. This will give you a diff of everything that has happened since startTimecode. <br/> 5) If no data is returned, wait X seconds and do the same request. <br/> 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
@return ApiLiveGameDiffPatchV1Request
*/
func (a *GameAPIService) LiveGameDiffPatchV1(ctx context.Context, gamePk interface{}) ApiLiveGameDiffPatchV1Request {
return ApiLiveGameDiffPatchV1Request{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) LiveGameDiffPatchV1Execute(r ApiLiveGameDiffPatchV1Request) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.LiveGameDiffPatchV1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1.1/game/{game_pk}/feed/live/diffPatch"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.startTimecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "startTimecode", r.startTimecode, "", "")
}
if r.endTimecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "endTimecode", r.endTimecode, "", "")
}
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiLiveGameV1Request struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
timecode *interface{}
fields *interface{}
inclusiveTimecode *interface{}
accent *interface{}
}
// Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
func (r ApiLiveGameV1Request) Timecode(timecode interface{}) ApiLiveGameV1Request {
r.timecode = &timecode
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiLiveGameV1Request) Fields(fields interface{}) ApiLiveGameV1Request {
r.fields = &fields
return r
}
// True to include plays that happen before or at the specified timecode
func (r ApiLiveGameV1Request) InclusiveTimecode(inclusiveTimecode interface{}) ApiLiveGameV1Request {
r.inclusiveTimecode = &inclusiveTimecode
return r
}
// Boolean value to specify wanting a person&#39;s name with accents or without
func (r ApiLiveGameV1Request) Accent(accent interface{}) ApiLiveGameV1Request {
r.accent = &accent
return r
}
func (r ApiLiveGameV1Request) Execute() (*http.Response, error) {
return r.ApiService.LiveGameV1Execute(r)
}
/*
LiveGameV1 Get live game status.
This API can return very large payloads. It is STRONGLY recommended that clients ask for diffs and use "Accept-Encoding: gzip" 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
@return ApiLiveGameV1Request
*/
func (a *GameAPIService) LiveGameV1(ctx context.Context, gamePk interface{}) ApiLiveGameV1Request {
return ApiLiveGameV1Request{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) LiveGameV1Execute(r ApiLiveGameV1Request) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.LiveGameV1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1.1/game/{game_pk}/feed/live"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.timecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if r.inclusiveTimecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "inclusiveTimecode", r.inclusiveTimecode, "", "")
}
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiLiveTimestampv11Request struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
}
func (r ApiLiveTimestampv11Request) Execute() (*http.Response, error) {
return r.ApiService.LiveTimestampv11Execute(r)
}
/*
LiveTimestampv11 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 ApiLiveTimestampv11Request
*/
func (a *GameAPIService) LiveTimestampv11(ctx context.Context, gamePk interface{}) ApiLiveTimestampv11Request {
return ApiLiveTimestampv11Request{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) LiveTimestampv11Execute(r ApiLiveTimestampv11Request) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.LiveTimestampv11")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1.1/game/{game_pk}/feed/live/timestamps"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "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{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiPlayByPlayRequest struct {
ctx context.Context
ApiService *GameAPIService
gamePk interface{}
timecode *interface{}
fields *interface{}
inclusiveTimecode *interface{}
accent *interface{}
}
// Use this parameter to return a snapshot of the data at the specified time. Format: YYYYMMDD_HHMMSS
func (r ApiPlayByPlayRequest) Timecode(timecode interface{}) ApiPlayByPlayRequest {
r.timecode = &timecode
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiPlayByPlayRequest) Fields(fields interface{}) ApiPlayByPlayRequest {
r.fields = &fields
return r
}
// True to include plays that happen before or at the specified timecode
func (r ApiPlayByPlayRequest) InclusiveTimecode(inclusiveTimecode interface{}) ApiPlayByPlayRequest {
r.inclusiveTimecode = &inclusiveTimecode
return r
}
// Boolean value to specify wanting a person&#39;s name with accents or without
func (r ApiPlayByPlayRequest) Accent(accent interface{}) ApiPlayByPlayRequest {
r.accent = &accent
return r
}
func (r ApiPlayByPlayRequest) Execute() (*http.Response, error) {
return r.ApiService.PlayByPlayExecute(r)
}
/*
PlayByPlay 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
@return ApiPlayByPlayRequest
*/
func (a *GameAPIService) PlayByPlay(ctx context.Context, gamePk interface{}) ApiPlayByPlayRequest {
return ApiPlayByPlayRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
}
}
// Execute executes the request
func (a *GameAPIService) PlayByPlayExecute(r ApiPlayByPlayRequest) (*http.Response, error) {
var (
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
formFiles []formFile
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GameAPIService.PlayByPlay")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/game/{game_pk}/playByPlay"
localVarPath = strings.Replace(localVarPath, "{"+"game_pk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.timecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "timecode", r.timecode, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if r.inclusiveTimecode != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "inclusiveTimecode", r.inclusiveTimecode, "", "")
}
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarHTTPResponse, err
}
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}