Add separate examples for Client.
parent
8f5d035e92
commit
5418ecc69e
|
@ -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>")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue