2025-04-06 04:55:01 +00:00
|
|
|
/*
|
2025-04-07 02:59:20 +00:00
|
|
|
Copyright © 2025 filifa
|
|
|
|
|
|
|
|
This program 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.
|
|
|
|
|
|
|
|
This program 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
|
|
|
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
/*
|
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"
|
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// GamePaceAPIService GamePaceAPI service
|
|
|
|
type GamePaceAPIService service
|
|
|
|
|
|
|
|
type ApiGamePaceRequest struct {
|
2025-04-07 02:14:30 +00:00
|
|
|
ctx context.Context
|
|
|
|
ApiService *GamePaceAPIService
|
|
|
|
season *interface{}
|
|
|
|
teamId *interface{}
|
|
|
|
teamIds *interface{}
|
|
|
|
leagueId *interface{}
|
|
|
|
leagueIds *interface{}
|
|
|
|
leagueListId *interface{}
|
|
|
|
sportId *interface{}
|
|
|
|
sportIds *interface{}
|
|
|
|
gameType *interface{}
|
|
|
|
startDate *interface{}
|
|
|
|
endDate *interface{}
|
|
|
|
venueIds *interface{}
|
2025-04-06 23:39:04 +00:00
|
|
|
excludeVenueIds *interface{}
|
2025-04-07 02:14:30 +00:00
|
|
|
excludeGamePks *interface{}
|
|
|
|
orgType *interface{}
|
2025-04-06 23:39:04 +00:00
|
|
|
includeChildren *interface{}
|
2025-04-07 02:14:30 +00:00
|
|
|
fields *interface{}
|
2025-04-06 23:39:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Season of play
|
|
|
|
func (r ApiGamePaceRequest) Season(season interface{}) ApiGamePaceRequest {
|
|
|
|
r.season = &season
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
|
|
func (r ApiGamePaceRequest) TeamId(teamId interface{}) ApiGamePaceRequest {
|
|
|
|
r.teamId = &teamId
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of Unique Team identifiers
|
|
|
|
func (r ApiGamePaceRequest) TeamIds(teamIds interface{}) ApiGamePaceRequest {
|
|
|
|
r.teamIds = &teamIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unique League Identifier
|
|
|
|
func (r ApiGamePaceRequest) LeagueId(leagueId interface{}) ApiGamePaceRequest {
|
|
|
|
r.leagueId = &leagueId
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
|
|
func (r ApiGamePaceRequest) LeagueIds(leagueIds interface{}) ApiGamePaceRequest {
|
|
|
|
r.leagueIds = &leagueIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Unique League List Identifier
|
|
|
|
func (r ApiGamePaceRequest) LeagueListId(leagueListId interface{}) ApiGamePaceRequest {
|
|
|
|
r.leagueListId = &leagueListId
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Top level organization of a sport
|
|
|
|
func (r ApiGamePaceRequest) SportId(sportId interface{}) ApiGamePaceRequest {
|
|
|
|
r.sportId = &sportId
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
|
|
func (r ApiGamePaceRequest) SportIds(sportIds interface{}) ApiGamePaceRequest {
|
|
|
|
r.sportIds = &sportIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
|
|
func (r ApiGamePaceRequest) GameType(gameType interface{}) ApiGamePaceRequest {
|
|
|
|
r.gameType = &gameType
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
|
|
|
|
func (r ApiGamePaceRequest) StartDate(startDate interface{}) ApiGamePaceRequest {
|
|
|
|
r.startDate = &startDate
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
|
|
|
|
func (r ApiGamePaceRequest) EndDate(endDate interface{}) ApiGamePaceRequest {
|
|
|
|
r.endDate = &endDate
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of Unique venue identifiers
|
|
|
|
func (r ApiGamePaceRequest) VenueIds(venueIds interface{}) ApiGamePaceRequest {
|
|
|
|
r.venueIds = &venueIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of Unique venue identifiers
|
|
|
|
func (r ApiGamePaceRequest) ExcludeVenueIds(excludeVenueIds interface{}) ApiGamePaceRequest {
|
|
|
|
r.excludeVenueIds = &excludeVenueIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of unique primary keys
|
|
|
|
func (r ApiGamePaceRequest) ExcludeGamePks(excludeGamePks interface{}) ApiGamePaceRequest {
|
|
|
|
r.excludeGamePks = &excludeGamePks
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Organization level. Format: T(Team), L(League), S(Sport)
|
|
|
|
func (r ApiGamePaceRequest) OrgType(orgType interface{}) ApiGamePaceRequest {
|
|
|
|
r.orgType = &orgType
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Determines weather to include results from an organization's children (ex. a sport would also include results for the teams and leagues)
|
|
|
|
func (r ApiGamePaceRequest) IncludeChildren(includeChildren interface{}) ApiGamePaceRequest {
|
|
|
|
r.includeChildren = &includeChildren
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
|
|
func (r ApiGamePaceRequest) Fields(fields interface{}) ApiGamePaceRequest {
|
|
|
|
r.fields = &fields
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiGamePaceRequest) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.GamePaceExecute(r)
|
|
|
|
}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
GamePace View time of game info
|
|
|
|
|
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().
|
|
|
|
@return ApiGamePaceRequest
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
2025-04-06 23:39:04 +00:00
|
|
|
func (a *GamePaceAPIService) GamePace(ctx context.Context) ApiGamePaceRequest {
|
|
|
|
return ApiGamePaceRequest{
|
|
|
|
ApiService: a,
|
2025-04-07 02:14:30 +00:00
|
|
|
ctx: ctx,
|
2025-04-06 23:39:04 +00:00
|
|
|
}
|
|
|
|
}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// Execute executes the request
|
|
|
|
func (a *GamePaceAPIService) GamePaceExecute(r ApiGamePaceRequest) (*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, "GamePaceAPIService.GamePace")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/gamePace"
|
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.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.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.teamIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
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.leagueIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.leagueListId != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.sportId != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.sportIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.gameType != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.startDate != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.endDate != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.venueIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "venueIds", r.venueIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.excludeVenueIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "excludeVenueIds", r.excludeVenueIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.excludeGamePks != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "excludeGamePks", r.excludeGamePks, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.orgType != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "orgType", r.orgType, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.includeChildren != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "includeChildren", r.includeChildren, "", "")
|
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
|
|
|
}
|