-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstandingsparams.go
60 lines (52 loc) · 1.63 KB
/
standingsparams.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
package gonhl
import "time"
func NewStandingsParams() *StandingsParams {
return &StandingsParams{
season: -1,
}
}
func parseStandingsParams(params *StandingsParams) map[string]string {
query := map[string]string{}
expand := expandQuery("standings", map[string]bool{
"record": params.record,
})
query["expand"] = expand
if params.season != -1 {
query["season"] = createSeasonString(params.season)
}
if params.date != nil {
query["date"] = CreateStringFromDate(*params.date)
}
return query
}
type StandingsParams struct {
season int
date *time.Time
record bool
standingsType string
}
// ShowDetailedRecords makes response include detailed information for each team.
// This includes home and away records, record in shootouts, last ten games,
// and split head-to-head records against divisions and conferences.
func (sp *StandingsParams) ShowDetailedRecords() *StandingsParams {
sp.record = true
return sp
}
// SetSeason specifies which season to use in response (use the year season started).
// The response will represent the standings for that season.
func (sp *StandingsParams) SetSeason(season int) *StandingsParams {
sp.season = season
return sp
}
// SetDate specifies which date to use in response.
// The response will represent the standings on that date.
func (sp *StandingsParams) SetDate(date time.Time) *StandingsParams {
sp.date = &date
return sp
}
// SetStandingsType specifies which standing type to use.
// Retrieve Standings Types from GetStandingsTypes endpoint
func (sp *StandingsParams) SetStandingsType(standingsType string) *StandingsParams {
sp.standingsType = standingsType
return sp
}