/
gen_video_status.go
57 lines (47 loc) · 1.54 KB
/
gen_video_status.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
package baller
import (
"net/url"
)
type VideoStatusOptions struct {
LeagueID string
GameDate string
}
type VideoStatusResponse struct {
VideoStatus []VideoStatusVideoStatus
}
func (c *Client) VideoStatus(options *VideoStatusOptions) (*VideoStatusResponse, error) {
var (
q = url.Values{}
url = baseURL + "videostatus?"
dest VideoStatusResponse
res result
)
q.Set("LeagueID", encodeString(options.LeagueID))
q.Set("GameDate", encodeString(options.GameDate))
if err := c.do(url+q.Encode(), &res); err != nil {
return nil, err
}
err := res.unmarshalResultSets(map[string]interface{}{
"VideoStatus": &dest.VideoStatus,
})
if err != nil {
return nil, err
}
return &dest, nil
}
type VideoStatusVideoStatus struct {
GameID string `header:"GAME_ID"`
GameDate string `header:"GAME_DATE"`
VisitorTeamID int `header:"VISITOR_TEAM_ID"`
VisitorTeamCity string `header:"VISITOR_TEAM_CITY"`
VisitorTeamName string `header:"VISITOR_TEAM_NAME"`
VisitorTeamAbbreviation string `header:"VISITOR_TEAM_ABBREVIATION"`
HomeTeamID int `header:"HOME_TEAM_ID"`
HomeTeamCity string `header:"HOME_TEAM_CITY"`
HomeTeamName string `header:"HOME_TEAM_NAME"`
HomeTeamAbbreviation string `header:"HOME_TEAM_ABBREVIATION"`
GameStatus int `header:"GAME_STATUS"`
GameStatusText string `header:"GAME_STATUS_TEXT"`
IsAvailable int `header:"IS_AVAILABLE"`
PtXyzAvailable int `header:"PT_XYZ_AVAILABLE"`
}