/* Stats API Documentation Official API for Major League Baseball. API version: 2.0.0 */ // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. package api import ( "bytes" "context" "io" "net/http" "net/url" "strings" ) // DraftAPIService DraftAPI service type DraftAPIService service type ApiDraftPicksRequest struct { ctx context.Context ApiService *DraftAPIService year interface{} limit *interface{} offset *interface{} fields *interface{} order *interface{} sortBy *interface{} drafted *interface{} round *interface{} name *interface{} school *interface{} position *interface{} team *interface{} teamId *interface{} state *interface{} country *interface{} playerId *interface{} bisPlayerId *interface{} } // Number of results to return func (r ApiDraftPicksRequest) Limit(limit interface{}) ApiDraftPicksRequest { r.limit = &limit return r } // The pointer to start for a return set; used for pagination func (r ApiDraftPicksRequest) Offset(offset interface{}) ApiDraftPicksRequest { r.offset = &offset return r } // Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute func (r ApiDraftPicksRequest) Fields(fields interface{}) ApiDraftPicksRequest { r.fields = &fields return r } // The order of sorting, ascending or descending func (r ApiDraftPicksRequest) Order(order interface{}) ApiDraftPicksRequest { r.order = &order return r } // Sort the set of data by the specified field func (r ApiDraftPicksRequest) SortBy(sortBy interface{}) ApiDraftPicksRequest { r.sortBy = &sortBy return r } // Whether or not the players been drafted func (r ApiDraftPicksRequest) Drafted(drafted interface{}) ApiDraftPicksRequest { r.drafted = &drafted return r } // Round in which a player was drafted func (r ApiDraftPicksRequest) Round(round interface{}) ApiDraftPicksRequest { r.round = &round return r } // Filter players by the first letter of their name using using the specific character func (r ApiDraftPicksRequest) Name(name interface{}) ApiDraftPicksRequest { r.name = &name return r } // Filter players by the first letter of their school using using the specific character func (r ApiDraftPicksRequest) School(school interface{}) ApiDraftPicksRequest { r.school = &school return r } // Position number. Format: 1, 2, 3, etc func (r ApiDraftPicksRequest) Position(position interface{}) ApiDraftPicksRequest { r.position = &position return r } // Unique Team Code. Format: tor, nya, etc func (r ApiDraftPicksRequest) Team(team interface{}) ApiDraftPicksRequest { r.team = &team return r } // Unique Team Identifier. Format: 141, 147, etc func (r ApiDraftPicksRequest) TeamId(teamId interface{}) ApiDraftPicksRequest { r.teamId = &teamId return r } // State where the venue is located. Format: Ohio func (r ApiDraftPicksRequest) State(state interface{}) ApiDraftPicksRequest { r.state = &state return r } // Filter players by their home country func (r ApiDraftPicksRequest) Country(country interface{}) ApiDraftPicksRequest { r.country = &country return r } // A unique identifier for a player func (r ApiDraftPicksRequest) PlayerId(playerId interface{}) ApiDraftPicksRequest { r.playerId = &playerId return r } // A unique identifier for a player in the EBIS system func (r ApiDraftPicksRequest) BisPlayerId(bisPlayerId interface{}) ApiDraftPicksRequest { r.bisPlayerId = &bisPlayerId return r } func (r ApiDraftPicksRequest) Execute() (*http.Response, error) { return r.ApiService.DraftPicksExecute(r) } /* DraftPicks View MLB Drafted Players @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param year Year the player was drafted. Format: 2000 @return ApiDraftPicksRequest */ func (a *DraftAPIService) DraftPicks(ctx context.Context, year interface{}) ApiDraftPicksRequest { return ApiDraftPicksRequest{ ApiService: a, ctx: ctx, year: year, } } // Execute executes the request func (a *DraftAPIService) DraftPicksExecute(r ApiDraftPicksRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DraftAPIService.DraftPicks") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/api/v1/draft" localVarPath = strings.Replace(localVarPath, "{"+"year"+"}", url.PathEscape(parameterValueToString(r.year, "year")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.limit != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "") } if r.offset != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "") } if r.fields != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "") } if r.order != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "") } if r.sortBy != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "", "") } if r.drafted != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "drafted", r.drafted, "", "") } if r.round != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "round", r.round, "", "") } if r.name != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "", "") } if r.school != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "school", r.school, "", "") } if r.position != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "position", r.position, "", "") } if r.team != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "team", r.team, "", "") } if r.teamId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "") } if r.state != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "state", r.state, "", "") } if r.country != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "country", r.country, "", "") } if r.playerId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "playerId", r.playerId, "", "") } if r.bisPlayerId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "bisPlayerId", r.bisPlayerId, "", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := &GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } return localVarHTTPResponse, newErr } return localVarHTTPResponse, nil } type ApiDraftPicks1Request struct { ctx context.Context ApiService *DraftAPIService year interface{} limit *interface{} offset *interface{} fields *interface{} order *interface{} sortBy *interface{} drafted *interface{} round *interface{} name *interface{} school *interface{} position *interface{} team *interface{} teamId *interface{} state *interface{} country *interface{} playerId *interface{} bisPlayerId *interface{} } // Number of results to return func (r ApiDraftPicks1Request) Limit(limit interface{}) ApiDraftPicks1Request { r.limit = &limit return r } // The pointer to start for a return set; used for pagination func (r ApiDraftPicks1Request) Offset(offset interface{}) ApiDraftPicks1Request { r.offset = &offset return r } // Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute func (r ApiDraftPicks1Request) Fields(fields interface{}) ApiDraftPicks1Request { r.fields = &fields return r } // The order of sorting, ascending or descending func (r ApiDraftPicks1Request) Order(order interface{}) ApiDraftPicks1Request { r.order = &order return r } // Sort the set of data by the specified field func (r ApiDraftPicks1Request) SortBy(sortBy interface{}) ApiDraftPicks1Request { r.sortBy = &sortBy return r } // Whether or not the players been drafted func (r ApiDraftPicks1Request) Drafted(drafted interface{}) ApiDraftPicks1Request { r.drafted = &drafted return r } // Round in which a player was drafted func (r ApiDraftPicks1Request) Round(round interface{}) ApiDraftPicks1Request { r.round = &round return r } // Filter players by the first letter of their name using using the specific character func (r ApiDraftPicks1Request) Name(name interface{}) ApiDraftPicks1Request { r.name = &name return r } // Filter players by the first letter of their school using using the specific character func (r ApiDraftPicks1Request) School(school interface{}) ApiDraftPicks1Request { r.school = &school return r } // Position number. Format: 1, 2, 3, etc func (r ApiDraftPicks1Request) Position(position interface{}) ApiDraftPicks1Request { r.position = &position return r } // Unique Team Code. Format: tor, nya, etc func (r ApiDraftPicks1Request) Team(team interface{}) ApiDraftPicks1Request { r.team = &team return r } // Unique Team Identifier. Format: 141, 147, etc func (r ApiDraftPicks1Request) TeamId(teamId interface{}) ApiDraftPicks1Request { r.teamId = &teamId return r } // State where the venue is located. Format: Ohio func (r ApiDraftPicks1Request) State(state interface{}) ApiDraftPicks1Request { r.state = &state return r } // Filter players by their home country func (r ApiDraftPicks1Request) Country(country interface{}) ApiDraftPicks1Request { r.country = &country return r } // A unique identifier for a player func (r ApiDraftPicks1Request) PlayerId(playerId interface{}) ApiDraftPicks1Request { r.playerId = &playerId return r } // A unique identifier for a player in the EBIS system func (r ApiDraftPicks1Request) BisPlayerId(bisPlayerId interface{}) ApiDraftPicks1Request { r.bisPlayerId = &bisPlayerId return r } func (r ApiDraftPicks1Request) Execute() (*http.Response, error) { return r.ApiService.DraftPicks1Execute(r) } /* DraftPicks1 View MLB Drafted Players @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param year Year the player was drafted. Format: 2000 @return ApiDraftPicks1Request */ func (a *DraftAPIService) DraftPicks1(ctx context.Context, year interface{}) ApiDraftPicks1Request { return ApiDraftPicks1Request{ ApiService: a, ctx: ctx, year: year, } } // Execute executes the request func (a *DraftAPIService) DraftPicks1Execute(r ApiDraftPicks1Request) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DraftAPIService.DraftPicks1") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/api/v1/draft/{year}" localVarPath = strings.Replace(localVarPath, "{"+"year"+"}", url.PathEscape(parameterValueToString(r.year, "year")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.limit != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "") } if r.offset != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "") } if r.fields != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "") } if r.order != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "") } if r.sortBy != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "", "") } if r.drafted != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "drafted", r.drafted, "", "") } if r.round != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "round", r.round, "", "") } if r.name != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "", "") } if r.school != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "school", r.school, "", "") } if r.position != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "position", r.position, "", "") } if r.team != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "team", r.team, "", "") } if r.teamId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "") } if r.state != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "state", r.state, "", "") } if r.country != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "country", r.country, "", "") } if r.playerId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "playerId", r.playerId, "", "") } if r.bisPlayerId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "bisPlayerId", r.bisPlayerId, "", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := &GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } return localVarHTTPResponse, newErr } return localVarHTTPResponse, nil } type ApiDraftProspectsRequest struct { ctx context.Context ApiService *DraftAPIService year interface{} limit *interface{} offset *interface{} fields *interface{} order *interface{} sortBy *interface{} drafted *interface{} round *interface{} name *interface{} school *interface{} position *interface{} team *interface{} teamId *interface{} state *interface{} country *interface{} playerId *interface{} bisPlayerId *interface{} } // Number of results to return func (r ApiDraftProspectsRequest) Limit(limit interface{}) ApiDraftProspectsRequest { r.limit = &limit return r } // The pointer to start for a return set; used for pagination func (r ApiDraftProspectsRequest) Offset(offset interface{}) ApiDraftProspectsRequest { r.offset = &offset return r } // Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute func (r ApiDraftProspectsRequest) Fields(fields interface{}) ApiDraftProspectsRequest { r.fields = &fields return r } // The order of sorting, ascending or descending func (r ApiDraftProspectsRequest) Order(order interface{}) ApiDraftProspectsRequest { r.order = &order return r } // Sort the set of data by the specified field func (r ApiDraftProspectsRequest) SortBy(sortBy interface{}) ApiDraftProspectsRequest { r.sortBy = &sortBy return r } // Whether or not the players been drafted func (r ApiDraftProspectsRequest) Drafted(drafted interface{}) ApiDraftProspectsRequest { r.drafted = &drafted return r } // Round in which a player was drafted func (r ApiDraftProspectsRequest) Round(round interface{}) ApiDraftProspectsRequest { r.round = &round return r } // Filter players by the first letter of their name using using the specific character func (r ApiDraftProspectsRequest) Name(name interface{}) ApiDraftProspectsRequest { r.name = &name return r } // Filter players by the first letter of their school using using the specific character func (r ApiDraftProspectsRequest) School(school interface{}) ApiDraftProspectsRequest { r.school = &school return r } // Position number. Format: 1, 2, 3, etc func (r ApiDraftProspectsRequest) Position(position interface{}) ApiDraftProspectsRequest { r.position = &position return r } // Unique Team Code. Format: tor, nya, etc func (r ApiDraftProspectsRequest) Team(team interface{}) ApiDraftProspectsRequest { r.team = &team return r } // Unique Team Identifier. Format: 141, 147, etc func (r ApiDraftProspectsRequest) TeamId(teamId interface{}) ApiDraftProspectsRequest { r.teamId = &teamId return r } // State where the venue is located. Format: Ohio func (r ApiDraftProspectsRequest) State(state interface{}) ApiDraftProspectsRequest { r.state = &state return r } // Filter players by their home country func (r ApiDraftProspectsRequest) Country(country interface{}) ApiDraftProspectsRequest { r.country = &country return r } // A unique identifier for a player func (r ApiDraftProspectsRequest) PlayerId(playerId interface{}) ApiDraftProspectsRequest { r.playerId = &playerId return r } // A unique identifier for a player in the EBIS system func (r ApiDraftProspectsRequest) BisPlayerId(bisPlayerId interface{}) ApiDraftProspectsRequest { r.bisPlayerId = &bisPlayerId return r } func (r ApiDraftProspectsRequest) Execute() (*http.Response, error) { return r.ApiService.DraftProspectsExecute(r) } /* DraftProspects View MLB Draft Prospects @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param year Year the player was drafted. Format: 2000 @return ApiDraftProspectsRequest */ func (a *DraftAPIService) DraftProspects(ctx context.Context, year interface{}) ApiDraftProspectsRequest { return ApiDraftProspectsRequest{ ApiService: a, ctx: ctx, year: year, } } // Execute executes the request func (a *DraftAPIService) DraftProspectsExecute(r ApiDraftProspectsRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DraftAPIService.DraftProspects") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/api/v1/draft/prospects" localVarPath = strings.Replace(localVarPath, "{"+"year"+"}", url.PathEscape(parameterValueToString(r.year, "year")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.limit != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "") } if r.offset != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "") } if r.fields != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "") } if r.order != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "") } if r.sortBy != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "", "") } if r.drafted != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "drafted", r.drafted, "", "") } if r.round != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "round", r.round, "", "") } if r.name != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "", "") } if r.school != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "school", r.school, "", "") } if r.position != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "position", r.position, "", "") } if r.team != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "team", r.team, "", "") } if r.teamId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "") } if r.state != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "state", r.state, "", "") } if r.country != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "country", r.country, "", "") } if r.playerId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "playerId", r.playerId, "", "") } if r.bisPlayerId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "bisPlayerId", r.bisPlayerId, "", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := &GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } return localVarHTTPResponse, newErr } return localVarHTTPResponse, nil } type ApiDraftProspects1Request struct { ctx context.Context ApiService *DraftAPIService year interface{} limit *interface{} offset *interface{} fields *interface{} order *interface{} sortBy *interface{} drafted *interface{} round *interface{} name *interface{} school *interface{} position *interface{} team *interface{} teamId *interface{} state *interface{} country *interface{} playerId *interface{} bisPlayerId *interface{} } // Number of results to return func (r ApiDraftProspects1Request) Limit(limit interface{}) ApiDraftProspects1Request { r.limit = &limit return r } // The pointer to start for a return set; used for pagination func (r ApiDraftProspects1Request) Offset(offset interface{}) ApiDraftProspects1Request { r.offset = &offset return r } // Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute func (r ApiDraftProspects1Request) Fields(fields interface{}) ApiDraftProspects1Request { r.fields = &fields return r } // The order of sorting, ascending or descending func (r ApiDraftProspects1Request) Order(order interface{}) ApiDraftProspects1Request { r.order = &order return r } // Sort the set of data by the specified field func (r ApiDraftProspects1Request) SortBy(sortBy interface{}) ApiDraftProspects1Request { r.sortBy = &sortBy return r } // Whether or not the players been drafted func (r ApiDraftProspects1Request) Drafted(drafted interface{}) ApiDraftProspects1Request { r.drafted = &drafted return r } // Round in which a player was drafted func (r ApiDraftProspects1Request) Round(round interface{}) ApiDraftProspects1Request { r.round = &round return r } // Filter players by the first letter of their name using using the specific character func (r ApiDraftProspects1Request) Name(name interface{}) ApiDraftProspects1Request { r.name = &name return r } // Filter players by the first letter of their school using using the specific character func (r ApiDraftProspects1Request) School(school interface{}) ApiDraftProspects1Request { r.school = &school return r } // Position number. Format: 1, 2, 3, etc func (r ApiDraftProspects1Request) Position(position interface{}) ApiDraftProspects1Request { r.position = &position return r } // Unique Team Code. Format: tor, nya, etc func (r ApiDraftProspects1Request) Team(team interface{}) ApiDraftProspects1Request { r.team = &team return r } // Unique Team Identifier. Format: 141, 147, etc func (r ApiDraftProspects1Request) TeamId(teamId interface{}) ApiDraftProspects1Request { r.teamId = &teamId return r } // State where the venue is located. Format: Ohio func (r ApiDraftProspects1Request) State(state interface{}) ApiDraftProspects1Request { r.state = &state return r } // Filter players by their home country func (r ApiDraftProspects1Request) Country(country interface{}) ApiDraftProspects1Request { r.country = &country return r } // A unique identifier for a player func (r ApiDraftProspects1Request) PlayerId(playerId interface{}) ApiDraftProspects1Request { r.playerId = &playerId return r } // A unique identifier for a player in the EBIS system func (r ApiDraftProspects1Request) BisPlayerId(bisPlayerId interface{}) ApiDraftProspects1Request { r.bisPlayerId = &bisPlayerId return r } func (r ApiDraftProspects1Request) Execute() (*http.Response, error) { return r.ApiService.DraftProspects1Execute(r) } /* DraftProspects1 View MLB Draft Prospects @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param year Year the player was drafted. Format: 2000 @return ApiDraftProspects1Request */ func (a *DraftAPIService) DraftProspects1(ctx context.Context, year interface{}) ApiDraftProspects1Request { return ApiDraftProspects1Request{ ApiService: a, ctx: ctx, year: year, } } // Execute executes the request func (a *DraftAPIService) DraftProspects1Execute(r ApiDraftProspects1Request) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DraftAPIService.DraftProspects1") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/api/v1/draft/prospects/{year}" localVarPath = strings.Replace(localVarPath, "{"+"year"+"}", url.PathEscape(parameterValueToString(r.year, "year")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.limit != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "", "") } if r.offset != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "", "") } if r.fields != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "") } if r.order != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "order", r.order, "", "") } if r.sortBy != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "", "") } if r.drafted != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "drafted", r.drafted, "", "") } if r.round != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "round", r.round, "", "") } if r.name != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "", "") } if r.school != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "school", r.school, "", "") } if r.position != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "position", r.position, "", "") } if r.team != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "team", r.team, "", "") } if r.teamId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "teamId", r.teamId, "", "") } if r.state != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "state", r.state, "", "") } if r.country != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "country", r.country, "", "") } if r.playerId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "playerId", r.playerId, "", "") } if r.bisPlayerId != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "bisPlayerId", r.bisPlayerId, "", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := &GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } return localVarHTTPResponse, newErr } return localVarHTTPResponse, nil } type ApiLatestDraftPicksRequest struct { ctx context.Context ApiService *DraftAPIService year interface{} fields *interface{} } // Comma delimited list of specific fields to be returned. Format: topLevelNode, childNode, attribute func (r ApiLatestDraftPicksRequest) Fields(fields interface{}) ApiLatestDraftPicksRequest { r.fields = &fields return r } func (r ApiLatestDraftPicksRequest) Execute() (*http.Response, error) { return r.ApiService.LatestDraftPicksExecute(r) } /* LatestDraftPicks Get the last drafted player and the next 5 teams up to pick @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param year Year the player was drafted. Format: 2000 @return ApiLatestDraftPicksRequest */ func (a *DraftAPIService) LatestDraftPicks(ctx context.Context, year interface{}) ApiLatestDraftPicksRequest { return ApiLatestDraftPicksRequest{ ApiService: a, ctx: ctx, year: year, } } // Execute executes the request func (a *DraftAPIService) LatestDraftPicksExecute(r ApiLatestDraftPicksRequest) (*http.Response, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile ) localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DraftAPIService.LatestDraftPicks") if err != nil { return nil, &GenericOpenAPIError{error: err.Error()} } localVarPath := localBasePath + "/api/v1/draft/{year}/latest" localVarPath = strings.Replace(localVarPath, "{"+"year"+"}", url.PathEscape(parameterValueToString(r.year, "year")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} if r.fields != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "fields", r.fields, "", "") } // to determine the Content-Type header localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) if localVarHTTPContentType != "" { localVarHeaderParams["Content-Type"] = localVarHTTPContentType } // to determine the Accept header localVarHTTPHeaderAccepts := []string{} // set Accept header localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return nil, err } localVarHTTPResponse, err := a.client.callAPI(req) if err != nil || localVarHTTPResponse == nil { return localVarHTTPResponse, err } localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) localVarHTTPResponse.Body.Close() localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) if err != nil { return localVarHTTPResponse, err } if localVarHTTPResponse.StatusCode >= 300 { newErr := &GenericOpenAPIError{ body: localVarBody, error: localVarHTTPResponse.Status, } return localVarHTTPResponse, newErr } return localVarHTTPResponse, nil }