Documentation ¶
Index ¶
- type Address
- type BaseParameters
- type Cart
- type CartAddress
- type CartImage
- type CartItem
- type CartItemTotals
- type CartItemVariation
- type CartShippingRate
- type CartShippingRateInner
- type CartTotals
- type Coupon
- type CouponTotals
- type CouponType
- type Customer
- type Error
- type ErrorDetails
- type Float
- type Int
- type MetaData
- type NullFloat
- type NullTime
- type Order
- type OrderCoupon
- type OrderCreate
- type OrderCreateBilling
- type OrderCreateItem
- type OrderCreateMetadata
- type OrderCreateShipping
- type OrderItem
- type OrderRefund
- type OrderShipping
- type OrderShippingLine
- type OrderStatus
- type OrderTax
- type OrderUpdate
- type PageParams
- type Parameters
- type Product
- type ProductCommon
- type ProductStatus
- type ProductType
- type ProductVariation
- type String
- type Tax
- type Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Company string `json:"company"` Address1 string `json:"address_1"` Address2 string `json:"address_2"` City string `json:"city"` State string `json:"state"` Postcode string `json:"postcode"` Country string `json:"country"` Email string `json:"email,omitempty"` Phone string `json:"phone,omitempty"` }
Address is the address used in the order. It is used as billing and shipping address. Some fields are only present in billing address.
type BaseParameters ¶
BaseParameters is a wrapper around url.Values type.
func (BaseParameters) Values ¶
func (b BaseParameters) Values() url.Values
type Cart ¶
type Cart struct { // CartToken is the cart token returned by woocommerce on cart request. CartToken string `json:"cart_token"` Coupons []Coupon `json:"coupons"` Items []CartItem `json:"items"` ShippingAddress CartAddress `json:"shipping_address"` BillingAddress CartAddress `json:"billing_address"` Totals CartTotals `json:"totals"` ShippingRates []CartShippingRate `json:"shipping_rates"` }
Cart holds the cart data.
type CartAddress ¶
type CartAddress struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` Phone string `json:"phone,omitempty"` Company string `json:"company"` Address1 string `json:"address_1"` Address2 string `json:"address_2"` City string `json:"city"` State string `json:"state"` Postcode string `json:"postcode"` Country string `json:"country"` }
type CartItem ¶
type CartItem struct { Key string `json:"key"` ID int `json:"id"` Quantity int `json:"quantity"` Name string `json:"name"` Summary string `json:"summary"` ShortDescription string `json:"short_description"` Description string `json:"description"` SKU string `json:"sku"` Images []CartImage `json:"images"` Totals CartItemTotals `json:"totals"` Variations []CartItemVariation `json:"variation"` }
type CartItemTotals ¶
type CartItemVariation ¶
type CartShippingRate ¶
type CartShippingRate struct { PackageID int `json:"package_id"` Name string `json:"name"` ShippingRates []CartShippingRateInner `json:"shipping_rates"` }
type CartShippingRateInner ¶
type CartTotals ¶
type CartTotals struct { CurrencyCode string `json:"currency_code"` CurrencyMinorUnit int `json:"currency_minor_unit"` TotalItems Int `json:"total_items"` TotalItemsTax Int `json:"total_items_tax"` TotalFees Int `json:"total_fees"` TotalFeesTax Int `json:"total_fees_tax"` TotalDiscount Int `json:"total_discount"` TotalDiscountTax Int `json:"total_discount_tax"` TotalShipping Int `json:"total_shipping"` TotalShippingTax Int `json:"total_shipping_tax"` TotalPrice Int `json:"total_price"` TotalTax Int `json:"total_tax"` }
type Coupon ¶
type Coupon struct { Code string `json:"code"` Type CouponType `json:"discount_type"` Totals CouponTotals `json:"totals"` }
type CouponTotals ¶
type CouponTotals struct { CurrencyCode string `json:"currency_code"` CurrencySymbol string `json:"currency_symbol"` CurrencyMinorUnit int `json:"currency_minor_unit"` CurrencyDecimalSeparator string `json:"currency_decimal_separator"` CurrencyThousandSeparator string `json:"currency_thousand_separator"` CurrencyPrefix string `json:"currency_prefix"` CurrencySuffix string `json:"currency_suffix"` TotalDiscount Int `json:"total_discount"` TotalDiscountTax Int `json:"total_discount_tax"` }
type CouponType ¶
type CouponType string
const ( CouponTypePercent CouponType = "percent" CouponTypeFixedCart CouponType = "fixed_cart" CouponTypeFixedProduct CouponType = "fixed_product" )
type Customer ¶
type Customer struct { ID int `json:"id,omitempty"` DateCreated string `json:"date_created,omitempty"` DateModified string `json:"date_modified,omitempty"` Email string `json:"email,omitempty"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` Role string `json:"role,omitempty"` Username string `json:"username,omitempty"` Billing Address `json:"billing,omitempty"` Shipping Address `json:"shipping,omitempty"` IsPayingCustomer bool `json:"is_paying_customer,omitempty"` AvatarUrl string `json:"avatar_url,omitempty"` MetaData []MetaData `json:"meta_data,omitempty"` }
type Error ¶
type ErrorDetails ¶
type ErrorDetails struct { Code string `json:"code"` Message string `json:"message"` AdditionalErrors []ErrorDetails `json:"additional_errors"` }
type Float ¶
type Float float64
Float is a support type that marshals itself to string in JSON.
func (Float) MarshalJSON ¶
func (*Float) UnmarshalJSON ¶
type MetaData ¶
type MetaData struct { ID int `json:"id"` Key string `json:"key"` Value interface{} `json:"value"` }
MetaData holds the meta data.
type NullFloat ¶
NullFloat is a support type that marshals itself to string in JSON.
func (NullFloat) MarshalJSON ¶
func (*NullFloat) UnmarshalJSON ¶
type Order ¶
type Order struct { ID int `json:"id"` ParentID int `json:"parent_id"` Number string `json:"number"` OrderKey string `json:"order_key"` CreatedVia string `json:"created_via"` Version string `json:"version"` Status OrderStatus `json:"status"` // Currency in 3-letter ISO format. Currency string `json:"currency"` DateCreated Time `json:"date_created"` DateModified Time `json:"date_modified"` // DiscountTotal is the total discount amount for the order DiscountTotal string `json:"discount_total"` // DiscountTax is the discount tax amount for the order DiscountTax string `json:"discount_tax"` // ShippingTotal is the shipping amount for the order ShippingTotal string `json:"shipping_total"` // ShippingTax is the shipping tax amount for the order ShippingTax string `json:"shipping_tax"` // CartTax is the sum of line item taxes only CartTax string `json:"cart_tax"` // Total is the grand total Total string `json:"total"` // TotalTax is the sum of all taxes TotalTax string `json:"total_tax"` // PricesIncludeTax is true the prices included tax during checkout PricesIncludeTax bool `json:"prices_include_tax"` CustomerID int `json:"customer_id"` CustomerIPAddress string `json:"customer_ip_address"` CustomerUserAgent string `json:"customer_user_agent"` CustomerNote string `json:"customer_note"` Billing Address `json:"billing"` Shipping Address `json:"shipping"` // PaymentMethod is the ID of the Payment method PaymentMethod string `json:"payment_method"` PaymentMethodTitle string `json:"payment_method_title"` TransactionID string `json:"transaction_id"` DatePaid NullTime `json:"date_paid"` DateCompleted NullTime `json:"date_completed"` // CartHash is the MD5 hash of the cart items. CartHash string `json:"cart_hash"` MetaData []MetaData `json:"meta_data"` LineItems []OrderItem `json:"line_items"` TaxLines []OrderTax `json:"tax_lines"` ShippingLines []OrderShipping `json:"shipping_lines"` CouponLines []OrderCoupon `json:"coupon_lines"` Refunds []OrderRefund `json:"refunds"` }
Order is the order object that the API returns.
type OrderCoupon ¶
type OrderCreate ¶
type OrderCreate struct { CustomerID int `json:"customer_id,omitempty"` PaymentMethod string `json:"payment_method"` PaymentMethodTitle string `json:"payment_method_title"` Currency string `json:"currency"` SetPaid bool `json:"set_paid"` Billing OrderCreateBilling `json:"billing"` Shipping OrderCreateShipping `json:"shipping"` Items []OrderCreateItem `json:"line_items"` MetaData []OrderCreateMetadata `json:"meta_data"` ShippingLines []OrderShippingLine `json:"shipping_lines"` CouponLines []OrderCoupon `json:"coupon_lines,omitempty"` }
type OrderCreateBilling ¶
type OrderCreateBilling struct { FirstName string `json:"first_name"` LastName string `json:"last_name"` Company string `json:"company"` Address1 string `json:"address_1"` Address2 string `json:"address_2"` City string `json:"city"` State string `json:"state"` Postcode string `json:"postcode"` Country string `json:"country"` Email string `json:"email"` Phone string `json:"phone"` }
type OrderCreateItem ¶
type OrderCreateItem struct { ProductID int `json:"product_id"` Quantity int `json:"quantity"` Total Float `json:"total,omitempty"` MetaData []OrderCreateMetadata `json:"meta_data,omitempty"` }
type OrderCreateMetadata ¶
type OrderCreateShipping ¶
type OrderItem ¶
type OrderItem struct { ID int `json:"id"` Name string `json:"name"` ProductID int `json:"product_id"` VariationID int `json:"variation_id"` Quantity int `json:"quantity"` TaxClass string `json:"tax_class"` // Subtotal is line subtotal before discounts Subtotal Float `json:"subtotal"` // SubtotalTax is line subtotal tax before discounts SubtotalTax Float `json:"subtotal_tax"` // Total is line total after discounts Total Float `json:"total"` // TotalTax is line total tax after discounts TotalTax Float `json:"total_tax"` Taxes []OrderTax `json:"taxes"` MetaData []MetaData `json:"meta_data"` SKU string `json:"sku"` Price Float `json:"price"` }
type OrderRefund ¶
type OrderShipping ¶
type OrderShipping struct { ID int `json:"id"` MethodTitle string `json:"method_title"` MethodID string `json:"method_id"` // Total is the line total after discounts. Total Float `json:"total"` // TotalTax is the line total tax after discounts. TotalTax Float `json:"total_tax"` Taxes []OrderTax `json:"taxes"` MetaData []MetaData `json:"meta_data"` }
type OrderShippingLine ¶
type OrderStatus ¶
type OrderStatus string
const ( OrderStatusPending OrderStatus = "pending" OrderStatusProcessing OrderStatus = "processing" OrderStatusOnHold OrderStatus = "on-hold" OrderStatusCompleted OrderStatus = "completed" OrderStatusCancelled OrderStatus = "cancelled" OrderStatusRefunded OrderStatus = "refunded" OrderStatusFailed OrderStatus = "failed" OrderStatusTrash OrderStatus = "trash" )
type OrderTax ¶
type OrderTax struct { ID int `json:"id"` RateCode string `json:"rate_code"` RateID String `json:"rate_id"` Label string `json:"label"` Compound bool `json:"compound"` // TaxTotal presents tax total not including shipping taxes. TaxTotal Float `json:"tax_total"` ShippingTaxTotal Float `json:"shipping_tax_total"` MetaData []MetaData `json:"meta_data"` }
type OrderUpdate ¶
type OrderUpdate struct {
SetPaid bool `json:"set_paid"`
}
type PageParams ¶
type PageParams struct {
Page, PerPage int
}
PageParams represents parameters that are used to specify pagination values of list queries.
func (PageParams) Values ¶
func (p PageParams) Values() url.Values
type Parameters ¶
Parameters specifies a type that can return GET parameters of the request.
func ParametersWithValue ¶
func ParametersWithValue(p Parameters, key, value string) Parameters
ParametersWithValue sets the value of the given parameters and returns new parameters.
type Product ¶
type Product struct { ProductCommon Name string `json:"name,omitempty"` Slug string `json:"slug,omitempty"` Type ProductType `json:"type,omitempty"` Featured bool `json:"featured,omitempty"` ShortDescription string `json:"short_description,omitempty"` ParentID int `json:"parent_id,omitempty"` Variations []int `json:"variations,omitempty"` }
type ProductCommon ¶
type ProductCommon struct { ID int `json:"id,omitempty"` DateCreated string `json:"date_created,omitempty"` DateModified string `json:"date_modified,omitempty"` Status ProductStatus `json:"status,omitempty"` Description string `json:"description,omitempty"` SKU string `json:"sku,omitempty"` Price NullFloat `json:"price,omitempty"` RegularPrice NullFloat `json:"regular_price,omitempty"` SalePrice NullFloat `json:"sale_price,omitempty"` MetaData []MetaData `json:"meta_data,omitempty"` }
ProductCommon contains the common fields of product and product variation.
type ProductStatus ¶
type ProductStatus string
const ( ProductStatusDraft ProductStatus = "draft" ProductStatusPending ProductStatus = "pending" ProductStatusPrivate ProductStatus = "private" ProductStatusPublish ProductStatus = "publish" )
type ProductType ¶
type ProductType string
const ( ProductTypeSimple ProductType = "simple" ProductTypeGrouped ProductType = "grouped" ProductTypeExternal ProductType = "external" ProductTypeVariable ProductType = "variable" )
type ProductVariation ¶
type ProductVariation struct {
ProductCommon
}
type String ¶
type String string
String is a string that is sometimes a number (thanks woocommerce).