go-footballdata/example_test.go

28 lines
481 B
Go
Raw Normal View History

2016-06-12 22:39:00 +00:00
package footballdata_test
import (
"fmt"
"net/http"
"github.com/icedream/go-footballdata"
)
func Example() {
// Create client
client := footballdata.NewClient(http.DefaultClient)
// Tell it to use our API token
client.AuthToken = "<insert your api token here>"
// Get list of seasons...
seasons, err := client.SoccerSeasons().Do()
if err != nil {
panic(err)
}
// ...and print them
for _, season := range seasons {
fmt.Println(season.Id, season.Caption)
}
}