Documentation ¶
Index ¶
- Constants
- func CheckResponseError(r *http.Response) error
- func FulfillmentPathPrefix(resource string, resourceID string) string
- func MetafieldPathPrefix(resource string, resourceID int64) string
- func ShopBaseUrl(name string) string
- func ShopFullName(name string) string
- func ShopShortName(name string) string
- type Address
- type App
- type Client
- func (c *Client) Count(path string, options interface{}) (int, error)
- func (c *Client) CreateAndDo(method, path string, data, options, resource interface{}) error
- func (c *Client) Delete(path string) error
- func (c *Client) Do(req *http.Request, v interface{}) error
- func (c *Client) Get(path string, resource, options interface{}) error
- func (c *Client) NewRequest(method, urlStr string, body, options interface{}) (*http.Request, error)
- func (c *Client) Post(path string, data, resource interface{}) error
- func (c *Client) Put(path string, data, resource interface{}) error
- type ClientDetails
- type CountOptions
- type DiscountCode
- type Fulfillment
- type FulfillmentResource
- type FulfillmentService
- type FulfillmentServiceOp
- func (s *FulfillmentServiceOp) Cancel(fulfillmentID string) (*Fulfillment, error)
- func (s *FulfillmentServiceOp) Complete(fulfillmentID string) (*Fulfillment, error)
- func (s *FulfillmentServiceOp) Count(options interface{}) (int, error)
- func (s *FulfillmentServiceOp) Create(fulfillment Fulfillment) (*Fulfillment, error)
- func (s *FulfillmentServiceOp) Get(fulfillmentID string, options interface{}) (*Fulfillment, error)
- func (s *FulfillmentServiceOp) List(options interface{}) ([]Fulfillment, error)
- func (s *FulfillmentServiceOp) Transition(fulfillmentID string) (*Fulfillment, error)
- func (s *FulfillmentServiceOp) Update(fulfillment Fulfillment) (*Fulfillment, error)
- type FulfillmentsResource
- type FulfillmentsService
- type Image
- type ImageResource
- type ImageService
- type ImageServiceOp
- func (s *ImageServiceOp) Count(productID int64, options interface{}) (int, error)
- func (s *ImageServiceOp) Create(productID int64, image Image) (*Image, error)
- func (s *ImageServiceOp) Delete(productID int64, imageID int64) error
- func (s *ImageServiceOp) Get(productID int64, imageID int64, options interface{}) (*Image, error)
- func (s *ImageServiceOp) List(productID int64, options interface{}) ([]Image, error)
- func (s *ImageServiceOp) Update(productID int64, image Image) (*Image, error)
- type ImagesResource
- type LineItem
- type LineItemProperty
- type ListOptions
- type NoteAttribute
- type Option
- type Order
- type OrderCountOptions
- type OrderListOptions
- type OrderResource
- type OrderService
- type OrderServiceOp
- func (s *OrderServiceOp) CancelFulfillment(orderID string, fulfillmentID string) (*Fulfillment, error)
- func (s *OrderServiceOp) CompleteFulfillment(orderID string, fulfillmentID string) (*Fulfillment, error)
- func (s *OrderServiceOp) Count(options interface{}) (int, error)
- func (s *OrderServiceOp) CountFulfillments(orderID string, options interface{}) (int, error)
- func (s *OrderServiceOp) Create(order Order) (*Order, error)
- func (s *OrderServiceOp) CreateFulfillment(orderID string, fulfillment Fulfillment) (*Fulfillment, error)
- func (s *OrderServiceOp) Get(orderID string, options interface{}) (*Order, error)
- func (s *OrderServiceOp) GetFulfillment(orderID string, fulfillmentID string, options interface{}) (*Fulfillment, error)
- func (s *OrderServiceOp) List(options interface{}) ([]Order, error)
- func (s *OrderServiceOp) ListFulfillments(orderID string, options interface{}) ([]Fulfillment, error)
- func (s *OrderServiceOp) TransitionFulfillment(orderID string, fulfillmentID string) (*Fulfillment, error)
- func (s *OrderServiceOp) Update(order Order) (*Order, error)
- func (s *OrderServiceOp) UpdateFulfillment(orderID string, fulfillment Fulfillment) (*Fulfillment, error)
- type OrdersResource
- type PaymentDetails
- type Product
- type ProductOption
- type ProductResource
- type ProductService
- type ProductServiceOp
- func (s *ProductServiceOp) Count(options interface{}) (int, error)
- func (s *ProductServiceOp) Create(product Product) (*Product, error)
- func (s *ProductServiceOp) Delete(productID string) error
- func (s *ProductServiceOp) Get(productID string, options interface{}) (*Product, error)
- func (s *ProductServiceOp) List(options interface{}) ([]Product, error)
- func (s *ProductServiceOp) Update(product Product) (*Product, error)
- type ProductsResource
- type RateLimitError
- type Receipt
- type Refund
- type RefundLineItem
- type ResponseDecodingError
- type ResponseError
- type ShippingLine
- type TaxLine
- type Transaction
- type Variant
- type VariantResource
- type VariantService
- type VariantServiceOp
- func (s *VariantServiceOp) Count(productID int64, options interface{}) (int, error)
- func (s *VariantServiceOp) Create(productID int64, variant Variant) (*Variant, error)
- func (s *VariantServiceOp) Delete(productID int64, variantID int64) error
- func (s *VariantServiceOp) Get(variantID int64, options interface{}) (*Variant, error)
- func (s *VariantServiceOp) List(productID int64, options interface{}) ([]Variant, error)
- func (s *VariantServiceOp) Update(variant Variant) (*Variant, error)
- type VariantsResource
Constants ¶
const (
UserAgent = "goshoplazza/0.0.1"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponseError ¶
func FulfillmentPathPrefix ¶
Return the prefix for a fulfillment path
func MetafieldPathPrefix ¶
Return the prefix for a metafield path
func ShopFullName ¶
Return the full shop name, including .myshoplaza.com
func ShopShortName ¶
Return the short shop name, excluding .myshoplaza.com
Types ¶
type Address ¶
type Address struct { ID int64 `json:"id,omitempty"` Address1 string `json:"address1,omitempty"` Address2 string `json:"address2,omitempty"` City string `json:"city,omitempty"` Company string `json:"company,omitempty"` Country string `json:"country,omitempty"` CountryCode string `json:"country_code,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` Latitude float64 `json:"latitude,omitempty"` Longitude float64 `json:"longitude,omitempty"` Name string `json:"name,omitempty"` Phone string `json:"phone,omitempty"` Province string `json:"province,omitempty"` ProvinceCode string `json:"province_code,omitempty"` Zip string `json:"zip,omitempty"` }
type App ¶
App represents basic app settings such as Api key, secret, scope, and redirect url. See oauth.go for OAuth related helper functions.
func (App) NewClient ¶
NewClient returns a new Shopify API client with an already authenticated shopname and token. The shopName parameter is the shop's myshoplazza domain, e.g. "theshop.myshoplazza.com", or simply "theshop" a.NewClient(shopName, token, opts) is equivalent to NewClient(a, shopName, token, opts)
type Client ¶
type Client struct { // HTTP client used to communicate with the DO API. Client *http.Client // Services used for communicating with the API Product ProductService // CustomCollection CustomCollectionService // SmartCollection SmartCollectionService // Customer CustomerService // CustomerAddress CustomerAddressService Order OrderService // DraftOrder DraftOrderService // Shop ShopService // Webhook WebhookService Variant VariantService Image ImageService // contains filtered or unexported fields }
Client manages communication with the Shopify API.
func NewClient ¶
Returns a new Shopify API client with an already authenticated shopname and token. The shopName parameter is the shop's myshoplazza domain, e.g. "theshop.myshoplazza.com", or simply "theshop"
func (*Client) CreateAndDo ¶
CreateAndDo performs a web request to Shopify with the given method (GET, POST, PUT, DELETE) and relative path (e.g. "/admin/orders.json"). The data, options and resource arguments are optional and only relevant in certain situations. If the data argument is non-nil, it will be used as the body of the request for POST and PUT requests. The options argument is used for specifying request options such as search parameters like created_at_min Any data returned from Shopify will be marshalled into resource argument.
func (*Client) Do ¶
Do sends an API request and populates the given interface with the parsed response. It does not make much sense to call Do without a prepared interface instance.
func (*Client) Get ¶
Get performs a GET request for the given path and saves the result in the given resource.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, urlStr string, body, options interface{}) (*http.Request, error)
Creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type ClientDetails ¶
type ClientDetails struct { AcceptLanguage string `json:"accept_language,omitempty"` BrowserHeight int `json:"browser_height,omitempty"` BrowserIp string `json:"browser_ip,omitempty"` BrowserWidth int `json:"browser_width,omitempty"` SessionHash string `json:"session_hash,omitempty"` UserAgent string `json:"user_agent,omitempty"` }
type CountOptions ¶
type CountOptions struct { CreatedAtMin time.Time `url:"created_at_min,omitempty"` CreatedAtMax time.Time `url:"created_at_max,omitempty"` UpdatedAtMin time.Time `url:"updated_at_min,omitempty"` UpdatedAtMax time.Time `url:"updated_at_max,omitempty"` }
General count options that can be used for most collection counts.
type DiscountCode ¶
type Fulfillment ¶
type Fulfillment struct { ID string `json:"id,omitempty"` OrderID string `json:"order_id,omitempty"` Status string `json:"status,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` // Service string `json:"service,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` TrackingCompany string `json:"tracking_company,omitempty"` TrackingCompanyCode string `json:"tracking_company_code,omitempty"` // ShipmentStatus string `json:"shipment_status,omitempty"` TrackingNumber string `json:"tracking_number,omitempty"` // TrackingNumbers []string `json:"tracking_numbers,omitempty"` // TrackingUrl string `json:"tracking_url,omitempty"` // TrackingUrls []string `json:"tracking_urls,omitempty"` // Receipt Receipt `json:"receipt,omitempty"` LineItems []LineItem `json:"line_items,omitempty"` // NotifyCustomer bool `json:"notify_customer"` LineItemIDs []string `json:"line_item_ids,omitempty"` }
Fulfillment represents a Shopify fulfillment.
type FulfillmentResource ¶
type FulfillmentResource struct {
Fulfillment *Fulfillment `json:"fulfillment"`
}
FulfillmentResource represents the result from the fulfillments/X.json endpoint
type FulfillmentService ¶
type FulfillmentService interface { List(interface{}) ([]Fulfillment, error) Count(interface{}) (int, error) Get(string, interface{}) (*Fulfillment, error) Create(Fulfillment) (*Fulfillment, error) Update(Fulfillment) (*Fulfillment, error) Complete(string) (*Fulfillment, error) Transition(string) (*Fulfillment, error) Cancel(string) (*Fulfillment, error) }
FulfillmentService is an interface for interfacing with the fulfillment endpoints of the Shopify API. https://help.shopify.com/api/reference/fulfillment
type FulfillmentServiceOp ¶
type FulfillmentServiceOp struct {
// contains filtered or unexported fields
}
FulfillmentServiceOp handles communication with the fulfillment related methods of the Shopify API.
func (*FulfillmentServiceOp) Cancel ¶
func (s *FulfillmentServiceOp) Cancel(fulfillmentID string) (*Fulfillment, error)
Cancel an existing fulfillment
func (*FulfillmentServiceOp) Complete ¶
func (s *FulfillmentServiceOp) Complete(fulfillmentID string) (*Fulfillment, error)
Complete an existing fulfillment
func (*FulfillmentServiceOp) Count ¶
func (s *FulfillmentServiceOp) Count(options interface{}) (int, error)
Count fulfillments
func (*FulfillmentServiceOp) Create ¶
func (s *FulfillmentServiceOp) Create(fulfillment Fulfillment) (*Fulfillment, error)
Create a new fulfillment
func (*FulfillmentServiceOp) Get ¶
func (s *FulfillmentServiceOp) Get(fulfillmentID string, options interface{}) (*Fulfillment, error)
Get individual fulfillment
func (*FulfillmentServiceOp) List ¶
func (s *FulfillmentServiceOp) List(options interface{}) ([]Fulfillment, error)
List fulfillments
func (*FulfillmentServiceOp) Transition ¶
func (s *FulfillmentServiceOp) Transition(fulfillmentID string) (*Fulfillment, error)
Transition an existing fulfillment
func (*FulfillmentServiceOp) Update ¶
func (s *FulfillmentServiceOp) Update(fulfillment Fulfillment) (*Fulfillment, error)
Update an existing fulfillment
type FulfillmentsResource ¶
type FulfillmentsResource struct {
Fulfillments []Fulfillment `json:"fulfillments"`
}
FulfillmentsResource represents the result from the fullfilments.json endpoint
type FulfillmentsService ¶
type FulfillmentsService interface { ListFulfillments(string, interface{}) ([]Fulfillment, error) CountFulfillments(string, interface{}) (int, error) GetFulfillment(string, string, interface{}) (*Fulfillment, error) CreateFulfillment(string, Fulfillment) (*Fulfillment, error) UpdateFulfillment(string, Fulfillment) (*Fulfillment, error) CompleteFulfillment(string, string) (*Fulfillment, error) TransitionFulfillment(string, string) (*Fulfillment, error) CancelFulfillment(string, string) (*Fulfillment, error) }
FulfillmentsService is an interface for other Shopify resources to interface with the fulfillment endpoints of the Shopify API. https://help.shopify.com/api/reference/fulfillment
type Image ¶
type Image struct { ID string `json:"id,omitempty"` ProductID string `json:"product_id,omitempty"` Position int `json:"position,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Width interface{} `json:"width,omitempty"` // 有两种类型的值 220 和 "220", 使用时注意asset类型并做转换 Height interface{} `json:"height,omitempty"` // 有两种类型的值 220 和 "220", 使用时注意asset类型并做转换 Src string `json:"src,omitempty"` Alt string `json:"alt,omitempty"` }
Image represents a Shopify product's image.
type ImageResource ¶
type ImageResource struct {
Image *Image `json:"image"`
}
ImageResource represents the result form the products/X/images/Y.json endpoint
type ImageService ¶
type ImageService interface { List(int64, interface{}) ([]Image, error) Count(int64, interface{}) (int, error) Get(int64, int64, interface{}) (*Image, error) Create(int64, Image) (*Image, error) Update(int64, Image) (*Image, error) Delete(int64, int64) error }
ImageService is an interface for interacting with the image endpoints of the Shopify API. See https://help.shopify.com/api/reference/product_image
type ImageServiceOp ¶
type ImageServiceOp struct {
// contains filtered or unexported fields
}
ImageServiceOp handles communication with the image related methods of the Shopify API.
func (*ImageServiceOp) Count ¶
func (s *ImageServiceOp) Count(productID int64, options interface{}) (int, error)
Count images
func (*ImageServiceOp) Create ¶
func (s *ImageServiceOp) Create(productID int64, image Image) (*Image, error)
Create a new image
There are 2 methods of creating an image in Shopify: 1. Src 2. Filename and Attachment
If both Image.Filename and Image.Attachment are supplied, then Image.Src is not needed. And vice versa.
If both Image.Attachment and Image.Src are provided, Shopify will take the attachment.
Shopify will accept Image.Attachment without Image.Filename.
func (*ImageServiceOp) Delete ¶
func (s *ImageServiceOp) Delete(productID int64, imageID int64) error
Delete an existing image
func (*ImageServiceOp) Get ¶
func (s *ImageServiceOp) Get(productID int64, imageID int64, options interface{}) (*Image, error)
Get individual image
type ImagesResource ¶
type ImagesResource struct {
Images []Image `json:"images"`
}
ImagesResource represents the result from the products/X/images.json endpoint
type LineItem ¶
type LineItem struct { ID string `json:"id,omitempty"` ProductID string `json:"product_id,omitempty"` VariantID string `json:"variant_id,omitempty"` Quantity int `json:"quantity,omitempty"` Price *decimal.Decimal `json:"price,omitempty"` TotalDiscount *decimal.Decimal `json:"total_discount,omitempty"` ProductTitle string `json:"product_title,omitempty"` VariantTitle string `json:"variant_title,omitempty"` Name string `json:"name,omitempty"` SKU string `json:"sku,omitempty"` Vendor string `json:"vendor,omitempty"` GiftCard bool `json:"gift_card,omitempty"` Taxable bool `json:"taxable,omitempty"` FulfillmentService string `json:"fulfillment_service,omitempty"` RequiresShipping bool `json:"requires_shipping,omitempty"` VariantInventoryManagement string `json:"variant_inventory_management,omitempty"` PreTaxPrice *decimal.Decimal `json:"pre_tax_price,omitempty"` Properties []NoteAttribute `json:"properties,omitempty"` ProductExists bool `json:"product_exists,omitempty"` FulfillableQuantity int `json:"fulfillable_quantity,omitempty"` Grams int `json:"grams,omitempty"` FulfillmentStatus string `json:"fulfillment_status,omitempty"` TaxLines []TaxLine `json:"tax_lines,omitempty"` OriginLocation *Address `json:"origin_location,omitempty"` DestinationLocation *Address `json:"destination_location,omitempty"` }
type LineItemProperty ¶
type LineItemProperty struct {
Message string `json:"message"`
}
type ListOptions ¶
type ListOptions struct { Page int `url:"page,omitempty"` Limit int `url:"limit,omitempty"` SinceID int64 `url:"since_id,omitempty"` CreatedAtMin time.Time `url:"created_at_min,omitempty"` CreatedAtMax time.Time `url:"created_at_max,omitempty"` UpdatedAtMin time.Time `url:"updated_at_min,omitempty"` UpdatedAtMax time.Time `url:"updated_at_max,omitempty"` Order string `url:"order,omitempty"` Fields string `url:"fields,omitempty"` Vendor string `url:"vendor,omitempty"` IDs []int64 `url:"ids,omitempty,comma"` }
General list options that can be used for most collections of entities.
type NoteAttribute ¶
type NoteAttribute struct { Name string `json:"name,omitempty"` Value interface{} `json:"value,omitempty"` }
type Option ¶
type Option func(c *Client)
Option is used to configure client with options
func WithVersion ¶
WithVersion optionally sets the api-version if the passed string is valid
type Order ¶
type Order struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` CancelledAt *time.Time `json:"cancelled_at,omitempty"` ClosedAt *time.Time `json:"closed_at,omitempty"` ProcessedAt *time.Time `json:"processed_at,omitempty"` PaymentMethod string `json:"payment_method,omitempty"` // Customer *Customer `json:"customer,omitempty"` BillingAddress *Address `json:"billing_address,omitempty"` ShippingAddress *Address `json:"shipping_address,omitempty"` Currency string `json:"currency,omitempty"` TotalPrice *decimal.Decimal `json:"total_price,omitempty"` SubtotalPrice *decimal.Decimal `json:"subtotal_price,omitempty"` TotalDiscounts *decimal.Decimal `json:"total_discount,omitempty"` TotalShipping *decimal.Decimal `json:"total_shipping,omitempty"` TotalLineItemsPrice *decimal.Decimal `json:"total_line_items_price,omitempty"` TaxesIncluded bool `json:"taxes_included,omitempty"` TotalTax *decimal.Decimal `json:"total_tax,omitempty"` TaxLines []TaxLine `json:"tax_lines,omitempty"` TotalWeight int `json:"total_weight,omitempty"` FinancialStatus string `json:"financial_status,omitempty"` Fulfillments []Fulfillment `json:"fulfillments,omitempty"` FulfillmentStatus string `json:"fulfillment_status,omitempty"` Token string `json:"token,omitempty"` CartToken string `json:"cart_token,omitempty"` Number string `json:"number,omitempty"` OrderNumber int `json:"order_number,omitempty"` Note string `json:"note,omitempty"` Test bool `json:"test,omitempty"` BrowserIp string `json:"browser_ip,omitempty"` BuyerAcceptsMarketing bool `json:"buyer_accepts_marketing,omitempty"` CancelReason string `json:"cancel_reason,omitempty"` NoteAttributes []NoteAttribute `json:"note_attributes,omitempty"` DiscountCodes []DiscountCode `json:"discount_codes,omitempty"` LineItems []LineItem `json:"line_items,omitempty"` ShippingLine *ShippingLine `json:"shipping_line,omitempty"` Transactions []Transaction `json:"transactions,omitempty"` AppID int `json:"app_id,omitempty"` CustomerLocale string `json:"customer_locale,omitempty"` LandingSite string `json:"landing_site,omitempty"` ReferringSite string `json:"referring_site,omitempty"` SourceName string `json:"source_name,omitempty"` ClientDetails *ClientDetails `json:"client_details,omitempty"` Tags string `json:"tags,omitempty"` LocationId int64 `json:"location_id,omitempty"` PaymentGatewayNames []string `json:"payment_gateway_names,omitempty"` ProcessingMethod string `json:"processing_method,omitempty"` Refunds []Refund `json:"refunds,omitempty"` UserId int64 `json:"user_id,omitempty"` OrderStatusUrl string `json:"order_status_url,omitempty"` Gateway string `json:"gateway,omitempty"` Confirmed bool `json:"confirmed,omitempty"` TotalPriceUSD *decimal.Decimal `json:"total_price_usd,omitempty"` CheckoutToken string `json:"checkout_token,omitempty"` Reference string `json:"reference,omitempty"` SourceIdentifier string `json:"source_identifier,omitempty"` SourceURL string `json:"source_url,omitempty"` DeviceID int64 `json:"device_id,omitempty"` Phone string `json:"phone,omitempty"` LandingSiteRef string `json:"landing_site_ref,omitempty"` CheckoutID int64 `json:"checkout_id,omitempty"` ContactEmail string `json:"contact_email,omitempty"` }
Order represents a Shopify order
type OrderCountOptions ¶
type OrderCountOptions struct { Page int `url:"page,omitempty"` Limit int `url:"limit,omitempty"` SinceID int64 `url:"since_id,omitempty"` CreatedAtMin time.Time `url:"created_at_min,omitempty"` CreatedAtMax time.Time `url:"created_at_max,omitempty"` UpdatedAtMin time.Time `url:"updated_at_min,omitempty"` UpdatedAtMax time.Time `url:"updated_at_max,omitempty"` Order string `url:"order,omitempty"` Fields string `url:"fields,omitempty"` Status string `url:"status,omitempty"` FinancialStatus string `url:"financial_status,omitempty"` FulfillmentStatus string `url:"fulfillment_status,omitempty"` }
A struct for all available order count options
type OrderListOptions ¶
type OrderListOptions struct { Page int `url:"page,omitempty"` Limit int `url:"limit,omitempty"` SinceID int64 `url:"since_id,omitempty"` Status string `url:"status,omitempty"` FinancialStatus string `url:"financial_status,omitempty"` FulfillmentStatus string `url:"fulfillment_status,omitempty"` CreatedAtMin time.Time `url:"created_at_min,omitempty"` CreatedAtMax time.Time `url:"created_at_max,omitempty"` UpdatedAtMin time.Time `url:"updated_at_min,omitempty"` UpdatedAtMax time.Time `url:"updated_at_max,omitempty"` ProcessedAtMin time.Time `url:"processed_at_min,omitempty"` ProcessedAtMax time.Time `url:"processed_at_max,omitempty"` Fields string `url:"fields,omitempty"` Order string `url:"order,omitempty"` }
A struct for all available order list options. See: https://help.shopify.com/api/reference/order#index
type OrderResource ¶
type OrderResource struct {
Order *Order `json:"order"`
}
Represents the result from the orders/X endpoint
type OrderService ¶
type OrderService interface { List(interface{}) ([]Order, error) Count(interface{}) (int, error) Get(string, interface{}) (*Order, error) Create(Order) (*Order, error) Update(Order) (*Order, error) // FulfillmentsService used for Order resource to communicate with Fulfillments resource FulfillmentsService }
OrderService is an interface for interfacing with the orders endpoints of the Shopify API. See: https://help.shopify.com/api/reference/order
type OrderServiceOp ¶
type OrderServiceOp struct {
// contains filtered or unexported fields
}
OrderServiceOp handles communication with the order related methods of the Shopify API.
func (*OrderServiceOp) CancelFulfillment ¶
func (s *OrderServiceOp) CancelFulfillment(orderID string, fulfillmentID string) (*Fulfillment, error)
Cancel an existing fulfillment for an order
func (*OrderServiceOp) CompleteFulfillment ¶
func (s *OrderServiceOp) CompleteFulfillment(orderID string, fulfillmentID string) (*Fulfillment, error)
Complete an existing fulfillment for an order
func (*OrderServiceOp) Count ¶
func (s *OrderServiceOp) Count(options interface{}) (int, error)
Count orders
func (*OrderServiceOp) CountFulfillments ¶
func (s *OrderServiceOp) CountFulfillments(orderID string, options interface{}) (int, error)
Count fulfillments for an order
func (*OrderServiceOp) Create ¶
func (s *OrderServiceOp) Create(order Order) (*Order, error)
Create order
func (*OrderServiceOp) CreateFulfillment ¶
func (s *OrderServiceOp) CreateFulfillment(orderID string, fulfillment Fulfillment) (*Fulfillment, error)
Create a new fulfillment for an order
func (*OrderServiceOp) Get ¶
func (s *OrderServiceOp) Get(orderID string, options interface{}) (*Order, error)
Get individual order
func (*OrderServiceOp) GetFulfillment ¶
func (s *OrderServiceOp) GetFulfillment(orderID string, fulfillmentID string, options interface{}) (*Fulfillment, error)
Get individual fulfillment for an order
func (*OrderServiceOp) List ¶
func (s *OrderServiceOp) List(options interface{}) ([]Order, error)
List orders
func (*OrderServiceOp) ListFulfillments ¶
func (s *OrderServiceOp) ListFulfillments(orderID string, options interface{}) ([]Fulfillment, error)
List fulfillments for an order
func (*OrderServiceOp) TransitionFulfillment ¶
func (s *OrderServiceOp) TransitionFulfillment(orderID string, fulfillmentID string) (*Fulfillment, error)
Transition an existing fulfillment for an order
func (*OrderServiceOp) Update ¶
func (s *OrderServiceOp) Update(order Order) (*Order, error)
Update order
func (*OrderServiceOp) UpdateFulfillment ¶
func (s *OrderServiceOp) UpdateFulfillment(orderID string, fulfillment Fulfillment) (*Fulfillment, error)
Update an existing fulfillment for an order
type OrdersResource ¶
type OrdersResource struct {
Orders []Order `json:"orders"`
}
Represents the result from the orders endpoint
type PaymentDetails ¶
type PaymentDetails struct { AVSResultCode string `json:"avs_result_code,omitempty"` CreditCardBin string `json:"credit_card_bin,omitempty"` CVVResultCode string `json:"cvv_result_code,omitempty"` CreditCardNumber string `json:"credit_card_number,omitempty"` CreditCardCompany string `json:"credit_card_company,omitempty"` }
type Product ¶
type Product struct { ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` Brief string `json:"brief,omitempty"` Description string `json:"description,omitempty"` Vendor string `json:"vendor,omitempty"` VendorURL string `json:"vendor_url,omitempty"` HasOnlyDefaultVariant bool `json:"has_only_default_variant"` RequiresShipping bool `json:"requires_shipping"` Taxable bool `json:"taxable"` InventoryTracking bool `json:"inventory_tracking"` InventoryPolicy string `json:"inventory_policy"` InventoryQuantity int64 `json:"inventory_quantity"` Handle string `json:"handle,omitempty"` Tags string `json:"tags,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` PublishedAt *time.Time `json:"published_at,omitempty"` Published bool `json:"published,omitempty"` Note string `json:"note,omitempty"` MetaTitle string `json:"meta_title"` MetaDescription string `json:"meta_description"` MetaKeyword string `json:"meta_keyword"` NeedVariantImage bool `json:"need_variant_image"` Options []ProductOption `json:"options,omitempty"` Variants []Variant `json:"variants,omitempty"` Image Image `json:"image,omitempty"` Images []Image `json:"images,omitempty"` }
Product represents a Shopify product
type ProductOption ¶
type ProductOption struct { ID string `json:"id,omitempty"` ProductID string `json:"product_id,omitempty"` Name string `json:"name,omitempty"` Position int `json:"position,omitempty"` Values []string `json:"values,omitempty"` }
The options provided by Shopify
type ProductResource ¶
type ProductResource struct {
Product *Product `json:"product"`
}
Represents the result from the products/X endpoint
type ProductService ¶
type ProductService interface { List(interface{}) ([]Product, error) Count(interface{}) (int, error) Get(string, interface{}) (*Product, error) Create(Product) (*Product, error) Update(Product) (*Product, error) Delete(string) error }
ProductService is an interface for interfacing with the product endpoints of the Shopify API. See: https://help.shopify.com/api/reference/product
type ProductServiceOp ¶
type ProductServiceOp struct {
// contains filtered or unexported fields
}
ProductServiceOp handles communication with the product related methods of the Shopify API.
func (*ProductServiceOp) Count ¶
func (s *ProductServiceOp) Count(options interface{}) (int, error)
Count products
func (*ProductServiceOp) Create ¶
func (s *ProductServiceOp) Create(product Product) (*Product, error)
Create a new product
func (*ProductServiceOp) Delete ¶
func (s *ProductServiceOp) Delete(productID string) error
Delete an existing product
func (*ProductServiceOp) Get ¶
func (s *ProductServiceOp) Get(productID string, options interface{}) (*Product, error)
Get individual product
func (*ProductServiceOp) List ¶
func (s *ProductServiceOp) List(options interface{}) ([]Product, error)
List products
type ProductsResource ¶
type ProductsResource struct {
Products []Product `json:"products"`
}
Represents the result from the products endpoint
type RateLimitError ¶
type RateLimitError struct { ResponseError RetryAfter int }
An error specific to a rate-limiting response. Embeds the ResponseError to allow consumers to handle it the same was a normal ResponseError.
type Receipt ¶
type Receipt struct { TestCase bool `json:"testcase,omitempty"` Authorization string `json:"authorization,omitempty"` }
Receipt represents a Shopify receipt.
type Refund ¶
type Refund struct { Id int64 `json:"id,omitempty"` OrderId int64 `json:"order_id,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` Note string `json:"note,omitempty"` Restock bool `json:"restock,omitempty"` UserId int64 `json:"user_id,omitempty"` RefundLineItems []RefundLineItem `json:"refund_line_items,omitempty"` Transactions []Transaction `json:"transactions,omitempty"` }
type RefundLineItem ¶
type RefundLineItem struct { Id int64 `json:"id,omitempty"` Quantity int `json:"quantity,omitempty"` LineItemId int64 `json:"line_item_id,omitempty"` LineItem *LineItem `json:"line_item,omitempty"` Subtotal *decimal.Decimal `json:"subtotal,omitempty"` TotalTax *decimal.Decimal `json:"total_tax,omitempty"` }
type ResponseDecodingError ¶
ResponseDecodingError occurs when the response body from Shopify could not be parsed.
func (ResponseDecodingError) Error ¶
func (e ResponseDecodingError) Error() string
type ResponseError ¶
A general response error that follows a similar layout to Shopify's response errors, i.e. either a single message or a list of messages.
func (ResponseError) Error ¶
func (e ResponseError) Error() string
type ShippingLine ¶
type ShippingLine struct {
Name string `json:"name,omitempty"`
}
type Transaction ¶
type Transaction struct { ID int64 `json:"id,omitempty"` OrderID int64 `json:"order_id,omitempty"` Amount *decimal.Decimal `json:"amount,omitempty"` Kind string `json:"kind,omitempty"` Gateway string `json:"gateway,omitempty"` Status string `json:"status,omitempty"` Message string `json:"message,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` Test bool `json:"test,omitempty"` Authorization string `json:"authorization,omitempty"` Currency string `json:"currency,omitempty"` LocationID *int64 `json:"location_id,omitempty"` UserID *int64 `json:"user_id,omitempty"` ParentID *int64 `json:"parent_id,omitempty"` DeviceID *int64 `json:"device_id,omitempty"` ErrorCode string `json:"error_code,omitempty"` SourceName string `json:"source_name,omitempty"` PaymentDetails *PaymentDetails `json:"payment_details,omitempty"` }
type Variant ¶
type Variant struct { ID string `json:"id,omitempty"` ProductID string `json:"product_id,omitempty"` Title string `json:"title,omitempty"` Sku string `json:"sku,omitempty"` Position int `json:"position,omitempty"` Price *decimal.Decimal `json:"price,omitempty"` CompareAtPrice *decimal.Decimal `json:"compare_at_price,omitempty"` Option1 string `json:"option1,omitempty"` Option2 string `json:"option2,omitempty"` Option3 string `json:"option3,omitempty"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Image Image `json:"image,omitempty"` Barcode string `json:"barcode,omitempty"` InventoryQuantity int `json:"inventory_quantity,omitempty"` Weight *decimal.Decimal `json:"weight,omitempty"` WeightUnit string `json:"weight_unit,omitempty"` Note string `json:"note,omitempty"` }
Variant represents a Shopify variant
type VariantResource ¶
type VariantResource struct {
Variant *Variant `json:"variant"`
}
VariantResource represents the result from the variants/X.json endpoint
type VariantService ¶
type VariantService interface { List(int64, interface{}) ([]Variant, error) Count(int64, interface{}) (int, error) Get(int64, interface{}) (*Variant, error) Create(int64, Variant) (*Variant, error) Update(Variant) (*Variant, error) Delete(int64, int64) error }
VariantService is an interface for interacting with the variant endpoints of the Shopify API. See https://help.shopify.com/api/reference/product_variant
type VariantServiceOp ¶
type VariantServiceOp struct {
// contains filtered or unexported fields
}
VariantServiceOp handles communication with the variant related methods of the Shopify API.
func (*VariantServiceOp) Count ¶
func (s *VariantServiceOp) Count(productID int64, options interface{}) (int, error)
Count variants
func (*VariantServiceOp) Create ¶
func (s *VariantServiceOp) Create(productID int64, variant Variant) (*Variant, error)
Create a new variant
func (*VariantServiceOp) Delete ¶
func (s *VariantServiceOp) Delete(productID int64, variantID int64) error
Delete an existing product
func (*VariantServiceOp) Get ¶
func (s *VariantServiceOp) Get(variantID int64, options interface{}) (*Variant, error)
Get individual variant
type VariantsResource ¶
type VariantsResource struct {
Variants []Variant `json:"variants"`
}
VariantsResource represents the result from the products/X/variants.json endpoint