change to openapi generated code

This commit is contained in:
filifa 2025-04-06 19:39:04 -04:00
parent f6f86c3dc4
commit 6d4c701d0d
1120 changed files with 46634 additions and 2882617 deletions

View File

@ -1,11 +1,11 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):

View File

@ -0,0 +1,106 @@
.gitignore
.openapi-generator-ignore
.travis.yml
README.md
api/openapi.yaml
api_analytics.go
api_attendance.go
api_awards.go
api_bat_tracking.go
api_biomechanics.go
api_broadcast.go
api_conference.go
api_division.go
api_draft.go
api_game.go
api_game_pace.go
api_high_low.go
api_homerun_derby.go
api_job.go
api_league.go
api_milestones.go
api_misc.go
api_person.go
api_predictions.go
api_reviews.go
api_schedule.go
api_season.go
api_skeletal.go
api_sports.go
api_standings.go
api_stats.go
api_streaks.go
api_teams.go
api_transactions.go
api_uniforms.go
api_venues.go
api_weather.go
client.go
configuration.go
docs/AnalyticsAPI.md
docs/AttendanceAPI.md
docs/AwardsAPI.md
docs/BatTrackingAPI.md
docs/BiomechanicsAPI.md
docs/BroadcastAPI.md
docs/ConferenceAPI.md
docs/DivisionAPI.md
docs/DraftAPI.md
docs/GameAPI.md
docs/GamePaceAPI.md
docs/HighLowAPI.md
docs/HomerunDerbyAPI.md
docs/JobAPI.md
docs/LeagueAPI.md
docs/MilestonesAPI.md
docs/MiscAPI.md
docs/PersonAPI.md
docs/PredictionsAPI.md
docs/ReviewsAPI.md
docs/ScheduleAPI.md
docs/SeasonAPI.md
docs/SkeletalAPI.md
docs/SportsAPI.md
docs/StandingsAPI.md
docs/StatsAPI.md
docs/StreaksAPI.md
docs/TeamsAPI.md
docs/TransactionsAPI.md
docs/UniformsAPI.md
docs/VenuesAPI.md
docs/WeatherAPI.md
git_push.sh
response.go
test/api_analytics_test.go
test/api_attendance_test.go
test/api_awards_test.go
test/api_bat_tracking_test.go
test/api_biomechanics_test.go
test/api_broadcast_test.go
test/api_conference_test.go
test/api_division_test.go
test/api_draft_test.go
test/api_game_pace_test.go
test/api_game_test.go
test/api_high_low_test.go
test/api_homerun_derby_test.go
test/api_job_test.go
test/api_league_test.go
test/api_milestones_test.go
test/api_misc_test.go
test/api_person_test.go
test/api_predictions_test.go
test/api_reviews_test.go
test/api_schedule_test.go
test/api_season_test.go
test/api_skeletal_test.go
test/api_sports_test.go
test/api_standings_test.go
test/api_stats_test.go
test/api_streaks_test.go
test/api_teams_test.go
test/api_transactions_test.go
test/api_uniforms_test.go
test/api_venues_test.go
test/api_weather_test.go
utils.go

View File

@ -0,0 +1 @@
7.12.0

View File

@ -1 +0,0 @@
3.0.68

File diff suppressed because it is too large Load Diff

