/*
Copyright (C) 2025 filifa

This file is part of mlbstats.

mlbstats is free software: you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.

mlbstats is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
mlbstats. If not, see <https://www.gnu.org/licenses/>.
*/

/*
 * Stats API Documentation
 *
 * Official API for Major League Baseball.
 *
 * API version: 2.0.0
 * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
 */
package api

import (
	"context"
	"fmt"
	"github.com/antihax/optional"
	"io/ioutil"
	"net/http"
	"net/url"
	"strings"
)

// Linger please
var (
	_ context.Context
)

type LeagueApiService service

/*
LeagueApiService View al star ballot info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiAllStarBallotOpts - Optional Parameters:
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type LeagueApiAllStarBallotOpts struct {
	LeagueIds optional.Interface
	Season    optional.String
	Fields    optional.Interface
}

func (a *LeagueApiService) AllStarBallot(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiAllStarBallotOpts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/league/allStarBallot"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// to determine the Content-Type header
	localVarHttpContentTypes := []string{}

	// set Content-Type header
	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
	if localVarHttpContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHttpContentType
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{"*/*"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
	if localVarHttpHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View al star ballot info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiAllStarBallot1Opts - Optional Parameters:
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type LeagueApiAllStarBallot1Opts struct {
	LeagueIds optional.Interface
	Season    optional.String
	Fields    optional.Interface
}

