Documentation
¶
Index ¶
- Variables
- func Query(db *datastore.Datastore) datastore.Query
- type Listing
- type Listings
- type ShippingRateTable
- type Store
- func (s *Store) AddListing(id string, listing Listing)
- func (s *Store) AfterCreate() error
- func (s *Store) Defaults()
- func (s Store) GetShippingRates() (*shippingrates.ShippingRates, error)
- func (s Store) GetTaxRates() (*taxrates.TaxRates, error)
- func (s *Store) Init(db *datastore.Datastore)
- func (s Store) Kind() string
- func (s *Store) Load(ps []datastore.Property) (err error)
- func (s *Store) Save() (ps []datastore.Property, err error)
- func (s *Store) UpdateFromListing(entity mixin.Entity)
- func (s *Store) Validator() *val.Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ListingFields = reflect.FieldNames(Listing{})
Functions ¶
Types ¶
type Listing ¶
type Listing struct {
// Not customizable
ProductId string `json:"productId,omitempty"`
Slug string `json:"slug,omitempty"`
VariantId string `json:"variantId,omitempty"`
SKU string `json:"sku,omitempty"`
Currency currency.Type `json:"currency,omitempty"`
Name *string `json:"name"`
Headline *string `json:"headline,omitempty"`
Excerpt *string `json:"excerpt,omitempty"`
Description *string `json:"description,omitempty"`
// Product Media
HeaderImage *Media `json:"headerImage,omitempty"`
Media *[]Media `json:"media,omitempty"`
Sold *int `json:"sold"`
Price *currency.Cents `json:"price,omitempty"`
ListPrice *currency.Cents `json:"listPrice,omitempty"`
Shipping *currency.Cents `json:"shipping,omitempty"`
Taxable *bool `json:"taxable,omitempty"`
WeightUnit *weight.Unit `json:"weightUnit,omitempty"`
Available *bool `json:"available,omitempty"`
Availability *Availability `json:"availability,omitempty"`
Hidden *bool `json:"hidden,omitempty"`
}
Everything is a pointer, which allows fields to be nil. This way when we serialize to/from JSON we know what has and has not been set.
type ShippingRateTable ¶
type Store ¶
type Store struct {
mixin.Model
// Full name of store
Name string `json:"name"`
// Unique human readable id for url <slug>.hanzo.aie
Slug string `json:"slug"`
// Where this is hosted if not on hanzo.ai
Domain string `json:"domain"`
Prefix string `json:"prefix"`
// Currency for store
Currency currency.Type `json:"currency"`
Address Address `json:"address,omitempty"`
TaxNexus []Address `json:"taxNexus,omitempty"`
// Overrides per item
Listings Listings `json:"listings" datastore:"-"`
Listings_ string `json:"-" datastore:",noindex"`
Salesforce struct {
PriceBookId string `json:"PriceBookId"`
} `json:"-"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
Timezone string `json:"timezone,omitempty"`
ReferralBaseUrl string `json:"referralBaseUrl,omitempty"`
Mailchimp struct {
ListId string `json:"listId"`
APIKey string `json:"apiKey"`
} `json:"mailchimp,omitempty"`
}
func (*Store) AddListing ¶
Add a new listing to the listings map
func (Store) GetShippingRates ¶
func (s Store) GetShippingRates() (*shippingrates.ShippingRates, error)
Return ShippingRates
func (*Store) UpdateFromListing ¶
Update product/variant using listing for said item
Click to show internal directories.
Click to hide internal directories.