sorare/cmd/console/main.go

41 lines
620 B
Go
Raw Normal View History

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")
}
api := sorare.New()
api.SetJWTToken(
graphql.JwtToken{
Token: token,
ExpiredAt: time.Time{},
},
audience,
)
ctx := context.Background()
cu, err := api.Country.Get(ctx, graphql.SlugParams{Slug: "fr"})
if err != nil {
panic(err)
}
fmt.Println(cu)
}