sorare/tokens/tokens.go

104 lines
3.0 KiB
Go

package tokens
import (
"git.lehouerou.net/laurent/sorare/graphql"
"git.lehouerou.net/laurent/sorare/types"
)
type LiveParams struct {
UpdatedAfter *types.ISO8601DateTime `graphql:"updatedAfter"`
}
type LiveSingleSaleOffersParams struct {
LiveParams
Sport *types.Sport `graphql:"sport"`
PlayerSlug *string `graphql:"playerSlug"`
}
type LiveAuctionsParams struct {
LiveParams
Sport *types.Sport `graphql:"sport"`
}
type Tokens struct {
c *graphql.Client
AllNfts *graphql.PaginatedQuery[Token, AllNftsParams]
Auction *graphql.Query[TokenAuction, graphql.IdStringParams]
Auctions *graphql.Query[[]TokenAuction, graphql.IdStringsParams]
LiveAuctions *graphql.PaginatedQuery[TokenAuction, LiveAuctionsParams]
LivePrimaryOffers *graphql.PaginatedQuery[TokenPrimaryOffer, LiveParams]
LiveSingleSaleOffers *graphql.PaginatedQuery[TokenOffer, LiveSingleSaleOffersParams]
Nft *graphql.Query[Token, graphql.AssetIdParams]
Nfts *graphql.Query[[]Token, graphql.AssetIdsParams]
Offer *graphql.Query[TokenOffer, graphql.IdStringParams]
Offers *graphql.Query[[]TokenOffer, graphql.IdStringsParams]
PrimaryOffer *graphql.Query[TokenPrimaryOffer, graphql.IdStringParams]
PrimaryOffers *graphql.Query[[]TokenPrimaryOffer, graphql.IdStringsParams]
TokenPrices *graphql.Query[[]TokenPrice, TokenPricesParams]
}
func NewTokens(c *graphql.Client) *Tokens {
return &Tokens{
c: c,
AllNfts: graphql.NewPaginatedQuery[Token, AllNftsParams](
c,
"allNfts",
[]string{"tokens"},
),
Nft: graphql.NewQuery[Token, graphql.AssetIdParams](c, "nft", []string{"tokens"}),
Nfts: graphql.NewQuery[[]Token, graphql.AssetIdsParams](c, "nfts", []string{"tokens"}),
Offer: graphql.NewQuery[TokenOffer, graphql.IdStringParams](
c,
"offer",
[]string{"tokens"},
),
Offers: graphql.NewQuery[[]TokenOffer, graphql.IdStringsParams](
c,
"offers",
[]string{"tokens"},
),
PrimaryOffer: graphql.NewQuery[TokenPrimaryOffer, graphql.IdStringParams](
c,
"primaryOffer",
[]string{"tokens"},
),
PrimaryOffers: graphql.NewQuery[[]TokenPrimaryOffer, graphql.IdStringsParams](
c,
"primaryOffers",
[]string{"tokens"},
),
Auction: graphql.NewQuery[TokenAuction, graphql.IdStringParams](
c,
"auction",
[]string{"tokens"},
),
Auctions: graphql.NewQuery[[]TokenAuction, graphql.IdStringsParams](
c,
"auctions",
[]string{"tokens"},
),
LiveAuctions: graphql.NewPaginatedQuery[TokenAuction, LiveAuctionsParams](
c,
"liveAuctions",
[]string{"tokens"},
),
LivePrimaryOffers: graphql.NewPaginatedQuery[TokenPrimaryOffer, LiveParams](
c,
"livePrimaryOffers",
[]string{"tokens"},
),
LiveSingleSaleOffers: graphql.NewPaginatedQuery[TokenOffer, LiveSingleSaleOffersParams](
c,
"liveSingleSaleOffers",
[]string{"tokens"},
),
TokenPrices: graphql.NewQuery[[]TokenPrice, TokenPricesParams](
c,
"tokenPrices",
[]string{"tokens"},
),
}
}