-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
40 lines (34 loc) · 753 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"fmt"
"os"
"strconv"
"github.com/vbonduro/f1-fantasy-api-go/pkg/f1fantasy"
)
func main() {
leagueId, _ := strconv.Atoi(os.Getenv("F1_LEAGUE"))
user := os.Getenv("F1_USER")
password := os.Getenv("F1_PASSWORD")
api, err := f1fantasy.NewAuthenticatedApi(user, password)
if err != nil {
panic(err)
}
fmt.Println("\nPlayers")
players, err := api.GetPlayers()
if err != nil {
panic(err)
}
fmt.Printf("%v\n", players)
fmt.Println("\nLeaderboard")
leaderboard, err := api.GetLeagueLeaderboard(leagueId)
if err != nil {
panic(err)
}
fmt.Printf("%v\n", leaderboard)
fmt.Println("\nCircuits")
circuits, err := f1fantasy.NewApi().GetCircuits()
if err != nil {
panic(err)
}
fmt.Printf("%v\n", circuits)
}