7119
api/api/openapi.yaml Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,177 +1,199 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type AttendanceApiService service
// AttendanceAPIService AttendanceAPI service
type AttendanceAPIService service
/*
AttendanceApiService Get team attendance
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *AttendanceApiGetTeamAttendanceOpts - Optional Parameters:
* @param "TeamId" (optional.Interface of []int32) - Unique Team Identifier. Format: 141, 147, etc
* @param "LeagueId" (optional.Interface of []int32) - Comma delimited list of Unique league identifiers
* @param "Season" (optional.Interface of []string) - Comma delimited list of Seasons of play
* @param "LeagueListId" (optional.Interface of LeagueListsEnum) - Unique League List Identifier
* @param "GameType" (optional.Interface of []models.GameTypeEnum) - Type of Game. Available types in /api/v1/gameTypes
* @param "Date" (optional.String) - Date of Game. Format: YYYY-MM-DD
* @param "StartDate" (optional.String) - Start date for range of data (must be used with end date). Format: MM/DD/YYYY
* @param "EndDate" (optional.String) - End date for range of data (must be used with start date). Format: MM/DD/YYYY
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.AttendanceRestObject
*/
type AttendanceApiGetTeamAttendanceOpts struct {
TeamId optional.Interface
LeagueId optional.Interface
Season optional.Interface
LeagueListId optional.Interface
GameType optional.Interface
Date optional.String
StartDate optional.String
EndDate optional.String
Fields optional.Interface
type ApiGetTeamAttendanceRequest struct {
ctx context.Context
ApiService *AttendanceAPIService
teamId *interface{}
leagueId *interface{}
season *interface{}
leagueListId *interface{}
gameType *interface{}
date *interface{}
startDate *interface{}
endDate *interface{}
fields *interface{}
}
func (a *AttendanceApiService) GetTeamAttendance(ctx context.Context, localVarOptionals *AttendanceApiGetTeamAttendanceOpts) (models.AttendanceRestObject, *http.Response, error) {
// Unique Team Identifier. Format: 141, 147, etc
func (r ApiGetTeamAttendanceRequest) TeamId(teamId interface{}) ApiGetTeamAttendanceRequest {
r.teamId = &teamId
return r
}
// Comma delimited list of Unique league identifiers
func (r ApiGetTeamAttendanceRequest) LeagueId(leagueId interface{}) ApiGetTeamAttendanceRequest {
r.leagueId = &leagueId
return r
}
// Comma delimited list of Seasons of play
func (r ApiGetTeamAttendanceRequest) Season(season interface{}) ApiGetTeamAttendanceRequest {
r.season = &season
return r
}
// Unique League List Identifier
func (r ApiGetTeamAttendanceRequest) LeagueListId(leagueListId interface{}) ApiGetTeamAttendanceRequest {
r.leagueListId = &leagueListId
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiGetTeamAttendanceRequest) GameType(gameType interface{}) ApiGetTeamAttendanceRequest {
r.gameType = &gameType
return r
}
// Date of Game. Format: YYYY-MM-DD
func (r ApiGetTeamAttendanceRequest) Date(date interface{}) ApiGetTeamAttendanceRequest {
r.date = &date
return r
}
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
func (r ApiGetTeamAttendanceRequest) StartDate(startDate interface{}) ApiGetTeamAttendanceRequest {
r.startDate = &startDate
return r
}
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
func (r ApiGetTeamAttendanceRequest) EndDate(endDate interface{}) ApiGetTeamAttendanceRequest {
r.endDate = &endDate
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetTeamAttendanceRequest) Fields(fields interface{}) ApiGetTeamAttendanceRequest {
r.fields = &fields
return r
}
func (r ApiGetTeamAttendanceRequest) Execute() (*http.Response, error) {
return r.ApiService.GetTeamAttendanceExecute(r)
}
/*
GetTeamAttendance Get team attendance
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetTeamAttendanceRequest
*/
func (a *AttendanceAPIService) GetTeamAttendance(ctx context.Context) ApiGetTeamAttendanceRequest {
return ApiGetTeamAttendanceRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *AttendanceAPIService) GetTeamAttendanceExecute(r ApiGetTeamAttendanceRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.AttendanceRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/attendance"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AttendanceAPIService.GetTeamAttendance")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/attendance"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.TeamId.IsSet() {
localVarQueryParams.Add("teamId", parameterToString(localVarOptionals.TeamId.Value(), "multi"))
if r.teamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), "multi"))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), "multi"))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueListId.IsSet() {
localVarQueryParams.Add("leagueListId", parameterToString(localVarOptionals.LeagueListId.Value(), ""))
if r.leagueListId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), "multi"))
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
if r.date != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
}
if localVarOptionals != nil && localVarOptionals.StartDate.IsSet() {
localVarQueryParams.Add("startDate", parameterToString(localVarOptionals.StartDate.Value(), ""))
if r.startDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
}
if localVarOptionals != nil && localVarOptionals.EndDate.IsSet() {
localVarQueryParams.Add("endDate", parameterToString(localVarOptionals.EndDate.Value(), ""))
if r.endDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.AttendanceRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,355 +1,373 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type AwardsApiService service
// AwardsAPIService AwardsAPI service
type AwardsAPIService service
/*
AwardsApiService View recipients of an award
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param awardId Unique Award Identifier. Available awards in /api/v1/awards
* @param optional nil or *AwardsApiAwardRecipientsOpts - Optional Parameters:
* @param "Season" (optional.String) - Season of play
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "LeagueId" (optional.Interface of []int32) - Comma delimited list of Unique league identifiers
* @param "Fields" (optional.Interface of []string) -
@return models.AwardsRestObject
*/
type AwardsApiAwardRecipientsOpts struct {
Season optional.String
SportId optional.Int32
LeagueId optional.Interface
Fields optional.Interface
type ApiAwardRecipientsRequest struct {
ctx context.Context
ApiService *AwardsAPIService
awardId interface{}
season *interface{}
sportId *interface{}
leagueId *interface{}
fields *interface{}
}
func (a *AwardsApiService) AwardRecipients(ctx context.Context, awardId string, localVarOptionals *AwardsApiAwardRecipientsOpts) (models.AwardsRestObject, *http.Response, error) {
// Season of play
func (r ApiAwardRecipientsRequest) Season(season interface{}) ApiAwardRecipientsRequest {
r.season = &season
return r
}
// Top level organization of a sport
func (r ApiAwardRecipientsRequest) SportId(sportId interface{}) ApiAwardRecipientsRequest {
r.sportId = &sportId
return r
}
// Comma delimited list of Unique league identifiers
func (r ApiAwardRecipientsRequest) LeagueId(leagueId interface{}) ApiAwardRecipientsRequest {
r.leagueId = &leagueId
return r
}
func (r ApiAwardRecipientsRequest) Fields(fields interface{}) ApiAwardRecipientsRequest {
r.fields = &fields
return r
}
func (r ApiAwardRecipientsRequest) Execute() (*http.Response, error) {
return r.ApiService.AwardRecipientsExecute(r)
}
/*
AwardRecipients View recipients of an award
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param awardId Unique Award Identifier. Available awards in /api/v1/awards
@return ApiAwardRecipientsRequest
*/
func (a *AwardsAPIService) AwardRecipients(ctx context.Context, awardId interface{}) ApiAwardRecipientsRequest {
return ApiAwardRecipientsRequest{
ApiService: a,
ctx: ctx,
awardId: awardId,
}
}
// Execute executes the request
func (a *AwardsAPIService) AwardRecipientsExecute(r ApiAwardRecipientsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.AwardsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/awards/{awardId}/recipients"
localVarPath = strings.Replace(localVarPath, "{"+"awardId"+"}", fmt.Sprintf("%v", awardId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AwardsAPIService.AwardRecipients")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/awards/{awardId}/recipients"
localVarPath = strings.Replace(localVarPath, "{"+"awardId"+"}", url.PathEscape(parameterValueToString(r.awardId, "awardId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), "multi"))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.AwardsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiAwardsRequest struct {
ctx context.Context
ApiService *AwardsAPIService
awardId interface{}
orgId *interface{}
fields *interface{}
}
// Comma delimited list of top level organizations of a sport
func (r ApiAwardsRequest) OrgId(orgId interface{}) ApiAwardsRequest {
r.orgId = &orgId
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiAwardsRequest) Fields(fields interface{}) ApiAwardsRequest {
r.fields = &fields
return r
}
func (r ApiAwardsRequest) Execute() (*http.Response, error) {
return r.ApiService.AwardsExecute(r)
}
/*
AwardsApiService View awards info
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param awardId Unique Award Identifier. Available awards in /api/v1/awards
* @param optional nil or *AwardsApiAwardsOpts - Optional Parameters:
* @param "OrgId" (optional.Interface of []int32) - Comma delimited list of top level organizations of a sport
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.AwardsRestObject
*/
Awards View awards info
type AwardsApiAwardsOpts struct {
OrgId optional.Interface
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param awardId Unique Award Identifier. Available awards in /api/v1/awards
@return ApiAwardsRequest
*/
func (a *AwardsAPIService) Awards(ctx context.Context, awardId interface{}) ApiAwardsRequest {
return ApiAwardsRequest{
ApiService: a,
ctx: ctx,
awardId: awardId,
}
}
func (a *AwardsApiService) Awards(ctx context.Context, awardId string, localVarOptionals *AwardsApiAwardsOpts) (models.AwardsRestObject, *http.Response, error) {
// Execute executes the request
func (a *AwardsAPIService) AwardsExecute(r ApiAwardsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.AwardsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/awards"
localVarPath = strings.Replace(localVarPath, "{"+"awardId"+"}", fmt.Sprintf("%v", awardId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AwardsAPIService.Awards")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/awards"
localVarPath = strings.Replace(localVarPath, "{"+"awardId"+"}", url.PathEscape(parameterValueToString(r.awardId, "awardId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.OrgId.IsSet() {
localVarQueryParams.Add("orgId", parameterToString(localVarOptionals.OrgId.Value(), "multi"))
if r.orgId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "orgId", r.orgId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.AwardsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiAwards1Request struct {
ctx context.Context
ApiService *AwardsAPIService
awardId interface{}
orgId *interface{}
fields *interface{}
}
// Comma delimited list of top level organizations of a sport
func (r ApiAwards1Request) OrgId(orgId interface{}) ApiAwards1Request {
r.orgId = &orgId
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiAwards1Request) Fields(fields interface{}) ApiAwards1Request {
r.fields = &fields
return r
}
func (r ApiAwards1Request) Execute() (*http.Response, error) {
return r.ApiService.Awards1Execute(r)
}
/*
AwardsApiService View awards info
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param awardId Unique Award Identifier. Available awards in /api/v1/awards
* @param optional nil or *AwardsApiAwards1Opts - Optional Parameters:
* @param "OrgId" (optional.Interface of []int32) - Comma delimited list of top level organizations of a sport
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.AwardsRestObject
*/
Awards1 View awards info
type AwardsApiAwards1Opts struct {
OrgId optional.Interface
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param awardId Unique Award Identifier. Available awards in /api/v1/awards
@return ApiAwards1Request
*/
func (a *AwardsAPIService) Awards1(ctx context.Context, awardId interface{}) ApiAwards1Request {
return ApiAwards1Request{
ApiService: a,
ctx: ctx,
awardId: awardId,
}
}
func (a *AwardsApiService) Awards1(ctx context.Context, awardId string, localVarOptionals *AwardsApiAwards1Opts) (models.AwardsRestObject, *http.Response, error) {
// Execute executes the request
func (a *AwardsAPIService) Awards1Execute(r ApiAwards1Request) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.AwardsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/awards/{awardId}"
localVarPath = strings.Replace(localVarPath, "{"+"awardId"+"}", fmt.Sprintf("%v", awardId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "AwardsAPIService.Awards1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/awards/{awardId}"
localVarPath = strings.Replace(localVarPath, "{"+"awardId"+"}", url.PathEscape(parameterValueToString(r.awardId, "awardId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.OrgId.IsSet() {
localVarQueryParams.Add("orgId", parameterToString(localVarOptionals.OrgId.Value(), "multi"))
if r.orgId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "orgId", r.orgId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.AwardsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,143 +1,130 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type BatTrackingApiService service
// BatTrackingAPIService BatTrackingAPI service
type BatTrackingAPIService service
/*
BatTrackingApiService View Bat Tracking Data by playId and gameId
This endpoint allows you to pull bat 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
* @param optional nil or *BatTrackingApiBatTrackingOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.BatTrackingRestObject
*/
type BatTrackingApiBatTrackingOpts struct {
Fields optional.Interface
type ApiBatTrackingRequest struct {
ctx context.Context
ApiService *BatTrackingAPIService
gamePk interface{}
playId interface{}
fields *interface{}
}
func (a *BatTrackingApiService) BatTracking(ctx context.Context, gamePk int32, playId string, localVarOptionals *BatTrackingApiBatTrackingOpts) (models.BatTrackingRestObject, *http.Response, error) {
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiBatTrackingRequest) Fields(fields interface{}) ApiBatTrackingRequest {
r.fields = &fields
return r
}
func (r ApiBatTrackingRequest) Execute() (*http.Response, error) {
return r.ApiService.BatTrackingExecute(r)
}
/*
BatTracking View Bat Tracking Data by playId and gameId
This endpoint allows you to pull bat 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 ApiBatTrackingRequest
*/
func (a *BatTrackingAPIService) BatTracking(ctx context.Context, gamePk interface{}, playId interface{}) ApiBatTrackingRequest {
return ApiBatTrackingRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
playId: playId,
}
}
// Execute executes the request
func (a *BatTrackingAPIService) BatTrackingExecute(r ApiBatTrackingRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.BatTrackingRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/batTracking/game/{gamePk}/{playId}"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
localVarPath = strings.Replace(localVarPath, "{"+"playId"+"}", fmt.Sprintf("%v", playId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BatTrackingAPIService.BatTracking")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/batTracking/game/{gamePk}/{playId}"
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 localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.BatTrackingRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,145 +1,134 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type BiomechanicsApiService service
// BiomechanicsAPIService BiomechanicsAPI service
type BiomechanicsAPIService service
/*
BiomechanicsApiService 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
* @param optional nil or *BiomechanicsApiBiomechanicalOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.SkeletalDataWrapperRestObject
*/
type BiomechanicsApiBiomechanicalOpts struct {
Fields optional.Interface
type ApiBiomechanicalRequest struct {
ctx context.Context
ApiService *BiomechanicsAPIService
gamePk interface{}
playId interface{}
positionId interface{}
fields *interface{}
}
func (a *BiomechanicsApiService) Biomechanical(ctx context.Context, gamePk int32, playId string, positionId int32, localVarOptionals *BiomechanicsApiBiomechanicalOpts) (models.SkeletalDataWrapperRestObject, *http.Response, error) {
// 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 = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.SkeletalDataWrapperRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/{playId}/analytics/biomechanics/{positionId}"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
localVarPath = strings.Replace(localVarPath, "{"+"playId"+"}", fmt.Sprintf("%v", playId), -1)
localVarPath = strings.Replace(localVarPath, "{"+"positionId"+"}", fmt.Sprintf("%v", positionId), -1)
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 localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.SkeletalDataWrapperRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,237 +1,236 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type BroadcastApiService service
// BroadcastAPIService BroadcastAPI service
type BroadcastAPIService service
/*
BroadcastApiService Get All Active Broadcasters
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *BroadcastApiGetAllBroadcastersOpts - Optional Parameters:
* @param "ActiveStatus" (optional.Interface of BroadcasterActiveStatusEnum) - Current status of the broadcaster. Format: Active &#x3D; y, inactive &#x3D; n, both &#x3D; b
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return []models.BroadcasterRestObject
*/
type BroadcastApiGetAllBroadcastersOpts struct {
ActiveStatus optional.Interface
Fields optional.Interface
type ApiGetAllBroadcastersRequest struct {
ctx context.Context
ApiService *BroadcastAPIService
activeStatus *interface{}
fields *interface{}
}
func (a *BroadcastApiService) GetAllBroadcasters(ctx context.Context, localVarOptionals *BroadcastApiGetAllBroadcastersOpts) ([]models.BroadcasterRestObject, *http.Response, error) {
// Current status of the broadcaster. Format: Active &#x3D; y, inactive &#x3D; n, both &#x3D; b
func (r ApiGetAllBroadcastersRequest) ActiveStatus(activeStatus interface{}) ApiGetAllBroadcastersRequest {
r.activeStatus = &activeStatus
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetAllBroadcastersRequest) Fields(fields interface{}) ApiGetAllBroadcastersRequest {
r.fields = &fields
return r
}
func (r ApiGetAllBroadcastersRequest) Execute() (*http.Response, error) {
return r.ApiService.GetAllBroadcastersExecute(r)
}
/*
GetAllBroadcasters Get All Active Broadcasters
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetAllBroadcastersRequest
*/
func (a *BroadcastAPIService) GetAllBroadcasters(ctx context.Context) ApiGetAllBroadcastersRequest {
return ApiGetAllBroadcastersRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *BroadcastAPIService) GetAllBroadcastersExecute(r ApiGetAllBroadcastersRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []models.BroadcasterRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/broadcasters"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BroadcastAPIService.GetAllBroadcasters")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/broadcasters"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
if r.activeStatus != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "activeStatus", r.activeStatus, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []models.BroadcasterRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiGetBroadcastsRequest struct {
ctx context.Context
ApiService *BroadcastAPIService
broadcasterIds *interface{}
fields *interface{}
}
// All of the broadcast details
func (r ApiGetBroadcastsRequest) BroadcasterIds(broadcasterIds interface{}) ApiGetBroadcastsRequest {
r.broadcasterIds = &broadcasterIds
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetBroadcastsRequest) Fields(fields interface{}) ApiGetBroadcastsRequest {
r.fields = &fields
return r
}
func (r ApiGetBroadcastsRequest) Execute() (*http.Response, error) {
return r.ApiService.GetBroadcastsExecute(r)
}
/*
BroadcastApiService Get Broadcasters
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param broadcasterIds All of the broadcast details
* @param optional nil or *BroadcastApiGetBroadcastsOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return []models.BroadcasterRestObject
*/
GetBroadcasts Get Broadcasters
type BroadcastApiGetBroadcastsOpts struct {
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetBroadcastsRequest
*/
func (a *BroadcastAPIService) GetBroadcasts(ctx context.Context) ApiGetBroadcastsRequest {
return ApiGetBroadcastsRequest{
ApiService: a,
ctx: ctx,
}
}
func (a *BroadcastApiService) GetBroadcasts(ctx context.Context, broadcasterIds []int32, localVarOptionals *BroadcastApiGetBroadcastsOpts) ([]models.BroadcasterRestObject, *http.Response, error) {
// Execute executes the request
func (a *BroadcastAPIService) GetBroadcastsExecute(r ApiGetBroadcastsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []models.BroadcasterRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/broadcast"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "BroadcastAPIService.GetBroadcasts")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/broadcast"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.broadcasterIds == nil {
return nil, reportError("broadcasterIds is required and must be specified")
}
localVarQueryParams.Add("broadcasterIds", parameterToString(broadcasterIds, "multi"))
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
parameterAddToHeaderOrQuery(localVarQueryParams, "broadcasterIds", r.broadcasterIds, "", "")
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []models.BroadcasterRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,255 +1,262 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type ConferenceApiService service
// ConferenceAPIService ConferenceAPI service
type ConferenceAPIService service
/*
ConferenceApiService View conference info
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param conferenceId
* @param optional nil or *ConferenceApiConferencesOpts - Optional Parameters:
* @param "Season" (optional.String) - Season of play
* @param "IncludeInactive" (optional.Bool) -
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.ConferencesRestObject
*/
type ConferenceApiConferencesOpts struct {
Season optional.String
IncludeInactive optional.Bool
Fields optional.Interface
type ApiConferencesRequest struct {
ctx context.Context
ApiService *ConferenceAPIService
conferenceId interface{}
season *interface{}
includeInactive *interface{}
fields *interface{}
}
func (a *ConferenceApiService) Conferences(ctx context.Context, conferenceId int32, localVarOptionals *ConferenceApiConferencesOpts) (models.ConferencesRestObject, *http.Response, error) {
// Season of play
func (r ApiConferencesRequest) Season(season interface{}) ApiConferencesRequest {
r.season = &season
return r
}
func (r ApiConferencesRequest) IncludeInactive(includeInactive interface{}) ApiConferencesRequest {
r.includeInactive = &includeInactive
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiConferencesRequest) Fields(fields interface{}) ApiConferencesRequest {
r.fields = &fields
return r
}
func (r ApiConferencesRequest) Execute() (*http.Response, error) {
return r.ApiService.ConferencesExecute(r)
}
/*
Conferences View conference info
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param conferenceId
@return ApiConferencesRequest
*/
func (a *ConferenceAPIService) Conferences(ctx context.Context, conferenceId interface{}) ApiConferencesRequest {
return ApiConferencesRequest{
ApiService: a,
ctx: ctx,
conferenceId: conferenceId,
}
}
// Execute executes the request
func (a *ConferenceAPIService) ConferencesExecute(r ApiConferencesRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.ConferencesRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/conferences"
localVarPath = strings.Replace(localVarPath, "{"+"conferenceId"+"}", fmt.Sprintf("%v", conferenceId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConferenceAPIService.Conferences")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/conferences"
localVarPath = strings.Replace(localVarPath, "{"+"conferenceId"+"}", url.PathEscape(parameterValueToString(r.conferenceId, "conferenceId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.IncludeInactive.IsSet() {
localVarQueryParams.Add("includeInactive", parameterToString(localVarOptionals.IncludeInactive.Value(), ""))
if r.includeInactive != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeInactive", r.includeInactive, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.ConferencesRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiConferences1Request struct {
ctx context.Context
ApiService *ConferenceAPIService
conferenceId interface{}
season *interface{}
includeInactive *interface{}
fields *interface{}
}
// Season of play
func (r ApiConferences1Request) Season(season interface{}) ApiConferences1Request {
r.season = &season
return r
}
func (r ApiConferences1Request) IncludeInactive(includeInactive interface{}) ApiConferences1Request {
r.includeInactive = &includeInactive
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiConferences1Request) Fields(fields interface{}) ApiConferences1Request {
r.fields = &fields
return r
}
func (r ApiConferences1Request) Execute() (*http.Response, error) {
return r.ApiService.Conferences1Execute(r)
}
/*
ConferenceApiService View conference info
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param conferenceId
* @param optional nil or *ConferenceApiConferences1Opts - Optional Parameters:
* @param "Season" (optional.String) - Season of play
* @param "IncludeInactive" (optional.Bool) -
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.ConferencesRestObject
*/
Conferences1 View conference info
type ConferenceApiConferences1Opts struct {
Season optional.String
IncludeInactive optional.Bool
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param conferenceId
@return ApiConferences1Request
*/
func (a *ConferenceAPIService) Conferences1(ctx context.Context, conferenceId interface{}) ApiConferences1Request {
return ApiConferences1Request{
ApiService: a,
ctx: ctx,
conferenceId: conferenceId,
}
}
func (a *ConferenceApiService) Conferences1(ctx context.Context, conferenceId int32, localVarOptionals *ConferenceApiConferences1Opts) (models.ConferencesRestObject, *http.Response, error) {
// Execute executes the request
func (a *ConferenceAPIService) Conferences1Execute(r ApiConferences1Request) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.ConferencesRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/conferences/{conferenceId}"
localVarPath = strings.Replace(localVarPath, "{"+"conferenceId"+"}", fmt.Sprintf("%v", conferenceId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ConferenceAPIService.Conferences1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/conferences/{conferenceId}"
localVarPath = strings.Replace(localVarPath, "{"+"conferenceId"+"}", url.PathEscape(parameterValueToString(r.conferenceId, "conferenceId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.IncludeInactive.IsSet() {
localVarQueryParams.Add("includeInactive", parameterToString(localVarOptionals.IncludeInactive.Value(), ""))
if r.includeInactive != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeInactive", r.includeInactive, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.ConferencesRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,277 +1,308 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type DivisionApiService service
// DivisionAPIService DivisionAPI service
type DivisionAPIService service
/*
DivisionApiService Get division information
This endpoint allows you to pull divisions
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param divisionId Unique Division Identifier
* @param optional nil or *DivisionApiDivisionsOpts - Optional Parameters:
* @param "IncludeInactive" (optional.Bool) - Whether or not to include inactive
* @param "LeagueId" (optional.Int32) - Unique League Identifier
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "Season" (optional.String) - Season of play
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.DivisionsRestObject
*/
type DivisionApiDivisionsOpts struct {
IncludeInactive optional.Bool
LeagueId optional.Int32
SportId optional.Int32
Season optional.String
Fields optional.Interface
type ApiDivisionsRequest struct {
ctx context.Context
ApiService *DivisionAPIService
divisionId interface{}
includeInactive *interface{}
leagueId *interface{}
sportId *interface{}
season *interface{}
fields *interface{}
}
func (a *DivisionApiService) Divisions(ctx context.Context, divisionId int32, localVarOptionals *DivisionApiDivisionsOpts) (models.DivisionsRestObject, *http.Response, error) {
// Whether or not to include inactive
func (r ApiDivisionsRequest) IncludeInactive(includeInactive interface{}) ApiDivisionsRequest {
r.includeInactive = &includeInactive
return r
}
// Unique League Identifier
func (r ApiDivisionsRequest) LeagueId(leagueId interface{}) ApiDivisionsRequest {
r.leagueId = &leagueId
return r
}
// Top level organization of a sport
func (r ApiDivisionsRequest) SportId(sportId interface{}) ApiDivisionsRequest {
r.sportId = &sportId
return r
}
// Season of play
func (r ApiDivisionsRequest) Season(season interface{}) ApiDivisionsRequest {
r.season = &season
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiDivisionsRequest) Fields(fields interface{}) ApiDivisionsRequest {
r.fields = &fields
return r
}
func (r ApiDivisionsRequest) Execute() (*http.Response, error) {
return r.ApiService.DivisionsExecute(r)
}
/*
Divisions Get division information
This endpoint allows you to pull divisions
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param divisionId Unique Division Identifier
@return ApiDivisionsRequest
*/
func (a *DivisionAPIService) Divisions(ctx context.Context, divisionId interface{}) ApiDivisionsRequest {
return ApiDivisionsRequest{
ApiService: a,
ctx: ctx,
divisionId: divisionId,
}
}
// Execute executes the request
func (a *DivisionAPIService) DivisionsExecute(r ApiDivisionsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.DivisionsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/divisions"
localVarPath = strings.Replace(localVarPath, "{"+"divisionId"+"}", fmt.Sprintf("%v", divisionId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DivisionAPIService.Divisions")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/divisions"
localVarPath = strings.Replace(localVarPath, "{"+"divisionId"+"}", url.PathEscape(parameterValueToString(r.divisionId, "divisionId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.IncludeInactive.IsSet() {
localVarQueryParams.Add("includeInactive", parameterToString(localVarOptionals.IncludeInactive.Value(), ""))
if r.includeInactive != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeInactive", r.includeInactive, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.DivisionsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiDivisions1Request struct {
ctx context.Context
ApiService *DivisionAPIService
divisionId interface{}
includeInactive *interface{}
leagueId *interface{}
sportId *interface{}
season *interface{}
fields *interface{}
}
// Whether or not to include inactive
func (r ApiDivisions1Request) IncludeInactive(includeInactive interface{}) ApiDivisions1Request {
r.includeInactive = &includeInactive
return r
}
// Unique League Identifier
func (r ApiDivisions1Request) LeagueId(leagueId interface{}) ApiDivisions1Request {
r.leagueId = &leagueId
return r
}
// Top level organization of a sport
func (r ApiDivisions1Request) SportId(sportId interface{}) ApiDivisions1Request {
r.sportId = &sportId
return r
}
// Season of play
func (r ApiDivisions1Request) Season(season interface{}) ApiDivisions1Request {
r.season = &season
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiDivisions1Request) Fields(fields interface{}) ApiDivisions1Request {
r.fields = &fields
return r
}
func (r ApiDivisions1Request) Execute() (*http.Response, error) {
return r.ApiService.Divisions1Execute(r)
}
/*
DivisionApiService Get division information
This endpoint allows you to pull divisions
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param divisionId Unique Division Identifier
* @param optional nil or *DivisionApiDivisions1Opts - Optional Parameters:
* @param "IncludeInactive" (optional.Bool) - Whether or not to include inactive
* @param "LeagueId" (optional.Int32) - Unique League Identifier
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "Season" (optional.String) - Season of play
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.DivisionsRestObject
*/
Divisions1 Get division information
type DivisionApiDivisions1Opts struct {
IncludeInactive optional.Bool
LeagueId optional.Int32
SportId optional.Int32
Season optional.String
Fields optional.Interface
This endpoint allows you to pull divisions
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param divisionId Unique Division Identifier
@return ApiDivisions1Request
*/
func (a *DivisionAPIService) Divisions1(ctx context.Context, divisionId interface{}) ApiDivisions1Request {
return ApiDivisions1Request{
ApiService: a,
ctx: ctx,
divisionId: divisionId,
}
}
func (a *DivisionApiService) Divisions1(ctx context.Context, divisionId int32, localVarOptionals *DivisionApiDivisions1Opts) (models.DivisionsRestObject, *http.Response, error) {
// Execute executes the request
func (a *DivisionAPIService) Divisions1Execute(r ApiDivisions1Request) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.DivisionsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/divisions/{divisionId}"
localVarPath = strings.Replace(localVarPath, "{"+"divisionId"+"}", fmt.Sprintf("%v", divisionId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DivisionAPIService.Divisions1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/divisions/{divisionId}"
localVarPath = strings.Replace(localVarPath, "{"+"divisionId"+"}", url.PathEscape(parameterValueToString(r.divisionId, "divisionId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.IncludeInactive.IsSet() {
localVarQueryParams.Add("includeInactive", parameterToString(localVarOptionals.IncludeInactive.Value(), ""))
if r.includeInactive != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeInactive", r.includeInactive, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.DivisionsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,217 +1,279 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type GamePaceApiService service
// GamePaceAPIService GamePaceAPI service
type GamePaceAPIService service
/*
GamePaceApiService View time of game info
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *GamePaceApiGamePaceOpts - Optional Parameters:
* @param "Season" (optional.String) - Season of play
* @param "TeamId" (optional.Int32) - Unique Team Identifier. Format: 141, 147, etc
* @param "TeamIds" (optional.Interface of []int32) - Comma delimited list of Unique Team identifiers
* @param "LeagueId" (optional.Int32) - Unique League Identifier
* @param "LeagueIds" (optional.Interface of []int32) - Comma delimited list of Unique league identifiers
* @param "LeagueListId" (optional.Interface of LeagueListsEnum) - Unique League List Identifier
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "SportIds" (optional.Interface of []int32) - Comma delimited list of top level organizations of a sport
* @param "GameType" (optional.Interface of models.GameTypeEnum) - Type of Game. Available types in /api/v1/gameTypes
* @param "StartDate" (optional.String) - Start date for range of data (must be used with end date). Format: MM/DD/YYYY
* @param "EndDate" (optional.String) - End date for range of data (must be used with start date). Format: MM/DD/YYYY
* @param "VenueIds" (optional.Interface of []int32) - Comma delimited list of Unique venue identifiers
* @param "ExcludeVenueIds" (optional.Interface of []int32) - Comma delimited list of Unique venue identifiers
* @param "ExcludeGamePks" (optional.Interface of []int32) - Comma delimited list of unique primary keys
* @param "OrgType" (optional.Interface of OrganizationType) - Organization level. Format: T(Team), L(League), S(Sport)
* @param "IncludeChildren" (optional.Bool) - Determines weather to include results from an organization&#x27;s children (ex. a sport would also include results for the teams and leagues)
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.GamePaceWrapperRestObject
*/
type GamePaceApiGamePaceOpts struct {
Season optional.String
TeamId optional.Int32
TeamIds optional.Interface
LeagueId optional.Int32
LeagueIds optional.Interface
LeagueListId optional.Interface
SportId optional.Int32
SportIds optional.Interface
GameType optional.Interface
StartDate optional.String
EndDate optional.String
VenueIds optional.Interface
ExcludeVenueIds optional.Interface
ExcludeGamePks optional.Interface
OrgType optional.Interface
IncludeChildren optional.Bool
Fields optional.Interface
type ApiGamePaceRequest struct {
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{}
excludeVenueIds *interface{}
excludeGamePks *interface{}
orgType *interface{}
includeChildren *interface{}
fields *interface{}
}
func (a *GamePaceApiService) GamePace(ctx context.Context, localVarOptionals *GamePaceApiGamePaceOpts) (models.GamePaceWrapperRestObject, *http.Response, error) {
// 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&#39;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)
}
/*
GamePace View time of game info
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGamePaceRequest
*/
func (a *GamePaceAPIService) GamePace(ctx context.Context) ApiGamePaceRequest {
return ApiGamePaceRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *GamePaceAPIService) GamePaceExecute(r ApiGamePaceRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.GamePaceWrapperRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/gamePace"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "GamePaceAPIService.GamePace")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/gamePace"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.TeamId.IsSet() {
localVarQueryParams.Add("teamId", parameterToString(localVarOptionals.TeamId.Value(), ""))
if r.teamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
}
if localVarOptionals != nil && localVarOptionals.TeamIds.IsSet() {
localVarQueryParams.Add("teamIds", parameterToString(localVarOptionals.TeamIds.Value(), "multi"))
if r.teamIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
if r.leagueIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueListId.IsSet() {
localVarQueryParams.Add("leagueListId", parameterToString(localVarOptionals.LeagueListId.Value(), ""))
if r.leagueListId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
if r.sportIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if localVarOptionals != nil && localVarOptionals.StartDate.IsSet() {
localVarQueryParams.Add("startDate", parameterToString(localVarOptionals.StartDate.Value(), ""))
if r.startDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
}
if localVarOptionals != nil && localVarOptionals.EndDate.IsSet() {
localVarQueryParams.Add("endDate", parameterToString(localVarOptionals.EndDate.Value(), ""))
if r.endDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
}
if localVarOptionals != nil && localVarOptionals.VenueIds.IsSet() {
localVarQueryParams.Add("venueIds", parameterToString(localVarOptionals.VenueIds.Value(), "multi"))
if r.venueIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "venueIds", r.venueIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.ExcludeVenueIds.IsSet() {
localVarQueryParams.Add("excludeVenueIds", parameterToString(localVarOptionals.ExcludeVenueIds.Value(), "multi"))
if r.excludeVenueIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "excludeVenueIds", r.excludeVenueIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.ExcludeGamePks.IsSet() {
localVarQueryParams.Add("excludeGamePks", parameterToString(localVarOptionals.ExcludeGamePks.Value(), "multi"))
if r.excludeGamePks != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "excludeGamePks", r.excludeGamePks, "", "")
}
if localVarOptionals != nil && localVarOptionals.OrgType.IsSet() {
localVarQueryParams.Add("orgType", parameterToString(localVarOptionals.OrgType.Value(), ""))
if r.orgType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "orgType", r.orgType, "", "")
}
if localVarOptionals != nil && localVarOptionals.IncludeChildren.IsSet() {
localVarQueryParams.Add("includeChildren", parameterToString(localVarOptionals.IncludeChildren.Value(), ""))
if r.includeChildren != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeChildren", r.includeChildren, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.GamePaceWrapperRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,269 +1,300 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type HighLowApiService service
// HighLowAPIService HighLowAPI service
type HighLowAPIService service
/*
HighLowApiService View high/low stats by player or team
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param highLowType Type of high/low stats (&#x27;player&#x27;, &#x27;team&#x27;, &#x27;game&#x27;)
* @param optional nil or *HighLowApiHighLowOpts - Optional Parameters:
* @param "StatGroup" (optional.Interface of []StatGroup) - Comma delimited list of categories of statistic to return. Available types in /api/v1/statGroups
* @param "SortStat" (optional.Interface of []HighLowStatEnum) - Comma delimited list of baseball stats to sort splits by.
* @param "Season" (optional.Interface of []string) - Comma delimited list of Seasons of play
* @param "GameType" (optional.Interface of []models.GameTypeEnum) - Comma delimited list of type of Game. Available types in /api/v1/gameTypes
* @param "TeamId" (optional.Int32) - Unique Team Identifier. Format: 141, 147, etc
* @param "LeagueId" (optional.Int32) - Unique League Identifier
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "Offset" (optional.Int32) - The pointer to start for a return set; used for pagination
* @param "Limit" (optional.Int32) - Number of results to return
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.HighLowWrapperRestObject
*/
type HighLowApiHighLowOpts struct {
StatGroup optional.Interface
SortStat optional.Interface
Season optional.Interface
GameType optional.Interface
TeamId optional.Int32
LeagueId optional.Int32
SportId optional.Int32
Offset optional.Int32
Limit optional.Int32
Fields optional.Interface
type ApiHighLowRequest struct {
ctx context.Context
ApiService *HighLowAPIService
highLowType interface{}
statGroup *interface{}
sortStat *interface{}
season *interface{}
gameType *interface{}
teamId *interface{}
leagueId *interface{}
sportId *interface{}
offset *interface{}
limit *interface{}
fields *interface{}
}
func (a *HighLowApiService) HighLow(ctx context.Context, highLowType models.HighLowTypeEnum, localVarOptionals *HighLowApiHighLowOpts) (models.HighLowWrapperRestObject, *http.Response, error) {
// Comma delimited list of categories of statistic to return. Available types in /api/v1/statGroups
func (r ApiHighLowRequest) StatGroup(statGroup interface{}) ApiHighLowRequest {
r.statGroup = &statGroup
return r
}
// Comma delimited list of baseball stats to sort splits by.
func (r ApiHighLowRequest) SortStat(sortStat interface{}) ApiHighLowRequest {
r.sortStat = &sortStat
return r
}
// Comma delimited list of Seasons of play
func (r ApiHighLowRequest) Season(season interface{}) ApiHighLowRequest {
r.season = &season
return r
}
// Comma delimited list of type of Game. Available types in /api/v1/gameTypes
func (r ApiHighLowRequest) GameType(gameType interface{}) ApiHighLowRequest {
r.gameType = &gameType
return r
}
// Unique Team Identifier. Format: 141, 147, etc
func (r ApiHighLowRequest) TeamId(teamId interface{}) ApiHighLowRequest {
r.teamId = &teamId
return r
}
// Unique League Identifier
func (r ApiHighLowRequest) LeagueId(leagueId interface{}) ApiHighLowRequest {
r.leagueId = &leagueId
return r
}
// Top level organization of a sport
func (r ApiHighLowRequest) SportId(sportId interface{}) ApiHighLowRequest {
r.sportId = &sportId
return r
}
// The pointer to start for a return set; used for pagination
func (r ApiHighLowRequest) Offset(offset interface{}) ApiHighLowRequest {
r.offset = &offset
return r
}
// Number of results to return
func (r ApiHighLowRequest) Limit(limit interface{}) ApiHighLowRequest {
r.limit = &limit
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiHighLowRequest) Fields(fields interface{}) ApiHighLowRequest {
r.fields = &fields
return r
}
func (r ApiHighLowRequest) Execute() (*http.Response, error) {
return r.ApiService.HighLowExecute(r)
}
/*
HighLow View high/low stats by player or team
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param highLowType Type of high/low stats ('player', 'team', 'game')
@return ApiHighLowRequest
*/
func (a *HighLowAPIService) HighLow(ctx context.Context, highLowType interface{}) ApiHighLowRequest {
return ApiHighLowRequest{
ApiService: a,
ctx: ctx,
highLowType: highLowType,
}
}
// Execute executes the request
func (a *HighLowAPIService) HighLowExecute(r ApiHighLowRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.HighLowWrapperRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/highLow/{highLowType}"
localVarPath = strings.Replace(localVarPath, "{"+"highLowType"+"}", fmt.Sprintf("%v", highLowType), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HighLowAPIService.HighLow")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/highLow/{highLowType}"
localVarPath = strings.Replace(localVarPath, "{"+"highLowType"+"}", url.PathEscape(parameterValueToString(r.highLowType, "highLowType")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.StatGroup.IsSet() {
localVarQueryParams.Add("statGroup", parameterToString(localVarOptionals.StatGroup.Value(), "multi"))
if r.statGroup != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "statGroup", r.statGroup, "", "")
}
if localVarOptionals != nil && localVarOptionals.SortStat.IsSet() {
localVarQueryParams.Add("sortStat", parameterToString(localVarOptionals.SortStat.Value(), "multi"))
if r.sortStat != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sortStat", r.sortStat, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), "multi"))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), "multi"))
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if localVarOptionals != nil && localVarOptionals.TeamId.IsSet() {
localVarQueryParams.Add("teamId", parameterToString(localVarOptionals.TeamId.Value(), ""))
if r.teamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Offset.IsSet() {
localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), ""))
if r.offset != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
}
if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.HighLowWrapperRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiHighLowStatsRequest struct {
ctx context.Context
ApiService *HighLowAPIService
}
func (r ApiHighLowStatsRequest) Execute() (*http.Response, error) {
return r.ApiService.HighLowStatsExecute(r)
}
/*
HighLowApiService View high/low stat types
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
HighLowStats View high/low stat types
@return []models.BaseballStatsTypeRestObject
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiHighLowStatsRequest
*/
func (a *HighLowApiService) HighLowStats(ctx context.Context) ([]models.BaseballStatsTypeRestObject, *http.Response, error) {
func (a *HighLowAPIService) HighLowStats(ctx context.Context) ApiHighLowStatsRequest {
return ApiHighLowStatsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *HighLowAPIService) HighLowStatsExecute(r ApiHighLowStatsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue []models.BaseballStatsTypeRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/highLow/types"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "HighLowAPIService.HighLowStats")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/highLow/types"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v []models.BaseballStatsTypeRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,566 +1,630 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type JobApiService service
// JobAPIService JobAPI service
type JobAPIService service
type ApiDatacastersRequest struct {
ctx context.Context
ApiService *JobAPIService
sportId *interface{}
date *interface{}
fields *interface{}
}
// Top level organization of a sport
func (r ApiDatacastersRequest) SportId(sportId interface{}) ApiDatacastersRequest {
r.sportId = &sportId
return r
}
// Date of Game. Format: YYYY-MM-DD
func (r ApiDatacastersRequest) Date(date interface{}) ApiDatacastersRequest {
r.date = &date
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiDatacastersRequest) Fields(fields interface{}) ApiDatacastersRequest {
r.fields = &fields
return r
}
func (r ApiDatacastersRequest) Execute() (*http.Response, error) {
return r.ApiService.DatacastersExecute(r)
}
/*
JobApiService Get datacaster jobs
Datacasters Get datacaster jobs
Get datacaster jobs
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *JobApiDatacastersOpts - Optional Parameters:
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "Date" (optional.String) - Date of Game. Format: YYYY-MM-DD
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.RosterRestObject
*/
type JobApiDatacastersOpts struct {
SportId optional.Int32
Date optional.String
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiDatacastersRequest
*/
func (a *JobAPIService) Datacasters(ctx context.Context) ApiDatacastersRequest {
return ApiDatacastersRequest{
ApiService: a,
ctx: ctx,
}
}
func (a *JobApiService) Datacasters(ctx context.Context, localVarOptionals *JobApiDatacastersOpts) (models.RosterRestObject, *http.Response, error) {
// Execute executes the request
func (a *JobAPIService) DatacastersExecute(r ApiDatacastersRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.RosterRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/jobs/datacasters"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JobAPIService.Datacasters")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/jobs/datacasters"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
if r.date != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.RosterRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiGetJobsByTypeRequest struct {
ctx context.Context
ApiService *JobAPIService
jobType *interface{}
sportId *interface{}
date *interface{}
fields *interface{}
}
// Job Type Identifier (ie. UMPR, etc..)
func (r ApiGetJobsByTypeRequest) JobType(jobType interface{}) ApiGetJobsByTypeRequest {
r.jobType = &jobType
return r
}
// Top level organization of a sport
func (r ApiGetJobsByTypeRequest) SportId(sportId interface{}) ApiGetJobsByTypeRequest {
r.sportId = &sportId
return r
}
// Date of Game. Format: YYYY-MM-DD
func (r ApiGetJobsByTypeRequest) Date(date interface{}) ApiGetJobsByTypeRequest {
r.date = &date
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetJobsByTypeRequest) Fields(fields interface{}) ApiGetJobsByTypeRequest {
r.fields = &fields
return r
}
func (r ApiGetJobsByTypeRequest) Execute() (*http.Response, error) {
return r.ApiService.GetJobsByTypeExecute(r)
}
/*
JobApiService Get jobs by type
This endpoint allows you to pull teams
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param jobType Job Type Identifier (ie. UMPR, etc..)
* @param optional nil or *JobApiGetJobsByTypeOpts - Optional Parameters:
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "Date" (optional.String) - Date of Game. Format: YYYY-MM-DD
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.RosterRestObject
*/
GetJobsByType Get jobs by type
type JobApiGetJobsByTypeOpts struct {
SportId optional.Int32
Date optional.String
Fields optional.Interface
This endpoint allows you to pull teams
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetJobsByTypeRequest
*/
func (a *JobAPIService) GetJobsByType(ctx context.Context) ApiGetJobsByTypeRequest {
return ApiGetJobsByTypeRequest{
ApiService: a,
ctx: ctx,
}
}
func (a *JobApiService) GetJobsByType(ctx context.Context, jobType string, localVarOptionals *JobApiGetJobsByTypeOpts) (models.RosterRestObject, *http.Response, error) {
// Execute executes the request
func (a *JobAPIService) GetJobsByTypeExecute(r ApiGetJobsByTypeRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.RosterRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/jobs"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JobAPIService.GetJobsByType")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/jobs"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.jobType == nil {
return nil, reportError("jobType is required and must be specified")
}
localVarQueryParams.Add("jobType", parameterToString(jobType, ""))
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
parameterAddToHeaderOrQuery(localVarQueryParams, "jobType", r.jobType, "", "")
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
if r.date != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.RosterRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiOfficialScorersRequest struct {
ctx context.Context
ApiService *JobAPIService
sportId *interface{}
date *interface{}
fields *interface{}
}
// Top level organization of a sport
func (r ApiOfficialScorersRequest) SportId(sportId interface{}) ApiOfficialScorersRequest {
r.sportId = &sportId
return r
}
// Date of Game. Format: YYYY-MM-DD
func (r ApiOfficialScorersRequest) Date(date interface{}) ApiOfficialScorersRequest {
r.date = &date
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiOfficialScorersRequest) Fields(fields interface{}) ApiOfficialScorersRequest {
r.fields = &fields
return r
}
func (r ApiOfficialScorersRequest) Execute() (*http.Response, error) {
return r.ApiService.OfficialScorersExecute(r)
}
/*
JobApiService Get official scorers
This endpoint allows you to pull teams
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *JobApiOfficialScorersOpts - Optional Parameters:
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "Date" (optional.String) - Date of Game. Format: YYYY-MM-DD
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.RosterRestObject
*/
OfficialScorers Get official scorers
type JobApiOfficialScorersOpts struct {
SportId optional.Int32
Date optional.String
Fields optional.Interface
This endpoint allows you to pull teams
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiOfficialScorersRequest
*/
func (a *JobAPIService) OfficialScorers(ctx context.Context) ApiOfficialScorersRequest {
return ApiOfficialScorersRequest{
ApiService: a,
ctx: ctx,
}
}
func (a *JobApiService) OfficialScorers(ctx context.Context, localVarOptionals *JobApiOfficialScorersOpts) (models.RosterRestObject, *http.Response, error) {
// Execute executes the request
func (a *JobAPIService) OfficialScorersExecute(r ApiOfficialScorersRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.RosterRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/jobs/officialScorers"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JobAPIService.OfficialScorers")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/jobs/officialScorers"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
if r.date != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.RosterRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiUmpireScheduleRequest struct {
ctx context.Context
ApiService *JobAPIService
umpireId interface{}
season *interface{}
fields *interface{}
}
// Season of play
func (r ApiUmpireScheduleRequest) Season(season interface{}) ApiUmpireScheduleRequest {
r.season = &season
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiUmpireScheduleRequest) Fields(fields interface{}) ApiUmpireScheduleRequest {
r.fields = &fields
return r
}
func (r ApiUmpireScheduleRequest) Execute() (*http.Response, error) {
return r.ApiService.UmpireScheduleExecute(r)
}
/*
JobApiService Get umpires and associated game for umpireId
This endpoint allows you to pull teams
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param umpireId A unique identifier for an umpire
* @param season Season of play
* @param optional nil or *JobApiUmpireScheduleOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.ScheduleRestObject
*/
UmpireSchedule Get umpires and associated game for umpireId
type JobApiUmpireScheduleOpts struct {
Fields optional.Interface
This endpoint allows you to pull teams
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param umpireId A unique identifier for an umpire
@return ApiUmpireScheduleRequest
*/
func (a *JobAPIService) UmpireSchedule(ctx context.Context, umpireId interface{}) ApiUmpireScheduleRequest {
return ApiUmpireScheduleRequest{
ApiService: a,
ctx: ctx,
umpireId: umpireId,
}
}
func (a *JobApiService) UmpireSchedule(ctx context.Context, umpireId int32, season string, localVarOptionals *JobApiUmpireScheduleOpts) (models.ScheduleRestObject, *http.Response, error) {
// Execute executes the request
func (a *JobAPIService) UmpireScheduleExecute(r ApiUmpireScheduleRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.ScheduleRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/jobs/umpires/games/{umpireId}"
localVarPath = strings.Replace(localVarPath, "{"+"umpireId"+"}", fmt.Sprintf("%v", umpireId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JobAPIService.UmpireSchedule")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/jobs/umpires/games/{umpireId}"
localVarPath = strings.Replace(localVarPath, "{"+"umpireId"+"}", url.PathEscape(parameterValueToString(r.umpireId, "umpireId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.season == nil {
return nil, reportError("season is required and must be specified")
}
localVarQueryParams.Add("season", parameterToString(season, ""))
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.ScheduleRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiUmpiresRequest struct {
ctx context.Context
ApiService *JobAPIService
sportId *interface{}
date *interface{}
fields *interface{}
season *interface{}
}
// Top level organization of a sport
func (r ApiUmpiresRequest) SportId(sportId interface{}) ApiUmpiresRequest {
r.sportId = &sportId
return r
}
// Date of Game. Format: YYYY-MM-DD
func (r ApiUmpiresRequest) Date(date interface{}) ApiUmpiresRequest {
r.date = &date
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiUmpiresRequest) Fields(fields interface{}) ApiUmpiresRequest {
r.fields = &fields
return r
}
// Season of play
func (r ApiUmpiresRequest) Season(season interface{}) ApiUmpiresRequest {
r.season = &season
return r
}
func (r ApiUmpiresRequest) Execute() (*http.Response, error) {
return r.ApiService.UmpiresExecute(r)
}
/*
JobApiService Get umpires
This endpoint allows you to pull teams
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *JobApiUmpiresOpts - Optional Parameters:
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "Date" (optional.String) - Date of Game. Format: YYYY-MM-DD
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
* @param "Season" (optional.String) - Season of play
@return models.RosterRestObject
*/
Umpires Get umpires
type JobApiUmpiresOpts struct {
SportId optional.Int32
Date optional.String
Fields optional.Interface
Season optional.String
This endpoint allows you to pull teams
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiUmpiresRequest
*/
func (a *JobAPIService) Umpires(ctx context.Context) ApiUmpiresRequest {
return ApiUmpiresRequest{
ApiService: a,
ctx: ctx,
}
}
func (a *JobApiService) Umpires(ctx context.Context, localVarOptionals *JobApiUmpiresOpts) (models.RosterRestObject, *http.Response, error) {
// Execute executes the request
func (a *JobAPIService) UmpiresExecute(r ApiUmpiresRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.RosterRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/jobs/umpires"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "JobAPIService.Umpires")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/jobs/umpires"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
if r.date != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.RosterRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,254 +1,280 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"strings"
)
// Linger please
var (
_ context.Context
)
type PredictionsApiService service
// PredictionsAPIService PredictionsAPI service
type PredictionsAPIService service
/*
PredictionsApiService Get play-level predictions based on input scenarios
This endpoint allows you to get play-level predictions based on input scenarios
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *PredictionsApiGetPropsOpts - Optional Parameters:
* @param "BatterId" (optional.Int32) - Unique Player Identifier. Format: 434538, 429665, etc
* @param "PitcherId" (optional.Int32) - Unique Player Identifier. Format: 434538, 429665, etc
* @param "VenueId" (optional.Int32) - Unique Venue Identifier
* @param "BatSide" (optional.String) - Bat side of hitter
* @param "PitchHand" (optional.String) - Handedness of pitcher
* @param "BatterPosition" (optional.String) - Position abbreviation. Format: SS, P, 1B, etc
* @param "PitcherPosition" (optional.String) - Position abbreviation. Format: SS, P, 1B, etc
@return interface{}
*/
type PredictionsApiGetPropsOpts struct {
BatterId optional.Int32
PitcherId optional.Int32
VenueId optional.Int32
BatSide optional.String
PitchHand optional.String
BatterPosition optional.String
PitcherPosition optional.String
type ApiGetPropsRequest struct {
ctx context.Context
ApiService *PredictionsAPIService
batterId *interface{}
pitcherId *interface{}
venueId *interface{}
batSide *interface{}
pitchHand *interface{}
batterPosition *interface{}
pitcherPosition *interface{}
}
func (a *PredictionsApiService) GetProps(ctx context.Context, localVarOptionals *PredictionsApiGetPropsOpts) (interface{}, *http.Response, error) {
// Unique Player Identifier. Format: 434538, 429665, etc
func (r ApiGetPropsRequest) BatterId(batterId interface{}) ApiGetPropsRequest {
r.batterId = &batterId
return r
}
// Unique Player Identifier. Format: 434538, 429665, etc
func (r ApiGetPropsRequest) PitcherId(pitcherId interface{}) ApiGetPropsRequest {
r.pitcherId = &pitcherId
return r
}
// Unique Venue Identifier
func (r ApiGetPropsRequest) VenueId(venueId interface{}) ApiGetPropsRequest {
r.venueId = &venueId
return r
}
// Bat side of hitter
func (r ApiGetPropsRequest) BatSide(batSide interface{}) ApiGetPropsRequest {
r.batSide = &batSide
return r
}
// Handedness of pitcher
func (r ApiGetPropsRequest) PitchHand(pitchHand interface{}) ApiGetPropsRequest {
r.pitchHand = &pitchHand
return r
}
// Position abbreviation. Format: SS, P, 1B, etc
func (r ApiGetPropsRequest) BatterPosition(batterPosition interface{}) ApiGetPropsRequest {
r.batterPosition = &batterPosition
return r
}
// Position abbreviation. Format: SS, P, 1B, etc
func (r ApiGetPropsRequest) PitcherPosition(pitcherPosition interface{}) ApiGetPropsRequest {
r.pitcherPosition = &pitcherPosition
return r
}
func (r ApiGetPropsRequest) Execute() (*http.Response, error) {
return r.ApiService.GetPropsExecute(r)
}
/*
GetProps Get play-level predictions based on input scenarios
This endpoint allows you to get play-level predictions based on input scenarios
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetPropsRequest
*/
func (a *PredictionsAPIService) GetProps(ctx context.Context) ApiGetPropsRequest {
return ApiGetPropsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *PredictionsAPIService) GetPropsExecute(r ApiGetPropsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue interface{}
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/props/play/predictions"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PredictionsAPIService.GetProps")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/props/play/predictions"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.BatterId.IsSet() {
localVarQueryParams.Add("batterId", parameterToString(localVarOptionals.BatterId.Value(), ""))
if r.batterId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "batterId", r.batterId, "", "")
}
if localVarOptionals != nil && localVarOptionals.PitcherId.IsSet() {
localVarQueryParams.Add("pitcherId", parameterToString(localVarOptionals.PitcherId.Value(), ""))
if r.pitcherId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherId", r.pitcherId, "", "")
}
if localVarOptionals != nil && localVarOptionals.VenueId.IsSet() {
localVarQueryParams.Add("venueId", parameterToString(localVarOptionals.VenueId.Value(), ""))
if r.venueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "venueId", r.venueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.BatSide.IsSet() {
localVarQueryParams.Add("batSide", parameterToString(localVarOptionals.BatSide.Value(), ""))
if r.batSide != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "batSide", r.batSide, "", "")
}
if localVarOptionals != nil && localVarOptionals.PitchHand.IsSet() {
localVarQueryParams.Add("pitchHand", parameterToString(localVarOptionals.PitchHand.Value(), ""))
if r.pitchHand != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pitchHand", r.pitchHand, "", "")
}
if localVarOptionals != nil && localVarOptionals.BatterPosition.IsSet() {
localVarQueryParams.Add("batterPosition", parameterToString(localVarOptionals.BatterPosition.Value(), ""))
if r.batterPosition != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "batterPosition", r.batterPosition, "", "")
}
if localVarOptionals != nil && localVarOptionals.PitcherPosition.IsSet() {
localVarQueryParams.Add("pitcherPosition", parameterToString(localVarOptionals.PitcherPosition.Value(), ""))
if r.pitcherPosition != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "pitcherPosition", r.pitcherPosition, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v interface{}
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiGetPropsAdjustRequest struct {
ctx context.Context
ApiService *PredictionsAPIService
gamePk *interface{}
}
// Unique Primary Key Representing a Game
func (r ApiGetPropsAdjustRequest) GamePk(gamePk interface{}) ApiGetPropsAdjustRequest {
r.gamePk = &gamePk
return r
}
func (r ApiGetPropsAdjustRequest) Execute() (*http.Response, error) {
return r.ApiService.GetPropsAdjustExecute(r)
}
/*
PredictionsApiService Get play-level predictions based on input scenarios
This endpoint allows you to get play-level predictions based on input scenarios
- @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
GetPropsAdjust Get play-level predictions based on input scenarios
@return interface{}
This endpoint allows you to get play-level predictions based on input scenarios
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetPropsAdjustRequest
*/
func (a *PredictionsApiService) GetPropsAdjust(ctx context.Context, gamePk int32) (interface{}, *http.Response, error) {
func (a *PredictionsAPIService) GetPropsAdjust(ctx context.Context) ApiGetPropsAdjustRequest {
return ApiGetPropsAdjustRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *PredictionsAPIService) GetPropsAdjustExecute(r ApiGetPropsAdjustRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue interface{}
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/props/play/predictions/adjust"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PredictionsAPIService.GetPropsAdjust")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/props/play/predictions/adjust"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.gamePk == nil {
return nil, reportError("gamePk is required and must be specified")
}
localVarQueryParams.Add("gamePk", parameterToString(gamePk, ""))
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePk", r.gamePk, "", "")
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v interface{}
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,146 +1,151 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type ReviewsApiService service
// ReviewsAPIService ReviewsAPI service
type ReviewsAPIService service
/*
ReviewsApiService Get review info
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param sportId Unique Team Identifier. Format: 141, 147, etc
* @param season Comma delimited list of Seasons of play
* @param optional nil or *ReviewsApiGetReviewInfoOpts - Optional Parameters:
* @param "GameType" (optional.Interface of models.GameTypeEnum) - Type of Game. Available types in /api/v1/gameTypes
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.StatContainerRestObject
*/
type ReviewsApiGetReviewInfoOpts struct {
GameType optional.Interface
Fields optional.Interface
type ApiGetReviewInfoRequest struct {
ctx context.Context
ApiService *ReviewsAPIService
sportId *interface{}
season *interface{}
gameType *interface{}
fields *interface{}
}
func (a *ReviewsApiService) GetReviewInfo(ctx context.Context, sportId int32, season string, localVarOptionals *ReviewsApiGetReviewInfoOpts) (models.StatContainerRestObject, *http.Response, error) {
// Unique Team Identifier. Format: 141, 147, etc
func (r ApiGetReviewInfoRequest) SportId(sportId interface{}) ApiGetReviewInfoRequest {
r.sportId = &sportId
return r
}
// Comma delimited list of Seasons of play
func (r ApiGetReviewInfoRequest) Season(season interface{}) ApiGetReviewInfoRequest {
r.season = &season
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiGetReviewInfoRequest) GameType(gameType interface{}) ApiGetReviewInfoRequest {
r.gameType = &gameType
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetReviewInfoRequest) Fields(fields interface{}) ApiGetReviewInfoRequest {
r.fields = &fields
return r
}
func (r ApiGetReviewInfoRequest) Execute() (*http.Response, error) {
return r.ApiService.GetReviewInfoExecute(r)
}
/*
GetReviewInfo Get review info
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetReviewInfoRequest
*/
func (a *ReviewsAPIService) GetReviewInfo(ctx context.Context) ApiGetReviewInfoRequest {
return ApiGetReviewInfoRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *ReviewsAPIService) GetReviewInfoExecute(r ApiGetReviewInfoRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.StatContainerRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/review"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ReviewsAPIService.GetReviewInfo")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/review"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams.Add("sportId", parameterToString(sportId, ""))
localVarQueryParams.Add("season", parameterToString(season, ""))
if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
if r.sportId == nil {
return nil, reportError("sportId is required and must be specified")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.season == nil {
return nil, reportError("season is required and must be specified")
}
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.StatContainerRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,381 +1,426 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type SeasonApiService service
// SeasonAPIService SeasonAPI service
type SeasonAPIService service
type ApiAllSeasonsRequest struct {
ctx context.Context
ApiService *SeasonAPIService
divisionId *interface{}
leagueId *interface{}
sportId *interface{}
withGameTypeDates *interface{}
fields *interface{}
}
// Unique Division Identifier
func (r ApiAllSeasonsRequest) DivisionId(divisionId interface{}) ApiAllSeasonsRequest {
r.divisionId = &divisionId
return r
}
// Unique League Identifier
func (r ApiAllSeasonsRequest) LeagueId(leagueId interface{}) ApiAllSeasonsRequest {
r.leagueId = &leagueId
return r
}
// Top level organization of a sport
func (r ApiAllSeasonsRequest) SportId(sportId interface{}) ApiAllSeasonsRequest {
r.sportId = &sportId
return r
}
// Retrieve dates for each game type
func (r ApiAllSeasonsRequest) WithGameTypeDates(withGameTypeDates interface{}) ApiAllSeasonsRequest {
r.withGameTypeDates = &withGameTypeDates
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiAllSeasonsRequest) Fields(fields interface{}) ApiAllSeasonsRequest {
r.fields = &fields
return r
}
func (r ApiAllSeasonsRequest) Execute() (*http.Response, error) {
return r.ApiService.AllSeasonsExecute(r)
}
/*
SeasonApiService View all seasons
AllSeasons View all seasons
This endpoint allows you to view all seasons for a given Division, League or Sport
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *SeasonApiAllSeasonsOpts - Optional Parameters:
* @param "DivisionId" (optional.Int32) - Unique Division Identifier
* @param "LeagueId" (optional.Int32) - Unique League Identifier
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "WithGameTypeDates" (optional.Bool) - Retrieve dates for each game type
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.SeasonsRestObject
*/
type SeasonApiAllSeasonsOpts struct {
DivisionId optional.Int32
LeagueId optional.Int32
SportId optional.Int32
WithGameTypeDates optional.Bool
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiAllSeasonsRequest
*/
func (a *SeasonAPIService) AllSeasons(ctx context.Context) ApiAllSeasonsRequest {
return ApiAllSeasonsRequest{
ApiService: a,
ctx: ctx,
}
}
func (a *SeasonApiService) AllSeasons(ctx context.Context, localVarOptionals *SeasonApiAllSeasonsOpts) (models.SeasonsRestObject, *http.Response, error) {
// Execute executes the request
func (a *SeasonAPIService) AllSeasonsExecute(r ApiAllSeasonsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.SeasonsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/seasons/all"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeasonAPIService.AllSeasons")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/seasons/all"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.DivisionId.IsSet() {
localVarQueryParams.Add("divisionId", parameterToString(localVarOptionals.DivisionId.Value(), ""))
if r.divisionId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "divisionId", r.divisionId, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.WithGameTypeDates.IsSet() {
localVarQueryParams.Add("withGameTypeDates", parameterToString(localVarOptionals.WithGameTypeDates.Value(), ""))
if r.withGameTypeDates != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "withGameTypeDates", r.withGameTypeDates, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.SeasonsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiSeasonsRequest struct {
ctx context.Context
ApiService *SeasonAPIService
seasonId interface{}
season *interface{}
sportId *interface{}
withGameTypeDates *interface{}
fields *interface{}
}
// Season of play
func (r ApiSeasonsRequest) Season(season interface{}) ApiSeasonsRequest {
r.season = &season
return r
}
// Top level organization of a sport
func (r ApiSeasonsRequest) SportId(sportId interface{}) ApiSeasonsRequest {
r.sportId = &sportId
return r
}
// Retrieve dates for each game type
func (r ApiSeasonsRequest) WithGameTypeDates(withGameTypeDates interface{}) ApiSeasonsRequest {
r.withGameTypeDates = &withGameTypeDates
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiSeasonsRequest) Fields(fields interface{}) ApiSeasonsRequest {
r.fields = &fields
return r
}
func (r ApiSeasonsRequest) Execute() (*http.Response, error) {
return r.ApiService.SeasonsExecute(r)
}
/*
SeasonApiService View season info
This endpoint allows you to pull seasons
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param seasonId Season of play
* @param optional nil or *SeasonApiSeasonsOpts - Optional Parameters:
* @param "Season" (optional.Interface of []string) - Season of play
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "WithGameTypeDates" (optional.Bool) - Retrieve dates for each game type
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.SeasonsRestObject
*/
Seasons View season info
type SeasonApiSeasonsOpts struct {
Season optional.Interface
SportId optional.Int32
WithGameTypeDates optional.Bool
Fields optional.Interface
This endpoint allows you to pull seasons
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param seasonId Season of play
@return ApiSeasonsRequest
*/
func (a *SeasonAPIService) Seasons(ctx context.Context, seasonId interface{}) ApiSeasonsRequest {
return ApiSeasonsRequest{
ApiService: a,
ctx: ctx,
seasonId: seasonId,
}
}
func (a *SeasonApiService) Seasons(ctx context.Context, seasonId string, localVarOptionals *SeasonApiSeasonsOpts) (models.SeasonsRestObject, *http.Response, error) {
// Execute executes the request
func (a *SeasonAPIService) SeasonsExecute(r ApiSeasonsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.SeasonsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/seasons"
localVarPath = strings.Replace(localVarPath, "{"+"seasonId"+"}", fmt.Sprintf("%v", seasonId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeasonAPIService.Seasons")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/seasons"
localVarPath = strings.Replace(localVarPath, "{"+"seasonId"+"}", url.PathEscape(parameterValueToString(r.seasonId, "seasonId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), "multi"))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.WithGameTypeDates.IsSet() {
localVarQueryParams.Add("withGameTypeDates", parameterToString(localVarOptionals.WithGameTypeDates.Value(), ""))
if r.withGameTypeDates != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "withGameTypeDates", r.withGameTypeDates, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.SeasonsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiSeasons1Request struct {
ctx context.Context
ApiService *SeasonAPIService
seasonId interface{}
season *interface{}
sportId *interface{}
withGameTypeDates *interface{}
fields *interface{}
}
// Season of play
func (r ApiSeasons1Request) Season(season interface{}) ApiSeasons1Request {
r.season = &season
return r
}
// Top level organization of a sport
func (r ApiSeasons1Request) SportId(sportId interface{}) ApiSeasons1Request {
r.sportId = &sportId
return r
}
// Retrieve dates for each game type
func (r ApiSeasons1Request) WithGameTypeDates(withGameTypeDates interface{}) ApiSeasons1Request {
r.withGameTypeDates = &withGameTypeDates
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiSeasons1Request) Fields(fields interface{}) ApiSeasons1Request {
r.fields = &fields
return r
}
func (r ApiSeasons1Request) Execute() (*http.Response, error) {
return r.ApiService.Seasons1Execute(r)
}
/*
SeasonApiService View season info
This endpoint allows you to pull seasons
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param seasonId Season of play
* @param optional nil or *SeasonApiSeasons1Opts - Optional Parameters:
* @param "Season" (optional.Interface of []string) - Season of play
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "WithGameTypeDates" (optional.Bool) - Retrieve dates for each game type
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.SeasonsRestObject
*/
Seasons1 View season info
type SeasonApiSeasons1Opts struct {
Season optional.Interface
SportId optional.Int32
WithGameTypeDates optional.Bool
Fields optional.Interface
This endpoint allows you to pull seasons
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param seasonId Season of play
@return ApiSeasons1Request
*/
func (a *SeasonAPIService) Seasons1(ctx context.Context, seasonId interface{}) ApiSeasons1Request {
return ApiSeasons1Request{
ApiService: a,
ctx: ctx,
seasonId: seasonId,
}
}
func (a *SeasonApiService) Seasons1(ctx context.Context, seasonId string, localVarOptionals *SeasonApiSeasons1Opts) (models.SeasonsRestObject, *http.Response, error) {
// Execute executes the request
func (a *SeasonAPIService) Seasons1Execute(r ApiSeasons1Request) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.SeasonsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/seasons/{seasonId}"
localVarPath = strings.Replace(localVarPath, "{"+"seasonId"+"}", fmt.Sprintf("%v", seasonId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SeasonAPIService.Seasons1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/seasons/{seasonId}"
localVarPath = strings.Replace(localVarPath, "{"+"seasonId"+"}", url.PathEscape(parameterValueToString(r.seasonId, "seasonId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), "multi"))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.WithGameTypeDates.IsSet() {
localVarQueryParams.Add("withGameTypeDates", parameterToString(localVarOptionals.WithGameTypeDates.Value(), ""))
if r.withGameTypeDates != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "withGameTypeDates", r.withGameTypeDates, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.SeasonsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,243 +1,247 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type SkeletalApiService service
// SkeletalAPIService SkeletalAPI service
type SkeletalAPIService service
/*
SkeletalApiService 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
* @param fileName Skeletal chunked file name
* @param optional nil or *SkeletalApiSkeletalChunkedOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/
type SkeletalApiSkeletalChunkedOpts struct {
Fields optional.Interface
type ApiSkeletalChunkedRequest struct {
ctx context.Context
ApiService *SkeletalAPIService
gamePk interface{}
playId interface{}
fileName *interface{}
fields *interface{}
}
func (a *SkeletalApiService) SkeletalChunked(ctx context.Context, gamePk int32, playId string, fileName string, localVarOptionals *SkeletalApiSkeletalChunkedOpts) (string, *http.Response, error) {
// 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 = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue string
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/{playId}/analytics/skeletalData/chunked"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
localVarPath = strings.Replace(localVarPath, "{"+"playId"+"}", fmt.Sprintf("%v", playId), -1)
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{}
localVarQueryParams.Add("fileName", parameterToString(fileName, ""))
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v string
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
}
/*
SkeletalApiService 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
* @param optional nil or *SkeletalApiSkeletalDataFileNamesOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.SkeletalFileData
*/
type SkeletalApiSkeletalDataFileNamesOpts struct {
Fields optional.Interface
}
func (a *SkeletalApiService) SkeletalDataFileNames(ctx context.Context, gamePk int32, playId string, localVarOptionals *SkeletalApiSkeletalDataFileNamesOpts) (models.SkeletalFileData, *http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.SkeletalFileData
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/game/{gamePk}/{playId}/analytics/skeletalData/files"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
localVarPath = strings.Replace(localVarPath, "{"+"playId"+"}", fmt.Sprintf("%v", playId), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
}
// 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{"application/json"}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
body: localVarBody,
error: localVarHttpResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.SkeletalFileData
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,481 +1,542 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type SportsApiService service
// SportsAPIService SportsAPI service
type SportsAPIService service
type ApiAllSportBallotRequest struct {
ctx context.Context
ApiService *SportsAPIService
sportId interface{}
season *interface{}
fields *interface{}
}
// season
func (r ApiAllSportBallotRequest) Season(season interface{}) ApiAllSportBallotRequest {
r.season = &season
return r
}
func (r ApiAllSportBallotRequest) Fields(fields interface{}) ApiAllSportBallotRequest {
r.fields = &fields
return r
}
func (r ApiAllSportBallotRequest) Execute() (*http.Response, error) {
return r.ApiService.AllSportBallotExecute(r)
}
/*
SportsApiService Get ALL MLB ballot for sport
AllSportBallot Get ALL MLB ballot for sport
This endpoint allows you to get all players for MLB ballot
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param sportId Top level organization of a sport
* @param season season
* @param optional nil or *SportsApiAllSportBallotOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) -
@return models.PeopleRestObject
*/
type SportsApiAllSportBallotOpts struct {
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param sportId Top level organization of a sport
@return ApiAllSportBallotRequest
*/
func (a *SportsAPIService) AllSportBallot(ctx context.Context, sportId interface{}) ApiAllSportBallotRequest {
return ApiAllSportBallotRequest{
ApiService: a,
ctx: ctx,
sportId: sportId,
}
}
func (a *SportsApiService) AllSportBallot(ctx context.Context, sportId int32, season string, localVarOptionals *SportsApiAllSportBallotOpts) (models.PeopleRestObject, *http.Response, error) {
// Execute executes the request
func (a *SportsAPIService) AllSportBallotExecute(r ApiAllSportBallotRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.PeopleRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/sports/{sportId}/allSportBallot"
localVarPath = strings.Replace(localVarPath, "{"+"sportId"+"}", fmt.Sprintf("%v", sportId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SportsAPIService.AllSportBallot")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/sports/{sportId}/allSportBallot"
localVarPath = strings.Replace(localVarPath, "{"+"sportId"+"}", url.PathEscape(parameterValueToString(r.sportId, "sportId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.season == nil {
return nil, reportError("season is required and must be specified")
}
localVarQueryParams.Add("season", parameterToString(season, ""))
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.PeopleRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiSportPlayersRequest struct {
ctx context.Context
ApiService *SportsAPIService
sportId interface{}
season *interface{}
gameType *interface{}
hasStats *interface{}
accent *interface{}
fields *interface{}
}
// Season of play
func (r ApiSportPlayersRequest) Season(season interface{}) ApiSportPlayersRequest {
r.season = &season
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiSportPlayersRequest) GameType(gameType interface{}) ApiSportPlayersRequest {
r.gameType = &gameType
return r
}
// Returns sports that have individual player stats
func (r ApiSportPlayersRequest) HasStats(hasStats interface{}) ApiSportPlayersRequest {
r.hasStats = &hasStats
return r
}
// Boolean value to specify wanting a person&#39;s name with accents or without
func (r ApiSportPlayersRequest) Accent(accent interface{}) ApiSportPlayersRequest {
r.accent = &accent
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiSportPlayersRequest) Fields(fields interface{}) ApiSportPlayersRequest {
r.fields = &fields
return r
}
func (r ApiSportPlayersRequest) Execute() (*http.Response, error) {
return r.ApiService.SportPlayersExecute(r)
}
/*
SportsApiService Get all players for a sport level
SportPlayers Get all players for a sport level
This endpoint allows you to pull all players for a given sport
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param sportId Top level organization of a sport
* @param optional nil or *SportsApiSportPlayersOpts - Optional Parameters:
* @param "Season" (optional.String) - Season of play
* @param "GameType" (optional.Interface of models.GameTypeEnum) - Type of Game. Available types in /api/v1/gameTypes
* @param "HasStats" (optional.Bool) - Returns sports that have individual player stats
* @param "Accent" (optional.Bool) - Boolean value to specify wanting a person&#x27;s name with accents or without
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.PeopleRestObject
*/
type SportsApiSportPlayersOpts struct {
Season optional.String
GameType optional.Interface
HasStats optional.Bool
Accent optional.Bool
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param sportId Top level organization of a sport
@return ApiSportPlayersRequest
*/
func (a *SportsAPIService) SportPlayers(ctx context.Context, sportId interface{}) ApiSportPlayersRequest {
return ApiSportPlayersRequest{
ApiService: a,
ctx: ctx,
sportId: sportId,
}
}
func (a *SportsApiService) SportPlayers(ctx context.Context, sportId int32, localVarOptionals *SportsApiSportPlayersOpts) (models.PeopleRestObject, *http.Response, error) {
// Execute executes the request
func (a *SportsAPIService) SportPlayersExecute(r ApiSportPlayersRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.PeopleRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/sports/{sportId}/players"
localVarPath = strings.Replace(localVarPath, "{"+"sportId"+"}", fmt.Sprintf("%v", sportId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SportsAPIService.SportPlayers")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/sports/{sportId}/players"
localVarPath = strings.Replace(localVarPath, "{"+"sportId"+"}", url.PathEscape(parameterValueToString(r.sportId, "sportId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if localVarOptionals != nil && localVarOptionals.HasStats.IsSet() {
localVarQueryParams.Add("hasStats", parameterToString(localVarOptionals.HasStats.Value(), ""))
if r.hasStats != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "hasStats", r.hasStats, "", "")
}
if localVarOptionals != nil && localVarOptionals.Accent.IsSet() {
localVarQueryParams.Add("accent", parameterToString(localVarOptionals.Accent.Value(), ""))
if r.accent != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "accent", r.accent, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.PeopleRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiSportsRequest struct {
ctx context.Context
ApiService *SportsAPIService
sportId interface{}
season *interface{}
fields *interface{}
hasStats *interface{}
activeStatus *interface{}
}
// Season of play
func (r ApiSportsRequest) Season(season interface{}) ApiSportsRequest {
r.season = &season
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiSportsRequest) Fields(fields interface{}) ApiSportsRequest {
r.fields = &fields
return r
}
// Returns sports that have individual player stats
func (r ApiSportsRequest) HasStats(hasStats interface{}) ApiSportsRequest {
r.hasStats = &hasStats
return r
}
// Flag for fetching sports that are currently active (Y), inactive (N), pending (P), or all teams (B)
func (r ApiSportsRequest) ActiveStatus(activeStatus interface{}) ApiSportsRequest {
r.activeStatus = &activeStatus
return r
}
func (r ApiSportsRequest) Execute() (*http.Response, error) {
return r.ApiService.SportsExecute(r)
}
/*
SportsApiService Get sports information
This endpoint allows you to pull sports
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param sportId Top level organization of a sport
* @param optional nil or *SportsApiSportsOpts - Optional Parameters:
* @param "Season" (optional.String) - Season of play
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
* @param "HasStats" (optional.Bool) - Returns sports that have individual player stats
* @param "ActiveStatus" (optional.Interface of SportActiveStatusEnum) - Flag for fetching sports that are currently active (Y), inactive (N), pending (P), or all teams (B)
@return models.SportsRestObject
*/
Sports Get sports information
type SportsApiSportsOpts struct {
Season optional.String
Fields optional.Interface
HasStats optional.Bool
ActiveStatus optional.Interface
This endpoint allows you to pull sports
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param sportId Top level organization of a sport
@return ApiSportsRequest
*/
func (a *SportsAPIService) Sports(ctx context.Context, sportId interface{}) ApiSportsRequest {
return ApiSportsRequest{
ApiService: a,
ctx: ctx,
sportId: sportId,
}
}
func (a *SportsApiService) Sports(ctx context.Context, sportId int32, localVarOptionals *SportsApiSportsOpts) (models.SportsRestObject, *http.Response, error) {
// Execute executes the request
func (a *SportsAPIService) SportsExecute(r ApiSportsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.SportsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/sports"
localVarPath = strings.Replace(localVarPath, "{"+"sportId"+"}", fmt.Sprintf("%v", sportId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SportsAPIService.Sports")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/sports"
localVarPath = strings.Replace(localVarPath, "{"+"sportId"+"}", url.PathEscape(parameterValueToString(r.sportId, "sportId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if localVarOptionals != nil && localVarOptionals.HasStats.IsSet() {
localVarQueryParams.Add("hasStats", parameterToString(localVarOptionals.HasStats.Value(), ""))
if r.hasStats != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "hasStats", r.hasStats, "", "")
}
if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
if r.activeStatus != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "activeStatus", r.activeStatus, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.SportsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiSports1Request struct {
ctx context.Context
ApiService *SportsAPIService
sportId interface{}
season *interface{}
fields *interface{}
hasStats *interface{}
activeStatus *interface{}
}
// Season of play
func (r ApiSports1Request) Season(season interface{}) ApiSports1Request {
r.season = &season
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiSports1Request) Fields(fields interface{}) ApiSports1Request {
r.fields = &fields
return r
}
// Returns sports that have individual player stats
func (r ApiSports1Request) HasStats(hasStats interface{}) ApiSports1Request {
r.hasStats = &hasStats
return r
}
// Flag for fetching sports that are currently active (Y), inactive (N), pending (P), or all teams (B)
func (r ApiSports1Request) ActiveStatus(activeStatus interface{}) ApiSports1Request {
r.activeStatus = &activeStatus
return r
}
func (r ApiSports1Request) Execute() (*http.Response, error) {
return r.ApiService.Sports1Execute(r)
}
/*
SportsApiService Get sports information
This endpoint allows you to pull sports
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param sportId Top level organization of a sport
* @param optional nil or *SportsApiSports1Opts - Optional Parameters:
* @param "Season" (optional.String) - Season of play
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
* @param "HasStats" (optional.Bool) - Returns sports that have individual player stats
* @param "ActiveStatus" (optional.Interface of SportActiveStatusEnum) - Flag for fetching sports that are currently active (Y), inactive (N), pending (P), or all teams (B)
@return models.SportsRestObject
*/
Sports1 Get sports information
type SportsApiSports1Opts struct {
Season optional.String
Fields optional.Interface
HasStats optional.Bool
ActiveStatus optional.Interface
This endpoint allows you to pull sports
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param sportId Top level organization of a sport
@return ApiSports1Request
*/
func (a *SportsAPIService) Sports1(ctx context.Context, sportId interface{}) ApiSports1Request {
return ApiSports1Request{
ApiService: a,
ctx: ctx,
sportId: sportId,
}
}
func (a *SportsApiService) Sports1(ctx context.Context, sportId int32, localVarOptionals *SportsApiSports1Opts) (models.SportsRestObject, *http.Response, error) {
// Execute executes the request
func (a *SportsAPIService) Sports1Execute(r ApiSports1Request) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.SportsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/sports/{sportId}"
localVarPath = strings.Replace(localVarPath, "{"+"sportId"+"}", fmt.Sprintf("%v", sportId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "SportsAPIService.Sports1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/sports/{sportId}"
localVarPath = strings.Replace(localVarPath, "{"+"sportId"+"}", url.PathEscape(parameterValueToString(r.sportId, "sportId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if localVarOptionals != nil && localVarOptionals.HasStats.IsSet() {
localVarQueryParams.Add("hasStats", parameterToString(localVarOptionals.HasStats.Value(), ""))
if r.hasStats != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "hasStats", r.hasStats, "", "")
}
if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
if r.activeStatus != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "activeStatus", r.activeStatus, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.SportsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,297 +1,348 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type StandingsApiService service
// StandingsAPIService StandingsAPI service
type StandingsAPIService service
/*
StandingsApiService View standings for a league
This endpoint allows you to pull standings
* @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
* @param optional nil or *StandingsApiStandingsOpts - Optional Parameters:
* @param "LeagueId" (optional.Interface of []int32) - Unique League Identifier
* @param "Season" (optional.String) - Season of play
* @param "StandingsTypes" (optional.Interface of []StandingsType) - Type of season. Available types in /api/v1/standingsTypes
* @param "Date" (optional.String) - Date of Game. Format: YYYY-MM-DD
* @param "TeamId" (optional.Int32) - Unique Team Identifier. Format: 141, 147, etc
* @param "IncludeMLB" (optional.Bool) - Determines whether to include major league teams when using the &#x27;BY_ORGANIZATION&#x27; standings type
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.StandingsRestObject
*/
type StandingsApiStandingsOpts struct {
LeagueId optional.Interface
Season optional.String
StandingsTypes optional.Interface
Date optional.String
TeamId optional.Int32
IncludeMLB optional.Bool
Fields optional.Interface
type ApiStandingsRequest struct {
ctx context.Context
ApiService *StandingsAPIService
standingsType interface{}
leagueId *interface{}
season *interface{}
standingsTypes *interface{}
date *interface{}
teamId *interface{}
includeMLB *interface{}
fields *interface{}
}
func (a *StandingsApiService) Standings(ctx context.Context, standingsType string, localVarOptionals *StandingsApiStandingsOpts) (models.StandingsRestObject, *http.Response, error) {
// 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 &#39;BY_ORGANIZATION&#39; 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)
}
/*
Standings View standings for a league
This endpoint allows you to pull standings
@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
*/
func (a *StandingsAPIService) Standings(ctx context.Context, standingsType interface{}) ApiStandingsRequest {
return ApiStandingsRequest{
ApiService: a,
ctx: ctx,
standingsType: standingsType,
}
}
// Execute executes the request
func (a *StandingsAPIService) StandingsExecute(r ApiStandingsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.StandingsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/standings/{standingsType}"
localVarPath = strings.Replace(localVarPath, "{"+"standingsType"+"}", fmt.Sprintf("%v", standingsType), -1)
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)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), "multi"))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.StandingsTypes.IsSet() {
localVarQueryParams.Add("standingsTypes", parameterToString(localVarOptionals.StandingsTypes.Value(), "multi"))
if r.standingsTypes != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "standingsTypes", r.standingsTypes, "", "")
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
if r.date != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
}
if localVarOptionals != nil && localVarOptionals.TeamId.IsSet() {
localVarQueryParams.Add("teamId", parameterToString(localVarOptionals.TeamId.Value(), ""))
if r.teamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
}
if localVarOptionals != nil && localVarOptionals.IncludeMLB.IsSet() {
localVarQueryParams.Add("includeMLB", parameterToString(localVarOptionals.IncludeMLB.Value(), ""))
if r.includeMLB != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeMLB", r.includeMLB, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.StandingsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiStandings1Request struct {
ctx context.Context
ApiService *StandingsAPIService
standingsType interface{}
leagueId *interface{}
season *interface{}
standingsTypes *interface{}
date *interface{}
teamId *interface{}
includeMLB *interface{}
fields *interface{}
}
// 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 &#39;BY_ORGANIZATION&#39; 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)
}
/*
StandingsApiService View standings for a league
This endpoint allows you to pull standings
* @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
* @param optional nil or *StandingsApiStandings1Opts - Optional Parameters:
* @param "LeagueId" (optional.Interface of []int32) - Unique League Identifier
* @param "Season" (optional.String) - Season of play
* @param "StandingsTypes" (optional.Interface of []StandingsType) - Type of season. Available types in /api/v1/standingsTypes
* @param "Date" (optional.String) - Date of Game. Format: YYYY-MM-DD
* @param "TeamId" (optional.Int32) - Unique Team Identifier. Format: 141, 147, etc
* @param "IncludeMLB" (optional.Bool) - Determines whether to include major league teams when using the &#x27;BY_ORGANIZATION&#x27; standings type
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.StandingsRestObject
*/
Standings1 View standings for a league
type StandingsApiStandings1Opts struct {
LeagueId optional.Interface
Season optional.String
StandingsTypes optional.Interface
Date optional.String
TeamId optional.Int32
IncludeMLB optional.Bool
Fields optional.Interface
This endpoint allows you to pull standings
@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
*/
func (a *StandingsAPIService) Standings1(ctx context.Context, standingsType interface{}) ApiStandings1Request {
return ApiStandings1Request{
ApiService: a,
ctx: ctx,
standingsType: standingsType,
}
}
func (a *StandingsApiService) Standings1(ctx context.Context, standingsType string, localVarOptionals *StandingsApiStandings1Opts) (models.StandingsRestObject, *http.Response, error) {
// Execute executes the request
func (a *StandingsAPIService) Standings1Execute(r ApiStandings1Request) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.StandingsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/standings"
localVarPath = strings.Replace(localVarPath, "{"+"standingsType"+"}", fmt.Sprintf("%v", standingsType), -1)
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)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), "multi"))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.StandingsTypes.IsSet() {
localVarQueryParams.Add("standingsTypes", parameterToString(localVarOptionals.StandingsTypes.Value(), "multi"))
if r.standingsTypes != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "standingsTypes", r.standingsTypes, "", "")
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
if r.date != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
}
if localVarOptionals != nil && localVarOptionals.TeamId.IsSet() {
localVarQueryParams.Add("teamId", parameterToString(localVarOptionals.TeamId.Value(), ""))
if r.teamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
}
if localVarOptionals != nil && localVarOptionals.IncludeMLB.IsSet() {
localVarQueryParams.Add("includeMLB", parameterToString(localVarOptionals.IncludeMLB.Value(), ""))
if r.includeMLB != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeMLB", r.includeMLB, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.StandingsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,301 +1,358 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type StreaksApiService service
// StreaksAPIService StreaksAPI service
type StreaksAPIService service
/*
StreaksApiService View streaks
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *StreaksApiGetStreaksOpts - Optional Parameters:
* @param "StreakOrg" (optional.Interface of OrganizationType) -
* @param "StreakStat" (optional.Interface of []StreakStatEnum) -
* @param "StreakSpan" (optional.Interface of StreakSpanEnum) -
* @param "StreakLevel" (optional.Interface of StreakLevelEnum) -
* @param "StreakThreshold" (optional.Int32) -
* @param "Inverse" (optional.Bool) -
* @param "StartersOnly" (optional.Bool) -
* @param "StatGroup" (optional.Interface of []StatGroup) - Category of statistic to return. Available types in /api/v1/statGroups
* @param "GameType" (optional.Interface of []models.GameTypeEnum) - Type of Game. Available types in /api/v1/gameTypes
* @param "Season" (optional.Interface of []string) - Season of play
* @param "TeamId" (optional.Interface of []int32) - Unique Team Identifier. Format: 141, 147, etc
* @param "LeagueId" (optional.Interface of []int32) - Unique League Identifier
* @param "SportId" (optional.Interface of []int32) - Top level organization of a sport
* @param "ActiveStreak" (optional.Bool) - Whether or not a player is active
* @param "Limit" (optional.Int32) - Number of results to return
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
* @param "PlayerId" (optional.Interface of []int32) - A unique identifier for a player
@return models.StreaksWrapperRestObject
*/
type StreaksApiGetStreaksOpts struct {
StreakOrg optional.Interface
StreakStat optional.Interface
StreakSpan optional.Interface
StreakLevel optional.Interface
StreakThreshold optional.Int32
Inverse optional.Bool
StartersOnly optional.Bool
StatGroup optional.Interface
GameType optional.Interface
Season optional.Interface
TeamId optional.Interface
LeagueId optional.Interface
SportId optional.Interface
ActiveStreak optional.Bool
Limit optional.Int32
Fields optional.Interface
PlayerId optional.Interface
type ApiGetStreaksRequest struct {
ctx context.Context
ApiService *StreaksAPIService
streakOrg *interface{}
streakStat *interface{}
streakSpan *interface{}
streakLevel *interface{}
streakThreshold *interface{}
inverse *interface{}
startersOnly *interface{}
statGroup *interface{}
gameType *interface{}
season *interface{}
teamId *interface{}
leagueId *interface{}
sportId *interface{}
activeStreak *interface{}
limit *interface{}
fields *interface{}
playerId *interface{}
}
func (a *StreaksApiService) GetStreaks(ctx context.Context, localVarOptionals *StreaksApiGetStreaksOpts) (models.StreaksWrapperRestObject, *http.Response, error) {
func (r ApiGetStreaksRequest) StreakOrg(streakOrg interface{}) ApiGetStreaksRequest {
r.streakOrg = &streakOrg
return r
}
func (r ApiGetStreaksRequest) StreakStat(streakStat interface{}) ApiGetStreaksRequest {
r.streakStat = &streakStat
return r
}
func (r ApiGetStreaksRequest) StreakSpan(streakSpan interface{}) ApiGetStreaksRequest {
r.streakSpan = &streakSpan
return r
}
func (r ApiGetStreaksRequest) StreakLevel(streakLevel interface{}) ApiGetStreaksRequest {
r.streakLevel = &streakLevel
return r
}
func (r ApiGetStreaksRequest) StreakThreshold(streakThreshold interface{}) ApiGetStreaksRequest {
r.streakThreshold = &streakThreshold
return r
}
func (r ApiGetStreaksRequest) Inverse(inverse interface{}) ApiGetStreaksRequest {
r.inverse = &inverse
return r
}
func (r ApiGetStreaksRequest) StartersOnly(startersOnly interface{}) ApiGetStreaksRequest {
r.startersOnly = &startersOnly
return r
}
// Category of statistic to return. Available types in /api/v1/statGroups
func (r ApiGetStreaksRequest) StatGroup(statGroup interface{}) ApiGetStreaksRequest {
r.statGroup = &statGroup
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiGetStreaksRequest) GameType(gameType interface{}) ApiGetStreaksRequest {
r.gameType = &gameType
return r
}
// Season of play
func (r ApiGetStreaksRequest) Season(season interface{}) ApiGetStreaksRequest {
r.season = &season
return r
}
// Unique Team Identifier. Format: 141, 147, etc
func (r ApiGetStreaksRequest) TeamId(teamId interface{}) ApiGetStreaksRequest {
r.teamId = &teamId
return r
}
// Unique League Identifier
func (r ApiGetStreaksRequest) LeagueId(leagueId interface{}) ApiGetStreaksRequest {
r.leagueId = &leagueId
return r
}
// Top level organization of a sport
func (r ApiGetStreaksRequest) SportId(sportId interface{}) ApiGetStreaksRequest {
r.sportId = &sportId
return r
}
// Whether or not a player is active
func (r ApiGetStreaksRequest) ActiveStreak(activeStreak interface{}) ApiGetStreaksRequest {
r.activeStreak = &activeStreak
return r
}
// Number of results to return
func (r ApiGetStreaksRequest) Limit(limit interface{}) ApiGetStreaksRequest {
r.limit = &limit
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiGetStreaksRequest) Fields(fields interface{}) ApiGetStreaksRequest {
r.fields = &fields
return r
}
// A unique identifier for a player
func (r ApiGetStreaksRequest) PlayerId(playerId interface{}) ApiGetStreaksRequest {
r.playerId = &playerId
return r
}
func (r ApiGetStreaksRequest) Execute() (*http.Response, error) {
return r.ApiService.GetStreaksExecute(r)
}
/*
GetStreaks View streaks
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiGetStreaksRequest
*/
func (a *StreaksAPIService) GetStreaks(ctx context.Context) ApiGetStreaksRequest {
return ApiGetStreaksRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *StreaksAPIService) GetStreaksExecute(r ApiGetStreaksRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.StreaksWrapperRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/streaks"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StreaksAPIService.GetStreaks")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/streaks"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.StreakOrg.IsSet() {
localVarQueryParams.Add("streakOrg", parameterToString(localVarOptionals.StreakOrg.Value(), ""))
if r.streakOrg != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "streakOrg", r.streakOrg, "", "")
}
if localVarOptionals != nil && localVarOptionals.StreakStat.IsSet() {
localVarQueryParams.Add("streakStat", parameterToString(localVarOptionals.StreakStat.Value(), "multi"))
if r.streakStat != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "streakStat", r.streakStat, "", "")
}
if localVarOptionals != nil && localVarOptionals.StreakSpan.IsSet() {
localVarQueryParams.Add("streakSpan", parameterToString(localVarOptionals.StreakSpan.Value(), ""))
if r.streakSpan != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "streakSpan", r.streakSpan, "", "")
}
if localVarOptionals != nil && localVarOptionals.StreakLevel.IsSet() {
localVarQueryParams.Add("streakLevel", parameterToString(localVarOptionals.StreakLevel.Value(), ""))
if r.streakLevel != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "streakLevel", r.streakLevel, "", "")
}
if localVarOptionals != nil && localVarOptionals.StreakThreshold.IsSet() {
localVarQueryParams.Add("streakThreshold", parameterToString(localVarOptionals.StreakThreshold.Value(), ""))
if r.streakThreshold != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "streakThreshold", r.streakThreshold, "", "")
}
if localVarOptionals != nil && localVarOptionals.Inverse.IsSet() {
localVarQueryParams.Add("inverse", parameterToString(localVarOptionals.Inverse.Value(), ""))
if r.inverse != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "inverse", r.inverse, "", "")
}
if localVarOptionals != nil && localVarOptionals.StartersOnly.IsSet() {
localVarQueryParams.Add("startersOnly", parameterToString(localVarOptionals.StartersOnly.Value(), ""))
if r.startersOnly != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "startersOnly", r.startersOnly, "", "")
}
if localVarOptionals != nil && localVarOptionals.StatGroup.IsSet() {
localVarQueryParams.Add("statGroup", parameterToString(localVarOptionals.StatGroup.Value(), "multi"))
if r.statGroup != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "statGroup", r.statGroup, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), "multi"))
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), "multi"))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.TeamId.IsSet() {
localVarQueryParams.Add("teamId", parameterToString(localVarOptionals.TeamId.Value(), "multi"))
if r.teamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), "multi"))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), "multi"))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.ActiveStreak.IsSet() {
localVarQueryParams.Add("activeStreak", parameterToString(localVarOptionals.ActiveStreak.Value(), ""))
if r.activeStreak != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "activeStreak", r.activeStreak, "", "")
}
if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if localVarOptionals != nil && localVarOptionals.PlayerId.IsSet() {
localVarQueryParams.Add("playerId", parameterToString(localVarOptionals.PlayerId.Value(), "multi"))
if r.playerId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "playerId", r.playerId, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.StreaksWrapperRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiStreakTypesRequest struct {
ctx context.Context
ApiService *StreaksAPIService
}
func (r ApiStreakTypesRequest) Execute() (*http.Response, error) {
return r.ApiService.StreakTypesExecute(r)
}
/*
StreaksApiService View streaks parameter options
- @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
StreakTypes View streaks parameter options
@return map[string][]interface{}
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiStreakTypesRequest
*/
func (a *StreaksApiService) StreakTypes(ctx context.Context) (map[string][]interface{}, *http.Response, error) {
func (a *StreaksAPIService) StreakTypes(ctx context.Context) ApiStreakTypesRequest {
return ApiStreakTypesRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *StreaksAPIService) StreakTypesExecute(r ApiStreakTypesRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue map[string][]interface{}
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/streaks/types"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "StreaksAPIService.StreakTypes")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/streaks/types"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v map[string][]interface{}
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

File diff suppressed because it is too large Load Diff

View File

@ -1,198 +1,236 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type TransactionsApiService service
// TransactionsAPIService TransactionsAPI service
type TransactionsAPIService service
/*
TransactionsApiService View transaction info
This endpoint allows you to pull transactions.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param optional nil or *TransactionsApiTransactionsOpts - Optional Parameters:
* @param "LeagueId" (optional.Interface of []int32) - Comma delimited list of Unique league identifiers
* @param "SportId" (optional.Interface of []int32) - Comma delimited list of top level organizations of a sport
* @param "TeamId" (optional.Interface of []int32) - Comma delimited list of Unique Team identifiers
* @param "PlayerId" (optional.Interface of []int32) - A unique identifier for a player
* @param "Date" (optional.String) - Date of Game. Format: YYYY-MM-DD
* @param "StartDate" (optional.String) - Start date for range of data (must be used with end date). Format: MM/DD/YYYY
* @param "EndDate" (optional.String) - End date for range of data (must be used with start date). Format: MM/DD/YYYY
* @param "TransactionIds" (optional.Interface of []int32) -
* @param "TransactionTypes" (optional.Interface of []string) -
* @param "DivisionIds" (optional.Interface of []int32) -
* @param "Order" (optional.Interface of SortOrderEnum) -
* @param "Limit" (optional.Int32) -
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.TransactionsRestObject
*/
type TransactionsApiTransactionsOpts struct {
LeagueId optional.Interface
SportId optional.Interface
TeamId optional.Interface
PlayerId optional.Interface
Date optional.String
StartDate optional.String
EndDate optional.String
TransactionIds optional.Interface
TransactionTypes optional.Interface
DivisionIds optional.Interface
Order optional.Interface
Limit optional.Int32
Fields optional.Interface
type ApiTransactionsRequest struct {
ctx context.Context
ApiService *TransactionsAPIService
leagueId *interface{}
sportId *interface{}
teamId *interface{}
playerId *interface{}
date *interface{}
startDate *interface{}
endDate *interface{}
transactionIds *interface{}
transactionTypes *interface{}
divisionIds *interface{}
order *interface{}
limit *interface{}
fields *interface{}
}
func (a *TransactionsApiService) Transactions(ctx context.Context, localVarOptionals *TransactionsApiTransactionsOpts) (models.TransactionsRestObject, *http.Response, error) {
// Comma delimited list of Unique league identifiers
func (r ApiTransactionsRequest) LeagueId(leagueId interface{}) ApiTransactionsRequest {
r.leagueId = &leagueId
return r
}
// Comma delimited list of top level organizations of a sport
func (r ApiTransactionsRequest) SportId(sportId interface{}) ApiTransactionsRequest {
r.sportId = &sportId
return r
}
// Comma delimited list of Unique Team identifiers
func (r ApiTransactionsRequest) TeamId(teamId interface{}) ApiTransactionsRequest {
r.teamId = &teamId
return r
}
// A unique identifier for a player
func (r ApiTransactionsRequest) PlayerId(playerId interface{}) ApiTransactionsRequest {
r.playerId = &playerId
return r
}
// Date of Game. Format: YYYY-MM-DD
func (r ApiTransactionsRequest) Date(date interface{}) ApiTransactionsRequest {
r.date = &date
return r
}
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
func (r ApiTransactionsRequest) StartDate(startDate interface{}) ApiTransactionsRequest {
r.startDate = &startDate
return r
}
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
func (r ApiTransactionsRequest) EndDate(endDate interface{}) ApiTransactionsRequest {
r.endDate = &endDate
return r
}
func (r ApiTransactionsRequest) TransactionIds(transactionIds interface{}) ApiTransactionsRequest {
r.transactionIds = &transactionIds
return r
}
func (r ApiTransactionsRequest) TransactionTypes(transactionTypes interface{}) ApiTransactionsRequest {
r.transactionTypes = &transactionTypes
return r
}
func (r ApiTransactionsRequest) DivisionIds(divisionIds interface{}) ApiTransactionsRequest {
r.divisionIds = &divisionIds
return r
}
func (r ApiTransactionsRequest) Order(order interface{}) ApiTransactionsRequest {
r.order = &order
return r
}
func (r ApiTransactionsRequest) Limit(limit interface{}) ApiTransactionsRequest {
r.limit = &limit
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiTransactionsRequest) Fields(fields interface{}) ApiTransactionsRequest {
r.fields = &fields
return r
}
func (r ApiTransactionsRequest) Execute() (*http.Response, error) {
return r.ApiService.TransactionsExecute(r)
}
/*
Transactions View transaction info
This endpoint allows you to pull transactions.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiTransactionsRequest
*/
func (a *TransactionsAPIService) Transactions(ctx context.Context) ApiTransactionsRequest {
return ApiTransactionsRequest{
ApiService: a,
ctx: ctx,
}
}
// Execute executes the request
func (a *TransactionsAPIService) TransactionsExecute(r ApiTransactionsRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.TransactionsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/transactions"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TransactionsAPIService.Transactions")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/transactions"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), "multi"))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), "multi"))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.TeamId.IsSet() {
localVarQueryParams.Add("teamId", parameterToString(localVarOptionals.TeamId.Value(), "multi"))
if r.teamId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "")
}
if localVarOptionals != nil && localVarOptionals.PlayerId.IsSet() {
localVarQueryParams.Add("playerId", parameterToString(localVarOptionals.PlayerId.Value(), "multi"))
if r.playerId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "playerId", r.playerId, "", "")
}
if localVarOptionals != nil && localVarOptionals.Date.IsSet() {
localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
if r.date != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
}
if localVarOptionals != nil && localVarOptionals.StartDate.IsSet() {
localVarQueryParams.Add("startDate", parameterToString(localVarOptionals.StartDate.Value(), ""))
if r.startDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
}
if localVarOptionals != nil && localVarOptionals.EndDate.IsSet() {
localVarQueryParams.Add("endDate", parameterToString(localVarOptionals.EndDate.Value(), ""))
if r.endDate != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
}
if localVarOptionals != nil && localVarOptionals.TransactionIds.IsSet() {
localVarQueryParams.Add("transactionIds", parameterToString(localVarOptionals.TransactionIds.Value(), "multi"))
if r.transactionIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "transactionIds", r.transactionIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.TransactionTypes.IsSet() {
localVarQueryParams.Add("transactionTypes", parameterToString(localVarOptionals.TransactionTypes.Value(), "multi"))
if r.transactionTypes != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "transactionTypes", r.transactionTypes, "", "")
}
if localVarOptionals != nil && localVarOptionals.DivisionIds.IsSet() {
localVarQueryParams.Add("divisionIds", parameterToString(localVarOptionals.DivisionIds.Value(), "multi"))
if r.divisionIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "divisionIds", r.divisionIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.Order.IsSet() {
localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), ""))
if r.order != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "")
}
if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
if r.limit != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.TransactionsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,241 +1,250 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type UniformsApiService service
// UniformsAPIService UniformsAPI service
type UniformsAPIService service
type ApiUniformsByGameRequest struct {
ctx context.Context
ApiService *UniformsAPIService
gamePks *interface{}
fields *interface{}
}
// Comma delimited list of unique primary keys
func (r ApiUniformsByGameRequest) GamePks(gamePks interface{}) ApiUniformsByGameRequest {
r.gamePks = &gamePks
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiUniformsByGameRequest) Fields(fields interface{}) ApiUniformsByGameRequest {
r.fields = &fields
return r
}
func (r ApiUniformsByGameRequest) Execute() (*http.Response, error) {
return r.ApiService.UniformsByGameExecute(r)
}
/*
UniformsApiService View Game Uniform info
UniformsByGame View Game Uniform info
This endpoint allows you to pull team uniform data for a game
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param gamePks Comma delimited list of unique primary keys
* @param optional nil or *UniformsApiUniformsByGameOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.UniformsGamesRestObject
*/
type UniformsApiUniformsByGameOpts struct {
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiUniformsByGameRequest
*/
func (a *UniformsAPIService) UniformsByGame(ctx context.Context) ApiUniformsByGameRequest {
return ApiUniformsByGameRequest{
ApiService: a,
ctx: ctx,
}
}
func (a *UniformsApiService) UniformsByGame(ctx context.Context, gamePks []int32, localVarOptionals *UniformsApiUniformsByGameOpts) (models.UniformsGamesRestObject, *http.Response, error) {
// Execute executes the request
func (a *UniformsAPIService) UniformsByGameExecute(r ApiUniformsByGameRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.UniformsGamesRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/uniforms/game"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UniformsAPIService.UniformsByGame")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/uniforms/game"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if r.gamePks == nil {
return nil, reportError("gamePks is required and must be specified")
}
localVarQueryParams.Add("gamePks", parameterToString(gamePks, "multi"))
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePks", r.gamePks, "", "")
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.UniformsGamesRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiUniformsByTeamRequest struct {
ctx context.Context
ApiService *UniformsAPIService
teamIds *interface{}
season *interface{}
fields *interface{}
}
func (r ApiUniformsByTeamRequest) TeamIds(teamIds interface{}) ApiUniformsByTeamRequest {
r.teamIds = &teamIds
return r
}
// Season of play
func (r ApiUniformsByTeamRequest) Season(season interface{}) ApiUniformsByTeamRequest {
r.season = &season
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiUniformsByTeamRequest) Fields(fields interface{}) ApiUniformsByTeamRequest {
r.fields = &fields
return r
}
func (r ApiUniformsByTeamRequest) Execute() (*http.Response, error) {
return r.ApiService.UniformsByTeamExecute(r)
}
/*
UniformsApiService View Team Uniform info
This endpoint allows you to pull team uniform data for a season
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param teamIds
* @param optional nil or *UniformsApiUniformsByTeamOpts - Optional Parameters:
* @param "Season" (optional.String) - Season of play
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return UniformsTeamsRestObject
*/
UniformsByTeam View Team Uniform info
type UniformsApiUniformsByTeamOpts struct {
Season optional.String
Fields optional.Interface
This endpoint allows you to pull team uniform data for a season
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@return ApiUniformsByTeamRequest
*/
func (a *UniformsAPIService) UniformsByTeam(ctx context.Context) ApiUniformsByTeamRequest {
return ApiUniformsByTeamRequest{
ApiService: a,
ctx: ctx,
}
}
func (a *UniformsApiService) UniformsByTeam(ctx context.Context, teamIds []int32, localVarOptionals *UniformsApiUniformsByTeamOpts) (models.UniformsTeamsRestObject, *http.Response, error) {
// Execute executes the request
func (a *UniformsAPIService) UniformsByTeamExecute(r ApiUniformsByTeamRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.UniformsTeamsRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/uniforms/team"
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "UniformsAPIService.UniformsByTeam")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/uniforms/team"
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
localVarQueryParams.Add("teamIds", parameterToString(teamIds, "multi"))
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.teamIds == nil {
return nil, reportError("teamIds is required and must be specified")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.UniformsTeamsRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,347 +1,446 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type VenuesApiService service
// VenuesAPIService VenuesAPI service
type VenuesAPIService service
/*
VenuesApiService View venue info
This endpoint allows you to pull venues
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param venueId Unique Venue Identifier
* @param optional nil or *VenuesApiVenuesOpts - Optional Parameters:
* @param "VenueIds" (optional.Interface of []int32) - Comma delimited list of Unique venue identifiers
* @param "LeagueId" (optional.Int32) - Unique League Identifier
* @param "LeagueIds" (optional.Interface of []int32) - Comma delimited list of Unique league identifiers
* @param "GameType" (optional.Interface of models.GameTypeEnum) - Type of Game. Available types in /api/v1/gameTypes
* @param "GameTypes" (optional.Interface of []models.GameTypeEnum) - Comma delimited list of type of Game. Available types in /api/v1/gameTypes
* @param "Season" (optional.String) - Season of play
* @param "Seasons" (optional.Interface of []string) - Comma delimited list of Seasons of play
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
* @param "Active" (optional.Bool) - Whether or not a player is active
* @param "IncludeEvents" (optional.Bool) -
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "SportIds" (optional.Interface of []int32) - Comma delimited list of top level organizations of a sport
@return models.VenuesRestObject
*/
type VenuesApiVenuesOpts struct {
VenueIds optional.Interface
LeagueId optional.Int32
LeagueIds optional.Interface
GameType optional.Interface
GameTypes optional.Interface
Season optional.String
Seasons optional.Interface
Fields optional.Interface
Active optional.Bool
IncludeEvents optional.Bool
SportId optional.Int32
SportIds optional.Interface
type ApiVenuesRequest struct {
ctx context.Context
ApiService *VenuesAPIService
venueId interface{}
venueIds *interface{}
leagueId *interface{}
leagueIds *interface{}
gameType *interface{}
gameTypes *interface{}
season *interface{}
seasons *interface{}
fields *interface{}
active *interface{}
includeEvents *interface{}
sportId *interface{}
sportIds *interface{}
}
func (a *VenuesApiService) Venues(ctx context.Context, venueId int32, localVarOptionals *VenuesApiVenuesOpts) (models.VenuesRestObject, *http.Response, error) {
// Comma delimited list of Unique venue identifiers
func (r ApiVenuesRequest) VenueIds(venueIds interface{}) ApiVenuesRequest {
r.venueIds = &venueIds
return r
}
// Unique League Identifier
func (r ApiVenuesRequest) LeagueId(leagueId interface{}) ApiVenuesRequest {
r.leagueId = &leagueId
return r
}
// Comma delimited list of Unique league identifiers
func (r ApiVenuesRequest) LeagueIds(leagueIds interface{}) ApiVenuesRequest {
r.leagueIds = &leagueIds
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiVenuesRequest) GameType(gameType interface{}) ApiVenuesRequest {
r.gameType = &gameType
return r
}
// Comma delimited list of type of Game. Available types in /api/v1/gameTypes
func (r ApiVenuesRequest) GameTypes(gameTypes interface{}) ApiVenuesRequest {
r.gameTypes = &gameTypes
return r
}
// Season of play
func (r ApiVenuesRequest) Season(season interface{}) ApiVenuesRequest {
r.season = &season
return r
}
// Comma delimited list of Seasons of play
func (r ApiVenuesRequest) Seasons(seasons interface{}) ApiVenuesRequest {
r.seasons = &seasons
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiVenuesRequest) Fields(fields interface{}) ApiVenuesRequest {
r.fields = &fields
return r
}
// Whether or not a player is active
func (r ApiVenuesRequest) Active(active interface{}) ApiVenuesRequest {
r.active = &active
return r
}
func (r ApiVenuesRequest) IncludeEvents(includeEvents interface{}) ApiVenuesRequest {
r.includeEvents = &includeEvents
return r
}
// Top level organization of a sport
func (r ApiVenuesRequest) SportId(sportId interface{}) ApiVenuesRequest {
r.sportId = &sportId
return r
}
// Comma delimited list of top level organizations of a sport
func (r ApiVenuesRequest) SportIds(sportIds interface{}) ApiVenuesRequest {
r.sportIds = &sportIds
return r
}
func (r ApiVenuesRequest) Execute() (*http.Response, error) {
return r.ApiService.VenuesExecute(r)
}
/*
Venues View venue info
This endpoint allows you to pull venues
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param venueId Unique Venue Identifier
@return ApiVenuesRequest
*/
func (a *VenuesAPIService) Venues(ctx context.Context, venueId interface{}) ApiVenuesRequest {
return ApiVenuesRequest{
ApiService: a,
ctx: ctx,
venueId: venueId,
}
}
// Execute executes the request
func (a *VenuesAPIService) VenuesExecute(r ApiVenuesRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.VenuesRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/venues"
localVarPath = strings.Replace(localVarPath, "{"+"venueId"+"}", fmt.Sprintf("%v", venueId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VenuesAPIService.Venues")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/venues"
localVarPath = strings.Replace(localVarPath, "{"+"venueId"+"}", url.PathEscape(parameterValueToString(r.venueId, "venueId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.VenueIds.IsSet() {
localVarQueryParams.Add("venueIds", parameterToString(localVarOptionals.VenueIds.Value(), "multi"))
if r.venueIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "venueIds", r.venueIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
if r.leagueIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameTypes.IsSet() {
localVarQueryParams.Add("gameTypes", parameterToString(localVarOptionals.GameTypes.Value(), "multi"))
if r.gameTypes != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameTypes", r.gameTypes, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
if r.seasons != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if localVarOptionals != nil && localVarOptionals.Active.IsSet() {
localVarQueryParams.Add("active", parameterToString(localVarOptionals.Active.Value(), ""))
if r.active != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "active", r.active, "", "")
}
if localVarOptionals != nil && localVarOptionals.IncludeEvents.IsSet() {
localVarQueryParams.Add("includeEvents", parameterToString(localVarOptionals.IncludeEvents.Value(), ""))
if r.includeEvents != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeEvents", r.includeEvents, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
if r.sportIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.VenuesRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiVenues1Request struct {
ctx context.Context
ApiService *VenuesAPIService
venueId interface{}
venueIds *interface{}
leagueId *interface{}
leagueIds *interface{}
gameType *interface{}
gameTypes *interface{}
season *interface{}
seasons *interface{}
fields *interface{}
active *interface{}
includeEvents *interface{}
sportId *interface{}
sportIds *interface{}
}
// Comma delimited list of Unique venue identifiers
func (r ApiVenues1Request) VenueIds(venueIds interface{}) ApiVenues1Request {
r.venueIds = &venueIds
return r
}
// Unique League Identifier
func (r ApiVenues1Request) LeagueId(leagueId interface{}) ApiVenues1Request {
r.leagueId = &leagueId
return r
}
// Comma delimited list of Unique league identifiers
func (r ApiVenues1Request) LeagueIds(leagueIds interface{}) ApiVenues1Request {
r.leagueIds = &leagueIds
return r
}
// Type of Game. Available types in /api/v1/gameTypes
func (r ApiVenues1Request) GameType(gameType interface{}) ApiVenues1Request {
r.gameType = &gameType
return r
}
// Comma delimited list of type of Game. Available types in /api/v1/gameTypes
func (r ApiVenues1Request) GameTypes(gameTypes interface{}) ApiVenues1Request {
r.gameTypes = &gameTypes
return r
}
// Season of play
func (r ApiVenues1Request) Season(season interface{}) ApiVenues1Request {
r.season = &season
return r
}
// Comma delimited list of Seasons of play
func (r ApiVenues1Request) Seasons(seasons interface{}) ApiVenues1Request {
r.seasons = &seasons
return r
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiVenues1Request) Fields(fields interface{}) ApiVenues1Request {
r.fields = &fields
return r
}
// Whether or not a player is active
func (r ApiVenues1Request) Active(active interface{}) ApiVenues1Request {
r.active = &active
return r
}
func (r ApiVenues1Request) IncludeEvents(includeEvents interface{}) ApiVenues1Request {
r.includeEvents = &includeEvents
return r
}
// Top level organization of a sport
func (r ApiVenues1Request) SportId(sportId interface{}) ApiVenues1Request {
r.sportId = &sportId
return r
}
// Comma delimited list of top level organizations of a sport
func (r ApiVenues1Request) SportIds(sportIds interface{}) ApiVenues1Request {
r.sportIds = &sportIds
return r
}
func (r ApiVenues1Request) Execute() (*http.Response, error) {
return r.ApiService.Venues1Execute(r)
}
/*
VenuesApiService View venue info
This endpoint allows you to pull venues
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param venueId Unique Venue Identifier
* @param optional nil or *VenuesApiVenues1Opts - Optional Parameters:
* @param "VenueIds" (optional.Interface of []int32) - Comma delimited list of Unique venue identifiers
* @param "LeagueId" (optional.Int32) - Unique League Identifier
* @param "LeagueIds" (optional.Interface of []int32) - Comma delimited list of Unique league identifiers
* @param "GameType" (optional.Interface of models.GameTypeEnum) - Type of Game. Available types in /api/v1/gameTypes
* @param "GameTypes" (optional.Interface of []models.GameTypeEnum) - Comma delimited list of type of Game. Available types in /api/v1/gameTypes
* @param "Season" (optional.String) - Season of play
* @param "Seasons" (optional.Interface of []string) - Comma delimited list of Seasons of play
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
* @param "Active" (optional.Bool) - Whether or not a player is active
* @param "IncludeEvents" (optional.Bool) -
* @param "SportId" (optional.Int32) - Top level organization of a sport
* @param "SportIds" (optional.Interface of []int32) - Comma delimited list of top level organizations of a sport
@return models.VenuesRestObject
*/
Venues1 View venue info
type VenuesApiVenues1Opts struct {
VenueIds optional.Interface
LeagueId optional.Int32
LeagueIds optional.Interface
GameType optional.Interface
GameTypes optional.Interface
Season optional.String
Seasons optional.Interface
Fields optional.Interface
Active optional.Bool
IncludeEvents optional.Bool
SportId optional.Int32
SportIds optional.Interface
This endpoint allows you to pull venues
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param venueId Unique Venue Identifier
@return ApiVenues1Request
*/
func (a *VenuesAPIService) Venues1(ctx context.Context, venueId interface{}) ApiVenues1Request {
return ApiVenues1Request{
ApiService: a,
ctx: ctx,
venueId: venueId,
}
}
func (a *VenuesApiService) Venues1(ctx context.Context, venueId int32, localVarOptionals *VenuesApiVenues1Opts) (models.VenuesRestObject, *http.Response, error) {
// Execute executes the request
func (a *VenuesAPIService) Venues1Execute(r ApiVenues1Request) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.VenuesRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/venues/{venueId}"
localVarPath = strings.Replace(localVarPath, "{"+"venueId"+"}", fmt.Sprintf("%v", venueId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "VenuesAPIService.Venues1")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/venues/{venueId}"
localVarPath = strings.Replace(localVarPath, "{"+"venueId"+"}", url.PathEscape(parameterValueToString(r.venueId, "venueId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.VenueIds.IsSet() {
localVarQueryParams.Add("venueIds", parameterToString(localVarOptionals.VenueIds.Value(), "multi"))
if r.venueIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "venueIds", r.venueIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
if r.leagueId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
}
if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
if r.leagueIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
if r.gameType != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
}
if localVarOptionals != nil && localVarOptionals.GameTypes.IsSet() {
localVarQueryParams.Add("gameTypes", parameterToString(localVarOptionals.GameTypes.Value(), "multi"))
if r.gameTypes != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "gameTypes", r.gameTypes, "", "")
}
if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
if r.season != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
}
if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
if r.seasons != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
if localVarOptionals != nil && localVarOptionals.Active.IsSet() {
localVarQueryParams.Add("active", parameterToString(localVarOptionals.Active.Value(), ""))
if r.active != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "active", r.active, "", "")
}
if localVarOptionals != nil && localVarOptionals.IncludeEvents.IsSet() {
localVarQueryParams.Add("includeEvents", parameterToString(localVarOptionals.IncludeEvents.Value(), ""))
if r.includeEvents != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "includeEvents", r.includeEvents, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
if r.sportId != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
}
if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
if r.sportIds != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"*/*"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.VenuesRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,433 +1,440 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"bytes"
"context"
"fmt"
"github.com/antihax/optional"
"io/ioutil"
"io"
"net/http"
"net/url"
"scm.dairydemon.net/filifa/mlbstats/api/models"
"strings"
)
// Linger please
var (
_ context.Context
)
type WeatherApiService service
// WeatherAPIService WeatherAPI service
type WeatherAPIService service
type ApiWeatherBasicRequest struct {
ctx context.Context
ApiService *WeatherAPIService
venueId interface{}
fields *interface{}
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiWeatherBasicRequest) Fields(fields interface{}) ApiWeatherBasicRequest {
r.fields = &fields
return r
}
func (r ApiWeatherBasicRequest) Execute() (*http.Response, error) {
return r.ApiService.WeatherBasicExecute(r)
}
/*
WeatherApiService Get basic weather for a venue.
WeatherBasic Get basic weather for a venue.
Returns a json file containing basic weather for a specific venue.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param venueId Unique Venue Identifier
* @param optional nil or *WeatherApiWeatherBasicOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.BasicWeatherWrapperRestObject
*/
type WeatherApiWeatherBasicOpts struct {
Fields optional.Interface
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param venueId Unique Venue Identifier
@return ApiWeatherBasicRequest
*/
func (a *WeatherAPIService) WeatherBasic(ctx context.Context, venueId interface{}) ApiWeatherBasicRequest {
return ApiWeatherBasicRequest{
ApiService: a,
ctx: ctx,
venueId: venueId,
}
}
func (a *WeatherApiService) WeatherBasic(ctx context.Context, venueId int32, localVarOptionals *WeatherApiWeatherBasicOpts) (models.BasicWeatherWrapperRestObject, *http.Response, error) {
// Execute executes the request
func (a *WeatherAPIService) WeatherBasicExecute(r ApiWeatherBasicRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.BasicWeatherWrapperRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/weather/venues/{venueId}/basic"
localVarPath = strings.Replace(localVarPath, "{"+"venueId"+"}", fmt.Sprintf("%v", venueId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WeatherAPIService.WeatherBasic")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/weather/venues/{venueId}/basic"
localVarPath = strings.Replace(localVarPath, "{"+"venueId"+"}", url.PathEscape(parameterValueToString(r.venueId, "venueId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.BasicWeatherWrapperRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiWeatherDataBasedOnPlayRequest struct {
ctx context.Context
ApiService *WeatherAPIService
gamePk interface{}
playId interface{}
fields *interface{}
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiWeatherDataBasedOnPlayRequest) Fields(fields interface{}) ApiWeatherDataBasedOnPlayRequest {
r.fields = &fields
return r
}
func (r ApiWeatherDataBasedOnPlayRequest) Execute() (*http.Response, error) {
return r.ApiService.WeatherDataBasedOnPlayExecute(r)
}
/*
WeatherApiService Get the raw field weather data.
WeatherDataBasedOnPlay Get the raw field weather data.
Returns a json file containing weather for the current play.
* @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 identifier for a play within a game
* @param optional nil or *WeatherApiWeatherDataBasedOnPlayOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.PlayWeatherWrapperRestObject
*/
type WeatherApiWeatherDataBasedOnPlayOpts struct {
Fields optional.Interface
@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 identifier for a play within a game
@return ApiWeatherDataBasedOnPlayRequest
*/
func (a *WeatherAPIService) WeatherDataBasedOnPlay(ctx context.Context, gamePk interface{}, playId interface{}) ApiWeatherDataBasedOnPlayRequest {
return ApiWeatherDataBasedOnPlayRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
playId: playId,
}
}
func (a *WeatherApiService) WeatherDataBasedOnPlay(ctx context.Context, gamePk int32, playId string, localVarOptionals *WeatherApiWeatherDataBasedOnPlayOpts) (models.PlayWeatherWrapperRestObject, *http.Response, error) {
// Execute executes the request
func (a *WeatherAPIService) WeatherDataBasedOnPlayExecute(r ApiWeatherDataBasedOnPlayRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.PlayWeatherWrapperRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/weather/game/{gamePk}/{playId}"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
localVarPath = strings.Replace(localVarPath, "{"+"playId"+"}", fmt.Sprintf("%v", playId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WeatherAPIService.WeatherDataBasedOnPlay")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/weather/game/{gamePk}/{playId}"
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 localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.PlayWeatherWrapperRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiWeatherForecastRequest struct {
ctx context.Context
ApiService *WeatherAPIService
gamePk interface{}
roofType interface{}
fields *interface{}
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiWeatherForecastRequest) Fields(fields interface{}) ApiWeatherForecastRequest {
r.fields = &fields
return r
}
func (r ApiWeatherForecastRequest) Execute() (*http.Response, error) {
return r.ApiService.WeatherForecastExecute(r)
}
/*
WeatherApiService Get the weather forecast for a game.
WeatherForecast Get the weather forecast for a game.
Returns a json file containing the weather forecast for a specific 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
* @param roofType Venue roof type
* @param optional nil or *WeatherApiWeatherForecastOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.ForecastWeatherWrapperRestObject
*/
type WeatherApiWeatherForecastOpts struct {
Fields optional.Interface
@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 roofType Venue roof type
@return ApiWeatherForecastRequest
*/
func (a *WeatherAPIService) WeatherForecast(ctx context.Context, gamePk interface{}, roofType interface{}) ApiWeatherForecastRequest {
return ApiWeatherForecastRequest{
ApiService: a,
ctx: ctx,
gamePk: gamePk,
roofType: roofType,
}
}
func (a *WeatherApiService) WeatherForecast(ctx context.Context, gamePk int32, roofType models.RoofType, localVarOptionals *WeatherApiWeatherForecastOpts) (models.ForecastWeatherWrapperRestObject, *http.Response, error) {
// Execute executes the request
func (a *WeatherAPIService) WeatherForecastExecute(r ApiWeatherForecastRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.ForecastWeatherWrapperRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/weather/game/{gamePk}/forecast/{roofType}"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", fmt.Sprintf("%v", gamePk), -1)
localVarPath = strings.Replace(localVarPath, "{"+"roofType"+"}", fmt.Sprintf("%v", roofType), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WeatherAPIService.WeatherForecast")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/weather/game/{gamePk}/forecast/{roofType}"
localVarPath = strings.Replace(localVarPath, "{"+"gamePk"+"}", url.PathEscape(parameterValueToString(r.gamePk, "gamePk")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"roofType"+"}", url.PathEscape(parameterValueToString(r.roofType, "roofType")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.ForecastWeatherWrapperRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}
type ApiWeatherFullRequest struct {
ctx context.Context
ApiService *WeatherAPIService
venueId interface{}
fields *interface{}
}
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
func (r ApiWeatherFullRequest) Fields(fields interface{}) ApiWeatherFullRequest {
r.fields = &fields
return r
}
func (r ApiWeatherFullRequest) Execute() (*http.Response, error) {
return r.ApiService.WeatherFullExecute(r)
}
/*
WeatherApiService Get full weather for a venue.
Returns a json file containing full weather for a specific venue.
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param venueId Unique Venue Identifier
* @param optional nil or *WeatherApiWeatherFullOpts - Optional Parameters:
* @param "Fields" (optional.Interface of []string) - Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.FullWeatherWrapperRestObject
*/
WeatherFull Get full weather for a venue.
type WeatherApiWeatherFullOpts struct {
Fields optional.Interface
Returns a json file containing full weather for a specific venue.
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@param venueId Unique Venue Identifier
@return ApiWeatherFullRequest
*/
func (a *WeatherAPIService) WeatherFull(ctx context.Context, venueId interface{}) ApiWeatherFullRequest {
return ApiWeatherFullRequest{
ApiService: a,
ctx: ctx,
venueId: venueId,
}
}
func (a *WeatherApiService) WeatherFull(ctx context.Context, venueId int32, localVarOptionals *WeatherApiWeatherFullOpts) (models.FullWeatherWrapperRestObject, *http.Response, error) {
// Execute executes the request
func (a *WeatherAPIService) WeatherFullExecute(r ApiWeatherFullRequest) (*http.Response, error) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarHTTPMethod = http.MethodGet
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
localVarReturnValue models.FullWeatherWrapperRestObject
formFiles []formFile
)
// create path and map variables
localVarPath := a.client.cfg.BasePath + "/api/v1/weather/venues/{venueId}/full"
localVarPath = strings.Replace(localVarPath, "{"+"venueId"+"}", fmt.Sprintf("%v", venueId), -1)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "WeatherAPIService.WeatherFull")
if err != nil {
return nil, &GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v1/weather/venues/{venueId}/full"
localVarPath = strings.Replace(localVarPath, "{"+"venueId"+"}", url.PathEscape(parameterValueToString(r.venueId, "venueId")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := url.Values{}
localVarFormParams := url.Values{}
if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
if r.fields != nil {
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
}
// to determine the Content-Type header
localVarHttpContentTypes := []string{}
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{"application/json;charset=UTF-8"}
localVarHTTPHeaderAccepts := []string{}
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
if localVarHttpHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
if err != nil {
return localVarReturnValue, nil, err
return nil, err
}
localVarHttpResponse, err := a.client.callAPI(r)
if err != nil || localVarHttpResponse == nil {
return localVarReturnValue, localVarHttpResponse, err
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
localVarHttpResponse.Body.Close()
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHttpResponse, err
return localVarHTTPResponse, err
}
if localVarHttpResponse.StatusCode < 300 {
// If we succeed, return the data, otherwise pass on to decode error.
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err == nil {
return localVarReturnValue, localVarHttpResponse, err
}
}
if localVarHttpResponse.StatusCode >= 300 {
newErr := GenericSwaggerError{
if localVarHTTPResponse.StatusCode >= 300 {
newErr := &GenericOpenAPIError{
body: localVarBody,
error: localVarHttpResponse.Status,
error: localVarHTTPResponse.Status,
}
if localVarHttpResponse.StatusCode == 200 {
var v models.FullWeatherWrapperRestObject
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHttpResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHttpResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, newErr
return localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHttpResponse, nil
return localVarHTTPResponse, nil
}

View File

@ -1,29 +1,13 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
@ -34,8 +18,10 @@ import (
"errors"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"net/http/httputil"
"net/url"
"os"
"path/filepath"
@ -46,12 +32,13 @@ import (
"time"
"unicode/utf8"
"golang.org/x/oauth2"
)
var (
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`)
XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`)
queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`)
queryDescape = strings.NewReplacer( "%5B", "[", "%5D", "]" )
)
// APIClient manages communication with the Stats API Documentation API v2.0.0
@ -62,69 +49,69 @@ type APIClient struct {
// API Services
AnalyticsApi *AnalyticsApiService
AnalyticsAPI *AnalyticsAPIService
AttendanceApi *AttendanceApiService
AttendanceAPI *AttendanceAPIService
AwardsApi *AwardsApiService
AwardsAPI *AwardsAPIService
BatTrackingApi *BatTrackingApiService
BatTrackingAPI *BatTrackingAPIService
BiomechanicsApi *BiomechanicsApiService
BiomechanicsAPI *BiomechanicsAPIService
BroadcastApi *BroadcastApiService
BroadcastAPI *BroadcastAPIService
ConferenceApi *ConferenceApiService
ConferenceAPI *ConferenceAPIService
DivisionApi *DivisionApiService
DivisionAPI *DivisionAPIService
DraftApi *DraftApiService
DraftAPI *DraftAPIService
GameApi *GameApiService
GameAPI *GameAPIService
GamePaceApi *GamePaceApiService
GamePaceAPI *GamePaceAPIService
HighLowApi *HighLowApiService
HighLowAPI *HighLowAPIService
HomerunDerbyApi *HomerunDerbyApiService
HomerunDerbyAPI *HomerunDerbyAPIService
JobApi *JobApiService
JobAPI *JobAPIService
LeagueApi *LeagueApiService
LeagueAPI *LeagueAPIService
MilestonesApi *MilestonesApiService
MilestonesAPI *MilestonesAPIService
MiscApi *MiscApiService
MiscAPI *MiscAPIService
PersonApi *PersonApiService
PersonAPI *PersonAPIService
PredictionsApi *PredictionsApiService
PredictionsAPI *PredictionsAPIService
ReviewsApi *ReviewsApiService
ReviewsAPI *ReviewsAPIService
ScheduleApi *ScheduleApiService
ScheduleAPI *ScheduleAPIService
SeasonApi *SeasonApiService
SeasonAPI *SeasonAPIService
SkeletalApi *SkeletalApiService
SkeletalAPI *SkeletalAPIService
SportsApi *SportsApiService
SportsAPI *SportsAPIService
StandingsApi *StandingsApiService
StandingsAPI *StandingsAPIService
StatsApi *StatsApiService
StatsAPI *StatsAPIService
StreaksApi *StreaksApiService
StreaksAPI *StreaksAPIService
TeamsApi *TeamsApiService
TeamsAPI *TeamsAPIService
TransactionsApi *TransactionsApiService
TransactionsAPI *TransactionsAPIService
UniformsApi *UniformsApiService
UniformsAPI *UniformsAPIService
VenuesApi *VenuesApiService
VenuesAPI *VenuesAPIService
WeatherApi *WeatherApiService
WeatherAPI *WeatherAPIService
}
type service struct {
@ -143,38 +130,38 @@ func NewAPIClient(cfg *Configuration) *APIClient {
c.common.client = c
// API Services
c.AnalyticsApi = (*AnalyticsApiService)(&c.common)
c.AttendanceApi = (*AttendanceApiService)(&c.common)
c.AwardsApi = (*AwardsApiService)(&c.common)
c.BatTrackingApi = (*BatTrackingApiService)(&c.common)
c.BiomechanicsApi = (*BiomechanicsApiService)(&c.common)
c.BroadcastApi = (*BroadcastApiService)(&c.common)
c.ConferenceApi = (*ConferenceApiService)(&c.common)
c.DivisionApi = (*DivisionApiService)(&c.common)
c.DraftApi = (*DraftApiService)(&c.common)
c.GameApi = (*GameApiService)(&c.common)
c.GamePaceApi = (*GamePaceApiService)(&c.common)
c.HighLowApi = (*HighLowApiService)(&c.common)
c.HomerunDerbyApi = (*HomerunDerbyApiService)(&c.common)
c.JobApi = (*JobApiService)(&c.common)
c.LeagueApi = (*LeagueApiService)(&c.common)
c.MilestonesApi = (*MilestonesApiService)(&c.common)
c.MiscApi = (*MiscApiService)(&c.common)
c.PersonApi = (*PersonApiService)(&c.common)
c.PredictionsApi = (*PredictionsApiService)(&c.common)
c.ReviewsApi = (*ReviewsApiService)(&c.common)
c.ScheduleApi = (*ScheduleApiService)(&c.common)
c.SeasonApi = (*SeasonApiService)(&c.common)
c.SkeletalApi = (*SkeletalApiService)(&c.common)
c.SportsApi = (*SportsApiService)(&c.common)
c.StandingsApi = (*StandingsApiService)(&c.common)
c.StatsApi = (*StatsApiService)(&c.common)
c.StreaksApi = (*StreaksApiService)(&c.common)
c.TeamsApi = (*TeamsApiService)(&c.common)
c.TransactionsApi = (*TransactionsApiService)(&c.common)
c.UniformsApi = (*UniformsApiService)(&c.common)
c.VenuesApi = (*VenuesApiService)(&c.common)
c.WeatherApi = (*WeatherApiService)(&c.common)
c.AnalyticsAPI = (*AnalyticsAPIService)(&c.common)
c.AttendanceAPI = (*AttendanceAPIService)(&c.common)
c.AwardsAPI = (*AwardsAPIService)(&c.common)
c.BatTrackingAPI = (*BatTrackingAPIService)(&c.common)
c.BiomechanicsAPI = (*BiomechanicsAPIService)(&c.common)
c.BroadcastAPI = (*BroadcastAPIService)(&c.common)
c.ConferenceAPI = (*ConferenceAPIService)(&c.common)
c.DivisionAPI = (*DivisionAPIService)(&c.common)
c.DraftAPI = (*DraftAPIService)(&c.common)
c.GameAPI = (*GameAPIService)(&c.common)
c.GamePaceAPI = (*GamePaceAPIService)(&c.common)
c.HighLowAPI = (*HighLowAPIService)(&c.common)
c.HomerunDerbyAPI = (*HomerunDerbyAPIService)(&c.common)
c.JobAPI = (*JobAPIService)(&c.common)
c.LeagueAPI = (*LeagueAPIService)(&c.common)
c.MilestonesAPI = (*MilestonesAPIService)(&c.common)
c.MiscAPI = (*MiscAPIService)(&c.common)
c.PersonAPI = (*PersonAPIService)(&c.common)
c.PredictionsAPI = (*PredictionsAPIService)(&c.common)
c.ReviewsAPI = (*ReviewsAPIService)(&c.common)
c.ScheduleAPI = (*ScheduleAPIService)(&c.common)
c.SeasonAPI = (*SeasonAPIService)(&c.common)
c.SkeletalAPI = (*SkeletalAPIService)(&c.common)
c.SportsAPI = (*SportsAPIService)(&c.common)
c.StandingsAPI = (*StandingsAPIService)(&c.common)
c.StatsAPI = (*StatsAPIService)(&c.common)
c.StreaksAPI = (*StreaksAPIService)(&c.common)
c.TeamsAPI = (*TeamsAPIService)(&c.common)
c.TransactionsAPI = (*TransactionsAPIService)(&c.common)
c.UniformsAPI = (*UniformsAPIService)(&c.common)
c.VenuesAPI = (*VenuesAPIService)(&c.common)
c.WeatherAPI = (*WeatherAPIService)(&c.common)
return c
}
@ -207,10 +194,10 @@ func selectHeaderAccept(accepts []string) string {
return strings.Join(accepts, ",")
}
// contains is a case insenstive match, finding needle in a haystack
// contains is a case insensitive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
if strings.EqualFold(a, needle) {
return true
}
}
@ -226,41 +213,165 @@ func typeCheckParameter(obj interface{}, expected string, name string) error {
// Check the type is as expected.
if reflect.TypeOf(obj).String() != expected {
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String())
}
return nil
}
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
func parameterToString(obj interface{}, collectionFormat string) string {
var delimiter string
switch collectionFormat {
case "pipes":
delimiter = "|"
case "ssv":
delimiter = " "
case "tsv":
delimiter = "\t"
case "csv":
delimiter = ","
}
if reflect.TypeOf(obj).Kind() == reflect.Slice {
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
func parameterValueToString( obj interface{}, key string ) string {
if reflect.TypeOf(obj).Kind() != reflect.Ptr {
if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok {
return fmt.Sprintf("%v", actualObj.GetActualInstanceValue())
}
return fmt.Sprintf("%v", obj)
}
var param,ok = obj.(MappedNullable)
if !ok {
return ""
}
dataMap,err := param.ToMap()
if err != nil {
return ""
}
return fmt.Sprintf("%v", dataMap[key])
}
// parameterAddToHeaderOrQuery adds the provided object to the request header or url query
// supporting deep object syntax
func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) {
var v = reflect.ValueOf(obj)
var value = ""
if v == reflect.ValueOf(nil) {
value = "null"
} else {
switch v.Kind() {
case reflect.Invalid:
value = "invalid"
case reflect.Struct:
if t,ok := obj.(MappedNullable); ok {
dataMap,err := t.ToMap()
if err != nil {
return
}
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType)
return
}
if t, ok := obj.(time.Time); ok {
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType)
return
}
value = v.Type().String() + " value"
case reflect.Slice:
var indValue = reflect.ValueOf(obj)
if indValue == reflect.ValueOf(nil) {
return
}
var lenIndValue = indValue.Len()
for i:=0;i<lenIndValue;i++ {
var arrayValue = indValue.Index(i)
var keyPrefixForCollectionType = keyPrefix
if style == "deepObject" {
keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]"
}
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType)
}
return
case reflect.Map:
var indValue = reflect.ValueOf(obj)
if indValue == reflect.ValueOf(nil) {
return
}
iter := indValue.MapRange()
for iter.Next() {
k,v := iter.Key(), iter.Value()
parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType)
}
return
case reflect.Interface:
fallthrough
case reflect.Ptr:
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType)
return
case reflect.Int, reflect.Int8, reflect.Int16,
reflect.Int32, reflect.Int64:
value = strconv.FormatInt(v.Int(), 10)
case reflect.Uint, reflect.Uint8, reflect.Uint16,
reflect.Uint32, reflect.Uint64, reflect.Uintptr:
value = strconv.FormatUint(v.Uint(), 10)
case reflect.Float32, reflect.Float64:
value = strconv.FormatFloat(v.Float(), 'g', -1, 32)
case reflect.Bool:
value = strconv.FormatBool(v.Bool())
case reflect.String:
value = v.String()
default:
value = v.Type().String() + " value"
}
}
switch valuesMap := headerOrQueryParams.(type) {
case url.Values:
if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" {
valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix) + "," + value)
} else {
valuesMap.Add(keyPrefix, value)
}
break
case map[string]string:
valuesMap[keyPrefix] = value
break
}
}
// helper for converting interface{} parameters to json strings
func parameterToJson(obj interface{}) (string, error) {
jsonBuf, err := json.Marshal(obj)
if err != nil {
return "", err
}
return string(jsonBuf), err
}
// callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
return c.cfg.HTTPClient.Do(request)
if c.cfg.Debug {
dump, err := httputil.DumpRequestOut(request, true)
if err != nil {
return nil, err
}
log.Printf("\n%s\n", string(dump))
}
resp, err := c.cfg.HTTPClient.Do(request)
if err != nil {
return resp, err
}
if c.cfg.Debug {
dump, err := httputil.DumpResponse(resp, true)
if err != nil {
return resp, err
}
log.Printf("\n%s\n", string(dump))
}
return resp, err
}
// Change base path to allow switching to mocks
func (c *APIClient) ChangeBasePath(path string) {
c.cfg.BasePath = path
// Allow modification of underlying config for alternate implementations and testing
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
func (c *APIClient) GetConfig() *Configuration {
return c.cfg
}
type formFile struct {
fileBytes []byte
fileName string
formFileName string
}
// prepareRequest build the request
@ -271,8 +382,7 @@ func (c *APIClient) prepareRequest(
headerParams map[string]string,
queryParams url.Values,
formParams url.Values,
fileName string,
fileBytes []byte) (localVarRequest *http.Request, err error) {
formFiles []formFile) (localVarRequest *http.Request, err error) {
var body *bytes.Buffer
@ -291,7 +401,7 @@ func (c *APIClient) prepareRequest(
}
// add form parameters and file if available.
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
if body != nil {
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
}
@ -310,20 +420,22 @@ func (c *APIClient) prepareRequest(
}
}
}
if len(fileBytes) > 0 && fileName != "" {
for _, formFile := range formFiles {
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
w.Boundary()
//_, fileNm := filepath.Split(fileName)
part, err := w.CreateFormFile("file", filepath.Base(fileName))
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
if err != nil {
return nil, err
}
_, err = part.Write(fileBytes)
_, err = part.Write(formFile.fileBytes)
if err != nil {
return nil, err
}
}
}
// Set the Boundary in the Content-Type
headerParams["Content-Type"] = w.FormDataContentType()
}
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
@ -346,6 +458,16 @@ func (c *APIClient) prepareRequest(
return nil, err
}
// Override request host, if applicable
if c.cfg.Host != "" {
url.Host = c.cfg.Host
}
// Override request scheme, if applicable
if c.cfg.Scheme != "" {
url.Scheme = c.cfg.Scheme
}
// Adding Query Param
query := url.Query()
for k, v := range queryParams {
@ -355,7 +477,11 @@ func (c *APIClient) prepareRequest(
}
// Encode the parameters.
url.RawQuery = query.Encode()
url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string {
pieces := strings.Split(s, "=")
pieces[0] = queryDescape.Replace(pieces[0])
return strings.Join(pieces, "=")
})
// Generate a new request
if body != nil {
@ -371,16 +497,11 @@ func (c *APIClient) prepareRequest(
if len(headerParams) > 0 {
headers := http.Header{}
for h, v := range headerParams {
headers.Set(h, v)
headers[h] = []string{v}
}
localVarRequest.Header = headers
}
// Override request host, if applicable
if c.cfg.Host != "" {
localVarRequest.Host = c.cfg.Host
}
// Add the user agent to the request.
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
@ -390,43 +511,62 @@ func (c *APIClient) prepareRequest(
// Walk through any authentication.
// OAuth2 authentication
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
// We were able to grab an oauth2 token from the context
var latestToken *oauth2.Token
if latestToken, err = tok.Token(); err != nil {
return nil, err
}
latestToken.SetAuthHeader(localVarRequest)
}
// Basic HTTP Authentication
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
}
// AccessToken Authentication
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
localVarRequest.Header.Add("Authorization", "Bearer "+auth)
}
}
for header, value := range c.cfg.DefaultHeader {
localVarRequest.Header.Add(header, value)
}
return localVarRequest, nil
}
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
if strings.Contains(contentType, "application/xml") {
if len(b) == 0 {
return nil
}
if s, ok := v.(*string); ok {
*s = string(b)
return nil
}
if f, ok := v.(*os.File); ok {
f, err = os.CreateTemp("", "HttpClientFile")
if err != nil {
return
}
_, err = f.Write(b)
if err != nil {
return
}
_, err = f.Seek(0, io.SeekStart)
return
}
if f, ok := v.(**os.File); ok {
*f, err = os.CreateTemp("", "HttpClientFile")
if err != nil {
return
}
_, err = (*f).Write(b)
if err != nil {
return
}
_, err = (*f).Seek(0, io.SeekStart)
return
}
if XmlCheck.MatchString(contentType) {
if err = xml.Unmarshal(b, v); err != nil {
return err
}
return nil
} else if strings.Contains(contentType, "application/json") {
if err = json.Unmarshal(b, v); err != nil {
}
if JsonCheck.MatchString(contentType) {
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
return err
}
} else {
return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined")
}
} else if err = json.Unmarshal(b, v); err != nil { // simple model
return err
}
return nil
@ -436,11 +576,14 @@ func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err err
// Add a file to the multipart request
func addFile(w *multipart.Writer, fieldName, path string) error {
file, err := os.Open(path)
file, err := os.Open(filepath.Clean(path))
if err != nil {
return err
}
err = file.Close()
if err != nil {
return err
}
defer file.Close()
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
if err != nil {
@ -451,11 +594,6 @@ func addFile(w *multipart.Writer, fieldName, path string) error {
return err
}
// Prevent trying to import "fmt"
func reportError(format string, a ...interface{}) error {
return fmt.Errorf(format, a...)
}
// Set request body from an interface{}
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
if bodyBuf == nil {
@ -464,16 +602,22 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e
if reader, ok := body.(io.Reader); ok {
_, err = bodyBuf.ReadFrom(reader)
} else if fp, ok := body.(*os.File); ok {
_, err = bodyBuf.ReadFrom(fp)
} else if b, ok := body.([]byte); ok {
_, err = bodyBuf.Write(b)
} else if s, ok := body.(string); ok {
_, err = bodyBuf.WriteString(s)
} else if s, ok := body.(*string); ok {
_, err = bodyBuf.WriteString(*s)
} else if jsonCheck.MatchString(contentType) {
} else if JsonCheck.MatchString(contentType) {
err = json.NewEncoder(bodyBuf).Encode(body)
} else if xmlCheck.MatchString(contentType) {
xml.NewEncoder(bodyBuf).Encode(body)
} else if XmlCheck.MatchString(contentType) {
var bs []byte
bs, err = xml.Marshal(body)
if err == nil {
bodyBuf.Write(bs)
}
}
if err != nil {
@ -481,7 +625,7 @@ func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err e
}
if bodyBuf.Len() == 0 {
err = fmt.Errorf("Invalid body type %s\n", contentType)
err = fmt.Errorf("invalid body type %s\n", contentType)
return nil, err
}
return bodyBuf, nil
@ -543,8 +687,9 @@ func CacheExpires(r *http.Response) time.Time {
lifetime, err := time.ParseDuration(maxAge + "s")
if err != nil {
expires = now
}
} else {
expires = now.Add(lifetime)
}
} else {
expiresHeader := r.Header.Get("Expires")
if expiresHeader != "" {
@ -561,24 +706,44 @@ func strlen(s string) int {
return utf8.RuneCountInString(s)
}
// GenericSwaggerError Provides access to the body, error and model on returned errors.
type GenericSwaggerError struct {
// GenericOpenAPIError Provides access to the body, error and model on returned errors.
type GenericOpenAPIError struct {
body []byte
error string
model interface{}
}
// Error returns non-empty string if there was an error.
func (e GenericSwaggerError) Error() string {
func (e GenericOpenAPIError) Error() string {
return e.error
}
// Body returns the raw bytes of the response
func (e GenericSwaggerError) Body() []byte {
func (e GenericOpenAPIError) Body() []byte {
return e.body
}
// Model returns the unpacked model of the error
func (e GenericSwaggerError) Model() interface{} {
func (e GenericOpenAPIError) Model() interface{} {
return e.model
}
// format error message using title and detail when model implements rfc7807
func formatErrorMessage(status string, v interface{}) string {
str := ""
metaValue := reflect.ValueOf(v).Elem()
if metaValue.Kind() == reflect.Struct {
field := metaValue.FieldByName("Title")
if field != (reflect.Value{}) {
str = fmt.Sprintf("%s", field.Interface())
}
field = metaValue.FieldByName("Detail")
if field != (reflect.Value{}) {
str = fmt.Sprintf("%s (%s)", str, field.Interface())
}
}
return strings.TrimSpace(fmt.Sprintf("%s %s", status, str))
}

View File

@ -1,33 +1,20 @@
/*
Copyright (C) 2025 filifa
Stats API Documentation
This file is part of mlbstats.
Official API for Major League Baseball.
mlbstats 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.
mlbstats 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
mlbstats. If not, see <https://www.gnu.org/licenses/>.
API version: 2.0.0
*/
/*
* Stats API Documentation
*
* Official API for Major League Baseball.
*
* API version: 2.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"context"
"fmt"
"net/http"
"strings"
)
// contextKeys are used to identify the type of value in the context.
@ -41,17 +28,17 @@ func (c contextKey) String() string {
}
var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")
// ContextServerIndex uses a server configuration from the index.
ContextServerIndex = contextKey("serverIndex")
// ContextBasicAuth takes BasicAuth as authentication for the request.
ContextBasicAuth = contextKey("basic")
// ContextOperationServerIndices uses a server configuration from the index mapping.
ContextOperationServerIndices = contextKey("serverOperationIndices")
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAccessToken = contextKey("accesstoken")
// ContextServerVariables overrides a server configuration variables.
ContextServerVariables = contextKey("serverVariables")
// ContextAPIKey takes an APIKey as authentication for the request
ContextAPIKey = contextKey("apikey")
// ContextOperationServerVariables overrides a server configuration variables using operation specific values.
ContextOperationServerVariables = contextKey("serverOperationVariables")
)
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
@ -66,24 +53,163 @@ type APIKey struct {
Prefix string
}
// ServerVariable stores the information about a server variable
type ServerVariable struct {
Description string
DefaultValue string
EnumValues []string
}
// ServerConfiguration stores the information about a server
type ServerConfiguration struct {
URL string
Description string
Variables map[string]ServerVariable
}
// ServerConfigurations stores multiple ServerConfiguration items
type ServerConfigurations []ServerConfiguration
// Configuration stores the configuration of the API client
type Configuration struct {
BasePath string `json:"basePath,omitempty"`
Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
Debug bool `json:"debug,omitempty"`
Servers ServerConfigurations
OperationServers map[string]ServerConfigurations
HTTPClient *http.Client
}
// NewConfiguration returns a new Configuration object
func NewConfiguration() *Configuration {
cfg := &Configuration{
BasePath: "https://statsapi.mlb.com",
DefaultHeader: make(map[string]string),
UserAgent: "Swagger-Codegen/1.0.0/go",
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Servers: ServerConfigurations{
{
URL: "",
Description: "No description provided",
},
},
OperationServers: map[string]ServerConfigurations{
},
}
return cfg
}
// AddDefaultHeader adds a new HTTP header to the default header in the request
func (c *Configuration) AddDefaultHeader(key string, value string) {
c.DefaultHeader[key] = value
}
// URL formats template on a index using given variables
func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) {
if index < 0 || len(sc) <= index {
return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1)
}
server := sc[index]
url := server.URL
// go through variables and replace placeholders
for name, variable := range server.Variables {
if value, ok := variables[name]; ok {
found := bool(len(variable.EnumValues) == 0)
for _, enumValue := range variable.EnumValues {
if value == enumValue {
found = true
}
}
if !found {
return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues)
}
url = strings.Replace(url, "{"+name+"}", value, -1)
} else {
url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1)
}
}
return url, nil
}
// ServerURL returns URL based on server settings
func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) {
return c.Servers.URL(index, variables)
}
func getServerIndex(ctx context.Context) (int, error) {
si := ctx.Value(ContextServerIndex)
if si != nil {
if index, ok := si.(int); ok {
return index, nil
}
return 0, reportError("Invalid type %T should be int", si)
}
return 0, nil
}
func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) {
osi := ctx.Value(ContextOperationServerIndices)
if osi != nil {
if operationIndices, ok := osi.(map[string]int); !ok {
return 0, reportError("Invalid type %T should be map[string]int", osi)
} else {
index, ok := operationIndices[endpoint]
if ok {
return index, nil
}
}
}
return getServerIndex(ctx)
}
func getServerVariables(ctx context.Context) (map[string]string, error) {
sv := ctx.Value(ContextServerVariables)
if sv != nil {
if variables, ok := sv.(map[string]string); ok {
return variables, nil
}
return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv)
}
return nil, nil
}
func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) {
osv := ctx.Value(ContextOperationServerVariables)
if osv != nil {
if operationVariables, ok := osv.(map[string]map[string]string); !ok {
return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv)
} else {
variables, ok := operationVariables[endpoint]
if ok {
return variables, nil
}
}
}
return getServerVariables(ctx)
}
// ServerURLWithContext returns a new server URL given an endpoint
func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) {
sc, ok := c.OperationServers[endpoint]
if !ok {
sc = c.Servers
}
if ctx == nil {
return sc.URL(0, nil)
}
index, err := getServerOperationIndex(ctx, endpoint)
if err != nil {
return "", err
}
variables, err := getServerOperationVariables(ctx, endpoint)
if err != nil {
return "", err
}
return sc.URL(index, variables)
}

View File

@ -1,20 +0,0 @@
# About
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**AtBatIndex** | **int32** | | [optional] [default to null]
**HalfInning** | **string** | | [optional] [default to null]
**IsTopInning** | **bool** | | [optional] [default to null]
**Inning** | **int32** | | [optional] [default to null]
**StartTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
**EndTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
**IsComplete** | **bool** | | [optional] [default to null]
**IsScoringPlay** | **bool** | | [optional] [default to null]
**HasReview** | **bool** | | [optional] [default to null]
**HasOut** | **bool** | Does the play include an out? | [optional] [default to null]
**CaptivatingIndex** | **int32** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# AdditionalBio
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **int32** | | [optional] [default to null]
**HomeTown** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# AdditionalBioRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**HomeTown** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,8 +0,0 @@
# AggregateSortTypeEnum
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# AggregateSortTypeRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Code** | **string** | | [optional] [default to null]
**Description** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,8 +0,0 @@
# AllStarEnum
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

746
api/docs/AnalyticsAPI.md Normal file
View File

@ -0,0 +1,746 @@
# \AnalyticsAPI
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**ContextMetrics**](AnalyticsAPI.md#ContextMetrics) | **Get** /api/v1/game/{gamePk}/{guid}/contextMetrics | Get context metrics for a specific gamePk.
[**ContextMetricsWithAverages**](AnalyticsAPI.md#ContextMetricsWithAverages) | **Get** /api/v1/game/{gamePk}/{guid}/contextMetricsAverages | Get a json file containing raw coordinate data and refined calculated metrics.
[**ContextMetricsWithAveragesPost**](AnalyticsAPI.md#ContextMetricsWithAveragesPost) | **Post** /api/v1/game/{gamePk}/{guid}/contextMetricsAverages | Get a json file containing raw coordinate data and refined calculated metrics.
[**GameGuids**](AnalyticsAPI.md#GameGuids) | **Get** /api/v1/game/{gamePk}/guids | Get the GUIDs (plays) for a specific game.
[**GameGuidsFromPostgresRange**](AnalyticsAPI.md#GameGuidsFromPostgresRange) | **Get** /api/v1/analytics/guids | Get the GUIDs (plays) for a specific game.
[**GameGuidsFromPostgresRangeByGame**](AnalyticsAPI.md#GameGuidsFromPostgresRangeByGame) | **Get** /api/v1/analytics/game | Get all games by updated date.
[**GameLastPitch**](AnalyticsAPI.md#GameLastPitch) | **Get** /api/v1/game/lastPitch | Get the last pitch for a list of games
[**HomeRunBallparks**](AnalyticsAPI.md#HomeRunBallparks) | **Get** /api/v1/game/{gamePk}/{guid}/homeRunBallparks | Get if the play is a home run is each park for a specific play.
[**ParsedJsonFormattedAnalytics**](AnalyticsAPI.md#ParsedJsonFormattedAnalytics) | **Get** /api/v1/game/{gamePk}/{guid}/analytics | Get Statcast data for a specific play.
## ContextMetrics
> ContextMetrics(ctx, gamePk, guid).Fields(fields).Execute()
Get context metrics for a specific gamePk.
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
gamePk := TODO // interface{} | Unique Primary Key Representing a Game
guid := TODO // interface{} | Unique identifier for a play within a game
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.ContextMetrics(context.Background(), gamePk, guid).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.ContextMetrics``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | [**interface{}**](.md) | Unique Primary Key Representing a Game |
**guid** | [**interface{}**](.md) | Unique identifier for a play within a game |
### Other Parameters
Other parameters are passed through a pointer to a apiContextMetricsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## ContextMetricsWithAverages
> ContextMetricsWithAverages(ctx, gamePk, guid).Fields(fields).Execute()
Get a json file containing raw coordinate data and refined calculated metrics.
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
gamePk := TODO // interface{} | Unique Primary Key Representing a Game
guid := TODO // interface{} | Unique identifier for a play within a game
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.ContextMetricsWithAverages(context.Background(), gamePk, guid).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.ContextMetricsWithAverages``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | [**interface{}**](.md) | Unique Primary Key Representing a Game |
**guid** | [**interface{}**](.md) | Unique identifier for a play within a game |
### Other Parameters
Other parameters are passed through a pointer to a apiContextMetricsWithAveragesRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## ContextMetricsWithAveragesPost
> ContextMetricsWithAveragesPost(ctx, gamePk, guid).Fields(fields).Execute()
Get a json file containing raw coordinate data and refined calculated metrics.
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
gamePk := TODO // interface{} | Unique Primary Key Representing a Game
guid := TODO // interface{} | Unique identifier for a play within a game
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.ContextMetricsWithAveragesPost(context.Background(), gamePk, guid).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.ContextMetricsWithAveragesPost``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | [**interface{}**](.md) | Unique Primary Key Representing a Game |
**guid** | [**interface{}**](.md) | Unique identifier for a play within a game |
### Other Parameters
Other parameters are passed through a pointer to a apiContextMetricsWithAveragesPostRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## GameGuids
> GameGuids(ctx, gamePk).Fields(fields).GameModeId(gameModeId).IsPitch(isPitch).IsHit(isHit).IsPickoff(isPickoff).HasUpdates(hasUpdates).Since(since).UpdatedSince(updatedSince).LastPlayTime(lastPlayTime).LastUpdatedTime(lastUpdatedTime).LastMetricsUpdatedTime(lastMetricsUpdatedTime).LastAuditUpdatedTime(lastAuditUpdatedTime).LastVideoUpdatedTime(lastVideoUpdatedTime).Execute()
Get the GUIDs (plays) for a specific game.
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
gamePk := TODO // interface{} | Unique Primary Key Representing a Game
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
gameModeId := TODO // interface{} | Statcast game mode. Format: 0 = Batting Practive, 1 = Warmup 2 = Live (optional)
isPitch := TODO // interface{} | If there was a pitch (optional)
isHit := TODO // interface{} | If there was a hit ball tracked (optional)
isPickoff := TODO // interface{} | If there was a pickoff (optional)
hasUpdates := TODO // interface{} | True if updated by an auditor (optional)
since := TODO // interface{} | Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
updatedSince := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastPlayTime := TODO // interface{} | Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastMetricsUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastAuditUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastVideoUpdatedTime := TODO // interface{} | The last time SportyBot video was updated (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.GameGuids(context.Background(), gamePk).Fields(fields).GameModeId(gameModeId).IsPitch(isPitch).IsHit(isHit).IsPickoff(isPickoff).HasUpdates(hasUpdates).Since(since).UpdatedSince(updatedSince).LastPlayTime(lastPlayTime).LastUpdatedTime(lastUpdatedTime).LastMetricsUpdatedTime(lastMetricsUpdatedTime).LastAuditUpdatedTime(lastAuditUpdatedTime).LastVideoUpdatedTime(lastVideoUpdatedTime).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.GameGuids``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | [**interface{}**](.md) | Unique Primary Key Representing a Game |
### Other Parameters
Other parameters are passed through a pointer to a apiGameGuidsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
**gameModeId** | [**interface{}**](interface{}.md) | Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live |
**isPitch** | [**interface{}**](interface{}.md) | If there was a pitch |
**isHit** | [**interface{}**](interface{}.md) | If there was a hit ball tracked |
**isPickoff** | [**interface{}**](interface{}.md) | If there was a pickoff |
**hasUpdates** | [**interface{}**](interface{}.md) | True if updated by an auditor |
**since** | [**interface{}**](interface{}.md) | Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ |
**updatedSince** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastPlayTime** | [**interface{}**](interface{}.md) | Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastMetricsUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastAuditUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastVideoUpdatedTime** | [**interface{}**](interface{}.md) | The last time SportyBot video was updated |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## GameGuidsFromPostgresRange
> GameGuidsFromPostgresRange(ctx).Fields(fields).GameModeId(gameModeId).IsPitch(isPitch).IsHit(isHit).IsPickoff(isPickoff).IsNonStatcast(isNonStatcast).GamedayType(gamedayType).HasUpdates(hasUpdates).LastPlayTime(lastPlayTime).LastUpdatedTime(lastUpdatedTime).LastMetricsUpdatedTime(lastMetricsUpdatedTime).LastAuditUpdatedTime(lastAuditUpdatedTime).LastVideoUpdatedTime(lastVideoUpdatedTime).GameDate(gameDate).SportId(sportId).GameType(gameType).TrackingSystemOwner(trackingSystemOwner).Season(season).SortBy(sortBy).Limit(limit).Offset(offset).Execute()
Get the GUIDs (plays) for a specific game.
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
gameModeId := TODO // interface{} | Statcast game mode. Format: 0 = Batting Practive, 1 = Warmup 2 = Live (optional)
isPitch := TODO // interface{} | If there was a pitch (optional)
isHit := TODO // interface{} | If there was a hit ball tracked (optional)
isPickoff := TODO // interface{} | If there was a pickoff (optional)
isNonStatcast := TODO // interface{} | If non statcast games need to be included (optional)
gamedayType := TODO // interface{} | Indicates the level of Gameday (tracking, play-by-play, linescore, etc...) (optional)
hasUpdates := TODO // interface{} | True if updated by an auditor (optional)
lastPlayTime := TODO // interface{} | Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastMetricsUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastAuditUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastVideoUpdatedTime := TODO // interface{} | The last time SportyBot video was updated (optional)
gameDate := TODO // interface{} | Date of Game. Format: YYYY-MM-DD (optional)
sportId := TODO // interface{} | Top level organization of a sport (optional)
gameType := TODO // interface{} | Type of Game. Available types in /api/v1/gameTypes (optional)
trackingSystemOwner := TODO // interface{} | Owner of the tracking system (optional)
season := TODO // interface{} | Season of play (optional)
sortBy := TODO // interface{} | Sort the set of data by the specified field (optional)
limit := TODO // interface{} | Number of results to return (optional)
offset := TODO // interface{} | The pointer to start for a return set; used for pagination (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.GameGuidsFromPostgresRange(context.Background()).Fields(fields).GameModeId(gameModeId).IsPitch(isPitch).IsHit(isHit).IsPickoff(isPickoff).IsNonStatcast(isNonStatcast).GamedayType(gamedayType).HasUpdates(hasUpdates).LastPlayTime(lastPlayTime).LastUpdatedTime(lastUpdatedTime).LastMetricsUpdatedTime(lastMetricsUpdatedTime).LastAuditUpdatedTime(lastAuditUpdatedTime).LastVideoUpdatedTime(lastVideoUpdatedTime).GameDate(gameDate).SportId(sportId).GameType(gameType).TrackingSystemOwner(trackingSystemOwner).Season(season).SortBy(sortBy).Limit(limit).Offset(offset).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.GameGuidsFromPostgresRange``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiGameGuidsFromPostgresRangeRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
**gameModeId** | [**interface{}**](interface{}.md) | Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live |
**isPitch** | [**interface{}**](interface{}.md) | If there was a pitch |
**isHit** | [**interface{}**](interface{}.md) | If there was a hit ball tracked |
**isPickoff** | [**interface{}**](interface{}.md) | If there was a pickoff |
**isNonStatcast** | [**interface{}**](interface{}.md) | If non statcast games need to be included |
**gamedayType** | [**interface{}**](interface{}.md) | Indicates the level of Gameday (tracking, play-by-play, linescore, etc...) |
**hasUpdates** | [**interface{}**](interface{}.md) | True if updated by an auditor |
**lastPlayTime** | [**interface{}**](interface{}.md) | Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastMetricsUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastAuditUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastVideoUpdatedTime** | [**interface{}**](interface{}.md) | The last time SportyBot video was updated |
**gameDate** | [**interface{}**](interface{}.md) | Date of Game. Format: YYYY-MM-DD |
**sportId** | [**interface{}**](interface{}.md) | Top level organization of a sport |
**gameType** | [**interface{}**](interface{}.md) | Type of Game. Available types in /api/v1/gameTypes |
**trackingSystemOwner** | [**interface{}**](interface{}.md) | Owner of the tracking system |
**season** | [**interface{}**](interface{}.md) | Season of play |
**sortBy** | [**interface{}**](interface{}.md) | Sort the set of data by the specified field |
**limit** | [**interface{}**](interface{}.md) | Number of results to return |
**offset** | [**interface{}**](interface{}.md) | The pointer to start for a return set; used for pagination |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## GameGuidsFromPostgresRangeByGame
> GameGuidsFromPostgresRangeByGame(ctx).Fields(fields).GameModeId(gameModeId).IsPitch(isPitch).IsHit(isHit).IsPickoff(isPickoff).IsNonStatcast(isNonStatcast).GamedayType(gamedayType).HasUpdates(hasUpdates).LastPlayTime(lastPlayTime).LastVideoUpdatedTime(lastVideoUpdatedTime).LastUpdatedTime(lastUpdatedTime).LastMetricsUpdatedTime(lastMetricsUpdatedTime).LastAuditUpdatedTime(lastAuditUpdatedTime).GameDate(gameDate).SportId(sportId).GameType(gameType).Season(season).TrackingSystemOwner(trackingSystemOwner).SortBy(sortBy).Limit(limit).Offset(offset).ScheduleEventTypes(scheduleEventTypes).Execute()
Get all games by updated date.
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
gameModeId := TODO // interface{} | Statcast game mode. Format: 0 = Batting Practive, 1 = Warmup 2 = Live (optional)
isPitch := TODO // interface{} | If there was a pitch (optional)
isHit := TODO // interface{} | If there was a hit ball tracked (optional)
isPickoff := TODO // interface{} | If there was a pickoff (optional)
isNonStatcast := TODO // interface{} | If non statcast games need to be included (optional)
gamedayType := TODO // interface{} | Indicates the level of Gameday (tracking, play-by-play, linescore, etc...) (optional)
hasUpdates := TODO // interface{} | True if updated by an auditor (optional)
lastPlayTime := TODO // interface{} | Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastVideoUpdatedTime := TODO // interface{} | The last time SportyBot video was updated (optional)
lastUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastMetricsUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
lastAuditUpdatedTime := TODO // interface{} | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ (optional)
gameDate := TODO // interface{} | Date of Game. Format: YYYY-MM-DD (optional)
sportId := TODO // interface{} | Top level organization of a sport (optional)
gameType := TODO // interface{} | Type of Game. Available types in /api/v1/gameTypes (optional)
season := TODO // interface{} | Season of play (optional)
trackingSystemOwner := TODO // interface{} | Owner of the tracking system (optional)
sortBy := TODO // interface{} | Sort the set of data by the specified field (optional)
limit := TODO // interface{} | Number of results to return (optional)
offset := TODO // interface{} | The pointer to start for a return set; used for pagination (optional)
scheduleEventTypes := TODO // interface{} | Comma delimited list of type of event types (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.GameGuidsFromPostgresRangeByGame(context.Background()).Fields(fields).GameModeId(gameModeId).IsPitch(isPitch).IsHit(isHit).IsPickoff(isPickoff).IsNonStatcast(isNonStatcast).GamedayType(gamedayType).HasUpdates(hasUpdates).LastPlayTime(lastPlayTime).LastVideoUpdatedTime(lastVideoUpdatedTime).LastUpdatedTime(lastUpdatedTime).LastMetricsUpdatedTime(lastMetricsUpdatedTime).LastAuditUpdatedTime(lastAuditUpdatedTime).GameDate(gameDate).SportId(sportId).GameType(gameType).Season(season).TrackingSystemOwner(trackingSystemOwner).SortBy(sortBy).Limit(limit).Offset(offset).ScheduleEventTypes(scheduleEventTypes).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.GameGuidsFromPostgresRangeByGame``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiGameGuidsFromPostgresRangeByGameRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
**gameModeId** | [**interface{}**](interface{}.md) | Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live |
**isPitch** | [**interface{}**](interface{}.md) | If there was a pitch |
**isHit** | [**interface{}**](interface{}.md) | If there was a hit ball tracked |
**isPickoff** | [**interface{}**](interface{}.md) | If there was a pickoff |
**isNonStatcast** | [**interface{}**](interface{}.md) | If non statcast games need to be included |
**gamedayType** | [**interface{}**](interface{}.md) | Indicates the level of Gameday (tracking, play-by-play, linescore, etc...) |
**hasUpdates** | [**interface{}**](interface{}.md) | True if updated by an auditor |
**lastPlayTime** | [**interface{}**](interface{}.md) | Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastVideoUpdatedTime** | [**interface{}**](interface{}.md) | The last time SportyBot video was updated |
**lastUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastMetricsUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastAuditUpdatedTime** | [**interface{}**](interface{}.md) | Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**gameDate** | [**interface{}**](interface{}.md) | Date of Game. Format: YYYY-MM-DD |
**sportId** | [**interface{}**](interface{}.md) | Top level organization of a sport |
**gameType** | [**interface{}**](interface{}.md) | Type of Game. Available types in /api/v1/gameTypes |
**season** | [**interface{}**](interface{}.md) | Season of play |
**trackingSystemOwner** | [**interface{}**](interface{}.md) | Owner of the tracking system |
**sortBy** | [**interface{}**](interface{}.md) | Sort the set of data by the specified field |
**limit** | [**interface{}**](interface{}.md) | Number of results to return |
**offset** | [**interface{}**](interface{}.md) | The pointer to start for a return set; used for pagination |
**scheduleEventTypes** | [**interface{}**](interface{}.md) | Comma delimited list of type of event types |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## GameLastPitch
> GameLastPitch(ctx).GamePks(gamePks).Fields(fields).Execute()
Get the last pitch for a list of games
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
gamePks := TODO // interface{} | Unique Primary Key Representing a Game
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.GameLastPitch(context.Background()).GamePks(gamePks).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.GameLastPitch``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiGameLastPitchRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**gamePks** | [**interface{}**](interface{}.md) | Unique Primary Key Representing a Game |
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## HomeRunBallparks
> HomeRunBallparks(ctx, gamePk, guid).IsHomeRunParks(isHomeRunParks).Fields(fields).Execute()
Get if the play is a home run is each park for a specific play.
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
gamePk := TODO // interface{} | Unique Primary Key Representing a Game
guid := TODO // interface{} | Unique identifier for a play within a game
isHomeRunParks := TODO // interface{} |
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.HomeRunBallparks(context.Background(), gamePk, guid).IsHomeRunParks(isHomeRunParks).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.HomeRunBallparks``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | [**interface{}**](.md) | Unique Primary Key Representing a Game |
**guid** | [**interface{}**](.md) | Unique identifier for a play within a game |
### Other Parameters
Other parameters are passed through a pointer to a apiHomeRunBallparksRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**isHomeRunParks** | [**interface{}**](interface{}.md) | |
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## ParsedJsonFormattedAnalytics
> ParsedJsonFormattedAnalytics(ctx, gamePk, guid).Fields(fields).Execute()
Get Statcast data for a specific play.
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
gamePk := TODO // interface{} | Unique Primary Key Representing a Game
guid := TODO // interface{} | Unique identifier for a play within a game
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AnalyticsAPI.ParsedJsonFormattedAnalytics(context.Background(), gamePk, guid).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AnalyticsAPI.ParsedJsonFormattedAnalytics``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | [**interface{}**](.md) | Unique Primary Key Representing a Game |
**guid** | [**interface{}**](.md) | Unique identifier for a play within a game |
### Other Parameters
Other parameters are passed through a pointer to a apiParsedJsonFormattedAnalyticsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)

View File

@ -1,393 +0,0 @@
# {{classname}}
All URIs are relative to *https://statsapi.mlb.com*
Method | HTTP request | Description
------------- | ------------- | -------------
[**ContextMetrics**](AnalyticsApi.md#ContextMetrics) | **Get** /api/v1/game/{gamePk}/{guid}/contextMetrics | Get context metrics for a specific gamePk.
[**ContextMetricsWithAverages**](AnalyticsApi.md#ContextMetricsWithAverages) | **Get** /api/v1/game/{gamePk}/{guid}/contextMetricsAverages | Get a json file containing raw coordinate data and refined calculated metrics.
[**ContextMetricsWithAveragesPost**](AnalyticsApi.md#ContextMetricsWithAveragesPost) | **Post** /api/v1/game/{gamePk}/{guid}/contextMetricsAverages | Get a json file containing raw coordinate data and refined calculated metrics.
[**GameGuids**](AnalyticsApi.md#GameGuids) | **Get** /api/v1/game/{gamePk}/guids | Get the GUIDs (plays) for a specific game.
[**GameGuidsFromPostgresRange**](AnalyticsApi.md#GameGuidsFromPostgresRange) | **Get** /api/v1/analytics/guids | Get the GUIDs (plays) for a specific game.
[**GameGuidsFromPostgresRangeByGame**](AnalyticsApi.md#GameGuidsFromPostgresRangeByGame) | **Get** /api/v1/analytics/game | Get all games by updated date.
[**GameLastPitch**](AnalyticsApi.md#GameLastPitch) | **Get** /api/v1/game/lastPitch | Get the last pitch for a list of games
[**HomeRunBallparks**](AnalyticsApi.md#HomeRunBallparks) | **Get** /api/v1/game/{gamePk}/{guid}/homeRunBallparks | Get if the play is a home run is each park for a specific play.
[**ParsedJsonFormattedAnalytics**](AnalyticsApi.md#ParsedJsonFormattedAnalytics) | **Get** /api/v1/game/{gamePk}/{guid}/analytics | Get Statcast data for a specific play.
# **ContextMetrics**
> []CalculatedMetricRestObject ContextMetrics(ctx, gamePk, guid, optional)
Get context metrics for a specific gamePk.
Returns a json file containing raw coordinate data and refined calculated metrics.<br/><br/>This responses can be very large, so it is strongly recommended that you pass \"Accept-Encoding: gzip\" as a header to have the responses compressed.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | **int32**| Unique Primary Key Representing a Game |
**guid** | **string**| Unique identifier for a play within a game |
**optional** | ***AnalyticsApiContextMetricsOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiContextMetricsOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md)
### Authorization
[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **ContextMetricsWithAverages**
> []CalculatedMetricRestObject ContextMetricsWithAverages(ctx, gamePk, guid, optional)
Get a json file containing raw coordinate data and refined calculated metrics.
Returns a json file containing raw coordinate data and refined calculated metrics.<br/><br/>This responses can be very large, so it is strongly recommended that you pass \"Accept-Encoding: gzip\" as a header to have the responses compressed.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | **int32**| Unique Primary Key Representing a Game |
**guid** | **string**| Unique identifier for a play within a game |
**optional** | ***AnalyticsApiContextMetricsWithAveragesOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiContextMetricsWithAveragesOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md)
### Authorization
[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **ContextMetricsWithAveragesPost**
> []CalculatedMetricRestObject ContextMetricsWithAveragesPost(ctx, gamePk, guid, optional)
Get a json file containing raw coordinate data and refined calculated metrics.
Returns a json file containing raw coordinate data and refined calculated metrics.<br/><br/>This responses can be very large, so it is strongly recommended that you pass \"Accept-Encoding: gzip\" as a header to have the responses compressed.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | **int32**| Unique Primary Key Representing a Game |
**guid** | **string**| Unique identifier for a play within a game |
**optional** | ***AnalyticsApiContextMetricsWithAveragesPostOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiContextMetricsWithAveragesPostOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md)
### Authorization
[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **GameGuids**
> []AnalyticsPlayMetadataRestObject GameGuids(ctx, gamePk, optional)
Get the GUIDs (plays) for a specific game.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | **int32**| Unique Primary Key Representing a Game |
**optional** | ***AnalyticsApiGameGuidsOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiGameGuidsOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
**gameModeId** | **optional.Int32**| Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live |
**isPitch** | **optional.Bool**| If there was a pitch |
**isHit** | **optional.Bool**| If there was a hit ball tracked |
**isPickoff** | **optional.Bool**| If there was a pickoff |
**hasUpdates** | **optional.Bool**| True if updated by an auditor |
**since** | **optional.Time**| Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ |
**updatedSince** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastPlayTime** | **optional.Time**| Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastMetricsUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastAuditUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastVideoUpdatedTime** | **optional.Time**| The last time SportyBot video was updated |
### Return type
[**[]AnalyticsPlayMetadataRestObject**](AnalyticsPlayMetadataRestObject.md)
### Authorization
[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **GameGuidsFromPostgresRange**
> AnalyticsPlayMetadataWrapperRestObject GameGuidsFromPostgresRange(ctx, optional)
Get the GUIDs (plays) for a specific game.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***AnalyticsApiGameGuidsFromPostgresRangeOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiGameGuidsFromPostgresRangeOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
**gameModeId** | **optional.Int32**| Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live |
**isPitch** | **optional.Bool**| If there was a pitch |
**isHit** | **optional.Bool**| If there was a hit ball tracked |
**isPickoff** | **optional.Bool**| If there was a pickoff |
**isNonStatcast** | **optional.Bool**| If non statcast games need to be included |
**gamedayType** | **optional.String**| Indicates the level of Gameday (tracking, play-by-play, linescore, etc...) |
**hasUpdates** | **optional.Bool**| True if updated by an auditor |
**lastPlayTime** | **optional.Time**| Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastMetricsUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastAuditUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastVideoUpdatedTime** | **optional.Time**| The last time SportyBot video was updated |
**gameDate** | **optional.String**| Date of Game. Format: YYYY-MM-DD |
**sportId** | **optional.Int32**| Top level organization of a sport |
**gameType** | [**optional.Interface of GameTypeEnum**](.md)| Type of Game. Available types in /api/v1/gameTypes |
**trackingSystemOwner** | [**optional.Interface of TrackingSystemOwner**](.md)| Owner of the tracking system |
**season** | **optional.String**| Season of play |
**sortBy** | **optional.String**| Sort the set of data by the specified field |
**limit** | **optional.Int32**| Number of results to return |
**offset** | **optional.Int32**| The pointer to start for a return set; used for pagination |
### Return type
[**AnalyticsPlayMetadataWrapperRestObject**](AnalyticsPlayMetadataWrapperRestObject.md)
### Authorization
[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **GameGuidsFromPostgresRangeByGame**
> AnalyticsGameMetadataWrapperRestObject GameGuidsFromPostgresRangeByGame(ctx, optional)
Get all games by updated date.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***AnalyticsApiGameGuidsFromPostgresRangeByGameOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiGameGuidsFromPostgresRangeByGameOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
**gameModeId** | **optional.Int32**| Statcast game mode. Format: 0 &#x3D; Batting Practive, 1 &#x3D; Warmup 2 &#x3D; Live |
**isPitch** | **optional.Bool**| If there was a pitch |
**isHit** | **optional.Bool**| If there was a hit ball tracked |
**isPickoff** | **optional.Bool**| If there was a pickoff |
**isNonStatcast** | **optional.Bool**| If non statcast games need to be included |
**gamedayType** | **optional.String**| Indicates the level of Gameday (tracking, play-by-play, linescore, etc...) |
**hasUpdates** | **optional.Bool**| True if updated by an auditor |
**lastPlayTime** | **optional.Time**| Returns all data that was created after the specified timestamp. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastVideoUpdatedTime** | **optional.Time**| The last time SportyBot video was updated |
**lastUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastMetricsUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**lastAuditUpdatedTime** | **optional.Time**| Return data updated since a specified date. Format: YYYY-MM-DDTHH:MM:SSZ |
**gameDate** | **optional.String**| Date of Game. Format: YYYY-MM-DD |
**sportId** | **optional.Int32**| Top level organization of a sport |
**gameType** | [**optional.Interface of GameTypeEnum**](.md)| Type of Game. Available types in /api/v1/gameTypes |
**season** | **optional.String**| Season of play |
**trackingSystemOwner** | [**optional.Interface of TrackingSystemOwner**](.md)| Owner of the tracking system |
**sortBy** | **optional.String**| Sort the set of data by the specified field |
**limit** | **optional.Int32**| Number of results to return |
**offset** | **optional.Int32**| The pointer to start for a return set; used for pagination |
**scheduleEventTypes** | [**optional.Interface of []ScheduleEventTypes**](ScheduleEventTypes.md)| Comma delimited list of type of event types |
### Return type
[**AnalyticsGameMetadataWrapperRestObject**](AnalyticsGameMetadataWrapperRestObject.md)
### Authorization
[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **GameLastPitch**
> []AnalyticsPlayMetadataRestObject GameLastPitch(ctx, gamePks, optional)
Get the last pitch for a list of games
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePks** | [**[]int32**](int32.md)| Unique Primary Key Representing a Game |
**optional** | ***AnalyticsApiGameLastPitchOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiGameLastPitchOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**[]AnalyticsPlayMetadataRestObject**](AnalyticsPlayMetadataRestObject.md)
### Authorization
[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **HomeRunBallparks**
> VenuesRestObject HomeRunBallparks(ctx, gamePk, guid, isHomeRunParks, optional)
Get if the play is a home run is each park for a specific play.
Returns a json file containing raw coordinate data and refined calculated metrics.<br/><br/>This responses can be very large, so it is strongly recommended that you pass \"Accept-Encoding: gzip\" as a header to have the responses compressed.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | **int32**| Unique Primary Key Representing a Game |
**guid** | **string**| Unique identifier for a play within a game |
**isHomeRunParks** | **bool**| |
**optional** | ***AnalyticsApiHomeRunBallparksOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiHomeRunBallparksOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**VenuesRestObject**](VenuesRestObject.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **ParsedJsonFormattedAnalytics**
> AnalyticsRestObject ParsedJsonFormattedAnalytics(ctx, gamePk, guid, optional)
Get Statcast data for a specific play.
Returns a json file containing raw coordinate data and refined calculated metrics.<br/><br/>This responses can be very large, so it is strongly recommended that you pass \"Accept-Encoding: gzip\" as a header to have the responses compressed.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**gamePk** | **int32**| Unique Primary Key Representing a Game |
**guid** | **string**| Unique identifier for a play within a game |
**optional** | ***AnalyticsApiParsedJsonFormattedAnalyticsOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AnalyticsApiParsedJsonFormattedAnalyticsOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**AnalyticsRestObject**](AnalyticsRestObject.md)
### Authorization
[basicAuth](../README.md#basicAuth), [bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json;charset=UTF-8
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,15 +0,0 @@
# AnalyticsGameMetadataRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**GamePk** | **string** | | [optional] [default to null]
**UpdatedAt** | **string** | | [optional] [default to null]
**AuditUpdatedAt** | **string** | | [optional] [default to null]
**MetricsUpdatedAt** | **string** | | [optional] [default to null]
**VideoUpdatedAt** | **string** | | [optional] [default to null]
**Link** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# AnalyticsGameMetadataWrapperRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**TotalItems** | **int64** | | [optional] [default to null]
**Games** | [**[]AnalyticsGameMetadataRestObject**](AnalyticsGameMetadataRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,50 +0,0 @@
# AnalyticsPlayMetadataRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Hydrations** | **[]string** | | [optional] [default to null]
**GamePk** | **string** | | [optional] [default to null]
**GameDate** | **string** | | [optional] [default to null]
**TimeCode** | **string** | | [optional] [default to null]
**Guid** | **string** | | [optional] [default to null]
**AtBatNumber** | **int32** | | [optional] [default to null]
**PitchNumber** | **int32** | | [optional] [default to null]
**PickoffNumber** | **int32** | | [optional] [default to null]
**GameMode** | [***GameModeTo**](GameModeTO.md) | | [optional] [default to null]
**Inning** | **int32** | | [optional] [default to null]
**IsTopInning** | **bool** | | [optional] [default to null]
**IsPitch** | **bool** | | [optional] [default to null]
**IsPickoff** | **bool** | | [optional] [default to null]
**IsHit** | **bool** | | [optional] [default to null]
**IsManual** | **bool** | | [optional] [default to null]
**RawFile** | **string** | | [optional] [default to null]
**ParsedFile** | **string** | | [optional] [default to null]
**Time** | **string** | | [optional] [default to null]
**StartTime** | **string** | | [optional] [default to null]
**EndTime** | **string** | | [optional] [default to null]
**PitchTime** | **string** | | [optional] [default to null]
**CreatedAt** | **string** | | [optional] [default to null]
**UpdatedAt** | **string** | | [optional] [default to null]
**AuditUpdatedAt** | **string** | | [optional] [default to null]
**MetricsUpdatedAt** | **string** | | [optional] [default to null]
**HasUpdates** | **bool** | | [optional] [default to null]
**NumberOfMetricErrors** | **int32** | | [optional] [default to null]
**TimeCodeOffset** | **string** | | [optional] [default to null]
**IsScrubbed** | **bool** | | [optional] [default to null]
**VideoUpdatedAt** | **string** | | [optional] [default to null]
**StrikeZoneInfo** | [***JsonNode**](JsonNode.md) | | [optional] [default to null]
**PitchSegment** | [***PitchSegmentRestObject**](PitchSegmentRestObject.md) | | [optional] [default to null]
**HitSegment** | [***HitSegmentRestObject**](HitSegmentRestObject.md) | | [optional] [default to null]
**ContextMetrics** | [**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md) | | [optional] [default to null]
**ContextAverages** | [**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md) | | [optional] [default to null]
**CalculatedMetrics** | [**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md) | | [optional] [default to null]
**InvalidTracks** | [**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md) | | [optional] [default to null]
**Video** | [***IFeedRestObject**](IFeedRestObject.md) | | [optional] [default to null]
**MetaData** | [***StatSplitsRestObject**](StatSplitsRestObject.md) | | [optional] [default to null]
**PlayResult** | [***PlayResultRestObject**](PlayResultRestObject.md) | | [optional] [default to null]
**PlayByPlay** | [***BaseballPlayRestObject**](BaseballPlayRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# AnalyticsPlayMetadataWrapperRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**TotalItems** | **int64** | | [optional] [default to null]
**Plays** | [**[]AnalyticsPlayMetadataRestObject**](AnalyticsPlayMetadataRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,26 +0,0 @@
# AnalyticsRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Hydrations** | **[]string** | | [optional] [default to null]
**StrikeZoneInfo** | [***JsonNode**](JsonNode.md) | | [optional] [default to null]
**MetaData** | [***StatSplitsRestObject**](StatSplitsRestObject.md) | | [optional] [default to null]
**PlayResult** | [***PlayResultRestObject**](PlayResultRestObject.md) | | [optional] [default to null]
**TargetPositions** | [**[]PositionalMapRestObject**](PositionalMapRestObject.md) | | [optional] [default to null]
**BallSegments** | [***BallPositionalDataRestObject**](BallPositionalDataRestObject.md) | | [optional] [default to null]
**TrackedEvents** | [**[]PlayEventRestObject**](PlayEventRestObject.md) | | [optional] [default to null]
**CalculatedMetrics** | [***CalculatedMetricContainerRestObject**](CalculatedMetricContainerRestObject.md) | | [optional] [default to null]
**PositionMap** | [**map[string]BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Diagram** | **string** | | [optional] [default to null]
**ContextMetrics** | [**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md) | | [optional] [default to null]
**ContextAverages** | [**[]CalculatedMetricRestObject**](CalculatedMetricRestObject.md) | | [optional] [default to null]
**Video** | [***IFeedRestObject**](IFeedRestObject.md) | | [optional] [default to null]
**CalibrationData** | [***CalibrationContainerRestObject**](CalibrationContainerRestObject.md) | | [optional] [default to null]
**Bat** | [***BatTrackingRestObject**](BatTrackingRestObject.md) | | [optional] [default to null]
**Weather** | [***WeatherWrapperRestObject**](WeatherWrapperRestObject.md) | | [optional] [default to null]
**SoftwareVersions** | [***JsonNode**](JsonNode.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,17 +0,0 @@
# ApplicationRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**AndroidPackage** | **string** | | [optional] [default to null]
**Icon** | **string** | | [optional] [default to null]
**Intent** | **string** | | [optional] [default to null]
**Name** | **string** | | [optional] [default to null]
**AndroidUrl** | **string** | | [optional] [default to null]
**IosUrl** | **string** | | [optional] [default to null]
**IosPackage** | **string** | | [optional] [default to null]
**Primary** | **bool** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# Article
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Article** | [***JsonNode**](JsonNode.md) | | [optional] [default to null]
**PlayerId** | **string** | | [optional] [default to null]
**Date** | [**time.Time**](time.Time.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

87
api/docs/AttendanceAPI.md Normal file
View File

@ -0,0 +1,87 @@
# \AttendanceAPI
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**GetTeamAttendance**](AttendanceAPI.md#GetTeamAttendance) | **Get** /api/v1/attendance | Get team attendance
## GetTeamAttendance
> GetTeamAttendance(ctx).TeamId(teamId).LeagueId(leagueId).Season(season).LeagueListId(leagueListId).GameType(gameType).Date(date).StartDate(startDate).EndDate(endDate).Fields(fields).Execute()
Get team attendance
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
teamId := TODO // interface{} | Unique Team Identifier. Format: 141, 147, etc (optional)
leagueId := TODO // interface{} | Comma delimited list of Unique league identifiers (optional)
season := TODO // interface{} | Comma delimited list of Seasons of play (optional)
leagueListId := TODO // interface{} | Unique League List Identifier (optional)
gameType := TODO // interface{} | Type of Game. Available types in /api/v1/gameTypes (optional)
date := TODO // interface{} | Date of Game. Format: YYYY-MM-DD (optional)
startDate := TODO // interface{} | Start date for range of data (must be used with end date). Format: MM/DD/YYYY (optional)
endDate := TODO // interface{} | End date for range of data (must be used with start date). Format: MM/DD/YYYY (optional)
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AttendanceAPI.GetTeamAttendance(context.Background()).TeamId(teamId).LeagueId(leagueId).Season(season).LeagueListId(leagueListId).GameType(gameType).Date(date).StartDate(startDate).EndDate(endDate).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AttendanceAPI.GetTeamAttendance``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
### Other Parameters
Other parameters are passed through a pointer to a apiGetTeamAttendanceRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**teamId** | [**interface{}**](interface{}.md) | Unique Team Identifier. Format: 141, 147, etc |
**leagueId** | [**interface{}**](interface{}.md) | Comma delimited list of Unique league identifiers |
**season** | [**interface{}**](interface{}.md) | Comma delimited list of Seasons of play |
**leagueListId** | [**interface{}**](interface{}.md) | Unique League List Identifier |
**gameType** | [**interface{}**](interface{}.md) | Type of Game. Available types in /api/v1/gameTypes |
**date** | [**interface{}**](interface{}.md) | Date of Game. Format: YYYY-MM-DD |
**startDate** | [**interface{}**](interface{}.md) | Start date for range of data (must be used with end date). Format: MM/DD/YYYY |
**endDate** | [**interface{}**](interface{}.md) | End date for range of data (must be used with start date). Format: MM/DD/YYYY |
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)

View File

@ -1,48 +0,0 @@
# {{classname}}
All URIs are relative to *https://statsapi.mlb.com*
Method | HTTP request | Description
------------- | ------------- | -------------
[**GetTeamAttendance**](AttendanceApi.md#GetTeamAttendance) | **Get** /api/v1/attendance | Get team attendance
# **GetTeamAttendance**
> AttendanceRestObject GetTeamAttendance(ctx, optional)
Get team attendance
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**optional** | ***AttendanceApiGetTeamAttendanceOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AttendanceApiGetTeamAttendanceOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**teamId** | [**optional.Interface of []int32**](int32.md)| Unique Team Identifier. Format: 141, 147, etc |
**leagueId** | [**optional.Interface of []int32**](int32.md)| Comma delimited list of Unique league identifiers |
**season** | [**optional.Interface of []string**](string.md)| Comma delimited list of Seasons of play |
**leagueListId** | [**optional.Interface of LeagueListsEnum**](.md)| Unique League List Identifier |
**gameType** | [**optional.Interface of []GameTypeEnum**](GameTypeEnum.md)| Type of Game. Available types in /api/v1/gameTypes |
**date** | **optional.String**| Date of Game. Format: YYYY-MM-DD |
**startDate** | **optional.String**| Start date for range of data (must be used with end date). Format: MM/DD/YYYY |
**endDate** | **optional.String**| End date for range of data (must be used with start date). Format: MM/DD/YYYY |
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**AttendanceRestObject**](AttendanceRestObject.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,38 +0,0 @@
# AttendanceRecordRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**OpeningsTotal7day** | **int32** | | [optional] [default to null]
**OpeningsTotal** | **int32** | | [optional] [default to null]
**OpeningsTotalAway** | **int32** | | [optional] [default to null]
**OpeningsTotalHome** | **int32** | | [optional] [default to null]
**OpeningsTotalLost** | **int32** | | [optional] [default to null]
**OpeningsTotalYtd** | **int32** | | [optional] [default to null]
**GamesTotal** | **int32** | | [optional] [default to null]
**GamesAwayTotal** | **int32** | | [optional] [default to null]
**GamesHomeTotal** | **int32** | | [optional] [default to null]
**Year** | **string** | | [optional] [default to null]
**AttendanceAverageAway** | **int32** | | [optional] [default to null]
**AttendanceAverageHome** | **int32** | | [optional] [default to null]
**AttendanceAverageYtd** | **int32** | | [optional] [default to null]
**AttendanceHigh** | **int32** | | [optional] [default to null]
**AttendanceHighDate** | **string** | | [optional] [default to null]
**AttendanceHighGame** | [***BaseballScheduleItemRestObject**](BaseballScheduleItemRestObject.md) | | [optional] [default to null]
**AttendanceLow** | **int32** | | [optional] [default to null]
**AttendanceLowDate** | **string** | | [optional] [default to null]
**AttendanceLowGame** | [***BaseballScheduleItemRestObject**](BaseballScheduleItemRestObject.md) | | [optional] [default to null]
**AttendanceOpening7dayAvg** | **int32** | | [optional] [default to null]
**AttendanceOpeningAverage** | **int32** | | [optional] [default to null]
**AttendanceTotal7day** | **int32** | | [optional] [default to null]
**AttendanceTotal** | **int32** | | [optional] [default to null]
**AttendanceTotalAway** | **int32** | | [optional] [default to null]
**AttendanceTotalHome** | **int32** | | [optional] [default to null]
**AttendanceTotalYesterday** | **int32** | | [optional] [default to null]
**AttendanceTotalYtd** | **int32** | | [optional] [default to null]
**GameType** | [***GameTypeEnum**](GameTypeEnum.md) | | [optional] [default to null]
**Team** | [***BaseballTeamRestObject**](BaseballTeamRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# AttendanceRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Records** | [**[]AttendanceRecordRestObject**](AttendanceRecordRestObject.md) | | [optional] [default to null]
**AggregateTotals** | [***AttendanceRecordRestObject**](AttendanceRecordRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,31 +0,0 @@
# Award
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**RequestingUserRole** | [***Role**](Role.md) | | [optional] [default to null]
**Results** | [**[]AwardResult**](AwardResult.md) | | [optional] [default to null]
**Winners** | [**[]AwardWinner**](AwardWinner.md) | | [optional] [default to null]
**Id** | **string** | | [optional] [default to null]
**Name** | **string** | | [optional] [default to null]
**ShortName** | **string** | | [optional] [default to null]
**Description** | **string** | | [optional] [default to null]
**RecipientType** | **string** | | [optional] [default to null]
**History** | **string** | | [optional] [default to null]
**Team** | [***BaseballTeam**](BaseballTeam.md) | | [optional] [default to null]
**ImageUrl** | **string** | | [optional] [default to null]
**HomePageUrl** | **string** | | [optional] [default to null]
**Date** | **string** | | [optional] [default to null]
**Season** | **string** | | [optional] [default to null]
**SortOrder** | **int32** | | [optional] [default to null]
**Player** | [***BaseballPerson**](BaseballPerson.md) | | [optional] [default to null]
**Votes** | **int32** | | [optional] [default to null]
**VotesAvailable** | **int32** | | [optional] [default to null]
**Sport** | [***Sport**](Sport.md) | | [optional] [default to null]
**League** | [***League**](League.md) | | [optional] [default to null]
**Notes** | **string** | | [optional] [default to null]
**OrganizationId** | **int32** | | [optional] [default to null]
**UserPrivileges** | [**[]Privilege**](Privilege.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,29 +0,0 @@
# AwardRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Hydrations** | **[]string** | | [optional] [default to null]
**Id** | **string** | | [optional] [default to null]
**Name** | **string** | | [optional] [default to null]
**ShortName** | **string** | | [optional] [default to null]
**Description** | **string** | | [optional] [default to null]
**RecipientType** | **string** | | [optional] [default to null]
**History** | **string** | | [optional] [default to null]
**ImageUrl** | **string** | | [optional] [default to null]
**HomePageUrl** | **string** | | [optional] [default to null]
**Date** | **string** | | [optional] [default to null]
**Season** | **string** | | [optional] [default to null]
**Results** | [**[]AwardResultRestObject**](AwardResultRestObject.md) | | [optional] [default to null]
**Team** | [***BaseballTeamRestObject**](BaseballTeamRestObject.md) | | [optional] [default to null]
**SortOrder** | **int32** | | [optional] [default to null]
**Player** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Votes** | **int32** | | [optional] [default to null]
**VotesAvailable** | **int32** | | [optional] [default to null]
**Sport** | [***SportRestObject**](SportRestObject.md) | | [optional] [default to null]
**League** | [***LeagueRestObject**](LeagueRestObject.md) | | [optional] [default to null]
**Notes** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,12 +0,0 @@
# AwardResult
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**RequestingUserRole** | [***Role**](Role.md) | | [optional] [default to null]
**SeasonId** | **int32** | | [optional] [default to null]
**Winners** | [**[]AwardWinner**](AwardWinner.md) | | [optional] [default to null]
**UserPrivileges** | [**[]Privilege**](Privilege.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,12 +0,0 @@
# AwardResultRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Hydrations** | **[]string** | | [optional] [default to null]
**SeasonId** | **int32** | | [optional] [default to null]
**Winners** | [**[]AwardWinnerRestObject**](AwardWinnerRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,21 +0,0 @@
# AwardWinner
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**AwardId** | **int32** | | [optional] [default to null]
**TeamId** | **int32** | | [optional] [default to null]
**CoachId** | **int32** | | [optional] [default to null]
**PlayerId** | **int32** | | [optional] [default to null]
**Rank** | **string** | | [optional] [default to null]
**Person** | [***BaseballPerson**](BaseballPerson.md) | | [optional] [default to null]
**Player** | [***BaseballPerson**](BaseballPerson.md) | | [optional] [default to null]
**Coach** | [***BaseballPerson**](BaseballPerson.md) | | [optional] [default to null]
**Team** | [***BaseballTeam**](BaseballTeam.md) | | [optional] [default to null]
**AwardDate** | **string** | | [optional] [default to null]
**Season** | **string** | | [optional] [default to null]
**Empty** | **bool** | | [optional] [default to null]
**NotEmpty** | **bool** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,13 +0,0 @@
# AwardWinnerRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Rank** | **string** | | [optional] [default to null]
**Team** | [***BaseballTeamRestObject**](BaseballTeamRestObject.md) | | [optional] [default to null]
**Player** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Coach** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Copyright** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

225
api/docs/AwardsAPI.md Normal file
View File

@ -0,0 +1,225 @@
# \AwardsAPI
All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AwardRecipients**](AwardsAPI.md#AwardRecipients) | **Get** /api/v1/awards/{awardId}/recipients | View recipients of an award
[**Awards**](AwardsAPI.md#Awards) | **Get** /api/v1/awards | View awards info
[**Awards1**](AwardsAPI.md#Awards1) | **Get** /api/v1/awards/{awardId} | View awards info
## AwardRecipients
> AwardRecipients(ctx, awardId).Season(season).SportId(sportId).LeagueId(leagueId).Fields(fields).Execute()
View recipients of an award
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
awardId := TODO // interface{} | Unique Award Identifier. Available awards in /api/v1/awards
season := TODO // interface{} | Season of play (optional)
sportId := TODO // interface{} | Top level organization of a sport (optional)
leagueId := TODO // interface{} | Comma delimited list of Unique league identifiers (optional)
fields := TODO // interface{} | (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AwardsAPI.AwardRecipients(context.Background(), awardId).Season(season).SportId(sportId).LeagueId(leagueId).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AwardsAPI.AwardRecipients``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**awardId** | [**interface{}**](.md) | Unique Award Identifier. Available awards in /api/v1/awards |
### Other Parameters
Other parameters are passed through a pointer to a apiAwardRecipientsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**season** | [**interface{}**](interface{}.md) | Season of play |
**sportId** | [**interface{}**](interface{}.md) | Top level organization of a sport |
**leagueId** | [**interface{}**](interface{}.md) | Comma delimited list of Unique league identifiers |
**fields** | [**interface{}**](interface{}.md) | |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## Awards
> Awards(ctx, awardId).OrgId(orgId).Fields(fields).Execute()
View awards info
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
awardId := TODO // interface{} | Unique Award Identifier. Available awards in /api/v1/awards
orgId := TODO // interface{} | Comma delimited list of top level organizations of a sport (optional)
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AwardsAPI.Awards(context.Background(), awardId).OrgId(orgId).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AwardsAPI.Awards``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**awardId** | [**interface{}**](.md) | Unique Award Identifier. Available awards in /api/v1/awards |
### Other Parameters
Other parameters are passed through a pointer to a apiAwardsRequest struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orgId** | [**interface{}**](interface{}.md) | Comma delimited list of top level organizations of a sport |
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)
## Awards1
> Awards1(ctx, awardId).OrgId(orgId).Fields(fields).Execute()
View awards info
### Example
```go
package main
import (
"context"
"fmt"
"os"
openapiclient "//"
)
func main() {
awardId := TODO // interface{} | Unique Award Identifier. Available awards in /api/v1/awards
orgId := TODO // interface{} | Comma delimited list of top level organizations of a sport (optional)
fields := TODO // interface{} | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute (optional)
configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
r, err := apiClient.AwardsAPI.Awards1(context.Background(), awardId).OrgId(orgId).Fields(fields).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `AwardsAPI.Awards1``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
```
### Path Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**awardId** | [**interface{}**](.md) | Unique Award Identifier. Available awards in /api/v1/awards |
### Other Parameters
Other parameters are passed through a pointer to a apiAwards1Request struct via the builder pattern
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orgId** | [**interface{}**](interface{}.md) | Comma delimited list of top level organizations of a sport |
**fields** | [**interface{}**](interface{}.md) | Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
(empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: Not defined
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints)
[[Back to Model list]](../README.md#documentation-for-models)
[[Back to README]](../README.md)

View File

@ -1,117 +0,0 @@
# {{classname}}
All URIs are relative to *https://statsapi.mlb.com*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AwardRecipients**](AwardsApi.md#AwardRecipients) | **Get** /api/v1/awards/{awardId}/recipients | View recipients of an award
[**Awards**](AwardsApi.md#Awards) | **Get** /api/v1/awards | View awards info
[**Awards1**](AwardsApi.md#Awards1) | **Get** /api/v1/awards/{awardId} | View awards info
# **AwardRecipients**
> AwardsRestObject AwardRecipients(ctx, awardId, optional)
View recipients of an award
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**awardId** | **string**| Unique Award Identifier. Available awards in /api/v1/awards |
**optional** | ***AwardsApiAwardRecipientsOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AwardsApiAwardRecipientsOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**season** | **optional.String**| Season of play |
**sportId** | **optional.Int32**| Top level organization of a sport |
**leagueId** | [**optional.Interface of []int32**](int32.md)| Comma delimited list of Unique league identifiers |
**fields** | [**optional.Interface of []string**](string.md)| |
### Return type
[**AwardsRestObject**](AwardsRestObject.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **Awards**
> AwardsRestObject Awards(ctx, awardId, optional)
View awards info
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**awardId** | **string**| Unique Award Identifier. Available awards in /api/v1/awards |
**optional** | ***AwardsApiAwardsOpts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AwardsApiAwardsOpts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orgId** | [**optional.Interface of []int32**](int32.md)| Comma delimited list of top level organizations of a sport |
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**AwardsRestObject**](AwardsRestObject.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **Awards1**
> AwardsRestObject Awards1(ctx, awardId, optional)
View awards info
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**awardId** | **string**| Unique Award Identifier. Available awards in /api/v1/awards |
**optional** | ***AwardsApiAwards1Opts** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a pointer to a AwardsApiAwards1Opts struct
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orgId** | [**optional.Interface of []int32**](int32.md)| Comma delimited list of top level organizations of a sport |
**fields** | [**optional.Interface of []string**](string.md)| Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute |
### Return type
[**AwardsRestObject**](AwardsRestObject.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: */*
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# AwardsRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Awards** | [**[]AwardRestObject**](AwardRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,16 +0,0 @@
# BallPositionDataRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Velocity** | [***CoordinatesRestObject**](CoordinatesRestObject.md) | | [optional] [default to null]
**Position** | [***CoordinatesRestObject**](CoordinatesRestObject.md) | | [optional] [default to null]
**Time** | **float64** | | [optional] [default to null]
**Confidence** | **string** | | [optional] [default to null]
**TimeCode** | **int64** | | [optional] [default to null]
**TimeCodeOffset** | **float64** | | [optional] [default to null]
**Type_** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,13 +0,0 @@
# BallPositionalDataRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**GenericSegments** | [**[]SegmentRestObject**](SegmentRestObject.md) | | [optional] [default to null]
**PitchSegment** | [***PitchSegmentRestObject**](PitchSegmentRestObject.md) | | [optional] [default to null]
**HitSegment** | [***HitSegmentRestObject**](HitSegmentRestObject.md) | | [optional] [default to null]
**Positions** | [**[]BallPositionDataRestObject**](BallPositionDataRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,20 +0,0 @@
# BaseballAbsChallenge
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**HasChallenges** | **bool** | | [optional] [default to null]
**AwayChallengesUsed** | **int32** | | [optional] [default to null]
**AwayChallengesRemaining** | **int32** | | [optional] [default to null]
**HomeChallengesUsed** | **int32** | | [optional] [default to null]
**HomeChallengesRemaining** | **int32** | | [optional] [default to null]
**ChallengingTeam** | [***BaseballTeam**](BaseballTeam.md) | | [optional] [default to null]
**ReviewReason** | **string** | | [optional] [default to null]
**Limit9thInning** | **int32** | | [optional] [default to null]
**AwayChallengesUsedOverturned** | **int32** | | [optional] [default to null]
**AwayChallengesUsedStands** | **int32** | | [optional] [default to null]
**HomeChallengesUsedOverturned** | **int32** | | [optional] [default to null]
**HomeChallengesUsedStands** | **int32** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# BaseballAbsChallengeRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**HasChallenges** | **bool** | | [optional] [default to null]
**Reason** | **string** | | [optional] [default to null]
**Away** | [***BaseballTeamReview**](BaseballTeamReview.md) | | [optional] [default to null]
**Home** | [***BaseballTeamReview**](BaseballTeamReview.md) | | [optional] [default to null]
**ChallengingTeam** | [***BaseballTeamRestObject**](BaseballTeamRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# BaseballBoxscoreNoteRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Label** | **string** | | [optional] [default to null]
**Value** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# BaseballBoxscoreNoteWrapRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Title** | **string** | | [optional] [default to null]
**FieldList** | [**[]BaseballBoxscoreNoteRestObject**](BaseballBoxscoreNoteRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# BaseballBoxscoreRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Teams** | [**map[string]BaseballTeamBoxscore**](BaseballTeamBoxscore.md) | | [optional] [default to null]
**Officials** | [**[]OfficialRestObject**](OfficialRestObject.md) | | [optional] [default to null]
**Info** | [**[]BaseballBoxscoreNoteRestObject**](BaseballBoxscoreNoteRestObject.md) | | [optional] [default to null]
**PitchingNotes** | **[]string** | | [optional] [default to null]
**TopPerformers** | [**[]BaseballPlayerGameScoreRestObject**](BaseballPlayerGameScoreRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,16 +0,0 @@
# BaseballChallenge
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**HasChallenges** | **bool** | | [optional] [default to null]
**AwayChallengesUsed** | **int32** | | [optional] [default to null]
**AwayChallengesRemaining** | **int32** | | [optional] [default to null]
**HomeChallengesUsed** | **int32** | | [optional] [default to null]
**HomeChallengesRemaining** | **int32** | | [optional] [default to null]
**ChallengingTeam** | [***BaseballTeam**](BaseballTeam.md) | | [optional] [default to null]
**ReviewReason** | **string** | | [optional] [default to null]
**Limit9thInning** | **int32** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,16 +0,0 @@
# BaseballDecision
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**RequestingUserRole** | [***Role**](Role.md) | | [optional] [default to null]
**Winner** | [***BaseballPerson**](BaseballPerson.md) | | [optional] [default to null]
**Loser** | [***BaseballPerson**](BaseballPerson.md) | | [optional] [default to null]
**Save** | [***BaseballPerson**](BaseballPerson.md) | | [optional] [default to null]
**Empty** | **bool** | | [optional] [default to null]
**NotEmpty** | **bool** | | [optional] [default to null]
**HydratedPeople** | [**map[string]interface{}**](interface{}.md) | | [optional] [default to null]
**UserPrivileges** | [**[]Privilege**](Privilege.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,13 +0,0 @@
# BaseballDecisionRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Hydrations** | **[]string** | | [optional] [default to null]
**Winner** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Loser** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Save** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,23 +0,0 @@
# BaseballDefenseRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Pitcher** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Catcher** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**First** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Second** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Third** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Shortstop** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Left** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Center** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Right** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Batter** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**OnDeck** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**InHole** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**BattingOrder** | **int32** | | [optional] [default to null]
**Team** | [***BaseballTeamRestObject**](BaseballTeamRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,12 +0,0 @@
# BaseballDraftLatestRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Pick** | [***BaseballDraftProspectRestObject**](BaseballDraftProspectRestObject.md) | | [optional] [default to null]
**Number** | **int32** | | [optional] [default to null]
**NextUp** | [**[]BaseballDraftProspectRestObject**](BaseballDraftProspectRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,10 +0,0 @@
# BaseballDraftListRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Drafts** | [***BaseballDraftRestObject**](BaseballDraftRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,38 +0,0 @@
# BaseballDraftProspect
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**RequestingUserRole** | [***Role**](Role.md) | | [optional] [default to null]
**BisPlayerId** | **int32** | | [optional] [default to null]
**BisSchoolId** | **int32** | | [optional] [default to null]
**DraftPlayerId** | **int32** | | [optional] [default to null]
**PickRound** | **string** | | [optional] [default to null]
**PickRoundLabel** | **string** | | [optional] [default to null]
**PickNumber** | **int32** | | [optional] [default to null]
**DisplayPickNumber** | **int32** | | [optional] [default to null]
**RoundPickNumber** | **int32** | | [optional] [default to null]
**EnglishBlurb** | **string** | | [optional] [default to null]
**SpanishBlurb** | **string** | | [optional] [default to null]
**Rank** | **int32** | | [optional] [default to null]
**PickedTeamCode** | **string** | | [optional] [default to null]
**Home** | [***Location**](Location.md) | | [optional] [default to null]
**ScoutingReport** | **string** | | [optional] [default to null]
**PhotoFlag** | **bool** | | [optional] [default to null]
**School** | [***School**](School.md) | | [optional] [default to null]
**Comments** | **string** | | [optional] [default to null]
**HeadshotLink** | **string** | | [optional] [default to null]
**PickValue** | **string** | | [optional] [default to null]
**SigningBonus** | **string** | | [optional] [default to null]
**Person** | [***BaseballPerson**](BaseballPerson.md) | | [optional] [default to null]
**Team** | [***BaseballTeam**](BaseballTeam.md) | | [optional] [default to null]
**DraftType** | [***DraftTypeEnum**](DraftTypeEnum.md) | | [optional] [default to null]
**DraftStatus** | [***DraftStatusEnum**](DraftStatusEnum.md) | | [optional] [default to null]
**WasPassed** | **bool** | | [optional] [default to null]
**WasLastPick** | **bool** | | [optional] [default to null]
**WasSelected** | **bool** | | [optional] [default to null]
**Year** | **string** | | [optional] [default to null]
**UserPrivileges** | [**[]Privilege**](Privilege.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,29 +0,0 @@
# BaseballDraftProspectRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**BisPlayerId** | **int32** | | [optional] [default to null]
**BisSchoolId** | **int32** | | [optional] [default to null]
**PickRound** | **string** | | [optional] [default to null]
**PickNumber** | **int32** | | [optional] [default to null]
**DisplayPickNumber** | **int32** | | [optional] [default to null]
**RoundPickNumber** | **int32** | | [optional] [default to null]
**Rank** | **int32** | | [optional] [default to null]
**PickValue** | **string** | | [optional] [default to null]
**SigningBonus** | **string** | | [optional] [default to null]
**Home** | [***LocationRestObject**](LocationRestObject.md) | | [optional] [default to null]
**ScoutingReport** | **string** | | [optional] [default to null]
**School** | [***SchoolRestObject**](SchoolRestObject.md) | | [optional] [default to null]
**Blurb** | **string** | | [optional] [default to null]
**HeadshotLink** | **string** | | [optional] [default to null]
**Person** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Team** | [***BaseballTeamRestObject**](BaseballTeamRestObject.md) | | [optional] [default to null]
**DraftType** | [***DraftTypeEnumRestObject**](DraftTypeEnumRestObject.md) | | [optional] [default to null]
**IsDrafted** | **bool** | | [optional] [default to null]
**IsPass** | **bool** | | [optional] [default to null]
**Year** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# BaseballDraftRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**DraftYear** | **int32** | | [optional] [default to null]
**Rounds** | [**[]BaseballDraftRoundRestObject**](BaseballDraftRoundRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# BaseballDraftRoundRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Round** | **string** | | [optional] [default to null]
**Picks** | [**[]BaseballDraftProspectRestObject**](BaseballDraftProspectRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# BaseballGameAlert
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Type_** | **string** | | [optional] [default to null]
**Category** | **string** | | [optional] [default to null]
**Description** | **string** | | [optional] [default to null]
**ShortDescription** | **string** | | [optional] [default to null]
**Team** | [***BaseballTeam**](BaseballTeam.md) | | [optional] [default to null]
**AlertId** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,15 +0,0 @@
# BaseballGameAlertRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Type_** | **string** | | [optional] [default to null]
**Category** | **string** | | [optional] [default to null]
**Description** | **string** | | [optional] [default to null]
**ShortDescription** | **string** | | [optional] [default to null]
**Team** | [***BaseballTeamRestObject**](BaseballTeamRestObject.md) | | [optional] [default to null]
**AlertId** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,17 +0,0 @@
# BaseballGameContextRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Game** | [***BaseballScheduleItemRestObject**](BaseballScheduleItemRestObject.md) | | [optional] [default to null]
**ExpectedStatisticsData** | [***StatDataRestObject**](StatDataRestObject.md) | | [optional] [default to null]
**RunnerOnThird** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**LeftFieldSacFlyProbability** | [***SacFlyProbability**](SacFlyProbability.md) | | [optional] [default to null]
**CenterFieldSacFlyProbability** | [***SacFlyProbability**](SacFlyProbability.md) | | [optional] [default to null]
**RightFieldSacFlyProbability** | [***SacFlyProbability**](SacFlyProbability.md) | | [optional] [default to null]
**AwayWinProbability** | **float64** | | [optional] [default to null]
**HomeWinProbability** | **float64** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,19 +0,0 @@
# BaseballGameDataGameRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Pk** | **int32** | | [optional] [default to null]
**Type_** | **string** | | [optional] [default to null]
**DoubleHeader** | **string** | | [optional] [default to null]
**Id** | **string** | | [optional] [default to null]
**GamedayType** | **string** | | [optional] [default to null]
**Tiebreaker** | **string** | | [optional] [default to null]
**GameNumber** | **int32** | | [optional] [default to null]
**CalendarEventID** | **string** | | [optional] [default to null]
**Season** | **string** | | [optional] [default to null]
**SeasonDisplay** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,28 +0,0 @@
# BaseballGameDataRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Game** | [***BaseballGameDataGameRestObject**](BaseballGameDataGameRestObject.md) | | [optional] [default to null]
**Datetime** | [***BaseballGameDateTimeRestObject**](BaseballGameDateTimeRestObject.md) | | [optional] [default to null]
**Status** | [***GameStatusRestObject**](GameStatusRestObject.md) | | [optional] [default to null]
**Teams** | [**map[string]BaseballTeamRestObject**](BaseballTeamRestObject.md) | | [optional] [default to null]
**Players** | [**map[string]BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Venue** | [***VenueRestObject**](VenueRestObject.md) | | [optional] [default to null]
**OfficialVenue** | [***VenueRestObject**](VenueRestObject.md) | | [optional] [default to null]
**Weather** | [***WeatherRestObject**](WeatherRestObject.md) | | [optional] [default to null]
**GameInfo** | [***GameInfoRestObject**](GameInfoRestObject.md) | | [optional] [default to null]
**Review** | [***BaseballReviewRestObject**](BaseballReviewRestObject.md) | | [optional] [default to null]
**AbsChallenges** | [***BaseballAbsChallengeRestObject**](BaseballABSChallengeRestObject.md) | | [optional] [default to null]
**Flags** | [***BaseballGameFlagRestObject**](BaseballGameFlagRestObject.md) | | [optional] [default to null]
**Alerts** | [**[]BaseballGameAlertRestObject**](BaseballGameAlertRestObject.md) | | [optional] [default to null]
**ProbablePitchers** | [***BaseballGameProbableRestObject**](BaseballGameProbableRestObject.md) | | [optional] [default to null]
**OfficialScorer** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**PrimaryDatacaster** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**SecondaryDatacaster** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**RuleSettings** | [**[]RuleSettingsRestObject**](RuleSettingsRestObject.md) | | [optional] [default to null]
**MoundVisits** | [***MoundVisitsRestObject**](MoundVisitsRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,20 +0,0 @@
# BaseballGameDateTimeRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**DateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
**EndDateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
**OriginalDate** | **string** | | [optional] [default to null]
**OfficialDate** | **string** | | [optional] [default to null]
**ResumeDate** | **string** | | [optional] [default to null]
**ResumeDateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
**ResumedFromDate** | **string** | | [optional] [default to null]
**ResumedFromDateTime** | [**time.Time**](time.Time.md) | | [optional] [default to null]
**DayNight** | **string** | | [optional] [default to null]
**Time** | **string** | | [optional] [default to null]
**Ampm** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,20 +0,0 @@
# BaseballGameFlag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**IsNoHitter** | **bool** | | [optional] [default to null]
**IsPerfectGame** | **bool** | | [optional] [default to null]
**IsAwayTeamNoHitter** | **bool** | | [optional] [default to null]
**IsAwayTeamPerfectGame** | **bool** | | [optional] [default to null]
**IsHomeTeamNoHitter** | **bool** | | [optional] [default to null]
**IsHomeTeamPerfectGame** | **bool** | | [optional] [default to null]
**AwayTeamNoHitter** | **bool** | | [optional] [default to null]
**HomeTeamNoHitter** | **bool** | | [optional] [default to null]
**AwayTeamPerfectGame** | **bool** | | [optional] [default to null]
**HomeTeamPerfectGame** | **bool** | | [optional] [default to null]
**NoHitter** | **bool** | | [optional] [default to null]
**PerfectGame** | **bool** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,15 +0,0 @@
# BaseballGameFlagRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**NoHitter** | **bool** | | [optional] [default to null]
**PerfectGame** | **bool** | | [optional] [default to null]
**AwayTeamNoHitter** | **bool** | | [optional] [default to null]
**AwayTeamPerfectGame** | **bool** | | [optional] [default to null]
**HomeTeamNoHitter** | **bool** | | [optional] [default to null]
**HomeTeamPerfectGame** | **bool** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# BaseballGameLeaderRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Value** | **float64** | | [optional] [default to null]
**Player** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,12 +0,0 @@
# BaseballGameLeadersRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**HitDistance** | [***BaseballGameLeaderRestObject**](BaseballGameLeaderRestObject.md) | | [optional] [default to null]
**HitSpeed** | [***BaseballGameLeaderRestObject**](BaseballGameLeaderRestObject.md) | | [optional] [default to null]
**PitchSpeed** | [***BaseballGameLeaderRestObject**](BaseballGameLeaderRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# BaseballGameLiveDataRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Plays** | [***BaseballPlayByPlayRestObject**](BaseballPlayByPlayRestObject.md) | | [optional] [default to null]
**Linescore** | [***BaseballLinescoreRestObject**](BaseballLinescoreRestObject.md) | | [optional] [default to null]
**Boxscore** | [***BaseballBoxscoreRestObject**](BaseballBoxscoreRestObject.md) | | [optional] [default to null]
**Decisions** | [***BaseballDecisionRestObject**](BaseballDecisionRestObject.md) | | [optional] [default to null]
**Leaders** | [***BaseballGameLeadersRestObject**](BaseballGameLeadersRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,14 +0,0 @@
# BaseballGameLiveLookinRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**GamePk** | **int32** | | [optional] [default to null]
**MediaPlaybackId** | **int64** | | [optional] [default to null]
**Headline** | **string** | | [optional] [default to null]
**Kicker** | **string** | | [optional] [default to null]
**Playbacks** | [**[]LiveLookinPlayback**](LiveLookinPlayback.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,13 +0,0 @@
# BaseballGameMetaDataRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Wait** | **int32** | | [optional] [default to null]
**TimeStamp** | **string** | | [optional] [default to null]
**GameEvents** | **[]string** | | [optional] [default to null]
**LogicalEvents** | **[]string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@ -1,11 +0,0 @@
# BaseballGameProbableRestObject
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Copyright** | **string** | | [optional] [default to null]
**Away** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
**Home** | [***BaseballPersonRestObject**](BaseballPersonRestObject.md) | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Some files were not shown because too many files have changed in this diff Show More