41 lines
628 B
Go
41 lines
628 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"fmt"
|
||
|
"log"
|
||
|
"os"
|
||
|
"time"
|
||
|
|
||
|
"git.lehouerou.net/laurent/sorare"
|
||
|
"git.lehouerou.net/laurent/sorare/graphql"
|
||
|
)
|
||
|
|
||
|
func main() {
|
||
|
|
||
|
token := os.Getenv("SORARE_TOKEN")
|
||
|
audience := os.Getenv("SORARE_AUDIENCE")
|
||
|
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)
|
||
|
}
|