2025-04-06 04:55:01 +00:00
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
Stats API Documentation
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
Official API for Major League Baseball.
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
API version: 2.0.0
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
|
2025-04-06 04:55:01 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2025-04-06 23:39:04 +00:00
|
|
|
"bytes"
|
2025-04-06 04:55:01 +00:00
|
|
|
"context"
|
2025-04-06 23:39:04 +00:00
|
|
|
"io"
|
2025-04-06 04:55:01 +00:00
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// StandingsAPIService StandingsAPI service
|
|
|
|
type StandingsAPIService service
|
|
|
|
|
|
|
|
type ApiStandingsRequest struct {
|
2025-04-07 02:14:30 +00:00
|
|
|
ctx context.Context
|
|
|
|
ApiService *StandingsAPIService
|
|
|
|
standingsType interface{}
|
|
|
|
leagueId *interface{}
|
|
|
|
season *interface{}
|
2025-04-06 23:39:04 +00:00
|
|
|
standingsTypes *interface{}
|
2025-04-07 02:14:30 +00:00
|
|
|
date *interface{}
|
|
|
|
teamId *interface{}
|
|
|
|
includeMLB *interface{}
|
|
|
|
fields *interface{}
|
2025-04-06 23:39:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Unique League Identifier
|
|
|
|
func (r ApiStandingsRequest) LeagueId(leagueId interface{}) ApiStandingsRequest {
|
|
|
|
r.leagueId = &leagueId
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Season of play
|
|
|
|
func (r ApiStandingsRequest) Season(season interface{}) ApiStandingsRequest {
|
|
|
|
r.season = &season
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Type of season. Available types in /api/v1/standingsTypes
|
|
|
|
func (r ApiStandingsRequest) StandingsTypes(standingsTypes interface{}) ApiStandingsRequest {
|
|
|
|
r.standingsTypes = &standingsTypes
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
|
|
func (r ApiStandingsRequest) Date(date interface{}) ApiStandingsRequest {
|
|
|
|
r.date = &date
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
|
|
func (r ApiStandingsRequest) TeamId(teamId interface{}) ApiStandingsRequest {
|
|
|
|
r.teamId = &teamId
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Determines whether to include major league teams when using the 'BY_ORGANIZATION' standings type
|
|
|
|
func (r ApiStandingsRequest) IncludeMLB(includeMLB interface{}) ApiStandingsRequest {
|
|
|
|
r.includeMLB = &includeMLB
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
|
|
func (r ApiStandingsRequest) Fields(fields interface{}) ApiStandingsRequest {
|
|
|
|
r.fields = &fields
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiStandingsRequest) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.StandingsExecute(r)
|
|
|
|
}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
Standings View standings for a league
|
|
|
|
|
2025-04-06 04:55:01 +00:00
|
|
|
This endpoint allows you to pull standings
|
|
|
|
|
2025-04-07 02:14:30 +00:00
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
@param standingsType Type of season. Available types in /api/v1/standingsTypes
|
|
|
|
@return ApiStandingsRequest
|
2025-04-06 23:39:04 +00:00
|
|
|
*/
|
|
|
|
func (a *StandingsAPIService) Standings(ctx context.Context, standingsType interface{}) ApiStandingsRequest {
|
|
|
|
return ApiStandingsRequest{
|
2025-04-07 02:14:30 +00:00
|
|
|
ApiService: a,
|
|
|
|
ctx: ctx,
|
2025-04-06 23:39:04 +00:00
|
|
|
standingsType: standingsType,
|
|
|
|
}
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// Execute executes the request
|
|
|
|
func (a *StandingsAPIService) StandingsExecute(r ApiStandingsRequest) (*http.Response, error) {
|
2025-04-06 04:55:01 +00:00
|
|
|
var (
|
2025-04-07 02:14:30 +00:00
|
|
|
localVarHTTPMethod = http.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
formFiles []formFile
|
2025-04-06 04:55:01 +00:00
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StandingsAPIService.Standings")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/standings/{standingsType}"
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"standingsType"+"}", url.PathEscape(parameterValueToString(r.standingsType, "standingsType")), -1)
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.leagueId != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.season != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.standingsTypes != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "standingsTypes", r.standingsTypes, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.date != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.teamId != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.includeMLB != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "includeMLB", r.includeMLB, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.fields != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
// to determine the Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccepts := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return nil, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := &GenericOpenAPIError{
|
2025-04-06 04:55:01 +00:00
|
|
|
body: localVarBody,
|
2025-04-06 23:39:04 +00:00
|
|
|
error: localVarHTTPResponse.Status,
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, newErr
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ApiStandings1Request struct {
|
2025-04-07 02:14:30 +00:00
|
|
|
ctx context.Context
|
|
|
|
ApiService *StandingsAPIService
|
|
|
|
standingsType interface{}
|
|
|
|
leagueId *interface{}
|
|
|
|
season *interface{}
|
2025-04-06 23:39:04 +00:00
|
|
|
standingsTypes *interface{}
|
2025-04-07 02:14:30 +00:00
|
|
|
date *interface{}
|
|
|
|
teamId *interface{}
|
|
|
|
includeMLB *interface{}
|
|
|
|
fields *interface{}
|
2025-04-06 23:39:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Unique League Identifier
|
|
|
|
func (r ApiStandings1Request) LeagueId(leagueId interface{}) ApiStandings1Request {
|
|
|
|
r.leagueId = &leagueId
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Season of play
|
|
|
|
func (r ApiStandings1Request) Season(season interface{}) ApiStandings1Request {
|
|
|
|
r.season = &season
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Type of season. Available types in /api/v1/standingsTypes
|
|
|
|
func (r ApiStandings1Request) StandingsTypes(standingsTypes interface{}) ApiStandings1Request {
|
|
|
|
r.standingsTypes = &standingsTypes
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
|
|
func (r ApiStandings1Request) Date(date interface{}) ApiStandings1Request {
|
|
|
|
r.date = &date
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
|
|
func (r ApiStandings1Request) TeamId(teamId interface{}) ApiStandings1Request {
|
|
|
|
r.teamId = &teamId
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Determines whether to include major league teams when using the 'BY_ORGANIZATION' standings type
|
|
|
|
func (r ApiStandings1Request) IncludeMLB(includeMLB interface{}) ApiStandings1Request {
|
|
|
|
r.includeMLB = &includeMLB
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
|
|
func (r ApiStandings1Request) Fields(fields interface{}) ApiStandings1Request {
|
|
|
|
r.fields = &fields
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiStandings1Request) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.Standings1Execute(r)
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
Standings1 View standings for a league
|
|
|
|
|
2025-04-06 04:55:01 +00:00
|
|
|
This endpoint allows you to pull standings
|
|
|
|
|
2025-04-07 02:14:30 +00:00
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
@param standingsType Type of season. Available types in /api/v1/standingsTypes
|
|
|
|
@return ApiStandings1Request
|
2025-04-06 23:39:04 +00:00
|
|
|
*/
|
|
|
|
func (a *StandingsAPIService) Standings1(ctx context.Context, standingsType interface{}) ApiStandings1Request {
|
|
|
|
return ApiStandings1Request{
|
2025-04-07 02:14:30 +00:00
|
|
|
ApiService: a,
|
|
|
|
ctx: ctx,
|
2025-04-06 23:39:04 +00:00
|
|
|
standingsType: standingsType,
|
|
|
|
}
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// Execute executes the request
|
|
|
|
func (a *StandingsAPIService) Standings1Execute(r ApiStandings1Request) (*http.Response, error) {
|
2025-04-06 04:55:01 +00:00
|
|
|
var (
|
2025-04-07 02:14:30 +00:00
|
|
|
localVarHTTPMethod = http.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
formFiles []formFile
|
2025-04-06 04:55:01 +00:00
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StandingsAPIService.Standings1")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/standings"
|
|
|
|
localVarPath = strings.Replace(localVarPath, "{"+"standingsType"+"}", url.PathEscape(parameterValueToString(r.standingsType, "standingsType")), -1)
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.leagueId != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.season != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.standingsTypes != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "standingsTypes", r.standingsTypes, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.date != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.teamId != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.includeMLB != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "includeMLB", r.includeMLB, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.fields != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
// to determine the Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccepts := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return nil, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := &GenericOpenAPIError{
|
2025-04-06 04:55:01 +00:00
|
|
|
body: localVarBody,
|
2025-04-06 23:39:04 +00:00
|
|
|
error: localVarHTTPResponse.Status,
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, newErr
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, nil
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|