Add separate examples for Client.

api/rm-interface
Icedream 2016-06-26 12:02:53 +02:00
parent 8f5d035e92
commit 5418ecc69e
1 changed files with 22 additions and 0 deletions

View File

@ -25,3 +25,25 @@ func Example() {
fmt.Println(season.Id, season.Caption) fmt.Println(season.Id, season.Caption)
} }
} }
func ExampleClient() {
// Create client
client := footballdata.NewClient(http.DefaultClient)
/* Do something with the client instance... */
seasons, err := client.SoccerSeasons().Do()
if err != nil {
panic(err)
}
for _, season := range seasons {
fmt.Println(season.Id, season.Caption)
}
}
func ExampleClient_withToken() {
// Create client
client := footballdata.NewClient(http.DefaultClient)
// Tell it to use our API token
client.SetToken("<insert your api token here>")
}