From 2e1b00f3069f06a31d3b7cf8dc88bd8bfa0f1bb3 Mon Sep 17 00:00:00 2001 From: Laurent Le Houerou Date: Thu, 6 Jun 2024 09:52:09 +0400 Subject: [PATCH] tests in console --- cmd/console/main.go | 55 ++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 23 deletions(-) diff --git a/cmd/console/main.go b/cmd/console/main.go index 2046b47..e303032 100644 --- a/cmd/console/main.go +++ b/cmd/console/main.go @@ -31,39 +31,48 @@ func main() { ctx := context.Background() - si, err := api.ShopItems.Get(ctx, sorare.ShopItemsParams{ - Types: []sorare.ShopItemType{sorare.ShopItemTypeLevelUp}, - UnlockedOnly: true, - }) + p, err := api.Football.Player.Get(ctx, graphql.SlugParams{Slug: "joshua-kimmich"}) if err != nil { panic(err) } - 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(), - ) - } + log.Printf("%+v", p) - 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{ + // si, err := api.ShopItems.Get(ctx, sorare.ShopItemsParams{ + // Types: []sorare.ShopItemType{sorare.ShopItemTypeLevelUp}, + // UnlockedOnly: true, + // }) + // if err != nil { + // panic(err) + // } + // 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) + // cards, 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 + // sort.Slice(cards, func(i, j int) bool { + // return cards[i].XpNeededForNextGrade-cards[i].Xp > cards[j].XpNeededForNextGrade-cards[j].Xp // }) - // for _, card := range cu { + // for _, card := range cards { + // if !card.InSeasonEligible { + // continue + // } // log.Printf( // "%60s %2d %6d %6d %6d (%d/%d)", // card.Token.Name,