Documentation
      ¶
    
    
  
    
  
    Index ¶
- type Billing
 - type Client
 - type ClientConfig
 - type Customer
 - type Customers
 - type ErrorData
 - type ErrorResponse
 - type IndexResponse
 - type Links
 - type MetaData
 - type Order
 - type OrderCouponLine
 - type OrderFeeLine
 - type OrderLineItem
 - type OrderLineItemTax
 - type OrderNote
 - type OrderRefundLine
 - type OrderShippingLine
 - type OrderTaxLine
 - type Orders
 - type Shipping
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Billing ¶
type Billing 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"`
}
    Billing data
type Client ¶
type Client struct {
	// contains filtered or unexported fields
}
    Client is the main SDK entry point for all methods. It wraps all available SDK objects into a single access point.
func NewClient ¶
func NewClient(cc ClientConfig) Client
NewClient constructs a new woocommerce.Client object and sets the given configuration.
func (Client) Index ¶
func (c Client) Index() (IndexResponse, error)
Index method returns all available API endpoints for the current host.
type ClientConfig ¶
type ClientConfig struct {
	APIHost        string // Complete REST API base URL: "https://example.com/wp-json/wc/v3"
	ConsumerKey    string
	ConsumerSecret string
	UseBasicAuth   bool
	Debug          bool
}
    ClientConfig is used to instantiate a new Woocommerce API Client with the defined values.
func (ClientConfig) GetAPIEndpoint ¶
func (cc ClientConfig) GetAPIEndpoint(method string) string
GetAPIEndpoint takes an API method name and returns the full URL for that endpoint based on the current configuration.
type Customer ¶
type Customer struct {
	ID               int        `json:"id"`
	DateCreated      string     `json:"date_created"`
	DateCreatedGmt   string     `json:"date_created_gmt"`
	DateModified     string     `json:"date_modified"`
	DateModifiedGmt  string     `json:"date_modified_gmt"`
	Email            string     `json:"email"`
	FirstName        string     `json:"first_name"`
	LastName         string     `json:"last_name"`
	Role             string     `json:"role"`
	Username         string     `json:"username"`
	Billing          Billing    `json:"billing"`
	Shipping         Shipping   `json:"shipping"`
	IsPayingCustomer bool       `json:"is_paying_customer"`
	AvatarURL        string     `json:"avatar_url"`
	MetaData         []MetaData `json:"meta_data"`
	Links            Links      `json:"_links"`
}
    Customer data
type ErrorData ¶
type ErrorData struct {
	Status int
}
    ErrorData is used to store extra data from error responses.
type ErrorResponse ¶
ErrorResponse is the deafult error response data structure.
type IndexResponse ¶
IndexResponse data
type Links ¶
type Links struct {
	Self []struct {
		Href string `json:"href"`
	} `json:"self"`
	Collection []struct {
		Href string `json:"href"`
	} `json:"collection"`
}
    Links data
type MetaData ¶
type MetaData struct {
	ID    int         `json:"id"`
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}
    MetaData object
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             string              `json:"status"`
	Currency           string              `json:"currency"`
	DateCreated        string              `json:"date_created"`
	DateCreatedGmt     string              `json:"date_created_gmt"`
	DateModified       string              `json:"date_modified"`
	DateModifiedGmt    string              `json:"date_modified_gmt"`
	DiscountTotal      string              `json:"discount_total"`
	DiscountTax        string              `json:"discount_tax"`
	ShippingTotal      string              `json:"shipping_total"`
	ShippingTax        string              `json:"shipping_tax"`
	CartTax            string              `json:"cart_tax"`
	Total              string              `json:"total"`
	TotalTax           string              `json:"total_tax"`
	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            Billing             `json:"billing"`
	Shipping           Shipping            `json:"shipping"`
	PaymentMethod      string              `json:"payment_method"`
	PaymentMethodTitle string              `json:"payment_method_title"`
	TransactionID      string              `json:"transaction_id"`
	DatePaid           string              `json:"date_paid"`
	DatePaidGmt        string              `json:"date_paid_gmt"`
	DateCompleted      string              `json:"date_completed"`
	DateCompletedGmt   string              `json:"date_completed_gmt"`
	CartHash           string              `json:"cart_hash"`
	MetaData           []MetaData          `json:"meta_data"`
	LineItems          []OrderLineItem     `json:"line_items"`
	TaxLines           []OrderTaxLine      `json:"tax_lines"`
	ShippingLines      []OrderShippingLine `json:"shipping_lines"`
	FeeLines           []OrderFeeLine      `json:"fee_lines"`
	CouponLines        []OrderCouponLine   `json:"coupon_lines"`
	Refunds            []OrderRefundLine   `json:"refunds"`
	Links              Links               `json:"_links"`
}
    Order data
