Documentation ¶
Index ¶
- Constants
- Variables
- func NoColor() int
- type Category
- type Color
- type Item
- type KnownColor
- type Mapping
- type PriceDetail
- type PriceGuide
- type Reference
- func (r *Reference) GetCategories() ([]Category, error)
- func (r *Reference) GetCategory(id int) (*Category, error)
- func (r *Reference) GetColor(colorID int) (*Color, error)
- func (r *Reference) GetColors() ([]Color, error)
- func (r *Reference) GetElementID(options ...RequestOption) ([]Mapping, error)
- func (r *Reference) GetItem(options ...RequestOption) (*Item, error)
- func (r *Reference) GetItemImage(options ...RequestOption) (*Item, error)
- func (r *Reference) GetItemMapping(elementID string) ([]Mapping, error)
- func (r *Reference) GetKnownColors(options ...RequestOption) ([]KnownColor, error)
- func (r *Reference) GetPriceGuide(options ...RequestOption) (*PriceGuide, error)
- func (r *Reference) GetSubset(options ...RequestOption) (Subset, error)
- func (r *Reference) GetSupersets(options ...RequestOption) (Superset, error)
- type RequestOption
- func WithBox(box bool) RequestOption
- func WithBreakMinifigs(breakMinifigs bool) RequestOption
- func WithBreakSubsets(breakSubsets bool) RequestOption
- func WithColorID(colorID int) RequestOption
- func WithCondition(condition string) RequestOption
- func WithCountryCode(countryCode string) RequestOption
- func WithCurrencyCode(currencyCode string) RequestOption
- func WithGuideType(guideType string) RequestOption
- func WithInstruction(instruction bool) RequestOption
- func WithItemNo(itemNo string) RequestOption
- func WithItemType(typ bl.ItemType) RequestOption
- func WithRegion(region string) RequestOption
- func WithVAT(vat string) RequestOption
- type Subset
- type SubsetEntry
- type SubsetItem
- type Superset
- type SupersetEntry
- type SupersetItem
Constants ¶
const ( GuideTypeSold = "sold" GuideTypeStock = "stock" PGRegionAsia = "asia" PGRegionEurope = "europe" PGRegionAfrica = "africa" PGRegionNorthAmerica = "north_america" PGRegionSouthAmerica = "south_america" PGRegionOceania = "oceania" PGRegionMiddleEast = "middle_east" PGRegionEU = "eu" )
Variables ¶
var ItemTypes = map[string]string{
"S": "Set",
"P": "Part",
"M": "Minifig",
"G": "Gear",
"B": "Book",
"C": "Catalog",
"O": "Original Box",
"X": "Instruction",
"U": "Unsorted Lot",
}
Functions ¶
Types ¶
type Category ¶
type Category struct { ID int `json:"category_id"` CategoryName string `json:"category_name"` ParentId int `json:"parent_id"` }
Category represents a category.
func (*Category) PrimaryKey ¶
type Color ¶
type Color struct { ID int `json:"color_id"` ColorName string `json:"color_name"` ColorCode string `json:"color_code"` ColorType string `json:"color_type"` }
func (Color) PrimaryKey ¶
type Item ¶
type Item struct { ID string `json:"no,omitempty"` Name string `json:"name,omitempty"` Type string `json:"type"` CategoryID int `json:"category_id,omitempty"` AlternateNo string `json:"alternate_no,omitempty"` ImageURL string `json:"image_url,omitempty"` ThumbnailURL string `json:"thumbnail_url,omitempty"` // Weight and Dimensions are specified to 2 decimal places. Weight string `json:"weight,omitempty"` // grams DimX string `json:"dim_x,omitempty"` DimY string `json:"dim_y,omitempty"` DimZ string `json:"dim_z,omitempty"` YearReleased int `json:"year_released,omitempty"` Description string `json:"description,omitempty"` IsObsolete bool `json:"is_obsolete,omitempty"` LanguageCode string `json:"language_code,omitempty"` }
Item represents a catalog item from the Bricklink API. https://www.bricklink.com/v3/api.page?page=resource-representations-catalog
func (Item) PrimaryKey ¶
PrimaryKey returns a hashed value for item based on the item number and type.
func (*Item) UnmarshalJSON ¶
type KnownColor ¶
type Mapping ¶
type Mapping struct { Item Item `json:"item"` ColorID int `json:"color_id"` ElementID string `json:"element_id"` }
Mapping maps a unique identifier to a Bricklink item/part/type combination.
func (Mapping) PrimaryKey ¶
type PriceDetail ¶
type PriceGuide ¶
type PriceGuide struct { Item Item `json:"item"` Color int `json:"color_id"` // optional GuideType string `json:"-"` Region string `json:"-"` CountryCode string `json:"-"` NewOrUsed string `json:"new_or_used"` CurrencyCode string `json:"currency_code"` MinPrice string `json:"min_price"` MaxPrice string `json:"max_price"` AvgPrice string `json:"avg_price"` QtyAvgPrice string `json:"qty_avg_price"` UnitQuantity int `json:"unit_quantity"` TotalQuantity int `json:"total_quantity"` PriceDetails []PriceDetail `json:"price_detail"` }
func (*PriceGuide) Label ¶
func (pg *PriceGuide) Label() entity.Label
func (*PriceGuide) PrimaryKey ¶
func (pg *PriceGuide) PrimaryKey() int
PrimaryKey isn't meaningful for this entity.
type Reference ¶
func (*Reference) GetCategories ¶
GetCategories returns a list of categories.
func (*Reference) GetCategory ¶
GetCategory returns the details of a specific category.
func (*Reference) GetElementID ¶
func (r *Reference) GetElementID(options ...RequestOption) ([]Mapping, error)
GetElementID returns the element ID for a specific item/part/type combination.
func (*Reference) GetItem ¶
func (r *Reference) GetItem(options ...RequestOption) (*Item, error)
GetItem returns a single part from Bricklink using the Get Item API method for the catalog item. https://www.bricklink.com/v3/api.page?page=get-item
func (*Reference) GetItemImage ¶
func (r *Reference) GetItemImage(options ...RequestOption) (*Item, error)
GetItemImage returns the image URL from Bricklink using the Get Item Image API method for the catalog item. https://www.bricklink.com/v3/api.page?page=get-item-image
func (*Reference) GetItemMapping ¶
GetItemMapping returns the mapping resource for an Element ID.
func (*Reference) GetKnownColors ¶
func (r *Reference) GetKnownColors(options ...RequestOption) ([]KnownColor, error)
func (*Reference) GetPriceGuide ¶
func (r *Reference) GetPriceGuide(options ...RequestOption) (*PriceGuide, error)
GetPriceGuide gets the price guide data for an item. Available params documented at https://www.bricklink.com/v3/api.page?page=get-price-guide Item type and number are required.
func (*Reference) GetSubset ¶
func (r *Reference) GetSubset(options ...RequestOption) (Subset, error)
GetSubset returns a list of items that make up the item.
func (*Reference) GetSupersets ¶
func (r *Reference) GetSupersets(options ...RequestOption) (Superset, error)
GetSupersets returns a list of supersets that contain the item. If a colorID is provided, the list is filtered to supersets that contain the item in that color.
type RequestOption ¶
type RequestOption func(opts *requestOptions)
func WithBreakMinifigs ¶
func WithBreakMinifigs(breakMinifigs bool) RequestOption
WithBreakMinifigs sets the break minifigs flag filter.
func WithBreakSubsets ¶
func WithBreakSubsets(breakSubsets bool) RequestOption
WithBreakSubsets sets the break subsets flag filter.
func WithColorID ¶
func WithColorID(colorID int) RequestOption
WithColorID sets the color ID filter.
func WithCondition ¶
func WithCondition(condition string) RequestOption
WithCondition sets the condition (new or used) filter.
func WithCountryCode ¶
func WithCountryCode(countryCode string) RequestOption
WithCountryCode sets the country code filter.
func WithCurrencyCode ¶
func WithCurrencyCode(currencyCode string) RequestOption
WithCurrencyCode sets the currency code filter.
func WithGuideType ¶
func WithGuideType(guideType string) RequestOption
WithGuideType sets the guide type (sold or stock) filter.
func WithInstruction ¶
func WithInstruction(instruction bool) RequestOption
WithInstruction sets the instruction flag filter.
func WithItemNo ¶
func WithItemNo(itemNo string) RequestOption
WithItemNo sets the item number filter. It will be ignored if the calling function is a member function of the item type.
func WithItemType ¶
func WithItemType(typ bl.ItemType) RequestOption
type Subset ¶
type Subset []SubsetItem
func (*Subset) PrimaryKey ¶
PrimaryKey isn't meaningful for this entity.
type SubsetEntry ¶
type SubsetItem ¶
type SubsetItem struct { MatchNo int `json:"match_no"` // 0 value are unique parts with no alternates or counterparts Entries []SubsetEntry `json:"entries"` }
type Superset ¶
type Superset []SupersetItem
func (Superset) PrimaryKey ¶
PrimaryKey isn't meaningful for this entity.
type SupersetEntry ¶
type SupersetItem ¶
type SupersetItem struct { ColorID int `json:"color_id"` Entries []SupersetEntry `json:"entries"` }