/*
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"
	"scm.dairydemon.net/filifa/mlbstats/api/models"
	"strings"
)

// Linger please
var (
	_ context.Context
)

type TeamsApiService service

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiAffiliatesOpts - Optional Parameters:
     * @param "TeamIds" (optional.Interface of []int32) -  Unique Team Identifier. Format: 141, 147, etc
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "Season" (optional.String) -  Season of play
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.TeamsRestObject
*/

type TeamsApiAffiliatesOpts struct {
	TeamIds  optional.Interface
	SportId  optional.Int32
	Season   optional.String
	GameType optional.Interface
	Fields   optional.Interface
}

func (a *TeamsApiService) Affiliates(ctx context.Context, teamId int32, localVarOptionals *TeamsApiAffiliatesOpts) (models.TeamsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.TeamsRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.TeamIds.IsSet() {
		localVarQueryParams.Add("teamIds", parameterToString(localVarOptionals.TeamIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.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 models.TeamsRestObject
			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
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiAffiliates1Opts - Optional Parameters:
     * @param "TeamIds" (optional.Interface of []int32) -  Unique Team Identifier. Format: 141, 147, etc
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "Season" (optional.String) -  Season of play
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.TeamsRestObject
*/

type TeamsApiAffiliates1Opts struct {
	TeamIds  optional.Interface
	SportId  optional.Int32
	Season   optional.String
	GameType optional.Interface
	Fields   optional.Interface
}

func (a *TeamsApiService) Affiliates1(ctx context.Context, teamId int32, localVarOptionals *TeamsApiAffiliates1Opts) (models.TeamsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.TeamsRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.TeamIds.IsSet() {
		localVarQueryParams.Add("teamIds", parameterToString(localVarOptionals.TeamIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.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 models.TeamsRestObject
			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
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiAllTeamsOpts - Optional Parameters:
     * @param "TeamIds" (optional.Interface of []int32) -  Comma delimited list of Unique Team identifiers
     * @param "StartSeason" (optional.String) -  Start date for range of data (used with end date optionally). Example: &#x27;2018&#x27; or &#x27;2018.2&#x27;
     * @param "EndSeason" (optional.String) -  End date for range of data (used with start date optionally). Format: &#x27;2018&#x27; or &#x27;2018.2&#x27;
     * @param "Fields" (optional.Interface of []string) -
@return models.TeamsRestObject
*/

type TeamsApiAllTeamsOpts struct {
	TeamIds     optional.Interface
	StartSeason optional.String
	EndSeason   optional.String
	Fields      optional.Interface
}

func (a *TeamsApiService) AllTeams(ctx context.Context, teamId int32, localVarOptionals *TeamsApiAllTeamsOpts) (models.TeamsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.TeamsRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.TeamIds.IsSet() {
		localVarQueryParams.Add("teamIds", parameterToString(localVarOptionals.TeamIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.StartSeason.IsSet() {
		localVarQueryParams.Add("startSeason", parameterToString(localVarOptionals.StartSeason.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EndSeason.IsSet() {
		localVarQueryParams.Add("endSeason", parameterToString(localVarOptionals.EndSeason.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 models.TeamsRestObject
			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
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiAllTeams1Opts - Optional Parameters:
     * @param "TeamIds" (optional.Interface of []int32) -  Comma delimited list of Unique Team identifiers
     * @param "StartSeason" (optional.String) -  Start date for range of data (used with end date optionally). Example: &#x27;2018&#x27; or &#x27;2018.2&#x27;
     * @param "EndSeason" (optional.String) -  End date for range of data (used with start date optionally). Format: &#x27;2018&#x27; or &#x27;2018.2&#x27;
     * @param "Fields" (optional.Interface of []string) -
@return models.TeamsRestObject
*/

type TeamsApiAllTeams1Opts struct {
	TeamIds     optional.Interface
	StartSeason optional.String
	EndSeason   optional.String
	Fields      optional.Interface
}

func (a *TeamsApiService) AllTeams1(ctx context.Context, teamId int32, localVarOptionals *TeamsApiAllTeams1Opts) (models.TeamsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.TeamsRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.TeamIds.IsSet() {
		localVarQueryParams.Add("teamIds", parameterToString(localVarOptionals.TeamIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.StartSeason.IsSet() {
		localVarQueryParams.Add("startSeason", parameterToString(localVarOptionals.StartSeason.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EndSeason.IsSet() {
		localVarQueryParams.Add("endSeason", parameterToString(localVarOptionals.EndSeason.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 models.TeamsRestObject
			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
}

/*
TeamsApiService 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
 * @param season Season of play
 * @param optional nil or *TeamsApiAlumniOpts - Optional Parameters:
     * @param "Group" (optional.Interface of StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "Fields" (optional.Interface of []string) -
@return models.PeopleRestObject
*/

type TeamsApiAlumniOpts struct {
	Group  optional.Interface
	Fields optional.Interface
}

func (a *TeamsApiService) Alumni(ctx context.Context, teamId int32, season string, localVarOptionals *TeamsApiAlumniOpts) (models.PeopleRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.PeopleRestObject
	)

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

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

	localVarQueryParams.Add("season", parameterToString(season, ""))
	if localVarOptionals != nil && localVarOptionals.Group.IsSet() {
		localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.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 models.PeopleRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiCoachesOpts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "Date" (optional.String) -  Date of Game. Format: YYYY-MM-DD
     * @param "Fields" (optional.Interface of []string) -
@return models.RosterRestObject
*/

type TeamsApiCoachesOpts struct {
	Season optional.String
	Date   optional.String
	Fields optional.Interface
}

func (a *TeamsApiService) Coaches(ctx context.Context, teamId int32, localVarOptionals *TeamsApiCoachesOpts) (models.RosterRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.RosterRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/teams/{teamId}/coaches"
	localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", fmt.Sprintf("%v", teamId), -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.Date.IsSet() {
		localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.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 models.RosterRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
TeamsApiService View team stat leaders
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param teamId
 * @param optional nil or *TeamsApiLeadersOpts - Optional Parameters:
     * @param "LeaderCategories" (optional.Interface of []PersonLeadersEnum) -
     * @param "Season" (optional.String) -
     * @param "LeaderGameTypes" (optional.Interface of []models.GameTypeEnum) -
     * @param "Expand" (optional.Interface of []ExpandEnum) -
     * @param "Limit" (optional.Int32) -
     * @param "Offset" (optional.Int32) -
     * @param "PlayerPool" (optional.Interface of PlayerPoolEnum) -
     * @param "Fields" (optional.Interface of []string) -
@return models.TeamLeaderContainerRestObject
*/

type TeamsApiLeadersOpts struct {
	LeaderCategories optional.Interface
	Season           optional.String
	LeaderGameTypes  optional.Interface
	Expand           optional.Interface
	Limit            optional.Int32
	Offset           optional.Int32
	PlayerPool       optional.Interface
	Fields           optional.Interface
}

func (a *TeamsApiService) Leaders(ctx context.Context, teamId int32, localVarOptionals *TeamsApiLeadersOpts) (models.TeamLeaderContainerRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.TeamLeaderContainerRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.LeaderCategories.IsSet() {
		localVarQueryParams.Add("leaderCategories", parameterToString(localVarOptionals.LeaderCategories.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LeaderGameTypes.IsSet() {
		localVarQueryParams.Add("leaderGameTypes", parameterToString(localVarOptionals.LeaderGameTypes.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Expand.IsSet() {
		localVarQueryParams.Add("expand", parameterToString(localVarOptionals.Expand.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
		localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Offset.IsSet() {
		localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.PlayerPool.IsSet() {
		localVarQueryParams.Add("playerPool", parameterToString(localVarOptionals.PlayerPool.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 models.TeamLeaderContainerRestObject
			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
}

/*
TeamsApiService View leaders for team stats
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param optional nil or *TeamsApiLeaders1Opts - Optional Parameters:
     * @param "LeaderCategories" (optional.Interface of []PersonLeadersEnum) -  TBD
     * @param "GameTypes" (optional.Interface of []models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "Stats" (optional.Interface of []StatType) -  Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
     * @param "StatType" (optional.Interface of StatType) -
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "SportIds" (optional.Interface of []int32) -  Comma delimited list of top level organizations of a sport
     * @param "LeagueId" (optional.Int32) -  Unique League Identifier
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "StatGroup" (optional.Interface of []StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "Group" (optional.Interface of []StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "StartDate" (optional.String) -  Start date for range of data (must be used with end date). Format: MM/DD/YYYY
     * @param "EndDate" (optional.String) -  End date for range of data (must be used with start date). Format: MM/DD/YYYY
     * @param "DaysBack" (optional.Int32) -  Returns results from the last &#x27;X&#x27; days (Starting from yesterday).
     * @param "SitCodes" (optional.String) -  Situation code for a given stat split.
     * @param "OpposingTeamId" (optional.Int32) -  A unique identifier for the opposing team. Must be used with Team ID
     * @param "Limit" (optional.Int32) -  Number of results to return
     * @param "Offset" (optional.Int32) -  The pointer to start for a return set; used for pagination
     * @param "Fields" (optional.Interface of []string) -
@return models.LeagueLeaderContainerRestObject
*/

type TeamsApiLeaders1Opts struct {
	LeaderCategories optional.Interface
	GameTypes        optional.Interface
	Stats            optional.Interface
	StatType         optional.Interface
	SportId          optional.Int32
	SportIds         optional.Interface
	LeagueId         optional.Int32
	LeagueIds        optional.Interface
	Season           optional.String
	StatGroup        optional.Interface
	Group            optional.Interface
	StartDate        optional.String
	EndDate          optional.String
	DaysBack         optional.Int32
	SitCodes         optional.String
	OpposingTeamId   optional.Int32
	Limit            optional.Int32
	Offset           optional.Int32
	Fields           optional.Interface
}

func (a *TeamsApiService) Leaders1(ctx context.Context, localVarOptionals *TeamsApiLeaders1Opts) (models.LeagueLeaderContainerRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.LeagueLeaderContainerRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/teams/stats/leaders"

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

	if localVarOptionals != nil && localVarOptionals.LeaderCategories.IsSet() {
		localVarQueryParams.Add("leaderCategories", parameterToString(localVarOptionals.LeaderCategories.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.GameTypes.IsSet() {
		localVarQueryParams.Add("gameTypes", parameterToString(localVarOptionals.GameTypes.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Stats.IsSet() {
		localVarQueryParams.Add("stats", parameterToString(localVarOptionals.Stats.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.StatType.IsSet() {
		localVarQueryParams.Add("statType", parameterToString(localVarOptionals.StatType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
		localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueId.IsSet() {
		localVarQueryParams.Add("leagueId", parameterToString(localVarOptionals.LeagueId.Value(), ""))
	}
	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.StatGroup.IsSet() {
		localVarQueryParams.Add("statGroup", parameterToString(localVarOptionals.StatGroup.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.Group.IsSet() {
		localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.StartDate.IsSet() {
		localVarQueryParams.Add("startDate", parameterToString(localVarOptionals.StartDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EndDate.IsSet() {
		localVarQueryParams.Add("endDate", parameterToString(localVarOptionals.EndDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.DaysBack.IsSet() {
		localVarQueryParams.Add("daysBack", parameterToString(localVarOptionals.DaysBack.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SitCodes.IsSet() {
		localVarQueryParams.Add("sitCodes", parameterToString(localVarOptionals.SitCodes.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.OpposingTeamId.IsSet() {
		localVarQueryParams.Add("opposingTeamId", parameterToString(localVarOptionals.OpposingTeamId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
		localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Offset.IsSet() {
		localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.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 models.LeagueLeaderContainerRestObject
			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
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiPersonnelOpts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "Date" (optional.String) -  Date of Game. Format: YYYY-MM-DD
     * @param "Fields" (optional.Interface of []string) -
@return models.RosterRestObject
*/

type TeamsApiPersonnelOpts struct {
	Season optional.String
	Date   optional.String
	Fields optional.Interface
}

func (a *TeamsApiService) Personnel(ctx context.Context, teamId int32, localVarOptionals *TeamsApiPersonnelOpts) (models.RosterRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.RosterRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/teams/{teamId}/personnel"
	localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", fmt.Sprintf("%v", teamId), -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.Date.IsSet() {
		localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.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 models.RosterRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiRosterOpts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "Date" (optional.String) -  Date of Game. Format: YYYY-MM-DD
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.RosterRestObject
*/

type TeamsApiRosterOpts struct {
	Season   optional.String
	Date     optional.String
	GameType optional.Interface
	Fields   optional.Interface
}

func (a *TeamsApiService) Roster(ctx context.Context, teamId int32, rosterType string, localVarOptionals *TeamsApiRosterOpts) (models.RosterRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.RosterRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/teams/{teamId}/roster"
	localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", fmt.Sprintf("%v", teamId), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"rosterType"+"}", fmt.Sprintf("%v", rosterType), -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.Date.IsSet() {
		localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.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 models.RosterRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiRoster1Opts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "Date" (optional.String) -  Date of Game. Format: YYYY-MM-DD
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.RosterRestObject
*/

type TeamsApiRoster1Opts struct {
	Season   optional.String
	Date     optional.String
	GameType optional.Interface
	Fields   optional.Interface
}

func (a *TeamsApiService) Roster1(ctx context.Context, teamId int32, rosterType string, localVarOptionals *TeamsApiRoster1Opts) (models.RosterRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.RosterRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/teams/{teamId}/roster/{rosterType}"
	localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", fmt.Sprintf("%v", teamId), -1)
	localVarPath = strings.Replace(localVarPath, "{"+"rosterType"+"}", fmt.Sprintf("%v", rosterType), -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.Date.IsSet() {
		localVarQueryParams.Add("date", parameterToString(localVarOptionals.Date.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.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 models.RosterRestObject
			err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"))
			if err != nil {
				newErr.error = err.Error()
				return localVarReturnValue, localVarHttpResponse, newErr
			}
			newErr.model = v
			return localVarReturnValue, localVarHttpResponse, newErr
		}
		return localVarReturnValue, localVarHttpResponse, newErr
	}

	return localVarReturnValue, localVarHttpResponse, nil
}

/*
TeamsApiService 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
 * @param group Category of statistic to return. Available types in /api/v1/statGroups
 * @param optional nil or *TeamsApiStatsOpts - Optional Parameters:
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "Season" (optional.String) -  Season of play
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "Stats" (optional.Interface of []StatType) -  Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
     * @param "SortStat" (optional.Interface of BaseballStatsEnum) -  Baseball stat to sort splits by.
     * @param "Order" (optional.Interface of SortOrderEnum) -  The order of sorting, ascending or descending
     * @param "GroupBy" (optional.Interface of []models.GroupByEnum) -  Group stats by PLAYER, TEAM, SEASON, VENUE, SPORT or STAT_GROUP
     * @param "OpposingTeamId" (optional.Int32) -  A unique identifier for the opposing team. Must be used with Team ID
     * @param "OpposingPlayerId" (optional.Int32) -  A unique identifier for the opposing team
     * @param "SitCodes" (optional.String) -  Situation code for a given stat split.
     * @param "StartDate" (optional.String) -  Start date for range of data (must be used with end date). Format: MM/DD/YYYY
     * @param "EndDate" (optional.String) -  End date for range of data (must be used with start date). Format: MM/DD/YYYY
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.StatsRestObject
*/

type TeamsApiStatsOpts struct {
	SportId          optional.Int32
	Season           optional.String
	GameType         optional.Interface
	Stats            optional.Interface
	SortStat         optional.Interface
	Order            optional.Interface
	GroupBy          optional.Interface
	OpposingTeamId   optional.Int32
	OpposingPlayerId optional.Int32
	SitCodes         optional.String
	StartDate        optional.String
	EndDate          optional.String
	Fields           optional.Interface
}

func (a *TeamsApiService) Stats(ctx context.Context, teamId int32, group []models.StatGroup, localVarOptionals *TeamsApiStatsOpts) (models.StatsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.StatsRestObject
	)

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

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

	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Season.IsSet() {
		localVarQueryParams.Add("season", parameterToString(localVarOptionals.Season.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Stats.IsSet() {
		localVarQueryParams.Add("stats", parameterToString(localVarOptionals.Stats.Value(), "multi"))
	}
	localVarQueryParams.Add("group", parameterToString(group, "multi"))
	if localVarOptionals != nil && localVarOptionals.SortStat.IsSet() {
		localVarQueryParams.Add("sortStat", parameterToString(localVarOptionals.SortStat.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Order.IsSet() {
		localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GroupBy.IsSet() {
		localVarQueryParams.Add("groupBy", parameterToString(localVarOptionals.GroupBy.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.OpposingTeamId.IsSet() {
		localVarQueryParams.Add("opposingTeamId", parameterToString(localVarOptionals.OpposingTeamId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.OpposingPlayerId.IsSet() {
		localVarQueryParams.Add("opposingPlayerId", parameterToString(localVarOptionals.OpposingPlayerId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SitCodes.IsSet() {
		localVarQueryParams.Add("sitCodes", parameterToString(localVarOptionals.SitCodes.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.StartDate.IsSet() {
		localVarQueryParams.Add("startDate", parameterToString(localVarOptionals.StartDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EndDate.IsSet() {
		localVarQueryParams.Add("endDate", parameterToString(localVarOptionals.EndDate.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 models.StatsRestObject
			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
}

/*
TeamsApiService View a teams stats
 * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
 * @param group Category of statistic to return. Available types in /api/v1/statGroups
 * @param optional nil or *TeamsApiStats1Opts - Optional Parameters:
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "Stats" (optional.Interface of []StatType) -  Type of statistics. Format: Individual, Team, Career, etc. Available types in /api/v1/statTypes
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "SportIds" (optional.Interface of []int32) -  Comma delimited list of top level organizations of a sport
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "Season" (optional.String) -  Season of play
     * @param "SortStat" (optional.Interface of BaseballStatsEnum) -  Baseball stat to sort splits by.
     * @param "Order" (optional.Interface of SortOrderEnum) -  The order of sorting, ascending or descending
     * @param "StartDate" (optional.String) -  Start date for range of data (must be used with end date). Format: MM/DD/YYYY
     * @param "EndDate" (optional.String) -  End date for range of data (must be used with start date). Format: MM/DD/YYYY
     * @param "DaysBack" (optional.Int32) -  Returns results from the last &#x27;X&#x27; days (Starting from yesterday).
     * @param "SitCodes" (optional.String) -  Situation code for a given stat split.
     * @param "CombineSits" (optional.Bool) -  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
     * @param "OpposingTeamId" (optional.Int32) -  A unique identifier for the opposing team. Must be used with Team ID
     * @param "Offset" (optional.Int32) -  The pointer to start for a return set; used for pagination
     * @param "Limit" (optional.Int32) -  Number of results to return
     * @param "Fields" (optional.Interface of []string) -
@return models.StatsRestObject
*/

type TeamsApiStats1Opts struct {
	GameType       optional.Interface
	Stats          optional.Interface
	SportId        optional.Int32
	SportIds       optional.Interface
	LeagueIds      optional.Interface
	Season         optional.String
	SortStat       optional.Interface
	Order          optional.Interface
	StartDate      optional.String
	EndDate        optional.String
	DaysBack       optional.Int32
	SitCodes       optional.String
	CombineSits    optional.Bool
	OpposingTeamId optional.Int32
	Offset         optional.Int32
	Limit          optional.Int32
	Fields         optional.Interface
}

func (a *TeamsApiService) Stats1(ctx context.Context, group []models.StatGroup, localVarOptionals *TeamsApiStats1Opts) (models.StatsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.StatsRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/teams/stats"

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

	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Stats.IsSet() {
		localVarQueryParams.Add("stats", parameterToString(localVarOptionals.Stats.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
		localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
	}
	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(), ""))
	}
	localVarQueryParams.Add("group", parameterToString(group, "multi"))
	if localVarOptionals != nil && localVarOptionals.SortStat.IsSet() {
		localVarQueryParams.Add("sortStat", parameterToString(localVarOptionals.SortStat.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Order.IsSet() {
		localVarQueryParams.Add("order", parameterToString(localVarOptionals.Order.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.StartDate.IsSet() {
		localVarQueryParams.Add("startDate", parameterToString(localVarOptionals.StartDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.EndDate.IsSet() {
		localVarQueryParams.Add("endDate", parameterToString(localVarOptionals.EndDate.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.DaysBack.IsSet() {
		localVarQueryParams.Add("daysBack", parameterToString(localVarOptionals.DaysBack.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.SitCodes.IsSet() {
		localVarQueryParams.Add("sitCodes", parameterToString(localVarOptionals.SitCodes.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.CombineSits.IsSet() {
		localVarQueryParams.Add("combineSits", parameterToString(localVarOptionals.CombineSits.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.OpposingTeamId.IsSet() {
		localVarQueryParams.Add("opposingTeamId", parameterToString(localVarOptionals.OpposingTeamId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Offset.IsSet() {
		localVarQueryParams.Add("offset", parameterToString(localVarOptionals.Offset.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.Limit.IsSet() {
		localVarQueryParams.Add("limit", parameterToString(localVarOptionals.Limit.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 models.StatsRestObject
			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
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiTeamsOpts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "DivisionId" (optional.Int32) -  Unique Division Identifier
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "SportIds" (optional.Interface of []int32) -  Comma delimited list of top level organizations of a sport
     * @param "ActiveStatus" (optional.Interface of TeamActiveStatusEnum) -  Flag for fetching teams that are currently active (Y), inactive (N), pending (P), or all teams (B)
     * @param "LeagueListId" (optional.Interface of LeagueListsEnum) -  Unique League List Identifier
     * @param "AllStarStatuses" (optional.Interface of []AllStarEnum) -
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.TeamsRestObject
*/

type TeamsApiTeamsOpts struct {
	Season          optional.String
	SportId         optional.Int32
	DivisionId      optional.Int32
	GameType        optional.Interface
	LeagueIds       optional.Interface
	SportIds        optional.Interface
	ActiveStatus    optional.Interface
	LeagueListId    optional.Interface
	AllStarStatuses optional.Interface
	Fields          optional.Interface
}

func (a *TeamsApiService) Teams(ctx context.Context, teamId int32, localVarOptionals *TeamsApiTeamsOpts) (models.TeamsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.TeamsRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/teams"
	localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", fmt.Sprintf("%v", teamId), -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.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.DivisionId.IsSet() {
		localVarQueryParams.Add("divisionId", parameterToString(localVarOptionals.DivisionId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
		localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
		localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueListId.IsSet() {
		localVarQueryParams.Add("leagueListId", parameterToString(localVarOptionals.LeagueListId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.AllStarStatuses.IsSet() {
		localVarQueryParams.Add("allStarStatuses", parameterToString(localVarOptionals.AllStarStatuses.Value(), "multi"))
	}
	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 models.TeamsRestObject
			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
}

/*
TeamsApiService 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
 * @param optional nil or *TeamsApiTeams1Opts - Optional Parameters:
     * @param "Season" (optional.String) -  Season of play
     * @param "SportId" (optional.Int32) -  Top level organization of a sport
     * @param "DivisionId" (optional.Int32) -  Unique Division Identifier
     * @param "GameType" (optional.Interface of models.GameTypeEnum) -  Type of Game. Available types in /api/v1/gameTypes
     * @param "LeagueIds" (optional.Interface of []int32) -  Comma delimited list of Unique league identifiers
     * @param "SportIds" (optional.Interface of []int32) -  Comma delimited list of top level organizations of a sport
     * @param "ActiveStatus" (optional.Interface of TeamActiveStatusEnum) -  Flag for fetching teams that are currently active (Y), inactive (N), pending (P), or all teams (B)
     * @param "LeagueListId" (optional.Interface of LeagueListsEnum) -  Unique League List Identifier
     * @param "AllStarStatuses" (optional.Interface of []AllStarEnum) -
     * @param "Fields" (optional.Interface of []string) -  Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute
@return models.TeamsRestObject
*/

type TeamsApiTeams1Opts struct {
	Season          optional.String
	SportId         optional.Int32
	DivisionId      optional.Int32
	GameType        optional.Interface
	LeagueIds       optional.Interface
	SportIds        optional.Interface
	ActiveStatus    optional.Interface
	LeagueListId    optional.Interface
	AllStarStatuses optional.Interface
	Fields          optional.Interface
}

func (a *TeamsApiService) Teams1(ctx context.Context, teamId int32, localVarOptionals *TeamsApiTeams1Opts) (models.TeamsRestObject, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Get")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue models.TeamsRestObject
	)

	// create path and map variables
	localVarPath := a.client.cfg.BasePath + "/api/v1/teams/{teamId}"
	localVarPath = strings.Replace(localVarPath, "{"+"teamId"+"}", fmt.Sprintf("%v", teamId), -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.SportId.IsSet() {
		localVarQueryParams.Add("sportId", parameterToString(localVarOptionals.SportId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.DivisionId.IsSet() {
		localVarQueryParams.Add("divisionId", parameterToString(localVarOptionals.DivisionId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.GameType.IsSet() {
		localVarQueryParams.Add("gameType", parameterToString(localVarOptionals.GameType.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueIds.IsSet() {
		localVarQueryParams.Add("leagueIds", parameterToString(localVarOptionals.LeagueIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.SportIds.IsSet() {
		localVarQueryParams.Add("sportIds", parameterToString(localVarOptionals.SportIds.Value(), "multi"))
	}
	if localVarOptionals != nil && localVarOptionals.ActiveStatus.IsSet() {
		localVarQueryParams.Add("activeStatus", parameterToString(localVarOptionals.ActiveStatus.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.LeagueListId.IsSet() {
		localVarQueryParams.Add("leagueListId", parameterToString(localVarOptionals.LeagueListId.Value(), ""))
	}
	if localVarOptionals != nil && localVarOptionals.AllStarStatuses.IsSet() {
		localVarQueryParams.Add("allStarStatuses", parameterToString(localVarOptionals.AllStarStatuses.Value(), "multi"))
	}
	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 models.TeamsRestObject
			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
}

/*
TeamsApiService
 * @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 season Season of play
 * @param optional nil or *TeamsApiUpdateAlumniOpts - Optional Parameters:
     * @param "Group" (optional.Interface of StatGroup) -  Category of statistic to return. Available types in /api/v1/statGroups
     * @param "Fields" (optional.Interface of []string) -
@return string
*/

type TeamsApiUpdateAlumniOpts struct {
	Group  optional.Interface
	Fields optional.Interface
}

func (a *TeamsApiService) UpdateAlumni(ctx context.Context, teamId int32, season string, localVarOptionals *TeamsApiUpdateAlumniOpts) (string, *http.Response, error) {
	var (
		localVarHttpMethod  = strings.ToUpper("Post")
		localVarPostBody    interface{}
		localVarFileName    string
		localVarFileBytes   []byte
		localVarReturnValue string
	)

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

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

	localVarQueryParams.Add("season", parameterToString(season, ""))
	if localVarOptionals != nil && localVarOptionals.Group.IsSet() {
		localVarQueryParams.Add("group", parameterToString(localVarOptionals.Group.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
}
