tcgplayer

package
v0.0.0-...-1e91090 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CategoryMagic   = 1
	CategoryYuGiOh  = 2
	CategoryPokemon = 3

	ProductTypeCards               = "Cards"
	ProductTypeBoosterBox          = "Booster Box"
	ProductTypeBoosterPack         = "Booster Pack"
	ProductTypeSealedProducts      = "Sealed Products"
	ProductTypeIntroPack           = "Intro Pack"
	ProductTypeFatPack             = "Fat Pack"
	ProductTypeBoxSets             = "Box Sets"
	ProductTypePreconEventDecks    = "Precon/Event Decks"
	ProductTypeMagicDeckPack       = "Magic Deck Pack"
	ProductTypeMagicBoosterBoxCase = "Magic Booster Box Case"
	ProductTypeAll5IntroPacks      = "All 5 Intro Packs"
	ProductTypeIntroPackDisplay    = "Intro Pack Display"
	ProductType3xMagicBoosterPacks = "3x Magic Booster Packs"
	ProductTypeBoosterBattlePack   = "Booster Battle Pack"

	MaxLimit = 100
)
View Source
const (
	SellersPageURL     = "https://shop.tcgplayer.com/sellers"
	SellerInventoryURL = "https://mp-search-api.tcgplayer.com/v1/search/request?q=&isList=true&mpfev=1953"
	SellerListingURL   = "https://mp-search-api.tcgplayer.com/v1/product/%d/listings"

	DefaultSellerRequestSize = 50

	MaxGlobalScrapingValue = 8000
)
View Source
const (
	BaseProductURL    = "https://www.tcgplayer.com/product/"
	PartnerProductURL = "https://tcgplayer.pxf.io/c/%s/1830156/21018"
)

Variables

This section is empty.

Functions

func LoadTCGSKUs

func LoadTCGSKUs(reader io.Reader) (mtgjson.AllTCGSkus, error)

func Preprocess

func Preprocess(product *TCGProduct, editions map[int]string) (*mtgmatcher.Card, error)

func SellerKeyExists

func SellerKeyExists(sellerKey string) bool

func SellerName2ID

func SellerName2ID(sellerName string) (string, error)

func TCGLatestSales

func TCGLatestSales(tcgProductId string, foil ...bool) (*latestSalesResponse, error)

func TCGPlayerProductURL

func TCGPlayerProductURL(productId int, printing, affiliate, condition, language string) string

Types

type LatestSalesData

type LatestSalesData struct {
	Condition       string    `json:"condition"`
	Variant         string    `json:"variant"`
	Language        string    `json:"language"`
	Quantity        int       `json:"quantity"`
	Title           string    `json:"title"`
	ListingType     string    `json:"listingType"`
	CustomListingID string    `json:"customListingId"`
	PurchasePrice   float64   `json:"purchasePrice"`
	ShippingPrice   float64   `json:"shippingPrice"`
	OrderDate       time.Time `json:"orderDate"`
}

type SellerInventoryResult

type SellerInventoryResult struct {
	FoilOnly                bool    `json:"foilOnly"`
	ImageCount              float64 `json:"imageCount"`
	LowestPrice             float64 `json:"lowestPrice"`
	LowestPriceWithShipping float64 `json:"lowestPriceWithShipping"`
	MarketPrice             float64 `json:"marketPrice"`
	MaxFulfillableQuantity  float64 `json:"maxFulfillableQuantity"`
	NormalOnly              bool    `json:"normalOnly"`
	ProductID               float64 `json:"productId"`
	ProductLineID           float64 `json:"productLineId"`
	ProductLineName         string  `json:"productLineName"`
	ProductLineURLName      string  `json:"productLineUrlName"`
	ProductName             string  `json:"productName"`
	ProductStatusID         float64 `json:"productStatusId"`
	ProductTypeID           float64 `json:"productTypeId"`
	ProductTypeName         string  `json:"productTypeName"`
	ProductURLName          string  `json:"productUrlName"`
	RarityName              string  `json:"rarityName"`
	Score                   float64 `json:"score"`
	Sealed                  bool    `json:"sealed"`
	SellerListable          bool    `json:"sellerListable"`
	Sellers                 float64 `json:"sellers"`
	SetCode                 string  `json:"setCode"`
	SetID                   float64 `json:"setId"`
	SetName                 string  `json:"setName"`
	SetURLName              string  `json:"setUrlName"`
	ShippingCategoryID      float64 `json:"shippingCategoryId"`
	TotalListings           float64 `json:"totalListings"`
	CustomAttributes        struct {
		Number string `json:"number"`
	} `json:"customAttributes"`
	Listings []SellerListing `json:"listings"`
}

