248 lines
7.7 KiB
Go
248 lines
7.7 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"
|
|
)
|
|
|
|
|
|
// SkeletalAPIService SkeletalAPI service
|
|
type SkeletalAPIService service
|
|
|
|
type ApiSkeletalChunkedRequest struct {
|
|
ctx context.Context
|
|
ApiService *SkeletalAPIService
|
|
gamePk interface{}
|
|
playId interface{}
|
|
fileName *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Skeletal chunked file name
|
|
func (r ApiSkeletalChunkedRequest) FileName(fileName interface{}) ApiSkeletalChunkedRequest {
|
|
r.fileName = &fileName
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiSkeletalChunkedRequest) Fields(fields interface{}) ApiSkeletalChunkedRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiSkeletalChunkedRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.SkeletalChunkedExecute(r)
|
|
}
|
|
|
|
/*
|
|
SkeletalChunked View Skeletal Data by playId and gameId chunked
|
|
|
|
This endpoint allows you to pull chunked skeletal tracking data by gameId and playId
|
|
|
|
@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 playId Unique play identifier
|
|
@return ApiSkeletalChunkedRequest
|
|
*/
|
|
func (a *SkeletalAPIService) SkeletalChunked(ctx context.Context, gamePk interface{}, playId interface{}) ApiSkeletalChunkedRequest {
|
|
return ApiSkeletalChunkedRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
gamePk: gamePk,
|
|
playId: playId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *SkeletalAPIService) SkeletalChunkedExecute(r ApiSkeletalChunkedRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SkeletalAPIService.SkeletalChunked")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/game/{gamePk}/{playId}/analytics/skeletalData/chunked"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"playId"+"}", url.PathEscape(parameterValueToString(r.playId, "playId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.fileName == nil {
|
|
return nil, reportError("fileName is required and must be specified")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fileName", r.fileName, "", "")
|
|
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 ApiSkeletalDataFileNamesRequest struct {
|
|
ctx context.Context
|
|
ApiService *SkeletalAPIService
|
|
gamePk interface{}
|
|
playId interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiSkeletalDataFileNamesRequest) Fields(fields interface{}) ApiSkeletalDataFileNamesRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiSkeletalDataFileNamesRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.SkeletalDataFileNamesExecute(r)
|
|
}
|
|
|
|
/*
|
|
SkeletalDataFileNames View Skeletal Data by playId and gameId files
|
|
|
|
This endpoint allows you to pull chunked skeletal tracking data by gameId and playId
|
|
|
|
@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 playId Unique play identifier
|
|
@return ApiSkeletalDataFileNamesRequest
|
|
*/
|
|
func (a *SkeletalAPIService) SkeletalDataFileNames(ctx context.Context, gamePk interface{}, playId interface{}) ApiSkeletalDataFileNamesRequest {
|
|
return ApiSkeletalDataFileNamesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
gamePk: gamePk,
|
|
playId: playId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *SkeletalAPIService) SkeletalDataFileNamesExecute(r ApiSkeletalDataFileNamesRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SkeletalAPIService.SkeletalDataFileNames")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/game/{gamePk}/{playId}/analytics/skeletalData/files"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"playId"+"}", url.PathEscape(parameterValueToString(r.playId, "playId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
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
|
|
}
|