package sorare import ( "time" "github.com/shopspring/decimal" "git.lehouerou.net/laurent/sorare/football" "git.lehouerou.net/laurent/sorare/graphql" "git.lehouerou.net/laurent/sorare/tokens" "git.lehouerou.net/laurent/sorare/types" ) type baseUser struct { Active bool `graphql:"active"` FootballCardCounts struct { Common int `graphql:"common"` CustomSeries int `graphql:"customSeries"` Limited int `graphql:"limited"` Rare int `graphql:"rare"` SuperRare int `graphql:"superRare"` Unique int `graphql:"unique"` Total int `graphql:"total"` } `graphql:"footballCardCounts"` CreatedAt time.Time `graphql:"createdAt"` EthVaultId int `graphql:"ethVaultId"` EthereumAddress string `graphql:"ethereumAddress"` FollowersCount int `graphql:"followersCount"` FollowingCount int `graphql:"followingCount"` Id graphql.Id `graphql:"id"` Nickname string `graphql:"nickname"` Player struct { Slug string `graphql:"slug"` } Profile struct { ClubName string `graphql:"clubName"` DiscordUsername string `graphql:"discordUsername"` TwitterUsername string `graphql:"twitterUsername"` } `graphql:"profile"` Slug string `graphql:"slug"` SorareAddress string `graphql:"sorareAddress"` StarkKey string `graphql:"starkKey"` Suspended bool `graphql:"suspended"` } type User struct { baseUser AvatarUrl string `graphql:"avatarUrl"` } type CurrentUser struct { baseUser MyAccounts []struct { Accountable struct { TypeName string `graphql:"__typename"` FiatWallet struct { AvailableBalance decimal.Decimal `graphql:"availableBalance"` PublicInfo struct { Currency types.SupportedCurrency `graphql:"currency"` } `graphql:"publicInfo"` } `graphql:"... on PrivateFiatWalletAccount"` } `graphql:"accountable"` } `graphql:"myAccounts"` ApiKey *string `graphql:"apiKey"` AvailableBalance decimal.Decimal `graphql:"availableBalance"` AvailableBalanceForWithdrawal decimal.Decimal `graphql:"availableBalanceForWithdrawal"` BankBalance decimal.Decimal `graphql:"bankBalance"` BankMappedEthereumAddress string `graphql:"bankMappedEthereumAddress"` BankMappedEthereumAddressApprovedBank bool `graphql:"bankMappedEthereumAddressApprovedBank"` BetaTester bool `graphql:"betaTester"` BlockchainCardsInLineups []string `graphql:"blockchainCardsInLineups"` BlockedUntil time.Time `graphql:"blockedUntil"` CoinBalance int `graphql:"coinBalance"` Confirmed bool `graphql:"confirmed"` ConfirmedDevice bool `graphql:"confirmedDevice"` DepositedEth bool `graphql:"depositedEth"` Email string `graphql:"email"` FiatEnabled bool `graphql:"fiatEnabled"` FootballLast30DaysLineupsCount int `graphql:"footballLast30DaysLineupsCount"` FromPath string `graphql:"fromPath"` } type Users struct { c *graphql.Client User *graphql.Query[User, graphql.SlugParams] UserById *graphql.Query[User, graphql.IdParams] Users *graphql.Query[[]User, graphql.SlugsParams] CurrentUser *graphql.Query[CurrentUser, graphql.EmptyParams] } func NewUsers(c *graphql.Client) *Users { return &Users{c: c, User: graphql.NewQuery[User, graphql.SlugParams](c, "user", nil), UserById: graphql.NewQuery[User, graphql.IdParams](c, "userById", nil), Users: graphql.NewQuery[[]User, graphql.SlugsParams](c, "users", nil), CurrentUser: graphql.NewQuery[CurrentUser, graphql.EmptyParams](c, "currentUser", nil), } } type UserTokensParams struct { SortByEndDate *types.SortingOption `graphql:"sortByEndDate"` Sport []types.Sport `graphql:"sport"` } func (u *Users) BoughtSingleSaleTokenOffers( userSlug string, ) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenOffer, UserTokensParams]( u.c, "boughtSingleSaleTokenOffers", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } type UserBuyingTokenAuctionsParams struct { NewlyListed bool `graphql:"newlyListed"` Sport []types.Sport `graphql:"sport"` } func (u *Users) BuyingTokenAuctions( userSlug string, ) *graphql.Query[[]tokens.TokenAuction, UserBuyingTokenAuctionsParams] { return graphql.NewQuery[[]tokens.TokenAuction, UserBuyingTokenAuctionsParams]( u.c, "buyingTokenAuctions", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) EndedWithNoBuyerSingleSaleTokenOffers( userSlug string, ) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenOffer, UserTokensParams]( u.c, "endedWithNoBuyerSingleSaleTokenOffers", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) FootballCards( userSlug string, ) *graphql.PaginatedQuery[football.Card, football.CardsParams] { return graphql.NewPaginatedQuery[football.Card, football.CardsParams]( u.c, "footballCards", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) LiveSingleSaleTokenOffers( userSlug string, ) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenOffer, UserTokensParams]( u.c, "liveSingleSaleTokenOffers", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) LostTokenAuctions( userSlug string, ) *graphql.PaginatedQuery[tokens.TokenAuction, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenAuction, UserTokensParams]( u.c, "lostTokenAuctions", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) SingleSaleTokenOffers( userSlug string, ) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenOffer, UserTokensParams]( u.c, "singleSaleTokenOffers", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) SoldSingleSaleTokenOffers( userSlug string, ) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenOffer, UserTokensParams]( u.c, "soldSingleSaleTokenOffers", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) TokenAuctions( userSlug string, ) *graphql.PaginatedQuery[tokens.TokenAuction, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenAuction, UserTokensParams]( u.c, "tokenAuctions", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) WonTokenAuctions( userSlug string, ) *graphql.PaginatedQuery[tokens.TokenAuction, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenAuction, UserTokensParams]( u.c, "wonTokenAuctions", []string{"user(slug:$slug)"}, ).WithQueryParam("slug", userSlug) } func (u *Users) CurrentUserPendingTokenOffersReceived() *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenOffer, UserTokensParams]( u.c, "pendingTokenOffersReceived", []string{"currentUser"}, ) } func (u *Users) CurrentUserPendingTokenOffersSent() *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams] { return graphql.NewPaginatedQuery[tokens.TokenOffer, UserTokensParams]( u.c, "pendingTokenOffersSent", []string{"currentUser"}, ) }