type SellerListing

type SellerListing struct {
	ChannelID            float64 `json:"channelId"`
	Condition            string  `json:"condition"`
	ConditionID          float64 `json:"conditionId"`
	DirectInventory      float64 `json:"directInventory"`
	DirectProduct        bool    `json:"directProduct"`
	DirectSeller         bool    `json:"directSeller"`
	ForwardFreight       bool    `json:"forwardFreight"`
	GoldSeller           bool    `json:"goldSeller"`
	Language             string  `json:"language"`
	LanguageAbbreviation string  `json:"languageAbbreviation"`
	LanguageID           float64 `json:"languageId"`
	ListingID            float64 `json:"listingId"`
	ListingType          string  `json:"listingType"`
	Price                float64 `json:"price"`
	Printing             string  `json:"printing"`
	ProductConditionID   float64 `json:"productConditionId"`
	ProductID            float64 `json:"productId"`
	Quantity             float64 `json:"quantity"`
	RankedShippingPrice  float64 `json:"rankedShippingPrice"`
	Score                float64 `json:"score"`
	SellerID             string  `json:"sellerId"`
	SellerKey            string  `json:"sellerKey"`
	SellerName           string  `json:"sellerName"`
	SellerRating         float64 `json:"sellerRating"`
	SellerSales          string  `json:"sellerSales"`
	SellerShippingPrice  float64 `json:"sellerShippingPrice"`
	ShippingPrice        float64 `json:"shippingPrice"`
	VerifiedSeller       bool    `json:"verifiedSeller"`
}

type TCGAutoClient

type TCGAutoClient struct {
	// contains filtered or unexported fields
}

func NewTCGAutoClient

func NewTCGAutoClient(cartId string) *TCGAutoClient

func (*TCGAutoClient) AddProductToCart

func (tcg *TCGAutoClient) AddProductToCart(sellerKey string, skuId, qty int, isDirect bool) (*TCGAutocartResponse, error)

type TCGAutocartRequest

type TCGAutocartRequest struct {
	SKU               int    `json:"sku"`
	SellerKey         string `json:"sellerKey"`
	ChannelID         int    `json:"channelId"`
	RequestedQuantity int    `json:"requestedQuantity"`
	Price             int    `json:"price"`
	IsDirect          bool   `json:"isDirect"`
}

type TCGAutocartResponse

type TCGAutocartResponse struct {
	Errors []struct {
		Code    string `json:"code"`
		Message string `json:"message"`
	} `json:"errors"`
	Results []struct {
		IsDirect                bool    `json:"isDirect"`
		SellerQuantityAvailable int     `json:"sellerQuantityAvailable"`
		ItemQuantityInCart      int     `json:"itemQuantityInCart"`
		CurrentPrice            float64 `json:"currentPrice"`
		Status                  int     `json:"status"`
	}
}

type TCGCategory

type TCGCategory struct {
	CategoryID        int    `json:"categoryId"`
	Name              string `json:"name"`
	ModifiedOn        string `json:"modifiedOn"`
	DisplayName       string `json:"displayName"`
	SeoCategoryName   string `json:"seoCategoryName"`
	SealedLabel       string `json:"sealedLabel"`
	NonSealedLabel    string `json:"nonSealedLabel"`
	ConditionGuideURL string `json:"conditionGuideUrl"`
	IsScannable       bool   `json:"isScannable"`
	Popularity        int    `json:"popularity"`
}

type TCGClient

type TCGClient struct {
	// contains filtered or unexported fields
}

func NewTCGClient

func NewTCGClient(publicId, privateId string) *TCGClient

func NewTCGSellerClient

func NewTCGSellerClient() *TCGClient

func (*TCGClient) EditionMap

func (tcg *TCGClient) EditionMap(category int) (map[int]TCGGroup, error)

func (*TCGClient) Get

func (tcg *TCGClient) Get(url string) (*TCGResponse, error)

Perform an authenticated GET request on any URL

func (*TCGClient) ListAllGroups

func (tcg *TCGClient) ListAllGroups(category int, offset int, limit int) ([]TCGGroup, error)

func (*TCGClient) ListAllProducts

func (tcg *TCGClient) ListAllProducts(category int, productTypes []string, includeSkus bool, offset int, limit int) ([]TCGProduct, error)

func (*TCGClient) SKUsForId

