Skip to content

Commit

Permalink
feat: add product status to list options (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
si-m authored Sep 28, 2023
1 parent ff3081d commit 26d463b
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions product.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,23 @@ type ProductServiceOp struct {
client *Client
}

type productStatus string
// ProductStatus represents a Shopify product status.
type ProductStatus string

// https://shopify.dev/docs/api/admin-rest/2023-07/resources/product#resource-object
const (
//The product is ready to sell and is available to customers on the online store,
//sales channels, and apps. By default, existing products are set to active.
ProductStatusActive productStatus = "active"
ProductStatusActive ProductStatus = "active"

//The product is no longer being sold and isn't available to customers on sales
//channels and apps.
ProductStatusArchived productStatus = "archived"
ProductStatusArchived ProductStatus = "archived"

//The product isn't ready to sell and is unavailable to customers on sales
//channels and apps. By default, duplicated and unarchived products are set to
//draft.
ProductStatucDraft productStatus = "draft"
ProductStatucDraft ProductStatus = "draft"
)

// Product represents a Shopify product
Expand All @@ -65,7 +66,7 @@ type Product struct {
PublishedAt *time.Time `json:"published_at,omitempty"`
PublishedScope string `json:"published_scope,omitempty"`
Tags string `json:"tags,omitempty"`
Status productStatus `json:"status,omitempty"`
Status ProductStatus `json:"status,omitempty"`
Options []ProductOption `json:"options,omitempty"`
Variants []Variant `json:"variants,omitempty"`
Image Image `json:"image,omitempty"`
Expand All @@ -88,14 +89,15 @@ type ProductOption struct {

type ProductListOptions struct {
ListOptions
CollectionID int64 `url:"collection_id,omitempty"`
ProductType string `url:"product_type,omitempty"`
Vendor string `url:"vendor,omitempty"`
Handle string `url:"handle,omitempty"`
PublishedAtMin time.Time `url:"published_at_min,omitempty"`
PublishedAtMax time.Time `url:"published_at_max,omitempty"`
PublishedStatus string `url:"published_status,omitempty"`
PresentmentCurrencies string `url:"presentment_currencies,omitempty"`
CollectionID int64 `url:"collection_id,omitempty"`
ProductType string `url:"product_type,omitempty"`
Vendor string `url:"vendor,omitempty"`
Handle string `url:"handle,omitempty"`
PublishedAtMin time.Time `url:"published_at_min,omitempty"`
PublishedAtMax time.Time `url:"published_at_max,omitempty"`
PublishedStatus string `url:"published_status,omitempty"`
PresentmentCurrencies string `url:"presentment_currencies,omitempty"`
Status []ProductStatus `url:"status,omitempty,comma"`
}

// Represents the result from the products/X.json endpoint
Expand Down

0 comments on commit 26d463b

Please sign in to comment.