2016-06-12 22:39:00 +00:00
|
|
|
package footballdata
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
type FixtureRequest struct{ request }
|
|
|
|
|
2016-06-25 21:22:52 +00:00
|
|
|
// Head2Head modifies the request to specify the number of former games to be analyzed (normally 10).
|
2016-06-12 22:39:00 +00:00
|
|
|
func (r FixtureRequest) Head2Head(num uint16) FixtureRequest {
|
2016-06-25 10:15:58 +00:00
|
|
|
r.urlValues.Set("head2head", fmt.Sprintf("%d", num))
|
2016-06-12 22:39:00 +00:00
|
|
|
return r
|
|
|
|
}
|
|
|
|
|
2016-06-25 21:22:52 +00:00
|
|
|
// Do executes the request.
|
2016-06-12 22:39:00 +00:00
|
|
|
func (r FixtureRequest) Do() (s Fixture, err error) {
|
|
|
|
d, _, err := r.doJson("GET")
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
err = d.Decode(&s)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2016-06-26 10:24:59 +00:00
|
|
|
// Fixture prepares a request to fetch the fixtures of a soccer season.
|
2016-06-26 10:57:14 +00:00
|
|
|
func (c *Client) Fixture(id uint64) FixtureRequest {
|
2016-06-13 17:47:09 +00:00
|
|
|
return FixtureRequest{c.req("fixture/%d", id)}
|
2016-06-12 22:39:00 +00:00
|
|
|
}
|