Documentation
¶
Index ¶
- Variables
- func ParsePrice(strPrice string) (float64, error)
- func TransformPrice(price float64) string
- type Classification
- type Error
- type Image
- type ImageId
- type OptionType
- type OptionValue
- type Product
- type ProductId
- type ProductsEdge
- type Property
- type PropertyId
- type Resource
- type ShippingCategoryId
- type Spree
- func (s *Spree) Delete(url string) (resp *http.Response, err error)
- func (s *Spree) DeleteProduct(id ProductId) error
- func (s *Spree) FetchProducts() ([]*Product, error)
- func (s *Spree) Get(url string) (resp *http.Response, err error)
- func (s *Spree) GetProduct(id ProductId) (*Product, error)
- func (s *Spree) GetProducts(page int) (*ProductsEdge, error)
- func (s *Spree) GetVariant(id VariantId, prodId ProductId) (*Variant, error)
- func (s *Spree) Post(url string, body io.Reader) (resp *http.Response, err error)
- func (s *Spree) Put(url string, body io.Reader) (resp *http.Response, err error)
- func (s *Spree) RouteTo(path string, params url.Values, ids ...interface{}) (string, error)
- func (s *Spree) SetAndValidateCredentials(ctx context.Context, apiKey string) error
- func (s *Spree) SetClient(c http.Client)
- func (s *Spree) SetCredentials(ctx context.Context, apiKey string) error
- func (s *Spree) SetProduct(prod *Product) (newProd *Product, err error)
- func (s *Spree) SetVariant(v *Variant, prodId ProductId) (newVar *Variant, err error)
- func (s *Spree) UpdateStock(id VariantId, prodId ProductId, stockLocationId StockLocationId, count int) (*StockItem, error)
- type StockItem
- type StockItemId
- type StockLocationId
- type Taxon
- type Variant
- type VariantId
- type Webhook
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrorsSeparator = ";"
Functions ¶
func ParsePrice ¶
func TransformPrice ¶
Types ¶
type Classification ¶
type Error ¶
type Image ¶
type Image struct {
Id ImageId `json:"id"`
Position int `json:"position"`
AttachmentContentType string `json:"attachment_content_type"`
AttachmentFileName string `json:"attachment_file_name"`
Type string `json:"type"`
AttachmentUpdatedAt time.Time `json:"attachment_updated_at"`
AttachmentWidth int `json:"attachment_width"`
AttachmentHeight int `json:"attachment_height"`
Alt string `json:"alt"`
ViewableType string `json:"viewable_type"`
ViewableId int `json:"viewable_id"`
MiniURL string `json:"mini_url"`
SmallURL string `json:"small_url"`
ProductURL string `json:"product_url"`
LargeURL string `json:"large_url"`
}
type OptionType ¶
type OptionValue ¶
type Product ¶
type Product struct {
Id ProductId `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Price string `json:"price,omitempty"`
DisplayPrice string `json:"display_price,omitempty"`
ShippingCategoryId ShippingCategoryId `json:"shipping_category_id,omitempty"`
TaxonIds []int `json:"taxon_ids,omitempty"`
TotalOnHand int `json:"total_on_hand,omitempty"`
OptionTypes []*OptionType `json:"option_types,omitempty"`
ProductProperties []*Property `json:"product_properties,omitempty"`
Master *Variant `json:"master,omitempty"`
Variants []*Variant `json:"variants,omitempty"`
Slug string `json:"slug,omitempty"`
AvailableOn time.Time `json:"available_on,omitempty"`
}
func NewProduct ¶
func NewProduct(name string, price float64, shippingCategoryId ShippingCategoryId) (*Product, error)
TODO: add images as needed
func (*Product) VariantsIncludingMaster ¶
type ProductsEdge ¶
type Property ¶
type Property struct {
Id PropertyId
ProductId ProductId
PropertyId int
Value string
PropertyName string
}
type PropertyId ¶
type PropertyId int
type ShippingCategoryId ¶
type ShippingCategoryId int
type Spree ¶
func (*Spree) DeleteProduct ¶
func (*Spree) FetchProducts ¶
func (*Spree) GetProducts ¶
func (s *Spree) GetProducts(page int) (*ProductsEdge, error)
func (*Spree) GetVariant ¶
func (*Spree) SetAndValidateCredentials ¶
func (*Spree) SetCredentials ¶
func (*Spree) SetVariant ¶
func (*Spree) UpdateStock ¶
type StockItem ¶
type StockItem struct {
Id StockItemId `json:"id"`
CountOnHand int `json:"count_on_hand"`
StockLocationId StockLocationId `json:"stock_location_id"`
Backorderable bool `json:"backorderable"`
Available bool `json:"available"`
StockLocationName string `json:"stock_location_name"`
Force bool `json:"force,omitempty"`
}
type StockItemId ¶
type StockItemId int
type StockLocationId ¶
type StockLocationId int
type Variant ¶
type Variant struct {
Id VariantId `json:"id"`
Name string `json:"name"`
SKU string `json:"sku"`
Price string `json:"price"`
CostPrice string `json:"cost_price"`
Weight string `json:"weight"`
Height string `json:"height"`
Width string `json:"width"`
Depth string `json:"depth"`
IsMaster bool `json:"is_master"`
Slug string `json:"slug"`
Description string `json:"description"`
TrackInventory bool `json:"track_inventory"`
OptionValues []*OptionValue `json:"option_values"`
Images []*Image `json:"images"`
DisplayPrice string `json:"display_price"`
OptionsText string `json:"options_text"`
InStock bool `json:"in_stock"`
IsBackorderable bool `json:"is_backorderable"`
TotalOnHand int `json:"total_on_hand"`
IsDestroyed bool `json:"is_destroyed"`
StockItems []*StockItem `json:"stock_items"`
}
func NewVariant ¶
func NewVariant(name string, price float64, optionValues []*OptionValue, picsSrc []string) *Variant
func (*Variant) StockItemByLocation ¶
func (v *Variant) StockItemByLocation(stockLocationId StockLocationId) (*StockItem, error)
Click to show internal directories.
Click to hide internal directories.