tests in console

This commit is contained in:
Laurent Le Houerou 2024-06-06 09:52:09 +04:00
parent 57d157df6f
commit 2e1b00f306

View File

@ -31,39 +31,48 @@ func main() {
ctx := context.Background() ctx := context.Background()
si, err := api.ShopItems.Get(ctx, sorare.ShopItemsParams{ p, err := api.Football.Player.Get(ctx, graphql.SlugParams{Slug: "joshua-kimmich"})
Types: []sorare.ShopItemType{sorare.ShopItemTypeLevelUp},
UnlockedOnly: true,
})
if err != nil { if err != nil {
panic(err) panic(err)
} }
for _, item := range si { log.Printf("%+v", p)
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{}) // si, err := api.ShopItems.Get(ctx, sorare.ShopItemsParams{
if err != nil { // Types: []sorare.ShopItemType{sorare.ShopItemTypeLevelUp},
panic(err) // UnlockedOnly: true,
} // })
log.Printf("%d", cu.CoinBalance) // if err != nil {
// cu, err := api.Users.FootballCards("gigiz22").Get(ctx, football.CardsParams{ // 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}, // Rarities: []types.Rarity{types.RarityLimited},
// }) // })
// if err != nil { // if err != nil {
// panic(err) // panic(err)
// } // }
// sort.Slice(cu, func(i, j int) bool { // sort.Slice(cards, func(i, j int) bool {
// return cu[i].XpNeededForNextGrade-cu[i].Xp > cu[j].XpNeededForNextGrade-cu[j].Xp // 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( // log.Printf(
// "%60s %2d %6d %6d %6d (%d/%d)", // "%60s %2d %6d %6d %6d (%d/%d)",
// card.Token.Name, // card.Token.Name,