2025-04-06 04:55:01 +00:00
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
Stats API Documentation
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
Official API for Major League Baseball.
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
API version: 2.0.0
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
|
2025-04-06 04:55:01 +00:00
|
|
|
package api
|
|
|
|
|
|
|
|
import (
|
2025-04-06 23:39:04 +00:00
|
|
|
"bytes"
|
2025-04-06 04:55:01 +00:00
|
|
|
"context"
|
2025-04-06 23:39:04 +00:00
|
|
|
"io"
|
2025-04-06 04:55:01 +00:00
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// MilestonesAPIService MilestonesAPI service
|
|
|
|
type MilestonesAPIService service
|
|
|
|
|
|
|
|
type ApiAchievementStatusesRequest struct {
|
|
|
|
ctx context.Context
|
|
|
|
ApiService *MilestonesAPIService
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiAchievementStatusesRequest) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.AchievementStatusesExecute(r)
|
|
|
|
}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
AchievementStatuses View available achievementStatus options
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
@return ApiAchievementStatusesRequest
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
2025-04-06 23:39:04 +00:00
|
|
|
func (a *MilestonesAPIService) AchievementStatuses(ctx context.Context) ApiAchievementStatusesRequest {
|
|
|
|
return ApiAchievementStatusesRequest{
|
|
|
|
ApiService: a,
|
|
|
|
ctx: ctx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Execute executes the request
|
|
|
|
func (a *MilestonesAPIService) AchievementStatusesExecute(r ApiAchievementStatusesRequest) (*http.Response, error) {
|
2025-04-06 04:55:01 +00:00
|
|
|
var (
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPMethod = http.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
formFiles []formFile
|
2025-04-06 04:55:01 +00:00
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MilestonesAPIService.AchievementStatuses")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/achievementStatuses"
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccepts := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return nil, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := &GenericOpenAPIError{
|
2025-04-06 04:55:01 +00:00
|
|
|
body: localVarBody,
|
2025-04-06 23:39:04 +00:00
|
|
|
error: localVarHTTPResponse.Status,
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, newErr
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ApiMilestoneDurationsRequest struct {
|
|
|
|
ctx context.Context
|
|
|
|
ApiService *MilestonesAPIService
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiMilestoneDurationsRequest) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.MilestoneDurationsExecute(r)
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
MilestoneDurations View available milestoneDurations options
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
@return ApiMilestoneDurationsRequest
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
2025-04-06 23:39:04 +00:00
|
|
|
func (a *MilestonesAPIService) MilestoneDurations(ctx context.Context) ApiMilestoneDurationsRequest {
|
|
|
|
return ApiMilestoneDurationsRequest{
|
|
|
|
ApiService: a,
|
|
|
|
ctx: ctx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Execute executes the request
|
|
|
|
func (a *MilestonesAPIService) MilestoneDurationsExecute(r ApiMilestoneDurationsRequest) (*http.Response, error) {
|
2025-04-06 04:55:01 +00:00
|
|
|
var (
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPMethod = http.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
formFiles []formFile
|
2025-04-06 04:55:01 +00:00
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MilestonesAPIService.MilestoneDurations")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/milestoneDurations"
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccepts := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return nil, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := &GenericOpenAPIError{
|
2025-04-06 04:55:01 +00:00
|
|
|
body: localVarBody,
|
2025-04-06 23:39:04 +00:00
|
|
|
error: localVarHTTPResponse.Status,
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, newErr
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ApiMilestoneLookupsRequest struct {
|
|
|
|
ctx context.Context
|
|
|
|
ApiService *MilestonesAPIService
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiMilestoneLookupsRequest) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.MilestoneLookupsExecute(r)
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
MilestoneLookups View available milestoneLookup options
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
@return ApiMilestoneLookupsRequest
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
2025-04-06 23:39:04 +00:00
|
|
|
func (a *MilestonesAPIService) MilestoneLookups(ctx context.Context) ApiMilestoneLookupsRequest {
|
|
|
|
return ApiMilestoneLookupsRequest{
|
|
|
|
ApiService: a,
|
|
|
|
ctx: ctx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Execute executes the request
|
|
|
|
func (a *MilestonesAPIService) MilestoneLookupsExecute(r ApiMilestoneLookupsRequest) (*http.Response, error) {
|
2025-04-06 04:55:01 +00:00
|
|
|
var (
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPMethod = http.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
formFiles []formFile
|
2025-04-06 04:55:01 +00:00
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MilestonesAPIService.MilestoneLookups")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/milestoneLookups"
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccepts := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return nil, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := &GenericOpenAPIError{
|
2025-04-06 04:55:01 +00:00
|
|
|
body: localVarBody,
|
2025-04-06 23:39:04 +00:00
|
|
|
error: localVarHTTPResponse.Status,
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, newErr
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ApiMilestoneStatisticsRequest struct {
|
|
|
|
ctx context.Context
|
|
|
|
ApiService *MilestonesAPIService
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiMilestoneStatisticsRequest) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.MilestoneStatisticsExecute(r)
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
MilestoneStatistics View available milestone statistics options
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
@return ApiMilestoneStatisticsRequest
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
2025-04-06 23:39:04 +00:00
|
|
|
func (a *MilestonesAPIService) MilestoneStatistics(ctx context.Context) ApiMilestoneStatisticsRequest {
|
|
|
|
return ApiMilestoneStatisticsRequest{
|
|
|
|
ApiService: a,
|
|
|
|
ctx: ctx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Execute executes the request
|
|
|
|
func (a *MilestonesAPIService) MilestoneStatisticsExecute(r ApiMilestoneStatisticsRequest) (*http.Response, error) {
|
2025-04-06 04:55:01 +00:00
|
|
|
var (
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPMethod = http.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
formFiles []formFile
|
2025-04-06 04:55:01 +00:00
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MilestonesAPIService.MilestoneStatistics")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/milestoneStatistics"
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccepts := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return nil, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := &GenericOpenAPIError{
|
2025-04-06 04:55:01 +00:00
|
|
|
body: localVarBody,
|
2025-04-06 23:39:04 +00:00
|
|
|
error: localVarHTTPResponse.Status,
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, newErr
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ApiMilestoneTypesRequest struct {
|
|
|
|
ctx context.Context
|
|
|
|
ApiService *MilestonesAPIService
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiMilestoneTypesRequest) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.MilestoneTypesExecute(r)
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
MilestoneTypes View available milestoneType options
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
@return ApiMilestoneTypesRequest
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
2025-04-06 23:39:04 +00:00
|
|
|
func (a *MilestonesAPIService) MilestoneTypes(ctx context.Context) ApiMilestoneTypesRequest {
|
|
|
|
return ApiMilestoneTypesRequest{
|
|
|
|
ApiService: a,
|
|
|
|
ctx: ctx,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Execute executes the request
|
|
|
|
func (a *MilestonesAPIService) MilestoneTypesExecute(r ApiMilestoneTypesRequest) (*http.Response, error) {
|
2025-04-06 04:55:01 +00:00
|
|
|
var (
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPMethod = http.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
formFiles []formFile
|
2025-04-06 04:55:01 +00:00
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MilestonesAPIService.MilestoneTypes")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/milestoneTypes"
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
|
|
|
// to determine the Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccepts := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return nil, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := &GenericOpenAPIError{
|
2025-04-06 04:55:01 +00:00
|
|
|
body: localVarBody,
|
2025-04-06 23:39:04 +00:00
|
|
|
error: localVarHTTPResponse.Status,
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, newErr
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
type ApiMilestonesRequest struct {
|
|
|
|
ctx context.Context
|
|
|
|
ApiService *MilestonesAPIService
|
|
|
|
orgType *interface{}
|
|
|
|
achievementStatuses *interface{}
|
|
|
|
milestoneTypes *interface{}
|
|
|
|
isLastAchievement *interface{}
|
|
|
|
milestoneStatistics *interface{}
|
|
|
|
milestoneValues *interface{}
|
|
|
|
playerIds *interface{}
|
|
|
|
teamIds *interface{}
|
|
|
|
leagueIds *interface{}
|
|
|
|
statGroup *interface{}
|
|
|
|
season *interface{}
|
|
|
|
seasons *interface{}
|
|
|
|
venueIds *interface{}
|
|
|
|
gamePks *interface{}
|
|
|
|
limit *interface{}
|
|
|
|
fields *interface{}
|
|
|
|
showFirsts *interface{}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Organization level. Format: T(Team), L(League), S(Sport)
|
|
|
|
func (r ApiMilestonesRequest) OrgType(orgType interface{}) ApiMilestonesRequest {
|
|
|
|
r.orgType = &orgType
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of milestone achievement types
|
|
|
|
func (r ApiMilestonesRequest) AchievementStatuses(achievementStatuses interface{}) ApiMilestonesRequest {
|
|
|
|
r.achievementStatuses = &achievementStatuses
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of milestone types
|
|
|
|
func (r ApiMilestonesRequest) MilestoneTypes(milestoneTypes interface{}) ApiMilestonesRequest {
|
|
|
|
r.milestoneTypes = &milestoneTypes
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Filters out milestones that have already been surpassed.
|
|
|
|
func (r ApiMilestonesRequest) IsLastAchievement(isLastAchievement interface{}) ApiMilestonesRequest {
|
|
|
|
r.isLastAchievement = &isLastAchievement
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of milestone statistics
|
|
|
|
func (r ApiMilestonesRequest) MilestoneStatistics(milestoneStatistics interface{}) ApiMilestonesRequest {
|
|
|
|
r.milestoneStatistics = &milestoneStatistics
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of milestone values
|
|
|
|
func (r ApiMilestonesRequest) MilestoneValues(milestoneValues interface{}) ApiMilestonesRequest {
|
|
|
|
r.milestoneValues = &milestoneValues
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// A unique identifier for players
|
|
|
|
func (r ApiMilestonesRequest) PlayerIds(playerIds interface{}) ApiMilestonesRequest {
|
|
|
|
r.playerIds = &playerIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of Unique Team identifiers
|
|
|
|
func (r ApiMilestonesRequest) TeamIds(teamIds interface{}) ApiMilestonesRequest {
|
|
|
|
r.teamIds = &teamIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of Unique league identifiers
|
|
|
|
func (r ApiMilestonesRequest) LeagueIds(leagueIds interface{}) ApiMilestonesRequest {
|
|
|
|
r.leagueIds = &leagueIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Category of statistic to return. Available types in /api/v1/statGroups
|
|
|
|
func (r ApiMilestonesRequest) StatGroup(statGroup interface{}) ApiMilestonesRequest {
|
|
|
|
r.statGroup = &statGroup
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Season of play
|
|
|
|
func (r ApiMilestonesRequest) Season(season interface{}) ApiMilestonesRequest {
|
|
|
|
r.season = &season
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of Seasons of play
|
|
|
|
func (r ApiMilestonesRequest) Seasons(seasons interface{}) ApiMilestonesRequest {
|
|
|
|
r.seasons = &seasons
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of Unique venue identifiers
|
|
|
|
func (r ApiMilestonesRequest) VenueIds(venueIds interface{}) ApiMilestonesRequest {
|
|
|
|
r.venueIds = &venueIds
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of unique primary keys
|
|
|
|
func (r ApiMilestonesRequest) GamePks(gamePks interface{}) ApiMilestonesRequest {
|
|
|
|
r.gamePks = &gamePks
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Number of results to return
|
|
|
|
func (r ApiMilestonesRequest) Limit(limit interface{}) ApiMilestonesRequest {
|
|
|
|
r.limit = &limit
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
|
|
|
|
func (r ApiMilestonesRequest) Fields(fields interface{}) ApiMilestonesRequest {
|
|
|
|
r.fields = &fields
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
// True to show play first milestones, like first HR, first Save, etc
|
|
|
|
func (r ApiMilestonesRequest) ShowFirsts(showFirsts interface{}) ApiMilestonesRequest {
|
|
|
|
r.showFirsts = &showFirsts
|
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r ApiMilestonesRequest) Execute() (*http.Response, error) {
|
|
|
|
return r.ApiService.MilestonesExecute(r)
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2025-04-06 23:39:04 +00:00
|
|
|
Milestones View pending and achieved milestones.
|
|
|
|
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
|
|
@return ApiMilestonesRequest
|
2025-04-06 04:55:01 +00:00
|
|
|
*/
|
2025-04-06 23:39:04 +00:00
|
|
|
func (a *MilestonesAPIService) Milestones(ctx context.Context) ApiMilestonesRequest {
|
|
|
|
return ApiMilestonesRequest{
|
|
|
|
ApiService: a,
|
|
|
|
ctx: ctx,
|
|
|
|
}
|
|
|
|
}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
// Execute executes the request
|
|
|
|
func (a *MilestonesAPIService) MilestonesExecute(r ApiMilestonesRequest) (*http.Response, error) {
|
2025-04-06 04:55:01 +00:00
|
|
|
var (
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPMethod = http.MethodGet
|
|
|
|
localVarPostBody interface{}
|
|
|
|
formFiles []formFile
|
2025-04-06 04:55:01 +00:00
|
|
|
)
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MilestonesAPIService.Milestones")
|
|
|
|
if err != nil {
|
|
|
|
return nil, &GenericOpenAPIError{error: err.Error()}
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarPath := localBasePath + "/api/v1/milestones"
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.orgType != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "orgType", r.orgType, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.achievementStatuses != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "achievementStatuses", r.achievementStatuses, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.milestoneTypes != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "milestoneTypes", r.milestoneTypes, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.isLastAchievement != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "isLastAchievement", r.isLastAchievement, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.milestoneStatistics != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "milestoneStatistics", r.milestoneStatistics, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.milestoneValues != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "milestoneValues", r.milestoneValues, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.playerIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "playerIds", r.playerIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.teamIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "teamIds", r.teamIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.leagueIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "leagueIds", r.leagueIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.statGroup != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "statGroup", r.statGroup, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.season != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "season", r.season, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.seasons != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "seasons", r.seasons, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.venueIds != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "venueIds", r.venueIds, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.gamePks != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "gamePks", r.gamePks, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.limit != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.fields != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
if r.showFirsts != nil {
|
|
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "showFirsts", r.showFirsts, "", "")
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
// to determine the Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentTypes := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Content-Type header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
|
|
if localVarHTTPContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccepts := []string{}
|
2025-04-06 04:55:01 +00:00
|
|
|
|
|
|
|
// set Accept header
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
|
|
if localVarHTTPHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return nil, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
|
|
localVarHTTPResponse.Body.Close()
|
|
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
2025-04-06 04:55:01 +00:00
|
|
|
if err != nil {
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, err
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
|
|
newErr := &GenericOpenAPIError{
|
2025-04-06 04:55:01 +00:00
|
|
|
body: localVarBody,
|
2025-04-06 23:39:04 +00:00
|
|
|
error: localVarHTTPResponse.Status,
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, newErr
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|
|
|
|
|
2025-04-06 23:39:04 +00:00
|
|
|
return localVarHTTPResponse, nil
|
2025-04-06 04:55:01 +00:00
|
|
|
}
|