func (tcg *TCGClient) SKUsForId(productId string) ([]TCGSKU, error)

func (*TCGClient) TCGBuylistPricesForSKUs

func (tcg *TCGClient) TCGBuylistPricesForSKUs(ids []string) ([]TCGSKUPrice, error)

func (*TCGClient) TCGCategoriesDetails

func (tcg *TCGClient) TCGCategoriesDetails(ids []int) ([]TCGCategory, error)

func (*TCGClient) TCGInventoryForSeller

func (tcg *TCGClient) TCGInventoryForSeller(sellerKeys []string, size, page int, useDirect bool, sets ...string) (*sellerInventoryResponse, error)

func (*TCGClient) TCGInventoryListing

func (tcg *TCGClient) TCGInventoryListing(productId, size, page int) ([]SellerListing, error)

func (*TCGClient) TCGPricesForIds

func (tcg *TCGClient) TCGPricesForIds(productIds []string) ([]TCGPrice, error)

func (*TCGClient) TCGPricesForSKUs

func (tcg *TCGClient) TCGPricesForSKUs(ids []string) ([]TCGSKUPrice, error)

func (*TCGClient) TotalGroups

func (tcg *TCGClient) TotalGroups(category int) (int, error)

func (*TCGClient) TotalProducts

func (tcg *TCGClient) TotalProducts(category int, productTypes []string) (int, error)

type TCGDirectNet

type TCGDirectNet struct {
	DirectInventory mtgban.InventoryRecord
	// contains filtered or unexported fields
}

func NewTCGDirectNet

func NewTCGDirectNet() *TCGDirectNet

func (*TCGDirectNet) Buylist

func (tcg *TCGDirectNet) Buylist() (mtgban.BuylistRecord, error)

func (*TCGDirectNet) Info

func (tcg *TCGDirectNet) Info() (info mtgban.ScraperInfo)

type TCGGroup

type TCGGroup struct {
	GroupID      int    `json:"groupId"`
	Name         string `json:"name"`
	Abbreviation string `json:"abbreviation"`
	Supplemental bool   `json:"supplemental"`
	PublishedOn  string `json:"publishedOn"`
	ModifiedOn   string `json:"modifiedOn"`
	CategoryID   int    `json:"categoryId"`
}

type TCGPlayerGeneric

type TCGPlayerGeneric struct {
	LogCallback mtgban.LogCallbackFunc

	Affiliate      string
	MaxConcurrency int
	// contains filtered or unexported fields
}

func NewScraperGeneric

func NewScraperGeneric(publicId, privateId string, category int, groups ...string) (*TCGPlayerGeneric, error)

func (*TCGPlayerGeneric) Info

func (tcg *TCGPlayerGeneric) Info() (info mtgban.ScraperInfo)

func (*TCGPlayerGeneric) Inventory

func (tcg *TCGPlayerGeneric) Inventory() (mtgban.InventoryRecord, error)

type TCGPlayerIndex

type TCGPlayerIndex struct {
	LogCallback mtgban.LogCallbackFunc

	Affiliate      string
	MaxConcurrency int
	// contains filtered or unexported fields
}

func NewScraperIndex

func NewScraperIndex(publicId, privateId string) *TCGPlayerIndex

func (*TCGPlayerIndex) Info

func (tcg *TCGPlayerIndex) Info() (info mtgban.ScraperInfo)

func (*TCGPlayerIndex) Inventory

func (tcg *TCGPlayerIndex) Inventory() (mtgban.InventoryRecord, error)

func (*TCGPlayerIndex) MarketNames

func (tcg *TCGPlayerIndex) MarketNames() []string

type TCGPlayerMarket

type TCGPlayerMarket struct {
	LogCallback mtgban.LogCallbackFunc

	Affiliate      string
	MaxConcurrency int

	// The cache data defining SKU data, if not set it will be loaded
	// from the default location on mtgjson website.
	SKUsData map[string][]mtgjson.TCGSku
	// contains filtered or unexported fields
}

func NewScraperMarket

func NewScraperMarket(publicId, privateId string) *TCGPlayerMarket

func (*TCGPlayerMarket) Buylist

func (tcg *TCGPlayerMarket) Buylist() (mtgban.BuylistRecord, error)

func (*TCGPlayerMarket) Info

func (tcg *TCGPlayerMarket) Info() (info mtgban.ScraperInfo)

func (*TCGPlayerMarket) Inventory

func (tcg *TCGPlayerMarket) Inventory() (mtgban.InventoryRecord, error)