func (a *LeagueApiService) AllStarBallot1(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiAllStarBallot1Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/league/{leagueId}/allStarBallot"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// to determine the Content-Type header
	localVarHttpContentTypes := []string{}

	// set Content-Type header
	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
	if localVarHttpContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHttpContentType
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{"*/*"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
	if localVarHttpHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View al star ballot info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiAllStarBallot2Opts - Optional Parameters:
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type LeagueApiAllStarBallot2Opts struct {
	LeagueIds optional.Interface
	Season    optional.String
	Fields    optional.Interface
}

func (a *LeagueApiService) AllStarBallot2(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiAllStarBallot2Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/leagues/allStarBallot"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// to determine the Content-Type header
	localVarHttpContentTypes := []string{}

	// set Content-Type header
	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
	if localVarHttpContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHttpContentType
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{"*/*"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
	if localVarHttpHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View al star ballot info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiAllStarBallot3Opts - Optional Parameters:
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type LeagueApiAllStarBallot3Opts struct {
	LeagueIds optional.Interface
	Season    optional.String
	Fields    optional.Interface
}

func (a *LeagueApiService) AllStarBallot3(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiAllStarBallot3Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/leagues/{leagueId}/allStarBallot"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// to determine the Content-Type header
	localVarHttpContentTypes := []string{}

	// set Content-Type header
	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
	if localVarHttpContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHttpContentType
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{"*/*"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
	if localVarHttpHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View all star final vote info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiAllStarFinalVoteOpts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type LeagueApiAllStarFinalVoteOpts struct {
	Season optional.String
	Fields optional.Interface
}

func (a *LeagueApiService) AllStarFinalVote(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiAllStarFinalVoteOpts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/league/{leagueId}/allStarFinalVote"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// to determine the Content-Type header
	localVarHttpContentTypes := []string{}

	// set Content-Type header
	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
	if localVarHttpContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHttpContentType
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{"*/*"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
	if localVarHttpHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View all star final vote info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiAllStarFinalVote1Opts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type LeagueApiAllStarFinalVote1Opts struct {
	Season optional.String
	Fields optional.Interface
}

func (a *LeagueApiService) AllStarFinalVote1(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiAllStarFinalVote1Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/leagues/{leagueId}/allStarFinalVote"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// to determine the Content-Type header
	localVarHttpContentTypes := []string{}

	// set Content-Type header
	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
	if localVarHttpContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHttpContentType
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{"*/*"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
	if localVarHttpHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View all star write ins info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiAllStarWriteInsOpts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type LeagueApiAllStarWriteInsOpts struct {
	Season optional.String
	Fields optional.Interface
}

func (a *LeagueApiService) AllStarWriteIns(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiAllStarWriteInsOpts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/league/{leagueId}/allStarWriteIns"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// to determine the Content-Type header
	localVarHttpContentTypes := []string{}

	// set Content-Type header
	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
	if localVarHttpContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHttpContentType
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{"*/*"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
	if localVarHttpHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View all star write ins info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiAllStarWriteIns1Opts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return string
*/

type LeagueApiAllStarWriteIns1Opts struct {
	Season optional.String
	Fields optional.Interface
}

func (a *LeagueApiService) AllStarWriteIns1(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiAllStarWriteIns1Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/leagues/{leagueId}/allStarWriteIns"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	// to determine the Content-Type header
	localVarHttpContentTypes := []string{}

	// set Content-Type header
	localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
	if localVarHttpContentType != "" {
		localVarHeaderParams["Content-Type"] = localVarHttpContentType
	}

	// to determine the Accept header
	localVarHttpHeaderAccepts := []string{"*/*"}

	// set Accept header
	localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
	if localVarHttpHeaderAccept != "" {
		localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View league info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiLeagueOpts - Optional Parameters:
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "Seasons" (optional.Interface of []string) -  Comma delimited list of Seasons of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "ActiveStatus" (optional.Interface of LeagueActiveStatusEnum) -  Flag for fetching leagues that are currently active (Y), inactive (N), pending (P), or all teams (B)
@return string
*/

type LeagueApiLeagueOpts struct {
	LeagueIds    optional.Interface
	Season       optional.String
	Seasons      optional.Interface
	Fields       optional.Interface
	SportId      optional.Int32
	ActiveStatus optional.Interface
}

func (a *LeagueApiService) League(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiLeagueOpts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/league"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
		localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
		localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View league info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiLeague1Opts - Optional Parameters:
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "Seasons" (optional.Interface of []string) -  Comma delimited list of Seasons of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "ActiveStatus" (optional.Interface of LeagueActiveStatusEnum) -  Flag for fetching leagues that are currently active (Y), inactive (N), pending (P), or all teams (B)
@return string
*/

type LeagueApiLeague1Opts struct {
	LeagueIds    optional.Interface
	Season       optional.String
	Seasons      optional.Interface
	Fields       optional.Interface
	SportId      optional.Int32
	ActiveStatus optional.Interface
}

func (a *LeagueApiService) League1(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiLeague1Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/league/{leagueId}"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
		localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
		localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View league info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiLeague2Opts - Optional Parameters:
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "Seasons" (optional.Interface of []string) -  Comma delimited list of Seasons of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "ActiveStatus" (optional.Interface of LeagueActiveStatusEnum) -  Flag for fetching leagues that are currently active (Y), inactive (N), pending (P), or all teams (B)
@return string
*/

type LeagueApiLeague2Opts struct {
	LeagueIds    optional.Interface
	Season       optional.String
	Seasons      optional.Interface
	Fields       optional.Interface
	SportId      optional.Int32
	ActiveStatus optional.Interface
}

func (a *LeagueApiService) League2(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiLeague2Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/leagues"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
		localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
		localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
LeagueApiService View league info
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param leagueId Unique League Identifier
 * @param optional nil or *LeagueApiLeague3Opts - Optional Parameters:
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "Seasons" (optional.Interface of []string) -  Comma delimited list of Seasons of play
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "ActiveStatus" (optional.Interface of LeagueActiveStatusEnum) -  Flag for fetching leagues that are currently active (Y), inactive (N), pending (P), or all teams (B)
@return string
*/

type LeagueApiLeague3Opts struct {
	LeagueIds    optional.Interface
	Season       optional.String
	Seasons      optional.Interface
	Fields       optional.Interface
	SportId      optional.Int32
	ActiveStatus optional.Interface
}

func (a *LeagueApiService) League3(ctx context.Context, leagueId int32, localVarOptionals *LeagueApiLeague3Opts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/leagues/{leagueId}"
	localVarPath = strings.Replace(localVarPath, "{"+"leagueId"+"}", fmt.Sprintf("%v", leagueId), -1)

	localVarHeaderParams := make(map[string]string)
	localVarQueryParams := url.Values{}
	localVarFormParams := url.Values{}

	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Seasons.IsSet() {
		localVarQueryParams.Add("seasons", parameterToString(localVarOptionals.Seasons.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Fields.IsSet() {
		localVarQueryParams.Add("fields", parameterToString(localVarOptionals.Fields.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
		localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
	}
	// 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
	}
	r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
	if err != nil {
		return localVarReturnValue, nil, err
	}

	localVarHttpResponse, err := a.client.callAPI(r)
	if err != nil || localVarHttpResponse == nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
	localVarHttpResponse.Body.Close()
	if err != nil {
		return localVarReturnValue, localVarHttpResponse, err
	}

	if localVarHttpResponse.StatusCode < 300 {
		// If we succeed, return the data, otherwise pass on to decode error.
		err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
		if err == nil {
			return localVarReturnValue, localVarHttpResponse, err
		}
	}

	if localVarHttpResponse.StatusCode >= 300 {
		newErr := GenericSwaggerError{
			body:  localVarBody,
			error: localVarHttpResponse.Status,
		}
		if localVarHttpResponse.StatusCode == 200 {
			var v string
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}
