/
gen_boxscore_four_factors_v2.go
87 lines (76 loc) · 2.75 KB
/
gen_boxscore_four_factors_v2.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
75
76
77
78
79
80
81
82
83
84
85
86
87
package baller
import (
"net/url"
)
type BoxscoreFourFactorsV2Options struct {
GameID string
StartPeriod int
EndPeriod int
StartRange int
EndRange int
RangeType int
}
type BoxscoreFourFactorsV2Response struct {
SqlPlayersFourFactors []BoxscoreFourFactorsV2SqlPlayersFourFactors
SqlTeamsFourFactors []BoxscoreFourFactorsV2SqlTeamsFourFactors
}
func (c *Client) BoxscoreFourFactorsV2(options *BoxscoreFourFactorsV2Options) (*BoxscoreFourFactorsV2Response, error) {
var (
q = url.Values{}
url = baseURL + "boxscorefourfactorsv2?"
dest BoxscoreFourFactorsV2Response
res result
)
q.Set("GameID", encodeString(options.GameID))
q.Set("StartPeriod", encodeInt(options.StartPeriod))
q.Set("EndPeriod", encodeInt(options.EndPeriod))
q.Set("StartRange", encodeInt(options.StartRange))
q.Set("EndRange", encodeInt(options.EndRange))
q.Set("RangeType", encodeInt(options.RangeType))
if err := c.do(url+q.Encode(), &res); err != nil {
return nil, err
}
err := res.unmarshalResultSets(map[string]interface{}{
"sqlPlayersFourFactors": &dest.SqlPlayersFourFactors,
"sqlTeamsFourFactors": &dest.SqlTeamsFourFactors,
})
if err != nil {
return nil, err
}
return &dest, nil
}
type BoxscoreFourFactorsV2SqlPlayersFourFactors struct {
GameID string `header:"GAME_ID"`
TeamID int `header:"TEAM_ID"`
TeamAbbreviation string `header:"TEAM_ABBREVIATION"`
TeamCity string `header:"TEAM_CITY"`
PlayerID int `header:"PLAYER_ID"`
PlayerName string `header:"PLAYER_NAME"`
StartPosition string `header:"START_POSITION"`
Comment string `header:"COMMENT"`
Min string `header:"MIN"`
EfgPct float32 `header:"EFG_PCT"`
FtaRate float32 `header:"FTA_RATE"`
TmTovPct float32 `header:"TM_TOV_PCT"`
OrebPct float32 `header:"OREB_PCT"`
OppEfgPct float32 `header:"OPP_EFG_PCT"`
OppFtaRate float32 `header:"OPP_FTA_RATE"`
OppTovPct float32 `header:"OPP_TOV_PCT"`
OppOrebPct float32 `header:"OPP_OREB_PCT"`
}
type BoxscoreFourFactorsV2SqlTeamsFourFactors struct {
GameID string `header:"GAME_ID"`
TeamID int `header:"TEAM_ID"`
TeamName string `header:"TEAM_NAME"`
TeamAbbreviation string `header:"TEAM_ABBREVIATION"`
TeamCity string `header:"TEAM_CITY"`
Min string `header:"MIN"`
EfgPct float32 `header:"EFG_PCT"`
FtaRate float32 `header:"FTA_RATE"`
TmTovPct float32 `header:"TM_TOV_PCT"`
OrebPct float32 `header:"OREB_PCT"`
OppEfgPct float32 `header:"OPP_EFG_PCT"`
OppFtaRate float32 `header:"OPP_FTA_RATE"`
OppTovPct float32 `header:"OPP_TOV_PCT"`
OppOrebPct float32 `header:"OPP_OREB_PCT"`
}