2024-03-08 10:48:21 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"git.lehouerou.net/laurent/sorare"
|
|
|
|
"git.lehouerou.net/laurent/sorare/graphql"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
|
2024-03-25 08:40:29 +00:00
|
|
|
token := os.Getenv("JWTTOKEN")
|
|
|
|
audience := os.Getenv("JWTAUDIENCE")
|
2024-03-08 10:48:21 +00:00
|
|
|
if token == "" {
|
|
|
|
log.Fatal("No token provided")
|
|
|
|
}
|
|
|
|
if audience == "" {
|
|
|
|
log.Fatal("No audience provided")
|
|
|
|
}
|
2024-03-27 16:54:06 +00:00
|
|
|
api := sorare.New().Debug()
|
2024-03-08 10:48:21 +00:00
|
|
|
api.SetJWTToken(
|
|
|
|
graphql.JwtToken{
|
|
|
|
Token: token,
|
|
|
|
ExpiredAt: time.Time{},
|
|
|
|
},
|
|
|
|
audience,
|
|
|
|
)
|
|
|
|
|
|
|
|
ctx := context.Background()
|
|
|
|
|
2024-03-27 16:54:06 +00:00
|
|
|
//cu, err := api.Country.Get(ctx, graphql.SlugParams{Slug: "fr"})
|
|
|
|
params := make(map[string][]string)
|
|
|
|
params["0c7d5f17-7c01-4427-90b8-a736a44ea632"] = []string{"joshua-kimmich", "leon-goretzka"}
|
|
|
|
params["0d641a1d-c64a-40c9-85b0-7ddeca428abf"] = []string{"joshua-kimmich", "leon-goretzka"}
|
|
|
|
cu, err := api.Football.GamesScores.Get(
|
|
|
|
ctx,
|
|
|
|
params,
|
|
|
|
)
|
2024-03-08 10:48:21 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
2024-03-27 16:54:06 +00:00
|
|
|
for _, game := range cu {
|
|
|
|
log.Println(game.Game.Id.Value + " " + game.Player.Slug + " " + fmt.Sprintf("%s", game.Score))
|
|
|
|
}
|
2024-03-08 10:48:21 +00:00
|
|
|
}
|