/
gen_boxscore_four_factors.go
344 lines (320 loc) · 13.6 KB
/
gen_boxscore_four_factors.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
package baller
import (
"net/url"
)
type BoxscoreFourFactorsOptions struct {
GameID string
StartPeriod int
EndPeriod int
StartRange int
EndRange int
RangeType int
}
type BoxscoreFourFactorsResponse struct {
GameSummary []BoxscoreFourFactorsGameSummary
LineScore []BoxscoreFourFactorsLineScore
SeasonSeries []BoxscoreFourFactorsSeasonSeries
LastMeeting []BoxscoreFourFactorsLastMeeting
PlayerStats []BoxscoreFourFactorsPlayerStats
TeamStats []BoxscoreFourFactorsTeamStats
OtherStats []BoxscoreFourFactorsOtherStats
Officials []BoxscoreFourFactorsOfficials
GameInfo []BoxscoreFourFactorsGameInfo
InactivePlayers []BoxscoreFourFactorsInactivePlayers
AvailableVideo []BoxscoreFourFactorsAvailableVideo
PlayerTrack []BoxscoreFourFactorsPlayerTrack
PlayerTrackTeam []BoxscoreFourFactorsPlayerTrackTeam
SqlPlayersFourFactors []BoxscoreFourFactorsSqlPlayersFourFactors
SqlTeamsFourFactors []BoxscoreFourFactorsSqlTeamsFourFactors
}
func (c *Client) BoxscoreFourFactors(options *BoxscoreFourFactorsOptions) (*BoxscoreFourFactorsResponse, error) {
var (
q = url.Values{}
url = baseURL + "boxscorefourfactors?"
dest BoxscoreFourFactorsResponse
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{}{
"GameSummary": &dest.GameSummary,
"LineScore": &dest.LineScore,
"SeasonSeries": &dest.SeasonSeries,
"LastMeeting": &dest.LastMeeting,
"PlayerStats": &dest.PlayerStats,
"TeamStats": &dest.TeamStats,
"OtherStats": &dest.OtherStats,
"Officials": &dest.Officials,
"GameInfo": &dest.GameInfo,
"InactivePlayers": &dest.InactivePlayers,
"AvailableVideo": &dest.AvailableVideo,
"PlayerTrack": &dest.PlayerTrack,
"PlayerTrackTeam": &dest.PlayerTrackTeam,
"sqlPlayersFourFactors": &dest.SqlPlayersFourFactors,
"sqlTeamsFourFactors": &dest.SqlTeamsFourFactors,
})
if err != nil {
return nil, err
}
return &dest, nil
}
type BoxscoreFourFactorsGameSummary struct {
GameDateEst string `header:"GAME_DATE_EST"`
GameSequence int `header:"GAME_SEQUENCE"`
GameID string `header:"GAME_ID"`
GameStatusID int `header:"GAME_STATUS_ID"`
GameStatusText string `header:"GAME_STATUS_TEXT"`
Gamecode string `header:"GAMECODE"`
HomeTeamID int `header:"HOME_TEAM_ID"`
VisitorTeamID int `header:"VISITOR_TEAM_ID"`
Season string `header:"SEASON"`
LivePeriod int `header:"LIVE_PERIOD"`
LivePcTime string `header:"LIVE_PC_TIME"`
NatlTvBroadcasterAbbreviation string `header:"NATL_TV_BROADCASTER_ABBREVIATION"`
LivePeriodTimeBcast string `header:"LIVE_PERIOD_TIME_BCAST"`
WhStatus int `header:"WH_STATUS"`
}
type BoxscoreFourFactorsLineScore struct {
GameDateEst string `header:"GAME_DATE_EST"`
GameSequence int `header:"GAME_SEQUENCE"`
GameID string `header:"GAME_ID"`
TeamID int `header:"TEAM_ID"`
TeamAbbreviation string `header:"TEAM_ABBREVIATION"`
TeamCityName string `header:"TEAM_CITY_NAME"`
TeamWinsLosses string `header:"TEAM_WINS_LOSSES"`
PtsQtr1 int `header:"PTS_QTR1"`
PtsQtr2 int `header:"PTS_QTR2"`
PtsQtr3 int `header:"PTS_QTR3"`
PtsQtr4 int `header:"PTS_QTR4"`
PtsOt1 int `header:"PTS_OT1"`
PtsOt2 int `header:"PTS_OT2"`
PtsOt3 int `header:"PTS_OT3"`
PtsOt4 int `header:"PTS_OT4"`
PtsOt5 int `header:"PTS_OT5"`
PtsOt6 int `header:"PTS_OT6"`
PtsOt7 int `header:"PTS_OT7"`
PtsOt8 int `header:"PTS_OT8"`
PtsOt9 int `header:"PTS_OT9"`
PtsOt10 int `header:"PTS_OT10"`
Pts int `header:"PTS"`
}
type BoxscoreFourFactorsSeasonSeries struct {
GameID string `header:"GAME_ID"`
HomeTeamID int `header:"HOME_TEAM_ID"`
VisitorTeamID int `header:"VISITOR_TEAM_ID"`
GameDateEst string `header:"GAME_DATE_EST"`
HomeTeamWins int `header:"HOME_TEAM_WINS"`
HomeTeamLosses int `header:"HOME_TEAM_LOSSES"`
SeriesLeader string `header:"SERIES_LEADER"`
}
type BoxscoreFourFactorsLastMeeting struct {
GameID string `header:"GAME_ID"`
LastGameID string `header:"LAST_GAME_ID"`
LastGameDateEst string `header:"LAST_GAME_DATE_EST"`
LastGameHomeTeamID int `header:"LAST_GAME_HOME_TEAM_ID"`
LastGameHomeTeamCity string `header:"LAST_GAME_HOME_TEAM_CITY"`
LastGameHomeTeamName string `header:"LAST_GAME_HOME_TEAM_NAME"`
LastGameHomeTeamAbbreviation string `header:"LAST_GAME_HOME_TEAM_ABBREVIATION"`
LastGameHomeTeamPoints int `header:"LAST_GAME_HOME_TEAM_POINTS"`
LastGameVisitorTeamID int `header:"LAST_GAME_VISITOR_TEAM_ID"`
LastGameVisitorTeamCity string `header:"LAST_GAME_VISITOR_TEAM_CITY"`
LastGameVisitorTeamName string `header:"LAST_GAME_VISITOR_TEAM_NAME"`
LastGameVisitorTeamCity1 string `header:"LAST_GAME_VISITOR_TEAM_CITY1"`
LastGameVisitorTeamPoints int `header:"LAST_GAME_VISITOR_TEAM_POINTS"`
}
type BoxscoreFourFactorsPlayerStats 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"`
Fgm int `header:"FGM"`
Fga int `header:"FGA"`
FgPct float32 `header:"FG_PCT"`
Fg3m int `header:"FG3M"`
Fg3a int `header:"FG3A"`
Fg3Pct float32 `header:"FG3_PCT"`
Ftm int `header:"FTM"`
Fta int `header:"FTA"`
FtPct float32 `header:"FT_PCT"`
Oreb int `header:"OREB"`
Dreb int `header:"DREB"`
Reb int `header:"REB"`
Ast int `header:"AST"`
Stl int `header:"STL"`
Blk int `header:"BLK"`
To int `header:"TO"`
Pf int `header:"PF"`
Pts int `header:"PTS"`
PlusMinus float32 `header:"PLUS_MINUS"`
}
type BoxscoreFourFactorsTeamStats 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"`
Fgm int `header:"FGM"`
Fga int `header:"FGA"`
FgPct float32 `header:"FG_PCT"`
Fg3m int `header:"FG3M"`
Fg3a int `header:"FG3A"`
Fg3Pct float32 `header:"FG3_PCT"`
Ftm int `header:"FTM"`
Fta int `header:"FTA"`
FtPct float32 `header:"FT_PCT"`
Oreb int `header:"OREB"`
Dreb int `header:"DREB"`
Reb int `header:"REB"`
Ast int `header:"AST"`
Stl int `header:"STL"`
Blk int `header:"BLK"`
To int `header:"TO"`
Pf int `header:"PF"`
Pts int `header:"PTS"`
PlusMinus float32 `header:"PLUS_MINUS"`
}
type BoxscoreFourFactorsOtherStats struct {
LeagueID string `header:"LEAGUE_ID"`
SeasonID string `header:"SEASON_ID"`
TeamID int `header:"TEAM_ID"`
TeamAbbreviation string `header:"TEAM_ABBREVIATION"`
TeamCity string `header:"TEAM_CITY"`
PtsPaint int `header:"PTS_PAINT"`
Pts2ndChance int `header:"PTS_2ND_CHANCE"`
PtsFb int `header:"PTS_FB"`
LargestLead int `header:"LARGEST_LEAD"`
LeadChanges int `header:"LEAD_CHANGES"`
TimesTied int `header:"TIMES_TIED"`
}
type BoxscoreFourFactorsOfficials struct {
OfficialID int `header:"OFFICIAL_ID"`
FirstName string `header:"FIRST_NAME"`
LastName string `header:"LAST_NAME"`
JerseyNum string `header:"JERSEY_NUM"`
}
type BoxscoreFourFactorsGameInfo struct {
GameDate string `header:"GAME_DATE"`
Attendance int `header:"ATTENDANCE"`
GameTime string `header:"GAME_TIME"`
}
type BoxscoreFourFactorsInactivePlayers struct {
PlayerID int `header:"PLAYER_ID"`
FirstName string `header:"FIRST_NAME"`
LastName string `header:"LAST_NAME"`
JerseyNum string `header:"JERSEY_NUM"`
TeamID int `header:"TEAM_ID"`
TeamCity string `header:"TEAM_CITY"`
TeamName string `header:"TEAM_NAME"`
TeamAbbreviation string `header:"TEAM_ABBREVIATION"`
}
type BoxscoreFourFactorsAvailableVideo struct {
GameID string `header:"GAME_ID"`
VideoAvailableFlag int `header:"VIDEO_AVAILABLE_FLAG"`
PtAvailable int `header:"PT_AVAILABLE"`
}
type BoxscoreFourFactorsPlayerTrack 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"`
Spd float32 `header:"SPD"`
Dist float32 `header:"DIST"`
Orbc int `header:"ORBC"`
Drbc int `header:"DRBC"`
Rbc int `header:"RBC"`
Tchs int `header:"TCHS"`
Sast int `header:"SAST"`
Ftast int `header:"FTAST"`
Pass int `header:"PASS"`
Ast int `header:"AST"`
Cfgm int `header:"CFGM"`
Cfga int `header:"CFGA"`
CfgPct float32 `header:"CFG_PCT"`
Ufgm int `header:"UFGM"`
Ufga int `header:"UFGA"`
UfgPct float32 `header:"UFG_PCT"`
FgPct float32 `header:"FG_PCT"`
Dfgm int `header:"DFGM"`
Dfga int `header:"DFGA"`
DfgPct float32 `header:"DFG_PCT"`
}
type BoxscoreFourFactorsPlayerTrackTeam struct {
GameID string `header:"GAME_ID"`
TeamID int `header:"TEAM_ID"`
TeamNickname string `header:"TEAM_NICKNAME"`
TeamAbbreviation string `header:"TEAM_ABBREVIATION"`
TeamCity string `header:"TEAM_CITY"`
Min string `header:"MIN"`
Dist float32 `header:"DIST"`
Orbc int `header:"ORBC"`
Drbc int `header:"DRBC"`
Rbc int `header:"RBC"`
Tchs int `header:"TCHS"`
Sast int `header:"SAST"`
Ftast int `header:"FTAST"`
Pass int `header:"PASS"`
Ast int `header:"AST"`
Cfgm int `header:"CFGM"`
Cfga int `header:"CFGA"`
CfgPct float32 `header:"CFG_PCT"`
Ufgm int `header:"UFGM"`
Ufga int `header:"UFGA"`
UfgPct float32 `header:"UFG_PCT"`
FgPct float32 `header:"FG_PCT"`
Dfgm int `header:"DFGM"`
Dfga int `header:"DFGA"`
DfgPct float32 `header:"DFG_PCT"`
}
type BoxscoreFourFactorsSqlPlayersFourFactors 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 BoxscoreFourFactorsSqlTeamsFourFactors 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"`
}