Documentation ¶
Overview ¶
Package goshopify provides methods for making requests to Shopify's admin API.
Index ¶
- Constants
- func CheckResponseError(r *http.Response) error
- func ShopBaseUrl(name string) string
- func ShopFullName(name string) string
- func ShopShortName(name string) string
- type Address
- type App
- func (app App) AuthorizeUrl(shopName string, state string) string
- func (app App) GetAccessToken(shopName string, code string) (string, error)
- func (app App) VerifyAuthorizationURL(u *url.URL) (bool, error)
- func (app App) VerifyMessage(message, messageMAC string) bool
- func (app App) VerifyWebhookRequest(httpRequest *http.Request) bool
- type Asset
- type AssetResource
- type AssetService
- type AssetServiceOp
- type AssetsResource
- 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 CustomCollection
- type CustomCollectionResource
- type CustomCollectionService
- type CustomCollectionServiceOp
- func (s *CustomCollectionServiceOp) Count(options interface{}) (int, error)
- func (s *CustomCollectionServiceOp) Create(collection CustomCollection) (*CustomCollection, error)
- func (s *CustomCollectionServiceOp) Delete(collectionID int) error
- func (s *CustomCollectionServiceOp) Get(collectionID int, options interface{}) (*CustomCollection, error)
- func (s *CustomCollectionServiceOp) List(options interface{}) ([]CustomCollection, error)
- func (s *CustomCollectionServiceOp) Update(collection CustomCollection) (*CustomCollection, error)
- type CustomCollectionsResource
- type Customer
- type CustomerResource
- type CustomerSearchOptions
- type CustomerService
- type CustomerServiceOp
- func (s *CustomerServiceOp) Count(options interface{}) (int, error)
- func (s *CustomerServiceOp) Get(customerID int, options interface{}) (*Customer, error)
- func (s *CustomerServiceOp) List(options interface{}) ([]Customer, error)
- func (s *CustomerServiceOp) Search(options interface{}) ([]Customer, error)
- func (s *CustomerServiceOp) Update(customer Customer) (*Customer, error)
- type CustomersResource
- type DiscountCode
- type Fulfillment
- type Image
- type ImageResource
- type ImageService
- type ImageServiceOp
- func (s *ImageServiceOp) Count(productID int, options interface{}) (int, error)
- func (s *ImageServiceOp) Create(productID int, image Image) (*Image, error)
- func (s *ImageServiceOp) Delete(productID int, imageID int) error
- func (s *ImageServiceOp) Get(productID int, imageID int, options interface{}) (*Image, error)
- func (s *ImageServiceOp) List(productID int, options interface{}) ([]Image, error)
- func (s *ImageServiceOp) Update(productID int, image Image) (*Image, error)
- type ImagesResource
- type LineItem
- type LineItemProperty
- type ListOptions
- type NoteAttribute
- type Order
- type OrderListOptions
- type OrderResource
- type OrderService
- type OrderServiceOp
- 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 int) error
- func (s *ProductServiceOp) Get(productID int, 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 ResponseError
- type Rule
- type ShippingLines
- type Shop
- type ShopResource
- type ShopService
- type ShopServiceOp
- type SmartCollection
- type SmartCollectionResource
- type SmartCollectionService
- type SmartCollectionServiceOp
- func (s *SmartCollectionServiceOp) Count(options interface{}) (int, error)
- func (s *SmartCollectionServiceOp) Create(collection SmartCollection) (*SmartCollection, error)
- func (s *SmartCollectionServiceOp) Delete(collectionID int) error
- func (s *SmartCollectionServiceOp) Get(collectionID int, options interface{}) (*SmartCollection, error)
- func (s *SmartCollectionServiceOp) List(options interface{}) ([]SmartCollection, error)
- func (s *SmartCollectionServiceOp) Update(collection SmartCollection) (*SmartCollection, error)
- type SmartCollectionsResource
- type TaxLine
- type Theme
- type ThemeListOptions
- type ThemeService
- type ThemeServiceOp
- type ThemesResource
- type Transaction
- type TransactionResource
- type TransactionService
- type TransactionServiceOp
- func (s *TransactionServiceOp) Count(orderID int, options interface{}) (int, error)
- func (s *TransactionServiceOp) Create(orderID int, transaction Transaction) (*Transaction, error)
- func (s *TransactionServiceOp) Get(orderID int, transactionID int, options interface{}) (*Transaction, error)
- func (s *TransactionServiceOp) List(orderID int, options interface{}) ([]Transaction, error)
- type TransactionsResource
- type Variant
- type VariantResource
- type VariantService
- type VariantServiceOp
- func (s *VariantServiceOp) Count(productID int, options interface{}) (int, error)
- func (s *VariantServiceOp) Create(productID int, variant Variant) (*Variant, error)
- func (s *VariantServiceOp) Delete(productID int, variantID int) error
- func (s *VariantServiceOp) Get(variantID int, options interface{}) (*Variant, error)
- func (s *VariantServiceOp) List(productID int, options interface{}) ([]Variant, error)
- func (s *VariantServiceOp) Update(variant Variant) (*Variant, error)
- type VariantsResource
- type Webhook
- type WebhookOptions
- type WebhookResource
- type WebhookService
- type WebhookServiceOp
- func (s *WebhookServiceOp) Count(options interface{}) (int, error)
- func (s *WebhookServiceOp) Create(webhook Webhook) (*Webhook, error)
- func (s *WebhookServiceOp) Delete(ID int) error
- func (s *WebhookServiceOp) Get(webhookdID int, options interface{}) (*Webhook, error)
- func (s *WebhookServiceOp) List(options interface{}) ([]Webhook, error)
- func (s *WebhookServiceOp) Update(webhook Webhook) (*Webhook, error)
- type WebhooksResource
Constants ¶
const (
UserAgent = "goshopify/1.0.0"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponseError ¶
func ShopFullName ¶
Return the full shop name, including .myshopify.com
func ShopShortName ¶
Return the short shop name, excluding .myshopify.com
Types ¶
type Address ¶
type Address struct { ID int `json:"id"` Address1 string `json:"address1"` Address2 string `json:"address2"` City string `json:"city"` Company string `json:"company"` Country string `json:"country"` CountryCode string `json:"country_code"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Name string `json:"name"` Phone string `json:"phone"` Province string `json:"province"` ProvinceCode string `json:"province_code"` Zip string `json:"zip"` }
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) AuthorizeUrl ¶
Returns a Shopify oauth authorization url for the given shopname and state.
State is a unique value that can be used to check the authenticity during a callback from Shopify.
func (App) GetAccessToken ¶
func (App) VerifyAuthorizationURL ¶
Verifying URL callback parameters.
func (App) VerifyMessage ¶
Verify a message against a message HMAC
type Asset ¶
type Asset struct { Attachment string `json:"attachment"` ContentType string `json:"content_type"` Key string `json:"key"` PublicURL string `json:"public_url"` Size int `json:"size"` SourceKey string `json:"source_key"` Src string `json:"src"` ThemeID int `json:"theme_id"` Value string `json:"value"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` }
Asset represents a Shopify asset
type AssetResource ¶
type AssetResource struct {
Asset *Asset `json:"asset"`
}
AssetResource is the result from the themes/x/assets.json?asset[key]= endpoint
type AssetService ¶
type AssetService interface { List(int, interface{}) ([]Asset, error) Get(int, string) (*Asset, error) Update(int, Asset) (*Asset, error) Delete(int, string) error }
AssetService is an interface for interfacing with the asset endpoints of the Shopify API. See: https://help.shopify.com/api/reference/asset
type AssetServiceOp ¶
type AssetServiceOp struct {
// contains filtered or unexported fields
}
AssetServiceOp handles communication with the asset related methods of the Shopify API.
func (*AssetServiceOp) Delete ¶
func (s *AssetServiceOp) Delete(themeID int, key string) error
Delete an asset
func (*AssetServiceOp) Get ¶
func (s *AssetServiceOp) Get(themeID int, key string) (*Asset, error)
Get an asset by key from the given theme
type AssetsResource ¶
type AssetsResource struct {
Assets []Asset `json:"assets"`
}
AssetsResource is the result from the themes/x/assets.json endpoint
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 Order OrderService Shop ShopService Webhook WebhookService Variant VariantService Image ImageService Transaction TransactionService Theme ThemeService Asset AssetService // contains filtered or unexported fields }
Client manages communication with the Shopify API.
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 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 CustomCollection ¶
type CustomCollection struct { ID int `json:"id"` Handle string `json:"handle"` Title string `json:"title"` UpdatedAt *time.Time `json:"updated_at"` BodyHTML string `json:"body_html"` SortOrder string `json:"sort_order"` TemplateSuffix string `json:"template_suffix"` Image Image `json:"image"` Published bool `json:"published"` PublishedAt *time.Time `json:"published_at"` PublishedScope string `json:"published_scope"` }
CustomCollection represents a Shopify custom collection.
type CustomCollectionResource ¶
type CustomCollectionResource struct {
Collection *CustomCollection `json:"custom_collection"`
}
CustomCollectionResource represents the result form the custom_collections/X.json endpoint
type CustomCollectionService ¶
type CustomCollectionService interface { List(interface{}) ([]CustomCollection, error) Count(interface{}) (int, error) Get(int, interface{}) (*CustomCollection, error) Create(CustomCollection) (*CustomCollection, error) Update(CustomCollection) (*CustomCollection, error) Delete(int) error }
CustomCollectionService is an interface for interacting with the custom collection endpoints of the Shopify API. See https://help.shopify.com/api/reference/customcollection
type CustomCollectionServiceOp ¶
type CustomCollectionServiceOp struct {
// contains filtered or unexported fields
}
CustomCollectionServiceOp handles communication with the custom collection related methods of the Shopify API.
func (*CustomCollectionServiceOp) Count ¶
func (s *CustomCollectionServiceOp) Count(options interface{}) (int, error)
Count custom collections
func (*CustomCollectionServiceOp) Create ¶
func (s *CustomCollectionServiceOp) Create(collection CustomCollection) (*CustomCollection, error)
Create a new custom collection See Image for the details of the Image creation for a collection.
func (*CustomCollectionServiceOp) Delete ¶
func (s *CustomCollectionServiceOp) Delete(collectionID int) error
Delete an existing custom collection.
func (*CustomCollectionServiceOp) Get ¶
func (s *CustomCollectionServiceOp) Get(collectionID int, options interface{}) (*CustomCollection, error)
Get individual custom collection
func (*CustomCollectionServiceOp) List ¶
func (s *CustomCollectionServiceOp) List(options interface{}) ([]CustomCollection, error)
List custom collections
func (*CustomCollectionServiceOp) Update ¶
func (s *CustomCollectionServiceOp) Update(collection CustomCollection) (*CustomCollection, error)
Update an existing custom collection
type CustomCollectionsResource ¶
type CustomCollectionsResource struct {
Collections []CustomCollection `json:"custom_collections"`
}
CustomCollectionsResource represents the result from the custom_collections.json endpoint
type Customer ¶
type Customer struct { ID int `json:"id"` Email string `json:"email"` FirstName string `json:"first_name"` LastName string `json:"last_name"` State string `json:"state"` Note string `json:"note"` VerifiedEmail bool `json:"verified_email"` MultipassIdentifier string `json:"multipass_identifier"` OrdersCount int `json:"orders_count"` TaxExempt bool `json:"tax_exempt"` TotalSpent *decimal.Decimal `json:"total_spent"` Phone string `json:"phone"` Tags string `json:"tags"` LastOrderId int `json:"last_order_id"` AcceptsMarketing bool `json:"accepts_marketing"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` }
Customer represents a Shopify customer
type CustomerResource ¶
type CustomerResource struct {
Customer *Customer `json:"customer"`
}
Represents the result from the customers/X.json endpoint
type CustomerSearchOptions ¶
type CustomerSearchOptions struct { Page int `url:"page,omitempty"` Limit int `url:"limit,omitempty"` Fields string `url:"fields,omitempty"` Order string `url:"order,omitempty"` Query string `url:"query,omitempty"` }
Represents the options available when searching for a customer
type CustomerService ¶
type CustomerService interface { List(interface{}) ([]Customer, error) Count(interface{}) (int, error) Get(int, interface{}) (*Customer, error) Search(interface{}) ([]Customer, error) Update(Customer) (*Customer, error) }
CustomerService is an interface for interfacing with the customers endpoints of the Shopify API. See: https://help.shopify.com/api/reference/customer
type CustomerServiceOp ¶
type CustomerServiceOp struct {
// contains filtered or unexported fields
}
CustomerServiceOp handles communication with the product related methods of the Shopify API.
func (*CustomerServiceOp) Count ¶
func (s *CustomerServiceOp) Count(options interface{}) (int, error)
Count customers
func (*CustomerServiceOp) Get ¶
func (s *CustomerServiceOp) Get(customerID int, options interface{}) (*Customer, error)
Get customer
func (*CustomerServiceOp) List ¶
func (s *CustomerServiceOp) List(options interface{}) ([]Customer, error)
List customers
func (*CustomerServiceOp) Search ¶
func (s *CustomerServiceOp) Search(options interface{}) ([]Customer, error)
Search customers
type CustomersResource ¶
type CustomersResource struct {
Customers []Customer `json:"customers"`
}
Represents the result from the customers.json endpoint
type DiscountCode ¶
type Fulfillment ¶
type Fulfillment struct { ID int `json:"id"` OrderID int `json:"order_id"` Status string `json:"status"` CreatedAt *time.Time `json:"created_at"` Service string `json:"service"` UpdatedAt *time.Time `json:"updated_at"` TrackingCompany string `json:"tracking_company"` ShipmentStatus string `json:"shipment_status"` TrackingNumber string `json:"tracking_number"` TrackingNumbers []string `json:"tracking_numbers"` TrackingUrl string `json:"tracking_url"` TrackingUrls []string `json:"tracking_urls"` Receipt Receipt `json:"receipt"` LineItems []LineItem `json:"line_items"` }
type Image ¶
type Image struct { ID int `json:"id"` ProductID int `json:"product_id"` Position int `json:"position"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` Width int `json:"width"` Height int `json:"height"` Src string `json:"src,omitempty"` Attachment string `json:"attachment,omitempty"` Filename string `json:"filename,omitempty"` VariantIds []int `json:"variant_ids"` }
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(int, interface{}) ([]Image, error) Count(int, interface{}) (int, error) Get(int, int, interface{}) (*Image, error) Create(int, Image) (*Image, error) Update(int, Image) (*Image, error) Delete(int, int) 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 int, options interface{}) (int, error)
Count images
func (*ImageServiceOp) Create ¶
func (s *ImageServiceOp) Create(productID int, 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 int, imageID int) error
Delete an existing image
func (*ImageServiceOp) Get ¶
func (s *ImageServiceOp) Get(productID int, imageID int, 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 int `json:"id"` ProductID int `json:"product_id"` VariantID int `json:"variant_id"` Quantity int `json:"quantity"` Price *decimal.Decimal `json:"price"` TotalDiscount *decimal.Decimal `json:"total_discount"` Title string `json:"title"` VariantTitle string `json:"variant_title"` Name string `json:"name"` SKU string `json:"sku"` Vendor string `json:"vendor"` GiftCard bool `json:"gift_card"` Taxable bool `json:"taxable"` FulfillmentService string `json:"fulfillment_service"` RequiresShipping bool `json:"requires_shipping"` VariantInventoryManagement string `json:"variant_inventory_management"` Properties []NoteAttribute `json:"properties"` ProductExists bool `json:"product_exists"` FulfillableQuantity int `json:"fulfillable_quantity"` Grams int `json:"grams"` FulfillmentStatus string `json:"fulfillment_status"` TaxLines []TaxLine `json:"tax_lines"` OriginLocation *Address `json:"origin_location"` DestinationLocation *Address `json:"destination_location"` }
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 int `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"` }
General list options that can be used for most collections of entities.
type NoteAttribute ¶
type NoteAttribute struct { Name string `json:"Name"` Value interface{} `json:"Value"` }
type Order ¶
type Order struct { ID int `json:"id"` Name string `json:"name"` Email string `json:"email"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` CancelledAt *time.Time `json:"cancelled_at"` ClosedAt *time.Time `json:"closed_at"` ProcessedAt *time.Time `json:"processed_at"` Customer *Customer `json:"customer"` BillingAddress *Address `json:"billing_address"` ShippingAddress *Address `json:"shipping_address"` Currency string `json:"currency"` TotalPrice *decimal.Decimal `json:"total_price"` SubtotalPrice *decimal.Decimal `json:"subtotal_price"` TotalDiscounts *decimal.Decimal `json:"total_discounts"` TotalLineItemsPrice *decimal.Decimal `json:"total_line_items_price"` TaxesIncluded bool `json:"taxes_included"` TotalTax *decimal.Decimal `json:"total_tax"` TaxLines []TaxLine `json:"tax_lines"` TotalWeight int `json:"total_weight"` FinancialStatus string `json:"financial_status"` Fulfillments []Fulfillment `json:"fulfillments"` FulfillmentStatus string `json:"fulfillment_status"` Token string `json:"token"` CartToken string `json:"cart_token"` Number int `json:"number"` OrderNumber int `json:"order_number"` Note string `json:"note"` Test bool `json:"test"` BrowserIp string `json:"browser_ip"` BuyerAcceptsMarketing bool `json:"buyer_accepts_marketing"` CancelReason string `json:"cancel_reason"` NoteAttributes []NoteAttribute `json:"note_attributes"` DiscountCodes []DiscountCode `json:"discount_codes"` LineItems []LineItem `json:"line_items"` ShippingLines []ShippingLines `json:"shipping_lines"` Transactions []Transaction `json:"transactions"` AppID int `json:"app_id"` CustomerLocale string `json:"customer_locale"` LandingSite string `json:"landing_site"` ReferringSite string `json:"referring_site"` SourceName string `json:"source_name"` ClientDetails *ClientDetails `json:"client_details"` Tags string `json:"tags"` LocationId int `json:"location_id"` PaymentGatewayNames []string `json:"payment_gateway_names"` ProcessingMethod string `json:"processing_method"` Refunds []Refund `json:"refunds"` UserId int `json:"user_id"` OrderStatusUrl string `json:"order_status_url"` }
Order represents a Shopify order
type OrderListOptions ¶
type OrderListOptions struct { Page int `url:"page,omitempty"` Limit int `url:"limit,omitempty"` SinceID int `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.json endpoint
type OrderService ¶
type OrderService interface { List(interface{}) ([]Order, error) Count(interface{}) (int, error) Get(int, interface{}) (*Order, error) }
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) Count ¶
func (s *OrderServiceOp) Count(options interface{}) (int, error)
Count orders
func (*OrderServiceOp) Get ¶
func (s *OrderServiceOp) Get(orderID int, options interface{}) (*Order, error)
Get individual order
func (*OrderServiceOp) List ¶
func (s *OrderServiceOp) List(options interface{}) ([]Order, error)
List orders
type OrdersResource ¶
type OrdersResource struct {
Orders []Order `json:"orders"`
}
Represents the result from the orders.json endpoint
type PaymentDetails ¶
type Product ¶
type Product struct { ID int `json:"id"` Title string `json:"title"` BodyHTML string `json:"body_html"` Vendor string `json:"vendor"` ProductType string `json:"product_type"` Handle string `json:"handle"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` PublishedAt *time.Time `json:"published_at"` PublishedScope string `json:"published_scope"` Tags string `json:"tags"` Options []ProductOption `json:"options"` Variants []Variant `json:"variants"` Image Image `json:"image"` Images []Image `json:"images"` TemplateSuffix string `json:"template_suffix"` MetafieldsGlobalTitleTag string `json:"metafields_global_title_tag"` MetafieldsGlobalDescriptionTag string `json:"metafields_global_description_tag"` }
Product represents a Shopify product
type ProductOption ¶
type ProductOption struct { ID int `json:"id"` ProductID int `json:"product_id"` Name string `json:"name"` Position int `json:"position"` Values []string `json:"values"` }
The options provided by Shopify
type ProductResource ¶
type ProductResource struct {
Product *Product `json:"product"`
}
Represents the result from the products/X.json endpoint
type ProductService ¶
type ProductService interface { List(interface{}) ([]Product, error) Count(interface{}) (int, error) Get(int, interface{}) (*Product, error) Create(Product) (*Product, error) Update(Product) (*Product, error) Delete(int) 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 int) error
Delete an existing product
func (*ProductServiceOp) Get ¶
func (s *ProductServiceOp) Get(productID int, 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.json 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 Refund ¶
type Refund struct { Id int `json:"id"` OrderId int `json:"order_id"` CreatedAt *time.Time `json:"created_at"` Note string `json:"note"` Restock bool `json:"restock"` UserId int `json:"user_id"` RefundLineItems []RefundLineItem `json:"refund_line_items"` Transactions []Transaction `json:"transactions"` }
type RefundLineItem ¶
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 ShippingLines ¶
type ShippingLines struct { ID int `json:"id"` Title string `json:"title"` Price *decimal.Decimal `json:"price"` Code string `json:"code"` Source string `json:"source"` Phone string `json:"phone"` RequestedFulfillmentServiceID string `json:"requested_fulfillment_service_id"` DeliveryCategory string `json:"delivery_category"` CarrierIdentifier string `json:"carrier_identifier"` TaxLines []TaxLine `json:"tax_lines"` }
type Shop ¶
type Shop struct { ID int `json:"id"` Name string `json:"name"` ShopOwner string `json:"shop_owner"` Email string `json:"email"` CustomerEmail string `json:"customer_email"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` Address1 string `json:"address1"` Address2 string `json:"address2"` City string `json:"city"` Country string `json:"country"` CountryCode string `json:"country_code"` CountryName string `json:"country_name"` Currency string `json:"currency"` Domain string `json:"domain"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Phone string `json:"phone"` Province string `json:"province"` ProvinceCode string `json:"province_code"` Zip string `json:"zip"` MoneyFormat string `json:"money_format"` MoneyWithCurrencyFormat string `json:"money_with_currency_format"` WeightUnit string `json:"weight_unit"` MyshopifyDomain string `json:"myshopify_domain"` PlanName string `json:"plan_name"` PlanDisplayName string `json:"plan_display_name"` PasswordEnabled bool `json:"password_enabled"` PrimaryLocale string `json:"primary_locale"` Timezone string `json:"timezone"` IanaTimezone string `json:"iana_timezone"` ForceSSL bool `json:"force_ssl"` TaxShipping bool `json:"tax_shipping"` TaxesIncluded bool `json:"taxes_included"` HasStorefront bool `json:"has_storefront"` HasDiscounts bool `json:"has_discounts"` HasGiftcards bool `json:"has_gift_cards"` SetupRequire bool `json:"setup_required"` CountyTaxes bool `json:"county_taxes"` CheckoutAPISupported bool `json:"checkout_api_supported"` }
Shop represents a Shopify shop
type ShopResource ¶
type ShopResource struct {
Shop *Shop `json:"shop"`
}
Represents the result from the admin/shop.json endpoint
type ShopService ¶
ShopService is an interface for interfacing with the shop endpoint of the Shopify API. See: https://help.shopify.com/api/reference/shop
type ShopServiceOp ¶
type ShopServiceOp struct {
// contains filtered or unexported fields
}
ShopServiceOp handles communication with the shop related methods of the Shopify API.
func (*ShopServiceOp) Get ¶
func (s *ShopServiceOp) Get(options interface{}) (*Shop, error)
Get shop
type SmartCollection ¶
type SmartCollection struct { ID int `json:"id"` Handle string `json:"handle"` Title string `json:"title"` UpdatedAt *time.Time `json:"updated_at"` BodyHTML string `json:"body_html"` SortOrder string `json:"sort_order"` TemplateSuffix string `json:"template_suffix"` Image Image `json:"image"` Published bool `json:"published"` PublishedAt *time.Time `json:"published_at"` PublishedScope string `json:"published_scope"` Rules []Rule `json:"rules"` Disjunctive bool `json:"disjunctive"` }
SmartCollection represents a Shopify smart collection.
type SmartCollectionResource ¶
type SmartCollectionResource struct {
Collection *SmartCollection `json:"smart_collection"`
}
SmartCollectionResource represents the result form the smart_collections/X.json endpoint
type SmartCollectionService ¶
type SmartCollectionService interface { List(interface{}) ([]SmartCollection, error) Count(interface{}) (int, error) Get(int, interface{}) (*SmartCollection, error) Create(SmartCollection) (*SmartCollection, error) Update(SmartCollection) (*SmartCollection, error) Delete(int) error }
SmartCollectionService is an interface for interacting with the smart collection endpoints of the Shopify API. See https://help.shopify.com/api/reference/smartcollection
type SmartCollectionServiceOp ¶
type SmartCollectionServiceOp struct {
// contains filtered or unexported fields
}
SmartCollectionServiceOp handles communication with the smart collection related methods of the Shopify API.
func (*SmartCollectionServiceOp) Count ¶
func (s *SmartCollectionServiceOp) Count(options interface{}) (int, error)
Count smart collections
func (*SmartCollectionServiceOp) Create ¶
func (s *SmartCollectionServiceOp) Create(collection SmartCollection) (*SmartCollection, error)
Create a new smart collection See Image for the details of the Image creation for a collection.
func (*SmartCollectionServiceOp) Delete ¶
func (s *SmartCollectionServiceOp) Delete(collectionID int) error
Delete an existing smart collection.
func (*SmartCollectionServiceOp) Get ¶
func (s *SmartCollectionServiceOp) Get(collectionID int, options interface{}) (*SmartCollection, error)
Get individual smart collection
func (*SmartCollectionServiceOp) List ¶
func (s *SmartCollectionServiceOp) List(options interface{}) ([]SmartCollection, error)
List smart collections
func (*SmartCollectionServiceOp) Update ¶
func (s *SmartCollectionServiceOp) Update(collection SmartCollection) (*SmartCollection, error)
Update an existing smart collection
type SmartCollectionsResource ¶
type SmartCollectionsResource struct {
Collections []SmartCollection `json:"smart_collections"`
}
SmartCollectionsResource represents the result from the smart_collections.json endpoint
type Theme ¶
type Theme struct { ID int `json:"id"` Name string `json:"string"` Previewable bool `json:"previewable"` Processing bool `json:"processing"` Role string `json:"role"` ThemeStoreID int `json:"theme_store_id"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` }
Theme represents a Shopify theme
type ThemeListOptions ¶
type ThemeListOptions struct { ListOptions Role string `url:"role,omitempty"` }
Options for theme list
type ThemeService ¶
ThemeService is an interface for interfacing with the themes endpoints of the Shopify API. See: https://help.shopify.com/api/reference/theme
type ThemeServiceOp ¶
type ThemeServiceOp struct {
// contains filtered or unexported fields
}
ThemeServiceOp handles communication with the theme related methods of the Shopify API.
func (*ThemeServiceOp) List ¶
func (s *ThemeServiceOp) List(options interface{}) ([]Theme, error)
List all themes
type ThemesResource ¶
type ThemesResource struct {
Themes []Theme `json:"themes"`
}
ThemesResource is the result from the themes.json endpoint
type Transaction ¶
type Transaction struct { ID int `json:"id"` OrderID int `json:"order_id"` Amount *decimal.Decimal `json:"amount"` Kind string `json:"kind"` Gateway string `json:"gateway"` Status string `json:"status"` Message string `json:"message"` CreatedAt *time.Time `json:"created_at"` Test bool `json:"test"` Authorization string `json:"authorization"` Currency string `json:"currency"` LocationID *int `json:"location_id"` UserID *int `json:"user_id"` ParentID *int `json:"parent_id"` DeviceID *int `json:"device_id"` ErrorCode string `json:"error_code"` SourceName string `json:"source_name"` PaymentDetails *PaymentDetails `json:"payment_details"` }
type TransactionResource ¶
type TransactionResource struct {
Transaction *Transaction `json:"transaction"`
}
TransactionResource represents the result from the orders/X/transactions/Y.json endpoint
type TransactionService ¶
type TransactionService interface { List(int, interface{}) ([]Transaction, error) Count(int, interface{}) (int, error) Get(int, int, interface{}) (*Transaction, error) Create(int, Transaction) (*Transaction, error) }
TransactionService is an interface for interfacing with the transactions endpoints of the Shopify API. See: https://help.shopify.com/api/reference/transaction
type TransactionServiceOp ¶
type TransactionServiceOp struct {
// contains filtered or unexported fields
}
TransactionServiceOp handles communication with the transaction related methods of the Shopify API.
func (*TransactionServiceOp) Count ¶
func (s *TransactionServiceOp) Count(orderID int, options interface{}) (int, error)
Count transactions
func (*TransactionServiceOp) Create ¶
func (s *TransactionServiceOp) Create(orderID int, transaction Transaction) (*Transaction, error)
Create a new transaction
func (*TransactionServiceOp) Get ¶
func (s *TransactionServiceOp) Get(orderID int, transactionID int, options interface{}) (*Transaction, error)
Get individual transaction
func (*TransactionServiceOp) List ¶
func (s *TransactionServiceOp) List(orderID int, options interface{}) ([]Transaction, error)
List transactions
type TransactionsResource ¶
type TransactionsResource struct {
Transactions []Transaction `json:"transactions"`
}
TransactionsResource represents the result from the orders/X/transactions.json endpoint
type Variant ¶
type Variant struct { ID int `json:"id"` ProductID int `json:"product_id"` Title string `json:"title"` Sku string `json:"sku"` Position int `json:"position"` Grams int `json:"grams"` InventoryPolicy string `json:"inventory_policy"` Price *decimal.Decimal `json:"price"` CompareAtPrice *decimal.Decimal `json:"compare_at_price"` FulfillmentService string `json:"fulfillment_service"` InventoryManagement string `json:"inventory_management"` Option1 string `json:"option1"` Option2 string `json:"option2"` Option3 string `json:"option3"` CreatedAt *time.Time `json:"created_at"` UpdatedAt *time.Time `json:"updated_at"` Taxable bool `json:"taxable"` Barcode string `json:"barcode"` ImageID int `json:"image_id"` InventoryQuantity int `json:"inventory_quantity"` Weight *decimal.Decimal `json:"weight"` WeightUnit string `json:"weight_unit"` OldInventoryQuantity int `json:"old_inventory_quantity"` RequireShipping bool `json:"requires_shipping"` }
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(int, interface{}) ([]Variant, error) Count(int, interface{}) (int, error) Get(int, interface{}) (*Variant, error) Create(int, Variant) (*Variant, error) Update(Variant) (*Variant, error) Delete(int, int) 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 int, options interface{}) (int, error)
Count variants
func (*VariantServiceOp) Create ¶
func (s *VariantServiceOp) Create(productID int, variant Variant) (*Variant, error)
Create a new variant
func (*VariantServiceOp) Delete ¶
func (s *VariantServiceOp) Delete(productID int, variantID int) error
Delete an existing product
func (*VariantServiceOp) Get ¶
func (s *VariantServiceOp) Get(variantID int, 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
type Webhook ¶
type Webhook struct { ID int `json:"id"` Address string `json:"address"` Topic string `json:"topic"` Format string `json:"format"` CreatedAt *time.Time `json:"created_at,omitempty"` UpdatedAt *time.Time `json:"updated_at,omitempty"` Fields []string `json:"fields"` MetafieldNamespaces []string `json:"metafield_namespaces"` }
Webhook represents a Shopify webhook
type WebhookOptions ¶
type WebhookOptions struct { Address string `url:"address,omitempty"` Topic string `url:"topic,omitempty"` }
WebhookOptions can be used for filtering webhooks on a List request.
type WebhookResource ¶
type WebhookResource struct {
Webhook *Webhook `json:"webhook"`
}
WebhookResource represents the result from the admin/webhooks.json endpoint
type WebhookService ¶
type WebhookService interface { List(interface{}) ([]Webhook, error) Count(interface{}) (int, error) Get(int, interface{}) (*Webhook, error) Create(Webhook) (*Webhook, error) Update(Webhook) (*Webhook, error) Delete(int) error }
WebhookService is an interface for interfacing with the webhook endpoints of the Shopify API. See: https://help.shopify.com/api/reference/webhook
type WebhookServiceOp ¶
type WebhookServiceOp struct {
// contains filtered or unexported fields
}
WebhookServiceOp handles communication with the webhook-related methods of the Shopify API.
func (*WebhookServiceOp) Count ¶
func (s *WebhookServiceOp) Count(options interface{}) (int, error)
Count webhooks
func (*WebhookServiceOp) Create ¶
func (s *WebhookServiceOp) Create(webhook Webhook) (*Webhook, error)
Create a new webhook
func (*WebhookServiceOp) Delete ¶
func (s *WebhookServiceOp) Delete(ID int) error
Delete an existing webhooks
func (*WebhookServiceOp) Get ¶
func (s *WebhookServiceOp) Get(webhookdID int, options interface{}) (*Webhook, error)
Get individual webhook
func (*WebhookServiceOp) List ¶
func (s *WebhookServiceOp) List(options interface{}) ([]Webhook, error)
List webhooks
type WebhooksResource ¶
type WebhooksResource struct {
Webhooks []Webhook `json:"webhooks"`
}
WebhooksResource is the root object for a webhook get request.