func (*TCGPlayerMarket) MarketNames

func (tcg *TCGPlayerMarket) MarketNames() []string

type TCGPlayerSealed

type TCGPlayerSealed struct {
	LogCallback    mtgban.LogCallbackFunc
	Affiliate      string
	MaxConcurrency int
	// contains filtered or unexported fields
}

func NewScraperSealed

func NewScraperSealed(publicId, privateId string) *TCGPlayerSealed

func (*TCGPlayerSealed) Info

func (tcg *TCGPlayerSealed) Info() (info mtgban.ScraperInfo)

func (*TCGPlayerSealed) Inventory

func (tcg *TCGPlayerSealed) Inventory() (mtgban.InventoryRecord, error)

type TCGPrice

type TCGPrice struct {
	ProductId      int     `json:"productId"`
	LowPrice       float64 `json:"lowPrice"`
	MarketPrice    float64 `json:"marketPrice"`
	MidPrice       float64 `json:"midPrice"`
	DirectLowPrice float64 `json:"directLowPrice"`
	SubTypeName    string  `json:"subTypeName"`
}

type TCGProduct

type TCGProduct struct {
	ProductId    int      `json:"productId"`
	Name         string   `json:"name"`
	CleanName    string   `json:"cleanName"`
	ImageUrl     string   `json:"imageUrl"`
	GroupId      int      `json:"groupId"`
	URL          string   `json:"url"`
	ModifiedOn   string   `json:"modifiedOn"`
	Skus         []TCGSKU `json:"skus,omitempty"`
	ExtendedData []struct {
		Name        string `json:"name"`
		DisplayName string `json:"displayName"`
		Value       string `json:"value"`
	} `json:"extendedData,omitempty"`
}

func (*TCGProduct) GetNameAndVariant

func (tcgp *TCGProduct) GetNameAndVariant() (string, string)

func (*TCGProduct) GetNumber

func (tcgp *TCGProduct) GetNumber() string

func (*TCGProduct) IsToken

func (tcgp *TCGProduct) IsToken() bool

type TCGResponse

type TCGResponse struct {
	TotalItems int             `json:"totalItems"`
	Success    bool            `json:"success"`
	Errors     []string        `json:"errors"`
	Results    json.RawMessage `json:"results"`
}

type TCGSKU

type TCGSKU struct {
	SkuId       int `json:"skuId"`
	ProductId   int `json:"productId"`
	LanguageId  int `json:"languageId"`
	PrintingId  int `json:"printingId"`
	ConditionId int `json:"conditionId"`
}

type TCGSKUPrice

type TCGSKUPrice struct {
	SkuId int `json:"skuId"`

	// Only availabe from TCGPricesForSKUs()
	ProductId          int     `json:"productId"`
	LowPrice           float64 `json:"lowPrice"`
	LowestShipping     float64 `json:"lowestShipping"`
	LowestListingPrice float64 `json:"lowestListingPrice"`
	MarketPrice        float64 `json:"marketPrice"`
	DirectLowPrice     float64 `json:"directLowPrice"`

	// Only available from TCGBuylistPricesForSKUs()
	BuylistPrices struct {
		High   float64 `json:"high"`
		Market float64 `json:"market"`
	} `json:"prices"`
}

type TCGSYPList

type TCGSYPList struct {
	LogCallback mtgban.LogCallbackFunc
	// contains filtered or unexported fields
}

func NewScraperSYP

func NewScraperSYP() *TCGSYPList

func (*TCGSYPList) Info

func (tcg *TCGSYPList) Info() (info mtgban.ScraperInfo)

func (*TCGSYPList) Inventory

func (tcg *TCGSYPList) Inventory() (mtgban.InventoryRecord, error)

type TCGSellerInventory

type TCGSellerInventory struct {
	LogCallback    mtgban.LogCallbackFunc
	MaxConcurrency int
	Affiliate      string
	// contains filtered or unexported fields
}

func NewScraperForSeller

func NewScraperForSeller(sellerName string, onlyDirect bool) (*TCGSellerInventory, error)

func NewScraperForSellerIds

func NewScraperForSellerIds(sellerKeys []string, onlyDirect bool) *TCGSellerInventory

func (*TCGSellerInventory) Info

func (tcg *TCGSellerInventory) Info() (info mtgban.ScraperInfo)

func (*TCGSellerInventory) Inventory

func (tcg *TCGSellerInventory) Inventory() (mtgban.InventoryRecord, error)

Jump to

Keyboard shortcuts

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