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) (map[int]*Blueprint, map[int]string)
- func Preprocess(bp *Blueprint) (*mtgmatcher.Card, 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) 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) InitializeInventory(reader io.Reader) error
- func (ct *CardtraderMarket) Inventory() (mtgban.InventoryRecord, error)
- func (ct *CardtraderMarket) InventoryForSeller(sellerName string) (mtgban.InventoryRecord, error)
- func (tcg *CardtraderMarket) MarketNames() []string
- type Expansion
- type OrderItem
- type Product
Constants ¶
const ( MaxBulkUploadItems = 450 GameIdMagic = 1 )
const ( CategoryMagicSingles = iota + 1 CategoryMagicTokens CategoryMagicOversized CategoryMagicBoosterBoxes CategoryMagicCompleteSets CategoryMagicStarterDecks CategoryMagicEmptyPackaging CategoryMagicBooks CategoryMagicExtras CategoryMagicSleeves CategoryMagicBoxedSet CategoryMagicAlbums CategoryMagicDeckBoxes CategoryMagicPreconstructedDecks CategoryMagicPlaymats CategoryMagicLifeCounter CategoryMagicCardStorage CategoryMagicDice CategoryMagicBundles CategoryMagicTournamentPrereleasePacks CategoryMagicDividers CategoryMagicBinderPages CategoryMagicGamingStones )
Variables ¶
This section is empty.
Functions ¶
func ConvertItems ¶
func ConvertProducts ¶
func FormatBlueprints ¶
func Preprocess ¶
func Preprocess(bp *Blueprint) (*mtgmatcher.Card, 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) ProductsForExpansion ¶
func (ct *CTAuthClient) ProductsForExpansion(id int) (map[int][]Product, error)
Returns all products from an Expansion, with the 15 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"` Errors struct { ProductID []string `json:"product_id"` } `json:"errors"` 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(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) InitializeInventory ¶
func (ct *CardtraderMarket) InitializeInventory(reader io.Reader) error
func (*CardtraderMarket) Inventory ¶
func (ct *CardtraderMarket) Inventory() (mtgban.InventoryRecord, error)
func (*CardtraderMarket) InventoryForSeller ¶
func (ct *CardtraderMarket) InventoryForSeller(sellerName string) (mtgban.InventoryRecord, error)
func (*CardtraderMarket) MarketNames ¶
func (tcg *CardtraderMarket) 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"` Language string `json:"mtg_language"` Number string `json:"collector_number"` Foil bool `json:"mtg_foil"` Altered bool `json:"altered"` Signed bool `json:"signed"` } `json:"properties_hash"` User struct { Name string `json:"username"` Zero bool `json:"can_sell_via_hub"` } `json:"user"` Price struct { Cents int `json:"cents"` Currency string `json:"currency"` } `json:"price"` Expansion struct { Name string `json:"name"` } `json:"expansion"` UserDataField string `json:"user_data_field"` PriceCents int `json:"price_cents"` PriceCurrency string `json:"price_currency"` }