sorare/football/card.go

49 lines
2.2 KiB
Go

package football
import (
"github.com/shopspring/decimal"
"git.lehouerou.net/laurent/sorare/graphql"
"git.lehouerou.net/laurent/sorare/tokens"
"git.lehouerou.net/laurent/sorare/types"
)
type Card struct {
Token tokens.Token `graphql:"token"`
Power decimal.Decimal `graphql:"power"`
PowerMalusAfterTransfer decimal.Decimal `graphql:"powerMalusAfterTransfer"`
RivalsPower decimal.Decimal `graphql:"rivalsPower"`
Grade int `graphql:"grade"`
GradeAfterTransfer int `graphql:"gradeAfterTransfer"`
Xp int `graphql:"xp"`
XpAfterTransfer int `graphql:"xpAfterTransfer"`
XpNeededForNextGrade int `graphql:"xpNeededForNextGrade"`
XpNeededForCurrentGrade int `graphql:"xpNeededForCurrentGrade"`
InSeasonEligible bool `graphql:"inSeasonEligible"`
LevelUpAppliedCount int `graphql:"levelUpAppliedCount"`
MaxLevelUpAppliedCount int `graphql:"maxLevelUpAppliedCount"`
}
type CardsParams struct {
Age *int `graphql:"age"`
AssetIds []string `graphql:"assetIds"`
CustomCardEditionName *string `graphql:"customCardEditionName"`
Owned *bool `graphql:"owned"`
OwnedSinceAfter *types.ISO8601DateTime `graphql:"ownedSinceAfter"`
PlayerSlugs []string `graphql:"playerSlugs"`
Positions []types.Position `graphql:"positions"`
Rarities []types.Rarity `graphql:"rarities"`
SerialNumber *int `graphql:"serialNumber"`
ShirtNumber *int `graphql:"shirtNumber"`
Slugs []string `graphql:"slugs"`
TeamSlugs []string `graphql:"teamSlugs"`
}
func (f *Football) NewClubCardsQuery(clubSlug string) *graphql.PaginatedQuery[Card, CardsParams] {
return graphql.NewPaginatedQuery[Card, CardsParams](
f.c,
"cards",
[]string{"football", "club(slug:$slug)"},
).WithQueryParam("slug", clubSlug)
}