/* 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" ) // BiomechanicsAPIService BiomechanicsAPI service type BiomechanicsAPIService service type ApiBiomechanicalRequest struct { ctx context.Context ApiService *BiomechanicsAPIService gamePk interface{} playId interface{} positionId interface{} fields *interface{} } // Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute func (r ApiBiomechanicalRequest) Fields(fields interface{}) ApiBiomechanicalRequest { r.fields = &fields return r } func (r ApiBiomechanicalRequest) Execute() (*http.Response, error) { return r.ApiService.BiomechanicalExecute(r) } /* Biomechanical View Biomechanical data by playId and gameId filtered by player positionId This endpoint allows you to pull biomechanical tracking data by gameId and playId filtered by player positionId @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 @param positionId Position number. Format: 1, 2, 3, etc @return ApiBiomechanicalRequest */ func (a *BiomechanicsAPIService) Biomechanical(ctx context.Context, gamePk interface{}, playId interface{}, positionId interface{}) ApiBiomechanicalRequest { return ApiBiomechanicalRequest{ ApiService: a, ctx: ctx, gamePk: gamePk, playId: playId, positionId: positionId, } } // Execute executes the request func (a *BiomechanicsAPIService) BiomechanicalExecute(r ApiBiomechanicalRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BiomechanicsAPIService.Biomechanical") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/api/v1/game/{gamePk}/{playId}/analytics/biomechanics/{positionId}" localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1) localVarPath = strings.Replace(localVarPath, "{"+"playId"+"}", url.PathEscape(parameterValueToString(r.playId, "playId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"positionId"+"}", url.PathEscape(parameterValueToString(r.positionId, "positionId")), -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 }