-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_common_team_roster.go
74 lines (63 loc) · 1.91 KB
/
gen_common_team_roster.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package baller
import (
"net/url"
)
type CommonTeamRosterOptions struct {
TeamID int
LeagueID string
Season string
}
type CommonTeamRosterResponse struct {
CommonTeamRoster []CommonTeamRosterCommonTeamRoster
Coaches []CommonTeamRosterCoaches
}
func (c *Client) CommonTeamRoster(options *CommonTeamRosterOptions) (*CommonTeamRosterResponse, error) {
var (
q = url.Values{}
url = baseURL + "commonteamroster?"
dest CommonTeamRosterResponse
res result
)
q.Set("TeamID", encodeInt(options.TeamID))
q.Set("LeagueID", encodeString(options.LeagueID))
q.Set("Season", encodeString(options.Season))
if err := c.do(url+q.Encode(), &res); err != nil {
return nil, err
}
err := res.unmarshalResultSets(map[string]interface{}{
"CommonTeamRoster": &dest.CommonTeamRoster,
"Coaches": &dest.Coaches,
})
if err != nil {
return nil, err
}
return &dest, nil
}
type CommonTeamRosterCommonTeamRoster struct {
Teamid int `header:"TeamID"`
Season string `header:"SEASON"`
Leagueid string `header:"LeagueID"`
Player string `header:"PLAYER"`
Num string `header:"NUM"`
Position string `header:"POSITION"`
Height string `header:"HEIGHT"`
Weight string `header:"WEIGHT"`
BirthDate string `header:"BIRTH_DATE"`
Age float32 `header:"AGE"`
Exp string `header:"EXP"`
School string `header:"SCHOOL"`
PlayerID int `header:"PLAYER_ID"`
}
type CommonTeamRosterCoaches struct {
TeamID int `header:"TEAM_ID"`
Season string `header:"SEASON"`
CoachID string `header:"COACH_ID"`
FirstName string `header:"FIRST_NAME"`
LastName string `header:"LAST_NAME"`
CoachName string `header:"COACH_NAME"`
CoachCode string `header:"COACH_CODE"`
IsAssistant float32 `header:"IS_ASSISTANT"`
CoachType string `header:"COACH_TYPE"`
School string `header:"SCHOOL"`
SortSequence float32 `header:"SORT_SEQUENCE"`
}