Documentation
¶
Index ¶
- Constants
- func ConvertItems(blueprints map[int]*Blueprint, products []OrderItem, rates ...float64) mtgban.InventoryRecord
- func ConvertProducts(blueprints map[int]*Blueprint, products []Product, rates ...float64) mtgban.InventoryRecord
- func FormatBlueprints(blueprints []Blueprint, inExpansions []Expansion, sealed bool) (map[int]*Blueprint, map[int]string)
- func Preprocess(bp *Blueprint) (*mtgmatcher.InputCard, error)
- type Blueprint
- type BlueprintError
- type BlueprintFilter
- type BulkProduct
- type CTAuthClient
- func (ct *CTAuthClient) AddProductToCart(productId, quantity int, zero bool) (*CTCartResponse, error)
- func (ct *CTAuthClient) Blueprints(expansionId int) ([]Blueprint, error)
- func (ct *CTAuthClient) BulkCreate(products []BulkProduct) ([]string, error)
- func (ct *CTAuthClient) BulkDelete(products []BulkProduct) ([]string, error)
- func (ct *CTAuthClient) BulkUpdate(products []BulkProduct) ([]string, error)
- func (ct *CTAuthClient) Expansions() ([]Expansion, error)
- func (ct *CTAuthClient) ExportStock(blueprints map[int]*Blueprint) (mtgban.InventoryRecord, error)
- func (ct *CTAuthClient) ProductsExport() ([]Product, error)
- func (ct *CTAuthClient) ProductsForBlueprint(id int) ([]Product, error)
- func (ct *CTAuthClient) ProductsForExpansion(id int) (map[int][]Product, error)
- type CTCartResponse
- type CTClient
- type CTLoggedClient
- type CTPrice
- type CardtraderMarket
- func (ct *CardtraderMarket) Activate(user, pass string) error
- func (ct *CardtraderMarket) Add(entry mtgban.InventoryEntry) error
- func (ct *CardtraderMarket) Info() (info mtgban.ScraperInfo)
- func (ct *CardtraderMarket) InfoForScraper(name string) mtgban.ScraperInfo
- func (ct *CardtraderMarket) Inventory() (mtgban.InventoryRecord, error)
- func (tcg *CardtraderMarket) MarketNames() []string
- type CardtraderSealed
- type Expansion
- type OrderItem
- type Product
Constants ¶
const ( MaxBulkUploadItems = 450 GameIdMagic = 1 GameIdYuGiOh = 4 GameIdPokemon = 5 GameIdFleshAndBlood = 5 GameIdDigimon = 8 GameIdDragonBallSuper = 9 GameIdVanguard = 10 GameIdMyHeroAcademia = 14 GameIdOnePiece = 15 GameIdLorcana = 18 GameIdStarWarsUnlimited = 20 )
const ( CategoryMagicSingles = iota + 1 CategoryMagicTokens CategoryMagicOversized CategoryMagicBoosterBoxes CategoryMagicBoosters CategoryMagicCompleteSets CategoryMagicStarterDecks CategoryMagicEmptyPackaging CategoryMagicBooks CategoryMagicBoxDisplays CategoryMagicSleeves CategoryMagicBoxedSet CategoryMagicAlbums CategoryMagicDeckBoxes CategoryMagicPreconstructedDecks CategoryMagicMemorabilia CategoryMagicPlaymats CategoryMagicLifeCounter CategoryMagicCardStorage CategoryMagicDice CategoryMagicBundles CategoryMagicTournamentPrereleasePacks CategoryMagicDividers CategoryMagicBinderPages CategoryMagicGamingStones )
const ( CategoryLorcanaSingles = iota + 214 CategoryLorcanaBoosterBoxes CategoryLorcanaBoosters CategoryLorcanaBundles CategoryLorcanaBoxDisplays CategoryLorcanaStarterDecks CategoryLorcanaPlaymats CategoryLorcanaAlbums CategoryLorcanaSleeves CategoryLorcanaDeckBoxes CategoryLorcanaMemorabilia CategoryLorcanaOversized CategoryLorcanaCompleteSets )
Variables ¶
This section is empty.
Functions ¶
func ConvertItems ¶
func ConvertProducts ¶
func FormatBlueprints ¶
func Preprocess ¶
func Preprocess(bp *Blueprint) (*mtgmatcher.InputCard, error)
Types ¶
type Blueprint ¶
type Blueprint struct { Id int `json:"id"` Name string `json:"name"` Version string `json:"version"` CategoryId int `json:"category_id"` GameId int `json:"game_id"` Slug string `json:"slug"` ScryfallId string `json:"scryfall_id"` Expansion struct { Name string `json:"name"` Code string `json:"code"` } `json:"expansion"` // Returned by product Properties struct { Number string `json:"collector_number"` Language string `json:"mtg_language"` } `json:"properties_hash"` // Returned by market FixedProperties struct { Number string `json:"collector_number"` Language string `json:"mtg_language"` } `json:"fixed_properties"` ExpansionId int `json:"expansion_id"` }
type BlueprintError ¶
type BlueprintFilter ¶
type BulkProduct ¶
type BulkProduct struct { // The id of the Product to edit Id int `json:"id,omitempty"` // The id of the Blueprint to put on sale BlueprintId int `json:"blueprint_id,omitempty"` // The price of the product, indicated in your current currency Price float64 `json:"price,omitempty"` // The quantity to be put up for sale Quantity int `json:"quantity,omitempty"` // A public-facing description field Description string `json:"description,omitempty"` // A secondary internal-only field UserDataField string `json:"user_data_field,omitempty"` // A list of optional properties Properties struct { Condition string `json:"condition,omitempty"` Language string `json:"mtg_language,omitempty"` Foil bool `json:"mtg_foil,omitempty"` Signed bool `json:"signed,omitempty"` Altered bool `json:"altered,omitempty"` } `json:"properties,omitempty"` }
This is slightly different from the main Product type
type CTAuthClient ¶
type CTAuthClient struct {
// contains filtered or unexported fields
}
func NewCTAuthClient ¶
func NewCTAuthClient(token string) *CTAuthClient
func (*CTAuthClient) AddProductToCart ¶
func (ct *CTAuthClient) AddProductToCart(productId, quantity int, zero bool) (*CTCartResponse, error)
func (*CTAuthClient) Blueprints ¶
func (ct *CTAuthClient) Blueprints(expansionId int) ([]Blueprint, error)
func (*CTAuthClient) BulkCreate ¶
func (ct *CTAuthClient) BulkCreate(products []BulkProduct) ([]string, error)
Create new listings using the products slice, separating into multiple requests if there are more than MaxBulkUploadItems elements. A list of job ids is returned to monitor the execution status.
func (*CTAuthClient) BulkDelete ¶
func (ct *CTAuthClient) BulkDelete(products []BulkProduct) ([]string, error)
Delete existing listings using the products slice, separating into multiple requests if there are more than MaxBulkUploadItems elements. A list of job ids is returned to monitor the execution status.
func (*CTAuthClient) BulkUpdate ¶
func (ct *CTAuthClient) BulkUpdate(products []BulkProduct) ([]string, error)
Update existing listings using the products slice, separating into multiple requests if there are more than MaxBulkUploadItems elements. A list of job ids is returned to monitor the execution status.
func (*CTAuthClient) Expansions ¶
func (ct *CTAuthClient) Expansions() ([]Expansion, error)
func (*CTAuthClient) ExportStock ¶ added in v0.3.11
func (ct *CTAuthClient) ExportStock(blueprints map[int]*Blueprint) (mtgban.InventoryRecord, error)
Use the Simple API Token to convert your own inventory to a standard InventoryRecord
func (*CTAuthClient) ProductsExport ¶
func (ct *CTAuthClient) ProductsExport() ([]Product, error)
func (*CTAuthClient) ProductsForBlueprint ¶ added in v0.4.27
func (ct *CTAuthClient) ProductsForBlueprint(id int) ([]Product, error)
Returns all products from a given blueprint id, with the 25 cheapest listings
func (*CTAuthClient) ProductsForExpansion ¶
func (ct *CTAuthClient) ProductsForExpansion(id int) (map[int][]Product, error)
Returns all products from an Expansion, with the 25 cheapest listings per product
type CTCartResponse ¶
type CTCartResponse struct { ID int `json:"id"` Subcarts []struct { ID int `json:"id"` Seller struct { ID int `json:"id"` Username string `json:"username"` } `json:"seller"` CartItems []struct { Quantity int `json:"quantity"` PriceCents int `json:"price_cents"` PriceCurrency string `json:"price_currency"` Product struct { ID int `json:"id"` NameEn string `json:"name_en"` } `json:"product"` } `json:"cart_items"` } `json:"subcarts"` Subtotal CTPrice `json:"subtotal"` SafeguardFeeAmount CTPrice `json:"safeguard_fee_amount"` CtZeroFeeAmount CTPrice `json:"ct_zero_fee_amount"` PaymentMethodFeePercentageAmount CTPrice `json:"payment_method_fee_percentage_amount"` PaymentMethodFeeFixedAmount CTPrice `json:"payment_method_fee_fixed_amount"` ShippingCost CTPrice `json:"shipping_cost"` ErrorCode string `json:"error_code"` Extra struct { Message string `json:"message"` } `json:"extra"` RequestID string `json:"request_id"` }
type CTClient ¶
type CTClient struct {
// contains filtered or unexported fields
}
func NewCTClient ¶
func NewCTClient() *CTClient
func (*CTClient) ProductsForBlueprint ¶
func (ct *CTClient) ProductsForBlueprint(id int) (*BlueprintFilter, error)
type CTLoggedClient ¶
type CTLoggedClient struct {
// contains filtered or unexported fields
}
func NewCTLoggedClient ¶
func NewCTLoggedClient(user, pass string) (*CTLoggedClient, error)
func (*CTLoggedClient) Add2Cart ¶
func (ct *CTLoggedClient) Add2Cart(productId int, qty int, bundle bool) error
func (*CTLoggedClient) GetItemsForOrder ¶
func (ct *CTLoggedClient) GetItemsForOrder(orderId int) ([]OrderItem, error)
func (*CTLoggedClient) NewToken ¶
func (ct *CTLoggedClient) NewToken() (string, error)
type CardtraderMarket ¶
type CardtraderMarket struct { LogCallback mtgban.LogCallbackFunc MaxConcurrency int // Only retrieve data from a single edition TargetEdition string // Keep same-conditions entries KeepDuplicates bool // contains filtered or unexported fields }
func NewScraperMarket ¶
func NewScraperMarket(gameId int, token string) (*CardtraderMarket, error)
func (*CardtraderMarket) Activate ¶
func (ct *CardtraderMarket) Activate(user, pass string) error
func (*CardtraderMarket) Add ¶
func (ct *CardtraderMarket) Add(entry mtgban.InventoryEntry) error
func (*CardtraderMarket) Info ¶
func (ct *CardtraderMarket) Info() (info mtgban.ScraperInfo)
func (*CardtraderMarket) InfoForScraper ¶ added in v0.4.48
func (ct *CardtraderMarket) InfoForScraper(name string) mtgban.ScraperInfo
func (*CardtraderMarket) Inventory ¶
func (ct *CardtraderMarket) Inventory() (mtgban.InventoryRecord, error)
func (*CardtraderMarket) MarketNames ¶
func (tcg *CardtraderMarket) MarketNames() []string
type CardtraderSealed ¶ added in v0.3.34
type CardtraderSealed struct { LogCallback mtgban.LogCallbackFunc MaxConcurrency int // Only retrieve data from a single edition TargetEdition string // contains filtered or unexported fields }
func NewScraperSealed ¶ added in v0.3.34
func NewScraperSealed(token string) (*CardtraderSealed, error)
func (*CardtraderSealed) Info ¶ added in v0.3.34
func (ct *CardtraderSealed) Info() (info mtgban.ScraperInfo)
func (*CardtraderSealed) InfoForScraper ¶ added in v0.4.48
func (ct *CardtraderSealed) InfoForScraper(name string) mtgban.ScraperInfo
func (*CardtraderSealed) Inventory ¶ added in v0.3.34
func (ct *CardtraderSealed) Inventory() (mtgban.InventoryRecord, error)
func (*CardtraderSealed) MarketNames ¶ added in v0.3.34
func (tcg *CardtraderSealed) MarketNames() []string
type OrderItem ¶
type OrderItem struct { Id int `json:"id"` BlueprintId int `json:"blueprint_id"` Quantity int `json:"quantity"` Description string `json:"description"` PriceCents int `json:"price_cents"` PriceCurrency string `json:"price_currency"` Properties struct { Condition string `json:"condition"` Language string `json:"mtg_language"` Foil bool `json:"mtg_foil"` } `json:"properties_hash"` }
A variant of Product
type Product ¶
type Product struct { Id int `json:"id"` BlueprintId int `json:"blueprint_id"` Quantity int `json:"quantity"` Description string `json:"description"` OnVacation bool `json:"on_vacation"` Bundle bool `json:"bundle"` Properties struct { Condition string `json:"condition"` Number string `json:"collector_number"` Altered bool `json:"altered"` Signed bool `json:"signed"` MTGLanguage string `json:"mtg_language,omitempty"` MTGFoil bool `json:"mtg_foil,omitempty"` LorcanaLanguage string `json:"lorcana_language,omitempty"` LorcanaFoil bool `json:"lorcana_foil,omitempty"` } `json:"properties_hash"` User struct { Name string `json:"username"` SinglesZero bool `json:"can_sell_via_hub"` SealedZero bool `json:"can_sell_sealed_with_ct_zero"` } `json:"user"` Price struct { Cents int `json:"cents"` Currency string `json:"currency"` } `json:"price"` UserDataField string `json:"user_data_field"` PriceCents int `json:"price_cents"` PriceCurrency string `json:"price_currency"` }