type OrderCouponLine ¶
type OrderCouponLine struct {
	ID          int        `json:"id"`
	Code        string     `json:"code"`
	Discount    string     `json:"discount"`
	DiscountTax string     `json:"discount_tax"`
	MetaData    []MetaData `json:"meta_data"`
}
    OrderCouponLine data
type OrderFeeLine ¶
type OrderFeeLine struct {
	ID        int            `json:"id"`
	Name      string         `json:"name"`
	TaxClass  string         `json:"tax_class"`
	TaxStatus string         `json:"tax_status"`
	Total     string         `json:"total"`
	TotalTax  string         `json:"total_tax"`
	Taxes     []OrderTaxLine `json:"taxes"`
	MetaData  []MetaData     `json:"meta_data"`
}
    OrderFeeLine data
type OrderLineItem ¶
type OrderLineItem 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    string             `json:"subtotal"`
	SubtotalTax string             `json:"subtotal_tax"`
	Total       string             `json:"total"`
	TotalTax    string             `json:"total_tax"`
	Taxes       []OrderLineItemTax `json:"taxes"`
	MetaData    []MetaData         `json:"meta_data"`
	Sku         string             `json:"sku"`
	Price       int                `json:"price"`
}
    OrderLineItem data
type OrderLineItemTax ¶
type OrderLineItemTax struct {
	ID       int    `json:"id"`
	Total    string `json:"total"`
	Subtotal string `json:"subtotal"`
}
    OrderLineItemTax data
type OrderNote ¶
type OrderNote struct {
	ID             int    `json:"id"`
	Author         string `json:"author"`
	DateCreated    string `json:"date_created"`
	DateCreatedGmt string `json:"date_created_gmt"`
	Note           string `json:"note"`
	CustomerNote   bool   `json:"customer_note"`
	Links          Links  `json:"_links"`
}
    OrderNote data
type OrderRefundLine ¶
type OrderRefundLine struct {
	ID     int    `json:"id"`
	Reason string `json:"reason"`
	Total  string `json:"total"`
}
    OrderRefundLine data
type OrderShippingLine ¶
type OrderShippingLine struct {
	ID          int            `json:"id"`
	MethodTitle string         `json:"method_title"`
	MethodID    string         `json:"method_id"`
	Total       string         `json:"total"`
	TotalTax    string         `json:"total_tax"`
	Taxes       []OrderTaxLine `json:"taxes"`
	MetaData    []MetaData     `json:"meta_data"`
}
    OrderShippingLine data
type OrderTaxLine ¶
type OrderTaxLine struct {
	ID               int        `json:"id"`
	RateCode         string     `json:"rate_code"`
	RateID           int        `json:"rate_id"`
	Label            string     `json:"label"`
	Compound         bool       `json:"compound"`
	TaxTotal         string     `json:"tax_total"`
	ShippingTaxTotal string     `json:"shipping_tax_total"`
	MetaData         []MetaData `json:"meta_data"`
}
    OrderTaxLine data
type Orders ¶
type Orders struct {
	Client
}
    Orders API client
func (Orders) GetOrderNote ¶ added in v0.1.1
GetOrderNote by IDs
type Shipping ¶
type Shipping 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"`
}
    Shipping data