sorare

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 15 Imported by: 0

README

sorare

Go library for accessing Sorare API

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCountriesQuery

func NewCountriesQuery(c *graphql.Client) *graphql.Query[[]Country, graphql.SlugsParams]

Types

type Country

type Country struct {
	Id                 graphql.Id `graphql:"id"`
	Code               string     `graphql:"code"`
	Slug               string     `graphql:"slug"`
	ThreeLetterCode    string     `graphql:"threeLetterCode"`
	SubscriptionsCount int        `graphql:"subscriptionsCount"`
	FlagFlat64Url      string     `graphql:"flagFlat64:flagUrl(shape:\"flat\", size:64)"`
	FlagFlat32Url      string     `graphql:"flagFlat32:flagUrl(shape:\"flat\", size:32)"`
	FlagRound64Url     string     `graphql:"flagRound64:flagUrl(shape:\"round\", size:64)"`
	FlagRound32Url     string     `graphql:"flatRound32:flagUrl(shape:\"round\", size:32)"`
}

type CurrentUser

type CurrentUser struct {
	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"`
	// contains filtered or unexported fields
}

type ShopItem

type ShopItem struct {
	ShopItemInterface struct {
		Id    string `graphql:"id"`
		Name  string `graphql:"name"`
		Price int    `graphql:"price"`
	} `graphql:"... on ShopItemInterface"`
	JerseyShopItem struct {
		CurrentStockCount int `graphql:"currentStockCount"`
		InitialStockCount int `graphql:"initialStockCount"`
		LimitPerUser      int `graphql:"limitPerUser"`
	} `graphql:"... on JerseyShopItem"`
}

type ShopItemType

type ShopItemType string
const (
	ShopItemTypeJersey                   ShopItemType = "JERSEY"
	ShopItemTypeBanner                   ShopItemType = "BANNER"
	ShopItemTypeShield                   ShopItemType = "SHIELD"
	ShopItemTypeLevelUp                  ShopItemType = "LEVEL_UP"
	ShopItemTypeExtraSwap                ShopItemType = "EXTRA_SWAP"
	ShopItemTypeExtraTeamsCap            ShopItemType = "EXTRA_TEAMS_CAP"
	ShopItemTypeRecoveryKit              ShopItemType = "RECOVERY_KIT"
	ShopItemTypeXpRestore                ShopItemType = "XP_RESTORE"
	ShopItemTypeDeliverableWithNoVariant ShopItemType = "DELIVERABLE_WITH_NO_VARIANT"
)

type ShopItemsParams

type ShopItemsParams struct {
	Types        []ShopItemType `graphql:"types"`
	UnlockedOnly bool           `graphql:"unlockedOnly"`
}

type Sorare

type Sorare struct {
	Client *graphql.Client

	Football  *football.Football
	Users     *Users
	Country   *graphql.Query[Country, graphql.SlugParams]
	Countries *graphql.Query[[]Country, graphql.SlugsParams]
	Tokens    *tokens.Tokens
	ShopItems *graphql.PaginatedQuery[ShopItem, ShopItemsParams]

	Mutations     *mutations.Mutations
	Subscriptions *subscriptions.Subscriptions
	// contains filtered or unexported fields
}

func New

func New() *Sorare

func (*Sorare) Authenticate

func (s *Sorare) Authenticate(
	ctx context.Context,
	email string,
	password string,
	audience string,
	otp string,
) error

func (*Sorare) Debug

func (s *Sorare) Debug() *Sorare

func (*Sorare) GetCurrentToken

func (s *Sorare) GetCurrentToken() graphql.JwtToken

func (*Sorare) GetRawQuery

func (s *Sorare) GetRawQuery(query interface{}, variables map[string]interface{}) (string, error)

func (*Sorare) Query

func (s *Sorare) Query(
	ctx context.Context,
	query interface{},
	variables map[string]interface{},
) error

func (*Sorare) SetDefaultSettlementCurrencies

func (s *Sorare) SetDefaultSettlementCurrencies(currencies []types.SupportedCurrency)

func (*Sorare) SetJWTToken

func (s *Sorare) SetJWTToken(token graphql.JwtToken, audience string)

type User

type User struct {
	AvatarUrl string `graphql:"avatarUrl"`
	// contains filtered or unexported fields
}

type UserBuyingTokenAuctionsParams

type UserBuyingTokenAuctionsParams struct {
	NewlyListed bool          `graphql:"newlyListed"`
	Sport       []types.Sport `graphql:"sport"`
}

type UserTokensParams

type UserTokensParams struct {
	SortByEndDate *types.SortingOption `graphql:"sortByEndDate"`
	Sport         []types.Sport        `graphql:"sport"`
}

type Users

type Users struct {
	User        *graphql.Query[User, graphql.SlugParams]
	UserById    *graphql.Query[User, graphql.IdParams]
	Users       *graphql.Query[[]User, graphql.SlugsParams]
	CurrentUser *graphql.Query[CurrentUser, graphql.EmptyParams]
	// contains filtered or unexported fields
}

func NewUsers

func NewUsers(c *graphql.Client) *Users

func (*Users) BoughtSingleSaleTokenOffers

func (u *Users) BoughtSingleSaleTokenOffers(
	userSlug string,
) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams]

func (*Users) BuyingTokenAuctions

func (u *Users) BuyingTokenAuctions(
	userSlug string,
) *graphql.Query[[]tokens.TokenAuction, UserBuyingTokenAuctionsParams]

func (*Users) EndedWithNoBuyerSingleSaleTokenOffers

func (u *Users) EndedWithNoBuyerSingleSaleTokenOffers(
	userSlug string,
) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams]

func (*Users) FootballCards

func (u *Users) FootballCards(
	userSlug string,
) *graphql.PaginatedQuery[football.Card, football.CardsParams]

func (*Users) LiveSingleSaleTokenOffers

func (u *Users) LiveSingleSaleTokenOffers(
	userSlug string,
) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams]

func (*Users) LostTokenAuctions

func (u *Users) LostTokenAuctions(
	userSlug string,
) *graphql.PaginatedQuery[tokens.TokenAuction, UserTokensParams]

func (*Users) SingleSaleTokenOffers

func (u *Users) SingleSaleTokenOffers(
	userSlug string,
) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams]

func (*Users) SoldSingleSaleTokenOffers

func (u *Users) SoldSingleSaleTokenOffers(
	userSlug string,
) *graphql.PaginatedQuery[tokens.TokenOffer, UserTokensParams]

func (*Users) TokenAuctions

func (u *Users) TokenAuctions(
	userSlug string,
) *graphql.PaginatedQuery[tokens.TokenAuction, UserTokensParams]

func (*Users) WonTokenAuctions

func (u *Users) WonTokenAuctions(
	userSlug string,
) *graphql.PaginatedQuery[tokens.TokenAuction, UserTokensParams]

Directories

Path Synopsis
cmd
internal
bcrypt
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL