Documentation ¶
Overview ¶
Package shopify provides an easy-to-use API for making CRUD request to shopify.
Index ¶
- type ApplicationCharge
- type BillingAddress
- type ClientDetails
- type CountResponse
- type Customer
- type Discount
- type DiscountCode
- type DiscountCodeResponse
- type Fulfillment
- type ImagesResponse
- type LineItem
- type NoteAttribute
- type Order
- type OrderResponse
- type OrdersResponse
- type PaymentDetails
- type Product
- type ProductImage
- type ProductResponse
- type ProductsResponse
- type Refund
- type RefundLineItem
- type RefundsResponse
- type ShippingAddress
- type ShippingLine
- type Shopify
- func (shop *Shopify) CancelOrder(orderID int64) (*Order, []error)
- func (shop *Shopify) CloseOrder(orderID int64) (*Order, []error)
- func (shop *Shopify) CreateDiscountCode(priceRule string, discountCode DiscountCode) (*DiscountCode, []error)
- func (shop *Shopify) CreateOrder(order map[string]interface{}) (*Order, []error)
- func (shopify *Shopify) Delete(endpoint string) ([]byte, []error)
- func (shop *Shopify) DeleteOrder(orderID int64) (*Order, []error)
- func (shop *Shopify) EditOrder(orderID int64, order map[string]interface{}) (*Order, []error)
- func (shopify *Shopify) Get(endpoint string) ([]byte, []error)
- func (shop *Shopify) GetOrder(orderID int64) (*Order, []error)
- func (shopify *Shopify) GetOrderRefunds(orderID int64, parameters map[string]string) ([]Refund, []error)
- func (shop *Shopify) GetOrderTransactions(orderID int64) ([]Transaction, []error)
- func (shop *Shopify) GetOrderTransactionsCount(orderID int64) (int, []error)
- func (shop *Shopify) GetOrders(parameters map[string]string) ([]Order, []error)
- func (shop *Shopify) GetOrdersCount() (int, []error)
- func (shopify *Shopify) GetProduct(productID int64) (*Product, []error)
- func (shopify *Shopify) GetProductImages(productID int64) ([]ProductImage, []error)
- func (shopify *Shopify) GetProductVariants(productID int64) ([]Variant, []error)
- func (shopify *Shopify) GetProducts() ([]Product, []error)
- func (shopify *Shopify) GetWithParameters(endpoint string, parameters map[string]string) ([]byte, []error)
- func (shop *Shopify) OpenOrder(orderID int64) (*Order, []error)
- func (shopify *Shopify) Post(endpoint string, data interface{}) ([]byte, []error)
- func (shopify *Shopify) Put(endpoint string, data interface{}) ([]byte, []error)
- func (shopify *Shopify) Request(method, endpoint string, data interface{}) ([]byte, []error)
- type TaxLine
- type Transaction
- type TransactionsResponse
- type Variant
- type VariantsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationCharge ¶
type ApplicationCharge struct { ConfirmationURL string `json:"confirmation_url"` CreatedAt time.Time `json:"created_at"` ID int64 `json:"id"` Name string `json:"name"` Price string `json:"price"` ReturnURL string `json:"return_url"` Status string `json:"status"` Test string `json:"test"` UpdatedAt time.Time `json:"updated_at"` }
ApplicationCharge is an application charge
type BillingAddress ¶
type BillingAddress struct { Address1 string `json:"address1"` Address2 string `json:"address2"` City string `json:"city"` Company string `json:"company"` Country string `json:"country"` FirstName string `json:"first_name"` ID int64 `json:"id"` LastName string `json:"last_name"` Phone string `json:"phone"` Province string `json:"province"` Zip string `json:"zip"` Name string `json:"name"` ProvinceCode string `json:"province_code"` CountryCode string `json:"country_code"` Default bool `json:"default"` }
BillingAddress is a billing address
type ClientDetails ¶
type ClientDetails struct { AcceptLanguage *string `json:"accept_language"` //TODO check BrowserHeight int `json:"browser_height"` BrowserIP string `json:"browser_ip"` BrowserWidth int `json:"browser_width"` SessionHash *string `json:"session_hash"` UserAgent *string `json:"user_agent"` }
ClientDetails are details about a client
type CountResponse ¶
type CountResponse struct {
Count int `json:"count"`
}
CountResponse is a response to counts endpoint
type Customer ¶
type Customer struct { AcceptsMarketing bool `json:"accepts_marketing"` CreatedAt time.Time `json:"created_at"` Email string `json:"email"` ID int64 `json:"id"` FirstName string `json:"first_name"` Note string `json:"note"` LastName string `json:"last_name"` OrdersCount int `json:"orders_count"` State string `json:"state"` TotalSpent string `json:"total_spent"` UpdatedAt time.Time Tags string `json:"tags"` }
Customer is a customer
type Discount ¶
type Discount struct { ID int64 `json:"id"` DiscountType string `json:"discount_type"` Code string `json:"code"` Value string `json:"value"` EndsAt time.Time `json:"ends_at"` StartsAt time.Time `json:"starts_at"` Status string `json:"status"` MinimumOrderAmount string `json:"minimum_order_amount"` UsageLimit int `json:"usage_limit"` AppliesToID int64 `json:"applies_to_id"` AppliesOnce bool `json:"applies_once"` AppliesToResource string `json:"applies_to_resource"` TimesUsed int `json:"times_used"` }
Discount is a discount
type DiscountCode ¶
type DiscountCode struct { ID int `json:"id"` Amount string `json:"amount,omitempty"` Code string `json:"code"` Type string `json:"type,omitempty"` }
DiscountCode is a discount code
type DiscountCodeResponse ¶
type DiscountCodeResponse struct {
DiscountCode DiscountCode `json:"discount_code"`
}
DiscountCodeResponse is a response to /discount_codes endpoint
type Fulfillment ¶
type Fulfillment struct { ID int64 `json:"id"` CreatedAt time.Time `json:"created_at"` OrderID int64 `json:"order_id"` Status string `json:"status"` TrackingCompany string `json:"tracking_company"` TrackingNumber string `json:"tracking_number"` UpdatedAt time.Time `json:"updated_at"` }
Fulfillment is a fulfillment
type ImagesResponse ¶
type ImagesResponse struct {
Images []ProductImage `json:"images"`
}
ImagesResponse is a response for product images
type LineItem ¶
type LineItem struct { FulfillableQuantity int `json:"fulfillable_quantity"` FulfillmentService *string `json:"fulfillment_service"` FulfillmentStatus *string `json:"fulfillment_status"` Grams int `json:"grams"` ID int64 `json:"id"` Price string `json:"price"` //e.g. 199.99 ProductID int64 `json:"product_id"` Quantity int `json:"id"` RequiresShipping bool `json:"requires_shipping"` SKU string `json:"sku"` Title string `json:"title"` VariantID int64 `json:"variant_id"` VariantTitle string `json:"variant_title"` Vendor string `json:"vendor"` GiftCard *bool `json:"gift_card"` Taxable bool `json:"taxable"` TaxLines []TaxLine `json:"tax_line"` TotalDiscount string `json:"total_discount"` }
LineItem is an order line item
type NoteAttribute ¶
NoteAttribute is a note attribute
type Order ¶
type Order struct { BillingAddress *BillingAddress `json:"billing_address"` BrowserIP string `json:"browser_ip"` BuyerAcceptsMarketing bool `json:"buyer_accepts_marketing"` CancelReason *string `json:"cancel_reason"` CancelledAt *time.Time `json:"cancelled_at"` ClientDetails *ClientDetails `json:"client_details"` ClosedAt *time.Time `json:"closed_at"` CreatedAt time.Time `json:"created_at"` Currency string `json:"currency"` Customer *Customer `json:"customer"` DiscountCodes *[]DiscountCode `json:"discount_codes"` Email string `json:"email"` FinancialStatus string `json:"financial_status"` Fulfillments *[]Fulfillment `json:"fulfillments"` FulfillmentStatus string `json:"fulfillment_status"` Tags string `json:"tags"` ID int64 `json:"id"` InventoryBehaviour string `json:"inventory_behaviour"` //used only in create LandingSite string `json:"landing_site"` LineItems []LineItem `json:"line_items"` Name string `json:"name"` Note *string `json:"note"` NoteAttributes *[]NoteAttribute `json:"note_attributes"` Number int64 `json:"number"` OrderNumber int64 `json:"order_number"` PaymentGatewayNames []string `json:"payment_gateway_names"` ProcessedAt time.Time `json:"processed_at"` ProcessingMethod string `json:"processing_method"` ReferringSite string `json:"referring_site"` Refunds *[]Refund `json:"refunds"` SendReceipt bool `json:"send_receipt"` //used only in create SendFulfillmentReceipt bool `json:"send_fulfillment_receipt"` //used only in create ShippingAddress *ShippingAddress `json:"shipping_address"` ShippingLines *[]ShippingLine `json:"shipping_lines"` SourceName string `json:"source_name"` SubtotalPrice string `json:"subtotal_price"` TaxLines *[]TaxLine `json:"tax_lines"` TaxesIncluded bool `json:"taxes_included"` TotalDiscounts string `json:"total_discounts"` TotalPrice string `json:"total_price"` TotalTax string `json:"total_tax"` TotalWeight float64 `json:"total_weight"` UpdatedAt time.Time `json:"updatedAt"` }
Order is a product
type OrderResponse ¶
type OrderResponse struct {
Order Order `json:"order"`
}
OrderResponse is a response to /orders endpoint
type OrdersResponse ¶
type OrdersResponse struct {
Orders []Order `json:"orders"`
}
OrdersResponse is a response to /orders endpoint
type PaymentDetails ¶
type PaymentDetails struct { AvsResultCode *string `json:"avs_result_code"` CreditCardBin *string `json:"credit_card_bin"` CvvResultCode *string `json:"cvv_result_code"` CreditCardNumber string `json:"credit_card_number"` CreditCardCompany string `json:"credit_card_company"` }
PaymentDetails are the details about a payment
type Product ¶
type Product struct { BodyHTML string `json:"body_html"` CreatedAt time.Time `json:"created_at"` Handle string `json:"handle"` ID int64 `json:"id"` Images []ProductImage `json:"images"` Options []map[string]interface{} `json:"options"` ProductType string `json:"product_type"` PublishedAt *time.Time `json:"published_at"` PublishedScope string `json:"published_scope"` Tags string `json:"tags"` TemplateSuffix string `json:"template_suffix"` Title string `json:"title"` MetafieldsGlobalTitleTag string `json:"metafields_global_title_tag"` MetafieldsGlobalDescriptionTag string `json:"metafields_global_description_tag"` UpdatedAt time.Time `json:"updatedAt"` Variants []Variant `json:"variants"` Vendor string `json:"vendor"` }
Product is a product
type ProductImage ¶
type ProductImage struct { CreatedAt time.Time `json:"created_at"` ID int64 `json:"id"` Position int `json:"position"` ProductID int64 `json:"product_id"` VariantIDs []int64 `json:"variant_ids"` Src string `json:"src"` UpdatedAt time.Time `json:"id"` }
ProductImage is a product's image
type ProductResponse ¶
type ProductResponse struct {
Product Product `json:"product"`
}
ProductResponse is a response for a product
type ProductsResponse ¶
type ProductsResponse struct {
Products []Product `json:"products"`
}
ProductsResponse is a response from products
type Refund ¶
type Refund struct { CreatedAt time.Time `json:"created_at"` ID int64 `json:"id"` Note string `json:"note"` RefundLineItems []RefundLineItem `json:"refund_line_items"` Restock bool `json:"restock"` //Transactions []Transaction `json:"transactions"` UserID int64 `json:"user_id"` OrderID int64 `json:"order_id"` }
Refund is a refund
type RefundLineItem ¶
type RefundLineItem struct { ID int64 `json:"id"` LineItem LineItem `json:"line_item"` LineItemID int64 `json:"line_item_id"` Quantity int `json:"quantity"` }
RefundLineItem is a refund line item
type RefundsResponse ¶
type RefundsResponse struct {
Refunds []Refund `json:"refunds"`
}
type ShippingAddress ¶
type ShippingAddress struct { Address1 string `json:"address1"` Address2 string `json:"address2"` City string `json:"city"` Company string `json:"company"` Country string `json:"country"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Phone string `json:"phone"` Province string `json:"province"` Zip string `json:"zip"` Name string `json:"name"` ProvinceCode string `json:"province_code"` CountryCode string `json:"country_code"` }
ShippingAddress is a billing address
type ShippingLine ¶
type ShippingLine struct { Code string `json:"code"` Price string `json:"price"` Source string `json:"source"` Title string `json:"title"` TaxLines []TaxLine `json:"tax_lines"` }
ShippingLine is a shipping line
type Shopify ¶
type Shopify struct {
// contains filtered or unexported fields
}
Shopify store struct which we use to wrap our request operations.
func New ¶
New Creates a New Shopify Store API object with the store, apiKey and pass of your store. Usage: shopify.New("mystore", "XXX","YYY")
func (*Shopify) CancelOrder ¶
CancelOrder cancel an order
func (*Shopify) CloseOrder ¶
CloseOrder closes an order
func (*Shopify) CreateDiscountCode ¶
func (shop *Shopify) CreateDiscountCode(priceRule string, discountCode DiscountCode) (*DiscountCode, []error)
CreateDiscountCode creates a discount code
func (*Shopify) CreateOrder ¶
CreateOrder creates an order
func (*Shopify) Delete ¶
Delete Makes a DELETE request to shopify with the given endpoint. Usage: shopify.Delete("products/5.json")
func (*Shopify) DeleteOrder ¶
DeleteOrder cancel an order
func (*Shopify) Get ¶
Get Makes a GET request to shopify with the given endpoint. Usage: shopify.Get("products/5.json") shopify.Get("products/5/variants.json")
func (*Shopify) GetOrderRefunds ¶
func (shopify *Shopify) GetOrderRefunds(orderID int64, parameters map[string]string) ([]Refund, []error)
GetOrders returns all the orders
func (*Shopify) GetOrderTransactions ¶
func (shop *Shopify) GetOrderTransactions(orderID int64) ([]Transaction, []error)
GetOrderTransactions returns the order's transactions
func (*Shopify) GetOrderTransactionsCount ¶
GetOrderTransactionsCount returns the order's transactions count
func (*Shopify) GetOrdersCount ¶
GetOrdersCount returns all the products
func (*Shopify) GetProduct ¶
GetProduct returns all the orders
func (*Shopify) GetProductImages ¶
func (shopify *Shopify) GetProductImages(productID int64) ([]ProductImage, []error)
GetProductImages returns all the orders
func (*Shopify) GetProductVariants ¶
GetProductVariants returns all the product variants
func (*Shopify) GetProducts ¶
GetProducts returns all the orders
func (*Shopify) GetWithParameters ¶
func (shopify *Shopify) GetWithParameters(endpoint string, parameters map[string]string) ([]byte, []error)
GetWithParameters Makes a GET request to shopify with the given endpoint and given parameters
func (*Shopify) Post ¶
Post Makes a POST request to shopify with the given endpoint and data. Usage: shopify.Post("products", map[string]interface{} = product data map)
func (*Shopify) Put ¶
Put Makes a PUT request to shopify with the given endpoint and data. Usage: shopify.Put("products", map[string]interface{} = product data map)
type TaxLine ¶
type TaxLine struct { Title string `json:"title"` Price float64 `json:"price"` Rate float64 `json:"rate"` }
TaxLine is a tax line
type Transaction ¶
type Transaction struct { ID int64 `json:"id"` OrderID int64 `json:"orderId"` Amount string `json:"amount"` Kind string `json:"kind"` Authorization *string `json:"authorization"` Message string `json:"message"` CreatedAt time.Time `json:"created_at"` DeviceID *string `json:"device_id"` Gateway string `json:"gateway"` SourceName string `json:"source_name"` //PaymentDetails PaymentDetails `json:"payment_details"` Receipt string `json:"receipt"` ErrorCode string `json:"error_code"` Status string `json:"status"` Test bool `json:"test"` UserID *int64 `json:"userId"` Currency string `json:"currency"` }
Transaction is a transaction
type TransactionsResponse ¶
type TransactionsResponse struct {
Transactions []Transaction `json:"transactions"`
}
TransactionsResponse is a response to /orders/{id}/transactions
type Variant ¶
type Variant struct { BarCode string `json:"bar_code"` CompareAtPrice string `json:"compare_at_price"` CreatedAt time.Time `json:"created_at"` FulfillmentService string `json:"fulfillment_service"` Grams float64 `json:"grams"` Weight float64 `json:"weight"` WeightUnit string `json:"weight_unit"` ID int64 `json:"id"` InventoryManagement string `json:"inventory_management"` InventoryPolicy string `json:"inventory_policy"` InventoryQuantity int `json:"inventory_quantity"` Option1 string `json:"option1"` Option2 string `json:"option2"` Option3 string `json:"option3"` Position int `json:"position"` Price string `json:"price"` ProductID int64 `json:"product_id"` RequiresShipping bool `json:"requires_shipping"` SKU string `json:"sku"` Taxable bool `json:"taxable"` Title string `json:"title"` UpdatedAt time.Time `json:"updated_at"` }
Variant is a product's variant
type VariantsResponse ¶
type VariantsResponse struct {
Variants []Variant `json:"variants"`
}
VariantsResponse is a response for product images