sorare/football/card.go

43 lines
1.7 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 {
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"`
Token tokens.Token `graphql:"token"`
}
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)
}