reference

package
v0.1.4-beta Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
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

View Source
var Colors map[int]Color
View Source
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

This section is empty.

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) Label

func (c *Category) Label() entity.Label

func (*Category) PrimaryKey

func (c *Category) PrimaryKey() int

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) Label

func (c Color) Label() entity.Label

func (Color) PrimaryKey

func (c Color) PrimaryKey() int

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"`

	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"`
	// contains filtered or unexported fields
}

func (Item) Label

func (it Item) Label() entity.Label

func (Item) PrimaryKey

func (it Item) PrimaryKey() int

type KnownColor

type KnownColor struct {
	ColorID  int `json:"color_id"`
	Quantity int `json:"quantity"`
}

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) Label

func (m Mapping) Label() entity.Label

func (Mapping) PrimaryKey

func (m Mapping) PrimaryKey() string

type PriceDetail

type PriceDetail struct {
	Quantity          int       `json:"quantity"`
	UnitPrice         string    `json:"unit_price"`
	SellerCountryCode string    `json:"seller_country_code"`
	BuyerCountryCode  string    `json:"buyer_country_code"`
	DateOrdered       time.Time `json:"date_ordered"`
	ShippingAvailable bool      `json:"shipping_available"`
}

type PriceGuide

type PriceGuide struct {
	Item          Item          `json:"item"`
	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

type Reference struct {
	bl.Bricklink
}

func New

func New(b bl.Bricklink) *Reference

func (*Reference) GetCategories

func (r *Reference) GetCategories() ([]Category, error)

GetCategories returns a list of categories.

func (*Reference) GetCategory

func (r *Reference) GetCategory(id int) (*Category, error)

GetCategory returns the details of a specific category.

func (*Reference) GetColor

func (r *Reference) GetColor(colorID int) (*Color, error)

GetColor returns a color by color ID.

func (*Reference) GetColors

func (r *Reference) GetColors() ([]Color, error)

GetColors returns a list of colors.

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)

func (*Reference) GetItemImage

func (r *Reference) GetItemImage(options ...RequestOption) (*Item, error)

func (*Reference) GetItemMapping

func (r *Reference) GetItemMapping(elementID string) ([]Mapping, error)

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)

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 WithBox

func WithBox(box bool) RequestOption

WithBox sets the box flag filter.

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

func WithRegion

func WithRegion(region string) RequestOption

WithRegion sets the region filter.

func WithVAT

func WithVAT(vat string) RequestOption

WithVAT sets the VAT flag filter.

type Subset

type Subset []SubsetItem

func (*Subset) Label

func (sub *Subset) Label() entity.Label

func (*Subset) PrimaryKey

func (sub *Subset) PrimaryKey() int

PrimaryKey isn't meaningful for this entity.

type SubsetItem

type SubsetItem struct {
	MatchNo int `json:"match_no"` // 0 value are unique parts with no alternates or counterparts
	Entries []struct {
		Item          Item `json:"item"`
		ColorID       int  `json:"color_id"`
		Quantity      int  `json:"quantity"`
		ExtraQuantity int  `json:"extra_quantity"`
		IsAlternate   bool `json:"is_alternate"`
		IsCounterpart bool `json:"is_counterpart"`
	} `json:"entries"`
}

type Superset

type Superset []SupersetItem

func (Superset) Label

func (Superset) Label() entity.Label

func (Superset) PrimaryKey

func (Superset) PrimaryKey() int

PrimaryKey isn't meaningful for this entity.

type SupersetItem

type SupersetItem struct {
	ColorID int `json:"color_id"`
	Entries []struct {
		Item      Item   `json:"item"`
		Quantity  int    `json:"quantity"`
		AppearsAs string `json:"appears_as"`
	} `json:"entries"`
}

Jump to

Keyboard shortcuts

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