From da774aa9103c1e8806e06bff2c2abbb1d7e6ccb0 Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Tue, 16 Apr 2024 15:01:11 +0400 Subject: [PATCH] upgrade dependencies --- cmd/console/main.go | 53 +++++++++++++++++++++++++++++++++++---------- go.mod | 12 +++++----- go.sum | 12 ++++++++++ 3 files changed, 59 insertions(+), 18 deletions(-) diff --git a/cmd/console/main.go b/cmd/console/main.go index dc6094c..2046b47 100644 --- a/cmd/console/main.go +++ b/cmd/console/main.go @@ -2,7 +2,6 @@ package main import ( "context" - "fmt" "log" "os" "time" @@ -21,7 +20,7 @@ func main() { if audience == "" { log.Fatal("No audience provided") } - api := sorare.New().Debug() + api := sorare.New() api.SetJWTToken( graphql.JwtToken{ Token: token, @@ -32,18 +31,48 @@ func main() { ctx := context.Background() - //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, - ) + si, err := api.ShopItems.Get(ctx, sorare.ShopItemsParams{ + Types: []sorare.ShopItemType{sorare.ShopItemTypeLevelUp}, + UnlockedOnly: true, + }) if err != nil { panic(err) } - for _, game := range cu { - log.Println(game.Game.Id.Value + " " + game.Player.Slug + " " + fmt.Sprintf("%s", game.Score)) + for _, item := range si { + log.Printf( + "%s %d %d %s %s", + item.TypeName, + item.ShopItemInterface.MyBalance, + item.ShopItemInterface.Price, + item.LevelUpShopItem.Rarity, + time.Until(item.ShopItemInterface.MyLimitResetAt).String(), + ) } + + cu, err := api.Users.CurrentUser.Get(ctx, graphql.EmptyParams{}) + if err != nil { + panic(err) + } + log.Printf("%d", cu.CoinBalance) + // cu, err := api.Users.FootballCards("gigiz22").Get(ctx, football.CardsParams{ + // Rarities: []types.Rarity{types.RarityLimited}, + // }) + // if err != nil { + // panic(err) + // } + // sort.Slice(cu, func(i, j int) bool { + // return cu[i].XpNeededForNextGrade-cu[i].Xp > cu[j].XpNeededForNextGrade-cu[j].Xp + // }) + // for _, card := range cu { + // log.Printf( + // "%60s %2d %6d %6d %6d (%d/%d)", + // card.Token.Name, + // card.Grade, + // card.Xp-card.XpNeededForCurrentGrade, + // card.Xp, + // card.XpNeededForNextGrade-card.Xp, + // card.LevelUpAppliedCount, + // card.MaxLevelUpAppliedCount, + // ) + // } } diff --git a/go.mod b/go.mod index 000de46..8a5a6db 100644 --- a/go.mod +++ b/go.mod @@ -9,17 +9,17 @@ require ( github.com/llehouerou/go-graphql-client v0.9.7 github.com/pkg/errors v0.9.1 github.com/rs/zerolog v1.32.0 - github.com/shopspring/decimal v1.3.1 + github.com/shopspring/decimal v1.4.0 github.com/xlzd/gotp v0.1.0 - golang.org/x/crypto v0.21.0 + golang.org/x/crypto v0.22.0 golang.org/x/time v0.5.0 ) require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - golang.org/x/net v0.21.0 // indirect - golang.org/x/sys v0.18.0 // indirect - nhooyr.io/websocket v1.8.10 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/sys v0.19.0 // indirect + nhooyr.io/websocket v1.8.11 // indirect ) diff --git a/go.sum b/go.sum index a519f1b..258498d 100644 --- a/go.sum +++ b/go.sum @@ -22,6 +22,8 @@ github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovk github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -30,19 +32,29 @@ github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= +github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po= github.com/xlzd/gotp v0.1.0/go.mod h1:ndLJ3JKzi3xLmUProq4LLxCuECL93dG9WASNLpHz8qg= golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= +nhooyr.io/websocket v1.8.11 h1:f/qXNc2/3DpoSZkHt1DQu6rj4zGC8JmkkLkWss0MgN0= +nhooyr.io/websocket v1.8.11/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c=