Implement "timeFrameStart" and "timeFrameEnd" filters for fixtures.
parent
eeff7fb54b
commit
daa2878117
|
@ -13,12 +13,28 @@ func (r CompetitionFixturesRequest) Matchday(matchday uint16) CompetitionFixture
|
|||
return r
|
||||
}
|
||||
|
||||
// TimeFrame modifies the request to specify a specific time frame.
|
||||
// TimeFrame modifies the request to specify a specific relative time frame.
|
||||
func (r CompetitionFixturesRequest) TimeFrame(timeframe time.Duration) CompetitionFixturesRequest {
|
||||
r.urlValues.Set("timeFrame", durationToTimeFrame(timeframe))
|
||||
return r
|
||||
}
|
||||
|
||||
// TimeFrameStart modifies the request to specify the beginning of the time frame filter for the returned results.
|
||||
//
|
||||
// Only the year, month and day of the Time value will be used for the request.
|
||||
func (r CompetitionFixturesRequest) TimeFrameStart(date time.Time) CompetitionFixturesRequest {
|
||||
r.urlValues.Set("timeFrameStart", date.Format(timeFrameLayout))
|
||||
return r
|
||||
}
|
||||
|
||||
// TimeFrameEnd modifies the request to specify the end of the time frame filter for the returned results.
|
||||
//
|
||||
// Only the year, month and day of the Time value will be used for the request.
|
||||
func (r CompetitionFixturesRequest) TimeFrameStart(date time.Time) CompetitionFixturesRequest {
|
||||
r.urlValues.Set("timeFrameEnd", date.Format(timeFrameLayout))
|
||||
return r
|
||||
}
|
||||
|
||||
// Do executes the request.
|
||||
func (r CompetitionFixturesRequest) Do() (s FixtureList, err error) {
|
||||
d, _, err := r.doJson("GET")
|
||||
|
|
|
@ -7,12 +7,28 @@ import (
|
|||
|
||||
type FixturesRequest struct{ request }
|
||||
|
||||
// TimeFrame modifies the request to specify a specific time frame.
|
||||
// TimeFrame modifies the request to specify a specific relative time frame.
|
||||
func (r FixturesRequest) TimeFrame(timeframe time.Duration) FixturesRequest {
|
||||
r.urlValues.Set("timeFrame", durationToTimeFrame(timeframe))
|
||||
return r
|
||||
}
|
||||
|
||||
// TimeFrameStart modifies the request to specify the beginning of the time frame filter for the returned results.
|
||||
//
|
||||
// Only the year, month and day of the Time value will be used for the request.
|
||||
func (r FixturesRequest) TimeFrameStart(date time.Time) FixturesRequest {
|
||||
r.urlValues.Set("timeFrameStart", date.Format(timeFrameLayout))
|
||||
return r
|
||||
}
|
||||
|
||||
// TimeFrameEnd modifies the request to specify the end of the time frame filter for the returned results.
|
||||
//
|
||||
// Only the year, month and day of the Time value will be used for the request.
|
||||
func (r FixturesRequest) TimeFrameStart(date time.Time) FixturesRequest {
|
||||
r.urlValues.Set("timeFrameEnd", date.Format(timeFrameLayout))
|
||||
return r
|
||||
}
|
||||
|
||||
// League modifies the request to specify a list of leagues by their code.
|
||||
func (r FixturesRequest) League(leagueCodes ...string) FixturesRequest {
|
||||
r.urlValues.Set("league", strings.Join(leagueCodes, ","))
|
||||
|
|
Loading…
Reference in New Issue