Documentation ¶
Index ¶
- type Box
- type BoxesParams
- type Category
- type Client
- func (client *Client) Boxes(params BoxesParams) (result []Box, total int, err error)
- func (client *Client) Categories(productLines []int) (result []Category, err error)
- func (client *Client) ProductLines(superCatIds []int) (result []ProductLine, err error)
- func (client *Client) SuperCats() (result []SuperCat, err error)
- type Facets
- type ImageURLs
- type ProductLine
- type ResponseData
- type ResponseError
- type ResponsePayload
- type ResponseWrapper
- type SortBy
- type SuperCat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Box ¶
type Box struct { BoxID string `json:"boxId"` BoxName string `json:"boxName"` BoxDescription string `json:"boxDescription"` IsMasterBox int `json:"isMasterBox"` CategoryID int `json:"categoryId"` CategoryName string `json:"categoryName"` CategoryFriendlyName string `json:"categoryFriendlyName"` SuperCatID int `json:"superCatId"` SuperCatName string `json:"superCatName"` SuperCatFriendlyName string `json:"superCatFriendlyName"` ImageURLs ImageURLs `json:"imageUrls"` CannotBuy int `json:"cannotBuy"` IsNewBox int `json:"isNewBox"` SellPrice float64 `json:"sellPrice"` CashPrice float64 `json:"cashPrice"` ExchangePrice float64 `json:"exchangePrice"` FirstPrice int `json:"firstPrice"` PreviousPrice int `json:"previousPrice"` LastPriceUpdatedDate string `json:"lastPriceUpdatedDate"` BoxRating float64 `json:"boxRating"` CollectionQuantity int `json:"collectionQuantity"` EcomQuantityOnHand int `json:"ecomQuantityOnHand"` OutOfStock int `json:"outOfStock"` OutOfEcomStock int `json:"outOfEcomStock"` }
Box represents an individual product
type BoxesParams ¶
type BoxesParams struct { // One of these must be present SuperCatIDs []int `qstring:"superCatIds"` // super category ID CategoryIDs []int `qstring:"categoryIds"` // category ID BoxID string `qstring:"q"` // box ID // These are all optional FirstRecord int `qstring:"firstRecord,omitempty"` // default: 50, basically a database OFFSET Count int `qstring:"count,omitempty"` // default: 1, and a database LIMIT SortBy string `qstring:"sortBy,omitempty"` // default: relevance, attribute to sort by SortOrder string `qstring:"sortOrder,omitempty"` // default: desc, sort order }
BoxesParams represents the URL query parameters for the Boxes endpoint
type Category ¶
type Category struct { SuperCatID int `json:"superCatId"` CategoryID int `json:"categoryId"` CategoryFriendlyName string `json:"categoryFriendlyName"` ProductLineID int `json:"productLineId"` TotalBoxes int `json:"totalBoxes"` }
Category represents a category of boxes with a super category
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a HTTP client for interacting with CeX web resources.
func (*Client) Boxes ¶
func (client *Client) Boxes(params BoxesParams) (result []Box, total int, err error)
Boxes returns product boxes from the given search parameters
func (*Client) Categories ¶
Categories returns product categories from for a set of productlines
func (*Client) ProductLines ¶
func (client *Client) ProductLines(superCatIds []int) (result []ProductLine, err error)
ProductLines returns a list of product lines given a list of superCatIds
type Facets ¶
type Facets struct { SuperCatName []map[string]interface{} // TODO CategoryFriendlyName []map[string]interface{} // TODO ManufacturerName []map[string]interface{} // TODO NetworkName []map[string]interface{} // TODO AttributeStructureInfo interface{} // ??? AttributeInfo interface{} // ??? }
Facets seems to be some sort of summary of a set of query results containing data such as the number of items from each manufacturer etc. It hasn't been fully explored and modelled yet.
type ImageURLs ¶
type ImageURLs struct { Large string `json:"large"` Medium string `json:"medium"` Small string `json:"small"` }
ImageURLs contains a simple set of image URLs
type ProductLine ¶
type ProductLine struct { SuperCatID int `json:"superCatId"` ProductLineID int `json:"productLineId"` ProductLineName string `json:"productLineName"` TotalCategories int `json:"totalCategories"` }
ProductLine represents a top-level line of product categories
type ResponseData ¶
type ResponseData struct { // These are the main query result fields SuperCats []SuperCat `json:"superCats"` ProductLines []ProductLine `json:"productLines"` Categories []Category `json:"categories"` Boxes []Box `json:"boxes"` // These are additional pieces of data sent back with query results TotalRecords int `json:"totalRecords"` MinPrice float64 `json:"minPrice"` MaxPrice float64 `json:"maxPrice"` Facets Facets `json:"facets"` }
ResponseData contains the actual data from a query. Each query fills a different field.
type ResponseError ¶
type ResponseError struct { Code string `json:"code"` InternalMessage string `json:"internal_message"` MoreInfo []interface{} `json:"moreInfo"` }
ResponseError contains the structured error data (if any) in a response.
func (ResponseError) Error ¶
func (re ResponseError) Error() string
type ResponsePayload ¶
type ResponsePayload struct { Ack string `json:"ack"` Data ResponseData `json:"data"` Error ResponseError `json:"error"` }
ResponsePayload is the only member of the response object. Why it's wrapped in this way? Who knows... Maybe another version of the API contained more fields in the parent object.
type ResponseWrapper ¶
type ResponseWrapper struct {
Response ResponsePayload `json:"response"`
}
ResponseWrapper wraps each response from the API.
type SuperCat ¶
type SuperCat struct { SuperCatID int `json:"superCatId"` SuperCatFriendlyName string `json:"superCatFriendlyName"` }
SuperCat or "super category" represents a general purpose category, there are only a few of these. The following supercats exist at the time of writing:
- Gaming (1) - Film & TV (2) - Computing (3) - Phones (4) - Electronics (5) - Music (8)