2642 lines
79 KiB
Go
2642 lines
79 KiB
Go
/*
|
|
Copyright © 2025 filifa
|
|
|
|
This program is free software: you can redistribute it and/or modify it under
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
Foundation, either version 3 of the License, or (at your option) any later
|
|
version.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
/*
|
|
Stats API Documentation
|
|
|
|
Official API for Major League Baseball.
|
|
|
|
API version: 2.0.0
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package api
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
"strings"
|
|
)
|
|
|
|
// TeamsAPIService TeamsAPI service
|
|
type TeamsAPIService service
|
|
|
|
type ApiAffiliatesRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
teamIds *interface{}
|
|
sportId *interface{}
|
|
season *interface{}
|
|
gameType *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiAffiliatesRequest) TeamIds(teamIds interface{}) ApiAffiliatesRequest {
|
|
r.teamIds = &teamIds
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiAffiliatesRequest) SportId(sportId interface{}) ApiAffiliatesRequest {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiAffiliatesRequest) Season(season interface{}) ApiAffiliatesRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiAffiliatesRequest) GameType(gameType interface{}) ApiAffiliatesRequest {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiAffiliatesRequest) Fields(fields interface{}) ApiAffiliatesRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiAffiliatesRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.AffiliatesExecute(r)
|
|
}
|
|
|
|
/*
|
|
Affiliates View team and affiliate teams
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiAffiliatesRequest
|
|
*/
|
|
func (a *TeamsAPIService) Affiliates(ctx context.Context, teamId interface{}) ApiAffiliatesRequest {
|
|
return ApiAffiliatesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) AffiliatesExecute(r ApiAffiliatesRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Affiliates")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/affiliates"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.teamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.season != nil {
|
|
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{}
|
|
|
|
// 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 ApiAffiliates1Request struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
teamIds *interface{}
|
|
sportId *interface{}
|
|
season *interface{}
|
|
gameType *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Unique Team Identifier. Format: 141, 147, etc
|
|
func (r ApiAffiliates1Request) TeamIds(teamIds interface{}) ApiAffiliates1Request {
|
|
r.teamIds = &teamIds
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiAffiliates1Request) SportId(sportId interface{}) ApiAffiliates1Request {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiAffiliates1Request) Season(season interface{}) ApiAffiliates1Request {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiAffiliates1Request) GameType(gameType interface{}) ApiAffiliates1Request {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiAffiliates1Request) Fields(fields interface{}) ApiAffiliates1Request {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiAffiliates1Request) Execute() (*http.Response, error) {
|
|
return r.ApiService.Affiliates1Execute(r)
|
|
}
|
|
|
|
/*
|
|
Affiliates1 View team and affiliate teams
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiAffiliates1Request
|
|
*/
|
|
func (a *TeamsAPIService) Affiliates1(ctx context.Context, teamId interface{}) ApiAffiliates1Request {
|
|
return ApiAffiliates1Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) Affiliates1Execute(r ApiAffiliates1Request) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Affiliates1")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/affiliates"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.teamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.season != nil {
|
|
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{}
|
|
|
|
// 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 ApiAllTeamsRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
teamIds *interface{}
|
|
startSeason *interface{}
|
|
endSeason *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Comma delimited list of Unique Team identifiers
|
|
func (r ApiAllTeamsRequest) TeamIds(teamIds interface{}) ApiAllTeamsRequest {
|
|
r.teamIds = &teamIds
|
|
return r
|
|
}
|
|
|
|
// Start date for range of data (used with end date optionally). Example: '2018' or '2018.2'
|
|
func (r ApiAllTeamsRequest) StartSeason(startSeason interface{}) ApiAllTeamsRequest {
|
|
r.startSeason = &startSeason
|
|
return r
|
|
}
|
|
|
|
// End date for range of data (used with start date optionally). Format: '2018' or '2018.2'
|
|
func (r ApiAllTeamsRequest) EndSeason(endSeason interface{}) ApiAllTeamsRequest {
|
|
r.endSeason = &endSeason
|
|
return r
|
|
}
|
|
|
|
func (r ApiAllTeamsRequest) Fields(fields interface{}) ApiAllTeamsRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiAllTeamsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.AllTeamsExecute(r)
|
|
}
|
|
|
|
/*
|
|
AllTeams View historical records for a list of teams
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiAllTeamsRequest
|
|
*/
|
|
func (a *TeamsAPIService) AllTeams(ctx context.Context, teamId interface{}) ApiAllTeamsRequest {
|
|
return ApiAllTeamsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) AllTeamsExecute(r ApiAllTeamsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.AllTeams")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/history"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.teamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
|
}
|
|
if r.startSeason != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startSeason", r.startSeason, "", "")
|
|
}
|
|
if r.endSeason != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endSeason", r.endSeason, "", "")
|
|
}
|
|
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 ApiAllTeams1Request struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
teamIds *interface{}
|
|
startSeason *interface{}
|
|
endSeason *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Comma delimited list of Unique Team identifiers
|
|
func (r ApiAllTeams1Request) TeamIds(teamIds interface{}) ApiAllTeams1Request {
|
|
r.teamIds = &teamIds
|
|
return r
|
|
}
|
|
|
|
// Start date for range of data (used with end date optionally). Example: '2018' or '2018.2'
|
|
func (r ApiAllTeams1Request) StartSeason(startSeason interface{}) ApiAllTeams1Request {
|
|
r.startSeason = &startSeason
|
|
return r
|
|
}
|
|
|
|
// End date for range of data (used with start date optionally). Format: '2018' or '2018.2'
|
|
func (r ApiAllTeams1Request) EndSeason(endSeason interface{}) ApiAllTeams1Request {
|
|
r.endSeason = &endSeason
|
|
return r
|
|
}
|
|
|
|
func (r ApiAllTeams1Request) Fields(fields interface{}) ApiAllTeams1Request {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiAllTeams1Request) Execute() (*http.Response, error) {
|
|
return r.ApiService.AllTeams1Execute(r)
|
|
}
|
|
|
|
/*
|
|
AllTeams1 View historical records for a list of teams
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiAllTeams1Request
|
|
*/
|
|
func (a *TeamsAPIService) AllTeams1(ctx context.Context, teamId interface{}) ApiAllTeams1Request {
|
|
return ApiAllTeams1Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) AllTeams1Execute(r ApiAllTeams1Request) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.AllTeams1")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/history"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.teamIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
|
}
|
|
if r.startSeason != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startSeason", r.startSeason, "", "")
|
|
}
|
|
if r.endSeason != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endSeason", r.endSeason, "", "")
|
|
}
|
|
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 ApiAlumniRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
season *interface{}
|
|
group *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiAlumniRequest) Season(season interface{}) ApiAlumniRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiAlumniRequest) Group(group interface{}) ApiAlumniRequest {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
func (r ApiAlumniRequest) Fields(fields interface{}) ApiAlumniRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiAlumniRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.AlumniExecute(r)
|
|
}
|
|
|
|
/*
|
|
Alumni View all team alumni
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiAlumniRequest
|
|
*/
|
|
func (a *TeamsAPIService) Alumni(ctx context.Context, teamId interface{}) ApiAlumniRequest {
|
|
return ApiAlumniRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) AlumniExecute(r ApiAlumniRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Alumni")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/alumni"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -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")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
if r.group != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
}
|
|
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 ApiCoachesRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
season *interface{}
|
|
date *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiCoachesRequest) Season(season interface{}) ApiCoachesRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
func (r ApiCoachesRequest) Date(date interface{}) ApiCoachesRequest {
|
|
r.date = &date
|
|
return r
|
|
}
|
|
|
|
func (r ApiCoachesRequest) Fields(fields interface{}) ApiCoachesRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiCoachesRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.CoachesExecute(r)
|
|
}
|
|
|
|
/*
|
|
Coaches View all coaches for a team
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiCoachesRequest
|
|
*/
|
|
func (a *TeamsAPIService) Coaches(ctx context.Context, teamId interface{}) ApiCoachesRequest {
|
|
return ApiCoachesRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) CoachesExecute(r ApiCoachesRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Coaches")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/coaches"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.date != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
|
|
}
|
|
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 ApiLeadersRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
leaderCategories *interface{}
|
|
season *interface{}
|
|
leaderGameTypes *interface{}
|
|
expand *interface{}
|
|
limit *interface{}
|
|
offset *interface{}
|
|
playerPool *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
func (r ApiLeadersRequest) LeaderCategories(leaderCategories interface{}) ApiLeadersRequest {
|
|
r.leaderCategories = &leaderCategories
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeadersRequest) Season(season interface{}) ApiLeadersRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeadersRequest) LeaderGameTypes(leaderGameTypes interface{}) ApiLeadersRequest {
|
|
r.leaderGameTypes = &leaderGameTypes
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeadersRequest) Expand(expand interface{}) ApiLeadersRequest {
|
|
r.expand = &expand
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeadersRequest) Limit(limit interface{}) ApiLeadersRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeadersRequest) Offset(offset interface{}) ApiLeadersRequest {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeadersRequest) PlayerPool(playerPool interface{}) ApiLeadersRequest {
|
|
r.playerPool = &playerPool
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeadersRequest) Fields(fields interface{}) ApiLeadersRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeadersRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.LeadersExecute(r)
|
|
}
|
|
|
|
/*
|
|
Leaders View team stat leaders
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId
|
|
@return ApiLeadersRequest
|
|
*/
|
|
func (a *TeamsAPIService) Leaders(ctx context.Context, teamId interface{}) ApiLeadersRequest {
|
|
return ApiLeadersRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) LeadersExecute(r ApiLeadersRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Leaders")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/leaders"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.leaderCategories != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leaderCategories", r.leaderCategories, "", "")
|
|
}
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.leaderGameTypes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leaderGameTypes", r.leaderGameTypes, "", "")
|
|
}
|
|
if r.expand != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "expand", r.expand, "", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
|
|
}
|
|
if r.playerPool != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playerPool", r.playerPool, "", "")
|
|
}
|
|
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 ApiLeaders1Request struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
leaderCategories *interface{}
|
|
gameTypes *interface{}
|
|
stats *interface{}
|
|
statType *interface{}
|
|
sportId *interface{}
|
|
sportIds *interface{}
|
|
leagueId *interface{}
|
|
leagueIds *interface{}
|
|
season *interface{}
|
|
statGroup *interface{}
|
|
group *interface{}
|
|
startDate *interface{}
|
|
endDate *interface{}
|
|
daysBack *interface{}
|
|
sitCodes *interface{}
|
|
opposingTeamId *interface{}
|
|
limit *interface{}
|
|
offset *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// TBD
|
|
func (r ApiLeaders1Request) LeaderCategories(leaderCategories interface{}) ApiLeaders1Request {
|
|
r.leaderCategories = &leaderCategories
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiLeaders1Request) GameTypes(gameTypes interface{}) ApiLeaders1Request {
|
|
r.gameTypes = &gameTypes
|
|
return r
|
|
}
|
|
|
|
// Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
|
|
func (r ApiLeaders1Request) Stats(stats interface{}) ApiLeaders1Request {
|
|
r.stats = &stats
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders1Request) StatType(statType interface{}) ApiLeaders1Request {
|
|
r.statType = &statType
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiLeaders1Request) SportId(sportId interface{}) ApiLeaders1Request {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiLeaders1Request) SportIds(sportIds interface{}) ApiLeaders1Request {
|
|
r.sportIds = &sportIds
|
|
return r
|
|
}
|
|
|
|
// Unique League Identifier
|
|
func (r ApiLeaders1Request) LeagueId(leagueId interface{}) ApiLeaders1Request {
|
|
r.leagueId = &leagueId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiLeaders1Request) LeagueIds(leagueIds interface{}) ApiLeaders1Request {
|
|
r.leagueIds = &leagueIds
|
|
return r
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiLeaders1Request) Season(season interface{}) ApiLeaders1Request {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiLeaders1Request) StatGroup(statGroup interface{}) ApiLeaders1Request {
|
|
r.statGroup = &statGroup
|
|
return r
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiLeaders1Request) Group(group interface{}) ApiLeaders1Request {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
|
|
func (r ApiLeaders1Request) StartDate(startDate interface{}) ApiLeaders1Request {
|
|
r.startDate = &startDate
|
|
return r
|
|
}
|
|
|
|
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
|
|
func (r ApiLeaders1Request) EndDate(endDate interface{}) ApiLeaders1Request {
|
|
r.endDate = &endDate
|
|
return r
|
|
}
|
|
|
|
// Returns results from the last 'X' days (Starting from yesterday).
|
|
func (r ApiLeaders1Request) DaysBack(daysBack interface{}) ApiLeaders1Request {
|
|
r.daysBack = &daysBack
|
|
return r
|
|
}
|
|
|
|
// Situation code for a given stat split.
|
|
func (r ApiLeaders1Request) SitCodes(sitCodes interface{}) ApiLeaders1Request {
|
|
r.sitCodes = &sitCodes
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the opposing team. Must be used with Team ID
|
|
func (r ApiLeaders1Request) OpposingTeamId(opposingTeamId interface{}) ApiLeaders1Request {
|
|
r.opposingTeamId = &opposingTeamId
|
|
return r
|
|
}
|
|
|
|
// Number of results to return
|
|
func (r ApiLeaders1Request) Limit(limit interface{}) ApiLeaders1Request {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
// The pointer to start for a return set; used for pagination
|
|
func (r ApiLeaders1Request) Offset(offset interface{}) ApiLeaders1Request {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders1Request) Fields(fields interface{}) ApiLeaders1Request {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiLeaders1Request) Execute() (*http.Response, error) {
|
|
return r.ApiService.Leaders1Execute(r)
|
|
}
|
|
|
|
/*
|
|
Leaders1 View leaders for team stats
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiLeaders1Request
|
|
*/
|
|
func (a *TeamsAPIService) Leaders1(ctx context.Context) ApiLeaders1Request {
|
|
return ApiLeaders1Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) Leaders1Execute(r ApiLeaders1Request) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Leaders1")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/stats/leaders"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.leaderCategories != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leaderCategories", r.leaderCategories, "", "")
|
|
}
|
|
if r.gameTypes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameTypes", r.gameTypes, "", "")
|
|
}
|
|
if r.stats != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
|
|
}
|
|
if r.statType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "statType", r.statType, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.sportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
|
}
|
|
if r.leagueId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueId", r.leagueId, "", "")
|
|
}
|
|
if r.leagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
|
}
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.statGroup != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "statGroup", r.statGroup, "", "")
|
|
}
|
|
if r.group != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
}
|
|
if r.startDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
|
}
|
|
if r.endDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
|
}
|
|
if r.daysBack != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "daysBack", r.daysBack, "", "")
|
|
}
|
|
if r.sitCodes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
|
|
}
|
|
if r.opposingTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
|
|
}
|
|
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 ApiPersonnelRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
season *interface{}
|
|
date *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiPersonnelRequest) Season(season interface{}) ApiPersonnelRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
func (r ApiPersonnelRequest) Date(date interface{}) ApiPersonnelRequest {
|
|
r.date = &date
|
|
return r
|
|
}
|
|
|
|
func (r ApiPersonnelRequest) Fields(fields interface{}) ApiPersonnelRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiPersonnelRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.PersonnelExecute(r)
|
|
}
|
|
|
|
/*
|
|
Personnel View all coaches for a team
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiPersonnelRequest
|
|
*/
|
|
func (a *TeamsAPIService) Personnel(ctx context.Context, teamId interface{}) ApiPersonnelRequest {
|
|
return ApiPersonnelRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) PersonnelExecute(r ApiPersonnelRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Personnel")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/personnel"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.date != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
|
|
}
|
|
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 ApiRosterRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
rosterType interface{}
|
|
season *interface{}
|
|
date *interface{}
|
|
gameType *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiRosterRequest) Season(season interface{}) ApiRosterRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
func (r ApiRosterRequest) Date(date interface{}) ApiRosterRequest {
|
|
r.date = &date
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiRosterRequest) GameType(gameType interface{}) ApiRosterRequest {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiRosterRequest) Fields(fields interface{}) ApiRosterRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiRosterRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.RosterExecute(r)
|
|
}
|
|
|
|
/*
|
|
Roster View a teams roster
|
|
|
|
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 teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@param rosterType Type of roster. Available types in /api/v1/rosterTypes
|
|
@return ApiRosterRequest
|
|
*/
|
|
func (a *TeamsAPIService) Roster(ctx context.Context, teamId interface{}, rosterType interface{}) ApiRosterRequest {
|
|
return ApiRosterRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
rosterType: rosterType,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) RosterExecute(r ApiRosterRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Roster")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/roster"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"rosterType"+"}", url.PathEscape(parameterValueToString(r.rosterType, "rosterType")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.date != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
|
|
}
|
|
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{}
|
|
|
|
// 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 ApiRoster1Request struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
rosterType interface{}
|
|
season *interface{}
|
|
date *interface{}
|
|
gameType *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiRoster1Request) Season(season interface{}) ApiRoster1Request {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Date of Game. Format: YYYY-MM-DD
|
|
func (r ApiRoster1Request) Date(date interface{}) ApiRoster1Request {
|
|
r.date = &date
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiRoster1Request) GameType(gameType interface{}) ApiRoster1Request {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiRoster1Request) Fields(fields interface{}) ApiRoster1Request {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiRoster1Request) Execute() (*http.Response, error) {
|
|
return r.ApiService.Roster1Execute(r)
|
|
}
|
|
|
|
/*
|
|
Roster1 View a teams roster
|
|
|
|
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 teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@param rosterType Type of roster. Available types in /api/v1/rosterTypes
|
|
@return ApiRoster1Request
|
|
*/
|
|
func (a *TeamsAPIService) Roster1(ctx context.Context, teamId interface{}, rosterType interface{}) ApiRoster1Request {
|
|
return ApiRoster1Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
rosterType: rosterType,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) Roster1Execute(r ApiRoster1Request) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Roster1")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/roster/{rosterType}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
localVarPath = strings.Replace(localVarPath, "{"+"rosterType"+"}", url.PathEscape(parameterValueToString(r.rosterType, "rosterType")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.date != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "date", r.date, "", "")
|
|
}
|
|
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{}
|
|
|
|
// 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 ApiStatsRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
group *interface{}
|
|
sportId *interface{}
|
|
season *interface{}
|
|
gameType *interface{}
|
|
stats *interface{}
|
|
sortStat *interface{}
|
|
order *interface{}
|
|
groupBy *interface{}
|
|
opposingTeamId *interface{}
|
|
opposingPlayerId *interface{}
|
|
sitCodes *interface{}
|
|
startDate *interface{}
|
|
endDate *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiStatsRequest) Group(group interface{}) ApiStatsRequest {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiStatsRequest) SportId(sportId interface{}) ApiStatsRequest {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiStatsRequest) Season(season interface{}) ApiStatsRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiStatsRequest) GameType(gameType interface{}) ApiStatsRequest {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
|
|
func (r ApiStatsRequest) Stats(stats interface{}) ApiStatsRequest {
|
|
r.stats = &stats
|
|
return r
|
|
}
|
|
|
|
// Baseball stat to sort splits by.
|
|
func (r ApiStatsRequest) SortStat(sortStat interface{}) ApiStatsRequest {
|
|
r.sortStat = &sortStat
|
|
return r
|
|
}
|
|
|
|
// The order of sorting, ascending or descending
|
|
func (r ApiStatsRequest) Order(order interface{}) ApiStatsRequest {
|
|
r.order = &order
|
|
return r
|
|
}
|
|
|
|
// Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP
|
|
func (r ApiStatsRequest) GroupBy(groupBy interface{}) ApiStatsRequest {
|
|
r.groupBy = &groupBy
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the opposing team. Must be used with Team ID
|
|
func (r ApiStatsRequest) OpposingTeamId(opposingTeamId interface{}) ApiStatsRequest {
|
|
r.opposingTeamId = &opposingTeamId
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the opposing team
|
|
func (r ApiStatsRequest) OpposingPlayerId(opposingPlayerId interface{}) ApiStatsRequest {
|
|
r.opposingPlayerId = &opposingPlayerId
|
|
return r
|
|
}
|
|
|
|
// Situation code for a given stat split.
|
|
func (r ApiStatsRequest) SitCodes(sitCodes interface{}) ApiStatsRequest {
|
|
r.sitCodes = &sitCodes
|
|
return r
|
|
}
|
|
|
|
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
|
|
func (r ApiStatsRequest) StartDate(startDate interface{}) ApiStatsRequest {
|
|
r.startDate = &startDate
|
|
return r
|
|
}
|
|
|
|
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
|
|
func (r ApiStatsRequest) EndDate(endDate interface{}) ApiStatsRequest {
|
|
r.endDate = &endDate
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiStatsRequest) Fields(fields interface{}) ApiStatsRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiStatsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.StatsExecute(r)
|
|
}
|
|
|
|
/*
|
|
Stats View a teams stats
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiStatsRequest
|
|
*/
|
|
func (a *TeamsAPIService) Stats(ctx context.Context, teamId interface{}) ApiStatsRequest {
|
|
return ApiStatsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) StatsExecute(r ApiStatsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Stats")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/stats"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.group == nil {
|
|
return nil, reportError("group is required and must be specified")
|
|
}
|
|
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.gameType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
|
|
}
|
|
if r.stats != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
if r.sortStat != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sortStat", r.sortStat, "", "")
|
|
}
|
|
if r.order != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "")
|
|
}
|
|
if r.groupBy != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "groupBy", r.groupBy, "", "")
|
|
}
|
|
if r.opposingTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
|
|
}
|
|
if r.opposingPlayerId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingPlayerId", r.opposingPlayerId, "", "")
|
|
}
|
|
if r.sitCodes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
|
|
}
|
|
if r.startDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
|
}
|
|
if r.endDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
|
}
|
|
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 ApiStats1Request struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
group *interface{}
|
|
gameType *interface{}
|
|
stats *interface{}
|
|
sportId *interface{}
|
|
sportIds *interface{}
|
|
leagueIds *interface{}
|
|
season *interface{}
|
|
sortStat *interface{}
|
|
order *interface{}
|
|
startDate *interface{}
|
|
endDate *interface{}
|
|
daysBack *interface{}
|
|
sitCodes *interface{}
|
|
combineSits *interface{}
|
|
opposingTeamId *interface{}
|
|
offset *interface{}
|
|
limit *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiStats1Request) Group(group interface{}) ApiStats1Request {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiStats1Request) GameType(gameType interface{}) ApiStats1Request {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
|
|
func (r ApiStats1Request) Stats(stats interface{}) ApiStats1Request {
|
|
r.stats = &stats
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiStats1Request) SportId(sportId interface{}) ApiStats1Request {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiStats1Request) SportIds(sportIds interface{}) ApiStats1Request {
|
|
r.sportIds = &sportIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiStats1Request) LeagueIds(leagueIds interface{}) ApiStats1Request {
|
|
r.leagueIds = &leagueIds
|
|
return r
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiStats1Request) Season(season interface{}) ApiStats1Request {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Baseball stat to sort splits by.
|
|
func (r ApiStats1Request) SortStat(sortStat interface{}) ApiStats1Request {
|
|
r.sortStat = &sortStat
|
|
return r
|
|
}
|
|
|
|
// The order of sorting, ascending or descending
|
|
func (r ApiStats1Request) Order(order interface{}) ApiStats1Request {
|
|
r.order = &order
|
|
return r
|
|
}
|
|
|
|
// Start date for range of data (must be used with end date). Format: MM/DD/YYYY
|
|
func (r ApiStats1Request) StartDate(startDate interface{}) ApiStats1Request {
|
|
r.startDate = &startDate
|
|
return r
|
|
}
|
|
|
|
// End date for range of data (must be used with start date). Format: MM/DD/YYYY
|
|
func (r ApiStats1Request) EndDate(endDate interface{}) ApiStats1Request {
|
|
r.endDate = &endDate
|
|
return r
|
|
}
|
|
|
|
// Returns results from the last 'X' days (Starting from yesterday).
|
|
func (r ApiStats1Request) DaysBack(daysBack interface{}) ApiStats1Request {
|
|
r.daysBack = &daysBack
|
|
return r
|
|
}
|
|
|
|
// Situation code for a given stat split.
|
|
func (r ApiStats1Request) SitCodes(sitCodes interface{}) ApiStats1Request {
|
|
r.sitCodes = &sitCodes
|
|
return r
|
|
}
|
|
|
|
// If true, gathers stats where all of the situational criteria are met. If false, returns stats where any of the situational criteria are met. Default: false
|
|
func (r ApiStats1Request) CombineSits(combineSits interface{}) ApiStats1Request {
|
|
r.combineSits = &combineSits
|
|
return r
|
|
}
|
|
|
|
// A unique identifier for the opposing team. Must be used with Team ID
|
|
func (r ApiStats1Request) OpposingTeamId(opposingTeamId interface{}) ApiStats1Request {
|
|
r.opposingTeamId = &opposingTeamId
|
|
return r
|
|
}
|
|
|
|
// The pointer to start for a return set; used for pagination
|
|
func (r ApiStats1Request) Offset(offset interface{}) ApiStats1Request {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
// Number of results to return
|
|
func (r ApiStats1Request) Limit(limit interface{}) ApiStats1Request {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
func (r ApiStats1Request) Fields(fields interface{}) ApiStats1Request {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiStats1Request) Execute() (*http.Response, error) {
|
|
return r.ApiService.Stats1Execute(r)
|
|
}
|
|
|
|
/*
|
|
Stats1 View a teams stats
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return ApiStats1Request
|
|
*/
|
|
func (a *TeamsAPIService) Stats1(ctx context.Context) ApiStats1Request {
|
|
return ApiStats1Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) Stats1Execute(r ApiStats1Request) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Stats1")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/stats"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
if r.group == nil {
|
|
return nil, reportError("group is required and must be specified")
|
|
}
|
|
|
|
if r.gameType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
|
|
}
|
|
if r.stats != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "stats", r.stats, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.sportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
|
}
|
|
if r.leagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
|
}
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
if r.sortStat != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sortStat", r.sortStat, "", "")
|
|
}
|
|
if r.order != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "")
|
|
}
|
|
if r.startDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "startDate", r.startDate, "", "")
|
|
}
|
|
if r.endDate != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "endDate", r.endDate, "", "")
|
|
}
|
|
if r.daysBack != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "daysBack", r.daysBack, "", "")
|
|
}
|
|
if r.sitCodes != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sitCodes", r.sitCodes, "", "")
|
|
}
|
|
if r.combineSits != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "combineSits", r.combineSits, "", "")
|
|
}
|
|
if r.opposingTeamId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "opposingTeamId", r.opposingTeamId, "", "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "")
|
|
}
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
|
}
|
|
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 ApiTeamsRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
season *interface{}
|
|
sportId *interface{}
|
|
divisionId *interface{}
|
|
gameType *interface{}
|
|
leagueIds *interface{}
|
|
sportIds *interface{}
|
|
activeStatus *interface{}
|
|
leagueListId *interface{}
|
|
allStarStatuses *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiTeamsRequest) Season(season interface{}) ApiTeamsRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiTeamsRequest) SportId(sportId interface{}) ApiTeamsRequest {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Unique Division Identifier
|
|
func (r ApiTeamsRequest) DivisionId(divisionId interface{}) ApiTeamsRequest {
|
|
r.divisionId = &divisionId
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiTeamsRequest) GameType(gameType interface{}) ApiTeamsRequest {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiTeamsRequest) LeagueIds(leagueIds interface{}) ApiTeamsRequest {
|
|
r.leagueIds = &leagueIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiTeamsRequest) SportIds(sportIds interface{}) ApiTeamsRequest {
|
|
r.sportIds = &sportIds
|
|
return r
|
|
}
|
|
|
|
// Flag for fetching teams that are currently active (Y), inactive (N), pending (P), or all teams (B)
|
|
func (r ApiTeamsRequest) ActiveStatus(activeStatus interface{}) ApiTeamsRequest {
|
|
r.activeStatus = &activeStatus
|
|
return r
|
|
}
|
|
|
|
// Unique League List Identifier
|
|
func (r ApiTeamsRequest) LeagueListId(leagueListId interface{}) ApiTeamsRequest {
|
|
r.leagueListId = &leagueListId
|
|
return r
|
|
}
|
|
|
|
func (r ApiTeamsRequest) AllStarStatuses(allStarStatuses interface{}) ApiTeamsRequest {
|
|
r.allStarStatuses = &allStarStatuses
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiTeamsRequest) Fields(fields interface{}) ApiTeamsRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiTeamsRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.TeamsExecute(r)
|
|
}
|
|
|
|
/*
|
|
Teams View info for all teams
|
|
|
|
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 teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiTeamsRequest
|
|
*/
|
|
func (a *TeamsAPIService) Teams(ctx context.Context, teamId interface{}) ApiTeamsRequest {
|
|
return ApiTeamsRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) TeamsExecute(r ApiTeamsRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Teams")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.divisionId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "divisionId", r.divisionId, "", "")
|
|
}
|
|
if r.gameType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
|
|
}
|
|
if r.leagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
|
}
|
|
if r.sportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
|
}
|
|
if r.activeStatus != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "activeStatus", r.activeStatus, "", "")
|
|
}
|
|
if r.leagueListId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
|
|
}
|
|
if r.allStarStatuses != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "allStarStatuses", r.allStarStatuses, "", "")
|
|
}
|
|
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 ApiTeams1Request struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
season *interface{}
|
|
sportId *interface{}
|
|
divisionId *interface{}
|
|
gameType *interface{}
|
|
leagueIds *interface{}
|
|
sportIds *interface{}
|
|
activeStatus *interface{}
|
|
leagueListId *interface{}
|
|
allStarStatuses *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiTeams1Request) Season(season interface{}) ApiTeams1Request {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Top level organization of a sport
|
|
func (r ApiTeams1Request) SportId(sportId interface{}) ApiTeams1Request {
|
|
r.sportId = &sportId
|
|
return r
|
|
}
|
|
|
|
// Unique Division Identifier
|
|
func (r ApiTeams1Request) DivisionId(divisionId interface{}) ApiTeams1Request {
|
|
r.divisionId = &divisionId
|
|
return r
|
|
}
|
|
|
|
// Type of Game. Available types in /api/v1/gameTypes
|
|
func (r ApiTeams1Request) GameType(gameType interface{}) ApiTeams1Request {
|
|
r.gameType = &gameType
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
func (r ApiTeams1Request) LeagueIds(leagueIds interface{}) ApiTeams1Request {
|
|
r.leagueIds = &leagueIds
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of top level organizations of a sport
|
|
func (r ApiTeams1Request) SportIds(sportIds interface{}) ApiTeams1Request {
|
|
r.sportIds = &sportIds
|
|
return r
|
|
}
|
|
|
|
// Flag for fetching teams that are currently active (Y), inactive (N), pending (P), or all teams (B)
|
|
func (r ApiTeams1Request) ActiveStatus(activeStatus interface{}) ApiTeams1Request {
|
|
r.activeStatus = &activeStatus
|
|
return r
|
|
}
|
|
|
|
// Unique League List Identifier
|
|
func (r ApiTeams1Request) LeagueListId(leagueListId interface{}) ApiTeams1Request {
|
|
r.leagueListId = &leagueListId
|
|
return r
|
|
}
|
|
|
|
func (r ApiTeams1Request) AllStarStatuses(allStarStatuses interface{}) ApiTeams1Request {
|
|
r.allStarStatuses = &allStarStatuses
|
|
return r
|
|
}
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
func (r ApiTeams1Request) Fields(fields interface{}) ApiTeams1Request {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiTeams1Request) Execute() (*http.Response, error) {
|
|
return r.ApiService.Teams1Execute(r)
|
|
}
|
|
|
|
/*
|
|
Teams1 View info for all teams
|
|
|
|
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 teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiTeams1Request
|
|
*/
|
|
func (a *TeamsAPIService) Teams1(ctx context.Context, teamId interface{}) ApiTeams1Request {
|
|
return ApiTeams1Request{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) Teams1Execute(r ApiTeams1Request) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.Teams1")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -1)
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.season != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
}
|
|
if r.sportId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportId", r.sportId, "", "")
|
|
}
|
|
if r.divisionId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "divisionId", r.divisionId, "", "")
|
|
}
|
|
if r.gameType != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gameType", r.gameType, "", "")
|
|
}
|
|
if r.leagueIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
|
}
|
|
if r.sportIds != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "sportIds", r.sportIds, "", "")
|
|
}
|
|
if r.activeStatus != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "activeStatus", r.activeStatus, "", "")
|
|
}
|
|
if r.leagueListId != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueListId", r.leagueListId, "", "")
|
|
}
|
|
if r.allStarStatuses != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "allStarStatuses", r.allStarStatuses, "", "")
|
|
}
|
|
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 ApiUpdateAlumniRequest struct {
|
|
ctx context.Context
|
|
ApiService *TeamsAPIService
|
|
teamId interface{}
|
|
season *interface{}
|
|
group *interface{}
|
|
fields *interface{}
|
|
}
|
|
|
|
// Season of play
|
|
func (r ApiUpdateAlumniRequest) Season(season interface{}) ApiUpdateAlumniRequest {
|
|
r.season = &season
|
|
return r
|
|
}
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
func (r ApiUpdateAlumniRequest) Group(group interface{}) ApiUpdateAlumniRequest {
|
|
r.group = &group
|
|
return r
|
|
}
|
|
|
|
func (r ApiUpdateAlumniRequest) Fields(fields interface{}) ApiUpdateAlumniRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
func (r ApiUpdateAlumniRequest) Execute() (*http.Response, error) {
|
|
return r.ApiService.UpdateAlumniExecute(r)
|
|
}
|
|
|
|
/*
|
|
UpdateAlumni Method for UpdateAlumni
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@param teamId Unique Team Identifier. Format: 141, 147, etc
|
|
@return ApiUpdateAlumniRequest
|
|
*/
|
|
func (a *TeamsAPIService) UpdateAlumni(ctx context.Context, teamId interface{}) ApiUpdateAlumniRequest {
|
|
return ApiUpdateAlumniRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
teamId: teamId,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
func (a *TeamsAPIService) UpdateAlumniExecute(r ApiUpdateAlumniRequest) (*http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodPost
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TeamsAPIService.UpdateAlumni")
|
|
if err != nil {
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/api/v1/teams/{teamId}/alumni"
|
|
localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", url.PathEscape(parameterValueToString(r.teamId, "teamId")), -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")
|
|
}
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
|
if r.group != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "group", r.group, "", "")
|
|
}
|
|
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
|
|
}
|