Documentation ¶
Index ¶
- Variables
- func CheckMonitorType(t *shopifyTasks.ShopifyTask) string
- func ExtractProductInfo(prod Product, desiredSizes []string, strategy string) (shopifyTasks.CustomProduct, error)
- func ExtractProductInfoJS(prod ProductDotJS, desiredSizes []string, strategy string) (shopifyTasks.CustomProduct, error)
- func KeywordMonitor(t *shopifyTasks.ShopifyTask) (shopifyTasks.CustomProduct, error)
- func LinkMonitor(t *shopifyTasks.ShopifyTask) (shopifyTasks.CustomProduct, error)
- func ParseKws(in string) (pos, neg []string)
- type Images
- type ParseMethod
- type Product
- type ProductDotJS
- type ProductsDotJson
- type Variant
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNoProductSpecified = fmt.Errorf("no product specified") ParseFAOrder = ParseMethod("fa") ParseRAOrder = ParseMethod("ra") )
Functions ¶
func CheckMonitorType ¶
func CheckMonitorType(t *shopifyTasks.ShopifyTask) string
Return monitor type
func ExtractProductInfo ¶
func ExtractProductInfo(prod Product, desiredSizes []string, strategy string) (shopifyTasks.CustomProduct, error)
Extracts product information from products.json payload based on desired sizes and a given strategy
func ExtractProductInfoJS ¶
func ExtractProductInfoJS(prod ProductDotJS, desiredSizes []string, strategy string) (shopifyTasks.CustomProduct, error)
Extracts product information from a product .js payload based on desired sizes and a given strategy
func KeywordMonitor ¶
func KeywordMonitor(t *shopifyTasks.ShopifyTask) (shopifyTasks.CustomProduct, error)
Monitor products.json for keywords
func LinkMonitor ¶
func LinkMonitor(t *shopifyTasks.ShopifyTask) (shopifyTasks.CustomProduct, error)
Monitor a given product link
Types ¶
type Images ¶
type Images struct { ID int64 `json:"id"` CreatedAt string `json:"created_at"` Position int `json:"position"` UpdatedAt string `json:"updated_at"` ProductID int64 `json:"product_id"` VariantIds []interface{} `json:"variant_ids"` Src string `json:"src"` Width int `json:"width"` Height int `json:"height"` }
type ParseMethod ¶
type ParseMethod string
type Product ¶
type Product struct { ID int64 `json:"id"` Title string `json:"title"` Handle string `json:"handle"` // BodyHTML string `json:"body_html"` // PublishedAt string `json:"published_at"` // CreatedAt string `json:"created_at"` // UpdatedAt string `json:"updated_at"` // Vendor string `json:"vendor"` // ProductType string `json:"product_type"` // Tags []string `json:"tags"` Variants []Variant `json:"variants"` Images []Images `json:"images"` }
func FetchProducts ¶
func FetchProducts(t *shopifyTasks.ShopifyTask, client *requests.Session, posKws, negKws []string) (Product, error)
Main monitoring function Gets products from products.json and checks for keyword matches
type ProductDotJS ¶
type ProductDotJS struct { ID int64 `json:"id"` Title string `json:"title"` Handle string `json:"handle"` // Description string `json:"description"` // PublishedAt string `json:"published_at"` // CreatedAt string `json:"created_at"` // Vendor string `json:"vendor"` // Type string `json:"type"` // Tags []string `json:"tags"` // Price int `json:"price"` // PriceMin int `json:"price_min"` // PriceMax int `json:"price_max"` // Available bool `json:"available"` // PriceVaries bool `json:"price_varies"` // CompareAtPrice interface{} `json:"compare_at_price"` // CompareAtPriceMin int `json:"compare_at_price_min"` // CompareAtPriceMax int `json:"compare_at_price_max"` // CompareAtPriceVaries bool `json:"compare_at_price_varies"` Variants []Variant `json:"variants"` Images []string `json:"images"` FeaturedImage string `json:"featured_image"` }
func FetchProductFromLink ¶
func FetchProductFromLink(t *shopifyTasks.ShopifyTask, client *requests.Session) (ProductDotJS, error)
Get product JSON given a product link (using .js endpoint)
type ProductsDotJson ¶
type ProductsDotJson struct {
Products []Product `json:"products"`
}
We don't need many of the fields in the JSON response, so we only include/parse the ones we need
type Variant ¶
type Variant struct { ID int64 `json:"id"` Title string `json:"title"` Option1 string `json:"option1"` Option2 string `json:"option2"` // Option3 interface{} `json:"option3"` // Sku string `json:"sku"` // RequiresShipping bool `json:"requires_shipping"` // Taxable bool `json:"taxable"` FeaturedImage interface{} `json:"featured_image"` Available bool `json:"available"` Price interface{} `json:"price"` }
Click to show internal directories.
Click to hide internal directories.