go-footballdata/req_team.go

27 lines
471 B
Go
Raw Normal View History

2016-06-12 22:39:00 +00:00
package footballdata
type TeamRequest struct {
request
id uint64
}
// Do executes the request.
2016-06-12 22:39:00 +00:00
func (r TeamRequest) Do() (s Team, err error) {
d, _, err := r.doJson("GET")
if err != nil {
return
}
err = d.Decode(&s)
if err != nil {
// Fill up data not returned by the server
s.Id = r.id
}
return
}
// Team prepares a request to fetch a team's information.
func (c *Client) Team(id uint64) TeamRequest {
2016-06-13 17:47:09 +00:00
return TeamRequest{c.req("teams/%d", id), id}
2016-06-12 22:39:00 +00:00
}