Documentation
¶
Index ¶
- type BatchCouponUpdate
- type BatchCouponUpdateResponse
- type BatchCustomerUpdate
- type BatchCustomerUpdateResponse
- type BatchOrderUpdate
- type BatchOrderUpdateResponse
- type BatchProductUpdate
- type BatchProductUpdateResponse
- type BatchTaxRateUpdate
- type BatchTaxRateUpdateResponse
- type BatchWebhookUpdate
- type BatchWebhookUpdateResponse
- type Billing
- type Collection
- type Config
- type Coupon
- type CouponLine
- type CouponsService
- func (service *CouponsService) Batch(ctx context.Context, opts *BatchCouponUpdate) (*BatchCouponUpdateResponse, *http.Response, error)
- func (service *CouponsService) Create(ctx context.Context, coupon *Coupon) (*Coupon, *http.Response, error)
- func (service *CouponsService) Delete(ctx context.Context, couponID string, opts *DeleteCouponParams) (*Coupon, *http.Response, error)
- func (service *CouponsService) Get(ctx context.Context, couponID string) (*Coupon, *http.Response, error)
- func (service *CouponsService) List(ctx context.Context, opts *ListCouponParams) ([]Coupon, *http.Response, error)
- func (service *CouponsService) Update(ctx context.Context, couponID string, coupon *Coupon) (*Coupon, *http.Response, error)
- type CouponsServiceInterface
- type Customer
- type CustomerDownload
- type CustomersService
- func (service *CustomersService) Batch(ctx context.Context, opts *BatchCustomerUpdate) (*BatchCustomerUpdateResponse, *http.Response, error)
- func (service *CustomersService) Create(ctx context.Context, customer *Customer) (*Customer, *http.Response, error)
- func (service *CustomersService) Delete(ctx context.Context, customerID string, opts *DeleteCustomerParams) (*Customer, *http.Response, error)
- func (service *CustomersService) Get(ctx context.Context, customerID string) (*Customer, *http.Response, error)
- func (service *CustomersService) GetDownloads(ctx context.Context, customerID string) ([]CustomerDownload, *http.Response, error)
- func (service *CustomersService) List(ctx context.Context, opts *ListCustomerParams) ([]Customer, *http.Response, error)
- func (service *CustomersService) Update(ctx context.Context, customerID string, customer *Customer) (*Customer, *http.Response, error)
- type CustomersServiceInterface
- type DefaultAttributes
- type DeleteCouponParams
- type DeleteCustomerParams
- type DeleteOrderNoteParams
- type DeleteOrderParams
- type DeleteProductParams
- type DeleteRefundParams
- type DeleteTaxRateParams
- type DeleteWebhookParams
- type ErrorData
- type ErrorResponse
- type FeeLine
- type File
- type FlexibleString
- type GetOrderParams
- type HTTPClient
- type Image
- type LineItems
- type Links
- type ListCouponParams
- type ListCustomerParams
- type ListOrderNotesParams
- type ListOrdersParams
- type ListProductParams
- type ListRefundParams
- type ListTaxRatesParams
- type ListWebhooksParams
- type MetaData
- type Order
- type OrderNote
- type OrderNotesService
- func (service *OrderNotesService) Create(ctx context.Context, orderID string, orderNote *OrderNote) (*OrderNote, *http.Response, error)
- func (service *OrderNotesService) Delete(ctx context.Context, orderID string, noteID string, ...) (*OrderNote, *http.Response, error)
- func (service *OrderNotesService) Get(ctx context.Context, orderID string, noteID string) (*OrderNote, *http.Response, error)
- func (service *OrderNotesService) List(ctx context.Context, orderID string, opts *ListOrderNotesParams) ([]OrderNote, *http.Response, error)
- type OrderNotesServiceInterface
- type OrderRefund
- type OrdersService
- func (service *OrdersService) Batch(ctx context.Context, opts *BatchOrderUpdate) (*BatchOrderUpdateResponse, *http.Response, error)
- func (service *OrdersService) Create(ctx context.Context, order *Order) (*Order, *http.Response, error)
- func (service *OrdersService) Delete(ctx context.Context, orderID string, opts *DeleteOrderParams) (*Order, *http.Response, error)
- func (service *OrdersService) Get(ctx context.Context, orderID string, opts *GetOrderParams) (*Order, *http.Response, error)
- func (service *OrdersService) List(ctx context.Context, opts *ListOrdersParams) ([]Order, *http.Response, error)
- func (service *OrdersService) Update(ctx context.Context, orderID string, order *Order) (*Order, *http.Response, error)
- type OrdersServiceInterface
- type Product
- type ProductAttributes
- type ProductCategory
- type ProductDimensions
- type ProductDownloads
- type ProductTag
- type ProductsService
- func (service *ProductsService) Batch(ctx context.Context, opts *BatchProductUpdate) (*BatchProductUpdateResponse, *http.Response, error)
- func (service *ProductsService) Create(ctx context.Context, product *Product) (*Product, *http.Response, error)
- func (service *ProductsService) Delete(ctx context.Context, productID string, opts *DeleteProductParams) (*Product, *http.Response, error)
- func (service *ProductsService) Get(ctx context.Context, productID string) (*Product, *http.Response, error)
- func (service *ProductsService) List(ctx context.Context, opts *ListProductParams) ([]Product, *http.Response, error)
- func (service *ProductsService) Update(ctx context.Context, productID string, product *Product) (*Product, *http.Response, error)
- type ProductsServiceInterface
- type Refund
- type RefundLineItem
- type RefundTax
- type RefundsService
- func (service *RefundsService) Create(ctx context.Context, orderID string, refund *Refund) (*Refund, *http.Response, error)
- func (service *RefundsService) Delete(ctx context.Context, orderID string, refundID string, opts *DeleteRefundParams) (*Refund, *http.Response, error)
- func (service *RefundsService) Get(ctx context.Context, orderID string, refundID string) (*Refund, *http.Response, error)
- func (service *RefundsService) List(ctx context.Context, orderID string, opts *ListRefundParams) ([]Refund, *http.Response, error)
- type RefundsServiceInterface
- type Self
- type Shipping
- type ShippingLines
- type TaxLines
- type TaxRate
- type TaxRatesService
- func (service *TaxRatesService) Batch(ctx context.Context, opts *BatchTaxRateUpdate) (*BatchTaxRateUpdateResponse, *http.Response, error)
- func (service *TaxRatesService) Create(ctx context.Context, taxRate *TaxRate) (*TaxRate, *http.Response, error)
- func (service *TaxRatesService) Delete(ctx context.Context, taxRateID string, opts *DeleteTaxRateParams) (*TaxRate, *http.Response, error)
- func (service *TaxRatesService) Get(ctx context.Context, taxRateID string) (*TaxRate, *http.Response, error)
- func (service *TaxRatesService) List(ctx context.Context, opts *ListTaxRatesParams) ([]TaxRate, *http.Response, error)
- func (service *TaxRatesService) Update(ctx context.Context, taxRateID string, taxRate *TaxRate) (*TaxRate, *http.Response, error)
- type TaxRatesServiceInterface
- type Taxes
- type Webhook
- type WebhookService
- func (service *WebhookService) Batch(ctx context.Context, opts *BatchWebhookUpdate) (*BatchWebhookUpdateResponse, *http.Response, error)
- func (service *WebhookService) Create(ctx context.Context, webhook *Webhook) (*Webhook, *http.Response, error)
- func (service *WebhookService) Delete(ctx context.Context, webhookID string, opts *DeleteWebhookParams) (*Webhook, *http.Response, error)
- func (service *WebhookService) Get(ctx context.Context, webhookID string) (*Webhook, *http.Response, error)
- func (service *WebhookService) List(ctx context.Context, opts *ListWebhooksParams) ([]Webhook, *http.Response, error)
- func (service *WebhookService) Update(ctx context.Context, webhookID string, webhook *Webhook) (*Webhook, *http.Response, error)
- type WebhookServiceInterface
- type WooCommerce
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchCouponUpdate ¶
type BatchCustomerUpdate ¶
type BatchOrderUpdate ¶
type BatchProductUpdate ¶
type BatchTaxRateUpdate ¶
type BatchWebhookUpdate ¶
type Billing ¶
type Billing struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Company string `json:"company,omitempty"`
Address1 string `json:"address_1,omitempty"`
Address2 string `json:"address_2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Postcode string `json:"postcode,omitempty"`
Country string `json:"country,omitempty"`
Email string `json:"email,omitempty"`
Phone string `json:"phone,omitempty"`
}
type Collection ¶
type Collection struct {
Href string `json:"href,omitempty"`
}
type Config ¶ added in v1.0.2
type Config struct {
ShopURL string
ConsumerKey string
ConsumerSecret string
// Version defaults to "v3" if empty.
Version string
// HTTPClient defaults to a client with a 10s timeout if nil.
HTTPClient *http.Client
}
Config holds all configuration needed to create a WooCommerce client.
type Coupon ¶
type Coupon struct {
ID int `json:"id,omitempty"`
Code string `json:"code,omitempty"`
Amount string `json:"amount,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateCreatedGmt string `json:"date_created_gmt,omitempty"`
DateModified string `json:"date_modified,omitempty"`
DateModifiedGmt string `json:"date_modified_gmt,omitempty"`
DiscountType string `json:"discount_type,omitempty"`
Description string `json:"description,omitempty"`
DateExpires string `json:"date_expires,omitempty"`
DateExpiresGmt string `json:"date_expires_gmt,omitempty"`
UsageCount int `json:"usage_count,omitempty"`
IndividualUse bool `json:"individual_use,omitempty"`
UsageLimit int `json:"usage_limit,omitempty"`
UsageLimitPerUser int `json:"usage_limit_per_user,omitempty"`
LimitUsageToXItems int `json:"limit_usage_to_x_items,omitempty"`
FreeShipping bool `json:"free_shipping,omitempty"`
ExcludeSaleItems bool `json:"exclude_sale_items,omitempty"`
MinimumAmount string `json:"minimum_amount,omitempty"`
MaximumAmount string `json:"maximum_amount,omitempty"`
EmailRestrictions any `json:"email_restrictions,omitempty"`
UsedBy any `json:"used_by,omitempty"`
ProductIds []int `json:"product_ids,omitempty"`
ExcludedProductIds []int `json:"excluded_product_ids,omitempty"`
ProductCategories []int `json:"product_categories,omitempty"`
ExcludedProductCategories []int `json:"excluded_product_categories,omitempty"`
MetaData []MetaData `json:"meta_data,omitempty"`
}
Coupon object. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#coupon-properties
type CouponLine ¶
type CouponsService ¶
type CouponsService struct {
// contains filtered or unexported fields
}
Coupon service
func (*CouponsService) Batch ¶
func (service *CouponsService) Batch(ctx context.Context, opts *BatchCouponUpdate) (*BatchCouponUpdateResponse, *http.Response, error)
Batch update coupons. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-coupons
func (*CouponsService) Create ¶
func (service *CouponsService) Create(ctx context.Context, coupon *Coupon) (*Coupon, *http.Response, error)
Create a coupon. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-coupon
func (*CouponsService) Delete ¶
func (service *CouponsService) Delete(ctx context.Context, couponID string, opts *DeleteCouponParams) (*Coupon, *http.Response, error)
Delete a coupon. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-coupon
func (*CouponsService) Get ¶
func (service *CouponsService) Get(ctx context.Context, couponID string) (*Coupon, *http.Response, error)
Get a coupon. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-coupon
func (*CouponsService) List ¶
func (service *CouponsService) List(ctx context.Context, opts *ListCouponParams) ([]Coupon, *http.Response, error)
List coupons. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-coupons
type CouponsServiceInterface ¶ added in v1.0.1
type CouponsServiceInterface interface {
Create(ctx context.Context, coupon *Coupon) (*Coupon, *http.Response, error)
Get(ctx context.Context, couponID string) (*Coupon, *http.Response, error)
List(ctx context.Context, opts *ListCouponParams) ([]Coupon, *http.Response, error)
Update(ctx context.Context, couponID string, coupon *Coupon) (*Coupon, *http.Response, error)
Delete(ctx context.Context, couponID string, opts *DeleteCouponParams) (*Coupon, *http.Response, error)
Batch(ctx context.Context, opts *BatchCouponUpdate) (*BatchCouponUpdateResponse, *http.Response, error)
}
type Customer ¶
type Customer struct {
ID int `json:"id,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateCreatedGmt string `json:"date_created_gmt,omitempty"`
DateModified string `json:"date_modified,omitempty"`
DateModifiedGmt string `json:"date_modified_gmt,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"`
AvatarURL string `json:"avatar_url,omitempty"`
IsPayingCustomer bool `json:"is_paying_customer"`
MetaData []MetaData `json:"meta_data,omitempty"`
Billing *Billing `json:"billing,omitempty"`
Shipping *Shipping `json:"shipping,omitempty"`
Links *Links `json:"_links,omitempty"`
}
Customer object. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#customer-properties
type CustomerDownload ¶
type CustomerDownload struct {
DownloadID string `json:"download_id,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
ProductID int `json:"product_id,omitempty"`
ProductName string `json:"product_name,omitempty"`
DownloadName string `json:"download_name,omitempty"`
OrderID int `json:"order_id,omitempty"`
OrderKey string `json:"order_key,omitempty"`
DownloadsRemaining string `json:"downloads_remaining,omitempty"`
AccessExpires string `json:"access_expires,omitempty"`
AccessExpiresGmt string `json:"access_expires_gmt,omitempty"`
File *File `json:"file,omitempty"`
Links *Links `json:"_links,omitempty"`
}
type CustomersService ¶
type CustomersService struct {
// contains filtered or unexported fields
}
Customer service
func (*CustomersService) Batch ¶
func (service *CustomersService) Batch(ctx context.Context, opts *BatchCustomerUpdate) (*BatchCustomerUpdateResponse, *http.Response, error)
Batch update customers. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-customers
func (*CustomersService) Create ¶
func (service *CustomersService) Create(ctx context.Context, customer *Customer) (*Customer, *http.Response, error)
Create a customer. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-customer
func (*CustomersService) Delete ¶
func (service *CustomersService) Delete(ctx context.Context, customerID string, opts *DeleteCustomerParams) (*Customer, *http.Response, error)
Delete a customer. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-customer
func (*CustomersService) Get ¶
func (service *CustomersService) Get(ctx context.Context, customerID string) (*Customer, *http.Response, error)
Get a customer. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-customer
func (*CustomersService) GetDownloads ¶
func (service *CustomersService) GetDownloads(ctx context.Context, customerID string) ([]CustomerDownload, *http.Response, error)
GetDownloads retrieves customer downloads. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-customer-downloads
func (*CustomersService) List ¶
func (service *CustomersService) List(ctx context.Context, opts *ListCustomerParams) ([]Customer, *http.Response, error)
List customers. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-customers
type CustomersServiceInterface ¶ added in v1.0.1
type CustomersServiceInterface interface {
Create(ctx context.Context, customer *Customer) (*Customer, *http.Response, error)
Get(ctx context.Context, customerID string) (*Customer, *http.Response, error)
List(ctx context.Context, opts *ListCustomerParams) ([]Customer, *http.Response, error)
Update(ctx context.Context, customerID string, customer *Customer) (*Customer, *http.Response, error)
Delete(ctx context.Context, customerID string, opts *DeleteCustomerParams) (*Customer, *http.Response, error)
Batch(ctx context.Context, opts *BatchCustomerUpdate) (*BatchCustomerUpdateResponse, *http.Response, error)
GetDownloads(ctx context.Context, customerID string) ([]CustomerDownload, *http.Response, error)
}
type DefaultAttributes ¶
type DeleteCouponParams ¶
type DeleteCouponParams struct {
Force string `json:"force,omitempty"`
}
type DeleteCustomerParams ¶
type DeleteOrderNoteParams ¶
type DeleteOrderNoteParams struct {
Force bool `url:"force"`
}
type DeleteOrderParams ¶
type DeleteOrderParams struct {
Force bool `url:"force"`
}
type DeleteProductParams ¶
type DeleteProductParams struct {
Force string `json:"force,omitempty"`
}
type DeleteRefundParams ¶
type DeleteRefundParams struct {
Force bool `url:"force"`
}
type DeleteTaxRateParams ¶
type DeleteTaxRateParams struct {
Force bool `url:"force"`
}
type DeleteWebhookParams ¶
type DeleteWebhookParams struct {
Force string `json:"force,omitempty"`
}
type ErrorResponse ¶
type ErrorResponse struct {
Response *http.Response
Code string `json:"code"`
Message string `json:"message"`
Data ErrorData `json:"data"`
}
ErrorResponse represents an error returned by the WooCommerce API.
func (*ErrorResponse) Error ¶
func (e *ErrorResponse) Error() string
type FeeLine ¶
type FeeLine struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
TaxClass string `json:"tax_class,omitempty"`
TaxStatus string `json:"tax_status,omitempty"`
Amount string `json:"amount,omitempty"`
Total string `json:"total,omitempty"`
TotalTax string `json:"total_tax,omitempty"`
Taxes []Taxes `json:"taxes,omitempty"`
MetaData []MetaData `json:"meta_data,omitempty"`
}
type FlexibleString ¶ added in v1.0.9
type FlexibleString string
FlexibleString unmarshals from either a JSON string or a bare JSON number, coercing both to a Go string. WooCommerce documents price fields (price/regular_price/sale_price) as always strings, but some stores return them unquoted instead — observed with a bundle-product plugin ("woosb" type) that recalculates sale_price and re-serialises it as a number. The raw literal bytes are used as-is for the numeric case, so no float precision or formatting is lost. Always marshals back out as a normal JSON string, since that's what WooCommerce's write endpoints expect.
func (*FlexibleString) UnmarshalJSON ¶ added in v1.0.9
func (s *FlexibleString) UnmarshalJSON(data []byte) error
type GetOrderParams ¶
type GetOrderParams struct {
DecimalPoints int `url:"dp,omitempty"`
}
type HTTPClient ¶ added in v1.0.2
type HTTPClient interface {
NewRequest(ctx context.Context, method, path string, opts, body any) (*http.Request, error)
Do(req *http.Request, v any) (*http.Response, error)
}
HTTPClient is the interface that service implementations depend on. It can be replaced with a mock in tests.
type Image ¶
type Image struct {
ID any `json:"id,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateCreatedGmt string `json:"date_created_gmt,omitempty"`
DateModified string `json:"date_modified,omitempty"`
DateModifiedGmt string `json:"date_modified_gmt,omitempty"`
Source string `json:"src,omitempty"`
Name string `json:"name,omitempty"`
Alt string `json:"alt,omitempty"`
}
type LineItems ¶
type LineItems struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
ProductID int `json:"product_id,omitempty"`
VariationID int `json:"variation_id,omitempty"`
Quantity int `json:"quantity,omitempty"`
TaxClass string `json:"tax_class,omitempty"`
Subtotal string `json:"subtotal,omitempty"`
SubtotalTax string `json:"subtotal_tax,omitempty"`
Total string `json:"total,omitempty"`
TotalTax string `json:"total_tax,omitempty"`
Taxes []Taxes `json:"taxes,omitempty"`
MetaData []MetaData `json:"meta_data,omitempty"`
Sku string `json:"sku,omitempty"`
Price float64 `json:"price,omitempty"`
Image *Image `json:"image,omitempty"`
ParentName any `json:"parent_name,omitempty"`
}
type Links ¶
type Links struct {
Self []Self `json:"self,omitempty"`
Collection []Collection `json:"collection,omitempty"`
}
type ListCouponParams ¶
type ListCouponParams struct {
Context string `url:"context,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
Search string `url:"search,omitempty"`
Exclude []int `url:"exclude,omitempty,comma"`
Include []int `url:"include,omitempty,comma"`
Offset int `url:"offset,omitempty"`
Order string `url:"order,omitempty"`
OrderBy string `url:"orderby,omitempty"`
After string `url:"after,omitempty"`
Before string `url:"before,omitempty"`
ModifiedAfter string `url:"modified_after,omitempty"`
ModifiedBefore string `url:"modified_before,omitempty"`
DatesAreGmt bool `url:"dates_are_gmt,omitempty"`
Code string `url:"code,omitempty"`
}
type ListCustomerParams ¶
type ListCustomerParams struct {
Context string `url:"context,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
Search string `url:"search,omitempty"`
Exclude []int `url:"exclude,omitempty,comma"`
Include []int `url:"include,omitempty,comma"`
Offset int `url:"offset,omitempty"`
Order string `url:"order,omitempty"`
OrderBy string `url:"orderby,omitempty"`
Email string `url:"email,omitempty"`
Role string `url:"role,omitempty"`
}
type ListOrderNotesParams ¶
type ListOrdersParams ¶
type ListOrdersParams struct {
Context string `url:"context,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
Search string `url:"search,omitempty"`
Exclude []int `url:"exclude,omitempty,comma"`
Include []int `url:"include,omitempty,comma"`
Offset int `url:"offset,omitempty"`
Order string `url:"order,omitempty"`
OrderBy string `url:"orderby,omitempty"`
Customer int `url:"customer,omitempty"`
Product int `url:"product,omitempty"`
DecimalPoints int `url:"dp,omitempty"`
Parent []int `url:"parent,omitempty,comma"`
ParentExclude []int `url:"parent_exclude,omitempty,comma"`
DatesAreGMT bool `url:"dates_are_gmt"`
After string `url:"after,omitempty"`
Before string `url:"before,omitempty"`
ModifiedAfter string `url:"modified_after,omitempty"`
ModifiedBefore string `url:"modified_before,omitempty"`
Status []string `url:"status,omitempty,comma"`
}
type ListProductParams ¶
type ListProductParams struct {
Context string `url:"context,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
Search string `url:"search,omitempty"`
Exclude []int `url:"exclude,omitempty,comma"`
Include []int `url:"include,omitempty,comma"`
Offset int `url:"offset,omitempty"`
Order string `url:"order,omitempty"`
OrderBy string `url:"orderby,omitempty"`
After string `url:"after,omitempty"`
Before string `url:"before,omitempty"`
ModifiedAfter string `url:"modified_after,omitempty"`
ModifiedBefore string `url:"modified_before,omitempty"`
DatesAreGmt bool `url:"dates_are_gmt,omitempty"`
Slug string `url:"slug,omitempty"`
Status string `url:"status,omitempty"`
Type string `url:"type,omitempty"`
Sku string `url:"sku,omitempty"`
Featured bool `url:"featured,omitempty"`
Category string `url:"category,omitempty"`
Tag string `url:"tag,omitempty"`
ShippingClass string `url:"shipping_class,omitempty"`
Attribute string `url:"attribute,omitempty"`
AttributeTerm string `url:"attribute_term,omitempty"`
TaxClass string `url:"tax_class,omitempty"`
OnSale bool `url:"on_sale,omitempty"`
MinPrice string `url:"min_price,omitempty"`
MaxPrice string `url:"max_price,omitempty"`
StockStatus string `url:"stock_status,omitempty"`
Parent []int `url:"parent,omitempty,comma"`
ParentExclude []int `url:"parent_exclude,omitempty,comma"`
Fields []string `url:"_fields,omitempty,comma"`
}
type ListRefundParams ¶
type ListRefundParams struct {
Context string `url:"context,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
Search string `url:"search,omitempty"`
After string `url:"after,omitempty"`
Before string `url:"before,omitempty"`
DatesAreGmt bool `url:"dates_are_gmt,omitempty"`
Exclude []int `url:"exclude,omitempty,comma"`
Include []int `url:"include,omitempty,comma"`
Offset int `url:"offset,omitempty"`
Order string `url:"order,omitempty"`
OrderBy string `url:"orderby,omitempty"`
Parent []int `url:"parent,omitempty,comma"`
ParentExclude []int `url:"parent_exclude,omitempty,comma"`
Dp int `url:"dp,omitempty"`
}
type ListTaxRatesParams ¶
type ListTaxRatesParams struct {
Context string `url:"context,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
Search string `url:"search,omitempty"`
Exclude []int `url:"exclude,omitempty,comma"`
Include []int `url:"include,omitempty,comma"`
Offset int `url:"offset,omitempty"`
Order string `url:"order,omitempty"`
OrderBy string `url:"orderby,omitempty"`
Class string `url:"class,omitempty"`
}
type ListWebhooksParams ¶
type ListWebhooksParams struct {
Context string `url:"context,omitempty"`
Page int `url:"page,omitempty"`
PerPage int `url:"per_page,omitempty"`
Search string `url:"search,omitempty"`
Exclude *[]int `url:"exclude,omitempty"`
Include *[]int `url:"include,omitempty"`
Offset int `url:"offset,omitempty"`
Order string `url:"order,omitempty"`
OrderBy string `url:"orderby,omitempty"`
After string `url:"after,omitempty"`
Before string `url:"before,omitempty"`
Status string `url:"status,omitempty"`
}
type Order ¶
type Order struct {
ID int `json:"id,omitempty"`
ParentID int `json:"parent_id,omitempty"`
CustomerID int `json:"customer_id,omitempty"`
PricesIncludeTax bool `json:"prices_include_tax"`
NeedsPayment bool `json:"needs_payment"`
NeedsProcessing bool `json:"needs_processing"`
IsEditable bool `json:"is_editable"`
CurrencySymbol string `json:"currency_symbol,omitempty"`
Number string `json:"number,omitempty"`
OrderKey string `json:"order_key,omitempty"`
CreatedVia string `json:"created_via,omitempty"`
Version string `json:"version,omitempty"`
Status string `json:"status,omitempty"`
Currency string `json:"currency,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateCreatedGmt string `json:"date_created_gmt,omitempty"`
DateModified string `json:"date_modified,omitempty"`
DateModifiedGmt string `json:"date_modified_gmt,omitempty"`
DiscountTotal string `json:"discount_total,omitempty"`
DiscountTax string `json:"discount_tax,omitempty"`
ShippingTotal string `json:"shipping_total,omitempty"`
ShippingTax string `json:"shipping_tax,omitempty"`
CartTax string `json:"cart_tax,omitempty"`
Total string `json:"total,omitempty"`
TotalTax string `json:"total_tax,omitempty"`
CustomerIPAddress string `json:"customer_ip_address,omitempty"`
CustomerUserAgent string `json:"customer_user_agent,omitempty"`
CustomerNote string `json:"customer_note,omitempty"`
PaymentURL string `json:"payment_url,omitempty"`
PaymentMethod string `json:"payment_method,omitempty"`
PaymentMethodTitle string `json:"payment_method_title,omitempty"`
TransactionID string `json:"transaction_id,omitempty"`
DatePaid string `json:"date_paid,omitempty"`
DatePaidGmt string `json:"date_paid_gmt,omitempty"`
DateCompleted string `json:"date_completed,omitempty"`
DateCompletedGmt string `json:"date_completed_gmt,omitempty"`
CartHash string `json:"cart_hash,omitempty"`
Billing *Billing `json:"billing,omitempty"`
Shipping *Shipping `json:"shipping,omitempty"`
Links *Links `json:"_links,omitempty"`
FeeLines []FeeLine `json:"fee_lines,omitempty"`
Refunds []OrderRefund `json:"refunds,omitempty"`
MetaData []MetaData `json:"meta_data,omitempty"`
CouponLines []CouponLine `json:"coupon_lines,omitempty"`
LineItems []LineItems `json:"line_items,omitempty"`
TaxLines []TaxLines `json:"tax_lines,omitempty"`
ShippingLines []ShippingLines `json:"shipping_lines,omitempty"`
}
Order object. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#order-properties
type OrderNote ¶
type OrderNote struct {
ID int `json:"id,omitempty"`
Author string `json:"author,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateCreatedGmt string `json:"date_created_gmt,omitempty"`
Note string `json:"note,omitempty"`
CustomerNote bool `json:"customer_note,omitempty"`
AddedByUser bool `json:"added_by_user,omitempty"`
}
OrderNote object. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#order-note-properties
type OrderNotesService ¶
type OrderNotesService struct {
// contains filtered or unexported fields
}
Order Notes service
func (*OrderNotesService) Create ¶
func (service *OrderNotesService) Create(ctx context.Context, orderID string, orderNote *OrderNote) (*OrderNote, *http.Response, error)
Create an order note. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order-note
func (*OrderNotesService) Delete ¶
func (service *OrderNotesService) Delete(ctx context.Context, orderID string, noteID string, opts *DeleteOrderNoteParams) (*OrderNote, *http.Response, error)
Delete an order note. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-an-order-note
func (*OrderNotesService) Get ¶
func (service *OrderNotesService) Get(ctx context.Context, orderID string, noteID string) (*OrderNote, *http.Response, error)
Get an order note. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-an-order-note
func (*OrderNotesService) List ¶
func (service *OrderNotesService) List(ctx context.Context, orderID string, opts *ListOrderNotesParams) ([]OrderNote, *http.Response, error)
List order notes. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-order-notes
type OrderNotesServiceInterface ¶ added in v1.0.1
type OrderNotesServiceInterface interface {
Create(ctx context.Context, orderID string, orderNote *OrderNote) (*OrderNote, *http.Response, error)
Get(ctx context.Context, orderID string, noteID string) (*OrderNote, *http.Response, error)
List(ctx context.Context, orderID string, opts *ListOrderNotesParams) ([]OrderNote, *http.Response, error)
Delete(ctx context.Context, orderID string, noteID string, opts *DeleteOrderNoteParams) (*OrderNote, *http.Response, error)
}
type OrderRefund ¶
type OrdersService ¶
type OrdersService struct {
// contains filtered or unexported fields
}
Orders service
func (*OrdersService) Batch ¶
func (service *OrdersService) Batch(ctx context.Context, opts *BatchOrderUpdate) (*BatchOrderUpdateResponse, *http.Response, error)
Batch update orders. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-orders
func (*OrdersService) Create ¶
func (service *OrdersService) Create(ctx context.Context, order *Order) (*Order, *http.Response, error)
Create an order. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order
func (*OrdersService) Delete ¶
func (service *OrdersService) Delete(ctx context.Context, orderID string, opts *DeleteOrderParams) (*Order, *http.Response, error)
Delete an order. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-an-order
func (*OrdersService) Get ¶
func (service *OrdersService) Get(ctx context.Context, orderID string, opts *GetOrderParams) (*Order, *http.Response, error)
Get an order. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-an-order
func (*OrdersService) List ¶
func (service *OrdersService) List(ctx context.Context, opts *ListOrdersParams) ([]Order, *http.Response, error)
List orders. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-orders
type OrdersServiceInterface ¶ added in v1.0.1
type OrdersServiceInterface interface {
Create(ctx context.Context, order *Order) (*Order, *http.Response, error)
Get(ctx context.Context, orderID string, opts *GetOrderParams) (*Order, *http.Response, error)
List(ctx context.Context, opts *ListOrdersParams) ([]Order, *http.Response, error)
Update(ctx context.Context, orderID string, order *Order) (*Order, *http.Response, error)
Delete(ctx context.Context, orderID string, opts *DeleteOrderParams) (*Order, *http.Response, error)
Batch(ctx context.Context, opts *BatchOrderUpdate) (*BatchOrderUpdateResponse, *http.Response, error)
}
type Product ¶
type Product struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
Permalink string `json:"permalink,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateCreatedGmt string `json:"date_created_gmt,omitempty"`
DateModified string `json:"date_modified,omitempty"`
DateModifiedGmt string `json:"date_modified_gmt,omitempty"`
Type string `json:"type,omitempty"`
Status string `json:"status,omitempty"`
Featured bool `json:"featured,omitempty"`
CatalogVisibility string `json:"catalog_visibility,omitempty"`
Description string `json:"description,omitempty"`
ShortDescription string `json:"short_description,omitempty"`
Sku string `json:"sku,omitempty"`
Price FlexibleString `json:"price,omitempty"`
RegularPrice FlexibleString `json:"regular_price,omitempty"`
SalePrice FlexibleString `json:"sale_price,omitempty"`
DateOnSaleFrom string `json:"date_on_sale_from,omitempty"`
DateOnSaleFromGmt string `json:"date_on_sale_from_gmt,omitempty"`
DateOnSaleTo string `json:"date_on_sale_to,omitempty"`
DateOnSaleToGmt string `json:"date_on_sale_to_gmt,omitempty"`
PriceHtml string `json:"price_html,omitempty"`
OnSale bool `json:"on_sale,omitempty"`
Purchasable bool `json:"purchasable,omitempty"`
TotalSales int `json:"total_sales,omitempty"`
Virtual bool `json:"virtual,omitempty"`
Downloadable bool `json:"downloadable,omitempty"`
DownloadLimit int `json:"download_limit,omitempty"`
DownloadExpiry int `json:"download_expiry,omitempty"`
ExternalUrl string `json:"external_url,omitempty"`
ButtonText string `json:"button_text,omitempty"`
TaxStatus string `json:"tax_status,omitempty"`
TaxClass string `json:"tax_class,omitempty"`
ManageStock bool `json:"manage_stock,omitempty"`
StockQuantity *int `json:"stock_quantity,omitempty"`
StockStatus string `json:"stock_status,omitempty"`
LowStockAmount *int `json:"low_stock_amount,omitempty"`
Backorders string `json:"backorders,omitempty"`
BackordersAllowed bool `json:"backorders_allowed,omitempty"`
Backordered bool `json:"backordered,omitempty"`
SoldIndividually bool `json:"sold_individually,omitempty"`
Weight string `json:"weight,omitempty"`
ShippingRequired bool `json:"shipping_required,omitempty"`
ShippingTaxable bool `json:"shipping_taxable,omitempty"`
ShippingClass string `json:"shipping_class,omitempty"`
ShippingClassID int `json:"shipping_class_id,omitempty"`
ReviewsAllowed bool `json:"reviews_allowed,omitempty"`
AverageRating string `json:"average_rating,omitempty"`
RatingCount int `json:"rating_count,omitempty"`
ParentID int `json:"parent_id,omitempty"`
PurchaseNote string `json:"purchase_note,omitempty"`
MenuOrder int `json:"menu_order,omitempty"`
Variations []int `json:"variations,omitempty"`
GroupedProducts []int `json:"grouped_products,omitempty"`
MetaData []MetaData `json:"meta_data,omitempty"`
RelatedIds []int `json:"related_ids,omitempty"`
CrossSellIds []int `json:"cross_sell_ids,omitempty"`
UpsellIds []int `json:"upsell_ids,omitempty"`
Images []Image `json:"images,omitempty"`
Dimensions *ProductDimensions `json:"dimensions,omitempty"`
Downloads []ProductDownloads `json:"downloads,omitempty"`
Categories []ProductCategory `json:"categories,omitempty"`
Tags []ProductTag `json:"tags,omitempty"`
Attributes []ProductAttributes `json:"attributes,omitempty"`
DefaultAttributes []DefaultAttributes `json:"default_attributes,omitempty"`
}
Product object. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#product-properties
type ProductAttributes ¶
type ProductCategory ¶
type ProductDimensions ¶
type ProductDownloads ¶
type ProductTag ¶
type ProductsService ¶
type ProductsService struct {
// contains filtered or unexported fields
}
Product service
func (*ProductsService) Batch ¶
func (service *ProductsService) Batch(ctx context.Context, opts *BatchProductUpdate) (*BatchProductUpdateResponse, *http.Response, error)
Batch update products. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-products
func (*ProductsService) Create ¶
func (service *ProductsService) Create(ctx context.Context, product *Product) (*Product, *http.Response, error)
Create a product. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-product
func (*ProductsService) Delete ¶
func (service *ProductsService) Delete(ctx context.Context, productID string, opts *DeleteProductParams) (*Product, *http.Response, error)
Delete a product. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-product
func (*ProductsService) Get ¶
func (service *ProductsService) Get(ctx context.Context, productID string) (*Product, *http.Response, error)
Get a product. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-product
func (*ProductsService) List ¶
func (service *ProductsService) List(ctx context.Context, opts *ListProductParams) ([]Product, *http.Response, error)
List products. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-products
type ProductsServiceInterface ¶ added in v1.0.1
type ProductsServiceInterface interface {
Create(ctx context.Context, product *Product) (*Product, *http.Response, error)
Get(ctx context.Context, productID string) (*Product, *http.Response, error)
List(ctx context.Context, opts *ListProductParams) ([]Product, *http.Response, error)
Update(ctx context.Context, productID string, product *Product) (*Product, *http.Response, error)
Delete(ctx context.Context, productID string, opts *DeleteProductParams) (*Product, *http.Response, error)
Batch(ctx context.Context, opts *BatchProductUpdate) (*BatchProductUpdateResponse, *http.Response, error)
}
type Refund ¶
type Refund struct {
ID int `json:"id,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateCreatedGmt string `json:"date_created_gmt,omitempty"`
Amount string `json:"amount,omitempty"`
Reason string `json:"reason,omitempty"`
RefundedBy int `json:"refunded_by,omitempty"`
RefundedPayment bool `json:"refunded_payment,omitempty"`
ApiRefund bool `json:"api_refund,omitempty"`
MetaData []MetaData `json:"meta_data,omitempty"`
LineItems []RefundLineItem `json:"line_items,omitempty"`
}
Refund object. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#order-refund-properties
type RefundLineItem ¶
type RefundLineItem struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
ProductID int `json:"product_id,omitempty"`
VariationID int `json:"variation_id,omitempty"`
Quantity int `json:"quantity,omitempty"`
TaxClass string `json:"tax_class,omitempty"`
Subtotal string `json:"subtotal,omitempty"`
SubtotalTax string `json:"subtotal_tax,omitempty"`
Total string `json:"total,omitempty"`
TotalTax string `json:"total_tax,omitempty"`
Sku string `json:"sku,omitempty"`
Price float64 `json:"price,omitempty"`
RefundTotal float64 `json:"refund_total,omitempty"`
Taxes []RefundTax `json:"taxes,omitempty"`
MetaData []MetaData `json:"meta_data,omitempty"`
}
type RefundsService ¶
type RefundsService struct {
// contains filtered or unexported fields
}
Refunds service
func (*RefundsService) Create ¶
func (service *RefundsService) Create(ctx context.Context, orderID string, refund *Refund) (*Refund, *http.Response, error)
Create a refund. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-refund
func (*RefundsService) Delete ¶
func (service *RefundsService) Delete(ctx context.Context, orderID string, refundID string, opts *DeleteRefundParams) (*Refund, *http.Response, error)
Delete a refund. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-refund
func (*RefundsService) Get ¶
func (service *RefundsService) Get(ctx context.Context, orderID string, refundID string) (*Refund, *http.Response, error)
Get a refund. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-refund
func (*RefundsService) List ¶
func (service *RefundsService) List(ctx context.Context, orderID string, opts *ListRefundParams) ([]Refund, *http.Response, error)
List refunds. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-refunds
type RefundsServiceInterface ¶ added in v1.0.1
type RefundsServiceInterface interface {
Create(ctx context.Context, orderID string, refund *Refund) (*Refund, *http.Response, error)
Get(ctx context.Context, orderID string, refundID string) (*Refund, *http.Response, error)
List(ctx context.Context, orderID string, opts *ListRefundParams) ([]Refund, *http.Response, error)
Delete(ctx context.Context, orderID string, refundID string, opts *DeleteRefundParams) (*Refund, *http.Response, error)
}
type Shipping ¶
type Shipping struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Company string `json:"company,omitempty"`
Address1 string `json:"address_1,omitempty"`
Address2 string `json:"address_2,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Postcode string `json:"postcode,omitempty"`
Country string `json:"country,omitempty"`
Phone string `json:"phone,omitempty"`
}
type ShippingLines ¶
type ShippingLines struct {
ID int `json:"id,omitempty"`
MethodTitle string `json:"method_title,omitempty"`
MethodID string `json:"method_id,omitempty"`
InstanceID string `json:"instance_id,omitempty"`
Total string `json:"total,omitempty"`
TotalTax string `json:"total_tax,omitempty"`
Taxes []Taxes `json:"taxes,omitempty"`
MetaData []MetaData `json:"meta_data,omitempty"`
}
type TaxLines ¶
type TaxLines struct {
ID int `json:"id,omitempty"`
RateCode string `json:"rate_code,omitempty"`
RateID int `json:"rate_id,omitempty"`
Label string `json:"label,omitempty"`
Compound bool `json:"compound"`
TaxTotal string `json:"tax_total,omitempty"`
ShippingTaxTotal string `json:"shipping_tax_total,omitempty"`
RatePercent float64 `json:"rate_percent"`
MetaData []MetaData `json:"meta_data,omitempty"`
}
type TaxRate ¶
type TaxRate struct {
ID int `json:"id,omitempty"`
Country string `json:"country,omitempty"`
State string `json:"state,omitempty"`
Postcode string `json:"postcode,omitempty"`
City string `json:"city,omitempty"`
Rate string `json:"rate,omitempty"`
Name string `json:"name,omitempty"`
Priority int `json:"priority,omitempty"`
Compound bool `json:"compound,omitempty"`
Shipping bool `json:"shipping,omitempty"`
Order int `json:"order,omitempty"`
Class string `json:"class,omitempty"`
}
TaxRate object. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#tax-rate-properties
type TaxRatesService ¶
type TaxRatesService struct {
// contains filtered or unexported fields
}
Tax Rates service
func (*TaxRatesService) Batch ¶
func (service *TaxRatesService) Batch(ctx context.Context, opts *BatchTaxRateUpdate) (*BatchTaxRateUpdateResponse, *http.Response, error)
Batch update tax rates. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-tax-rates
func (*TaxRatesService) Create ¶
func (service *TaxRatesService) Create(ctx context.Context, taxRate *TaxRate) (*TaxRate, *http.Response, error)
Create a tax rate. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-tax-rate
func (*TaxRatesService) Delete ¶
func (service *TaxRatesService) Delete(ctx context.Context, taxRateID string, opts *DeleteTaxRateParams) (*TaxRate, *http.Response, error)
Delete a tax rate. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-tax-rate
func (*TaxRatesService) Get ¶
func (service *TaxRatesService) Get(ctx context.Context, taxRateID string) (*TaxRate, *http.Response, error)
Get a tax rate. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-tax-rate
func (*TaxRatesService) List ¶
func (service *TaxRatesService) List(ctx context.Context, opts *ListTaxRatesParams) ([]TaxRate, *http.Response, error)
List tax rates. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-tax-rates
type TaxRatesServiceInterface ¶ added in v1.0.1
type TaxRatesServiceInterface interface {
Create(ctx context.Context, taxRate *TaxRate) (*TaxRate, *http.Response, error)
Get(ctx context.Context, taxRateID string) (*TaxRate, *http.Response, error)
List(ctx context.Context, opts *ListTaxRatesParams) ([]TaxRate, *http.Response, error)
Update(ctx context.Context, taxRateID string, taxRate *TaxRate) (*TaxRate, *http.Response, error)
Delete(ctx context.Context, taxRateID string, opts *DeleteTaxRateParams) (*TaxRate, *http.Response, error)
Batch(ctx context.Context, opts *BatchTaxRateUpdate) (*BatchTaxRateUpdateResponse, *http.Response, error)
}
type Taxes ¶
type Taxes struct {
ID int `json:"id,omitempty"`
RateCode string `json:"rate_code,omitempty"`
RateID string `json:"rate_id,omitempty"`
Label string `json:"label,omitempty"`
Compound bool `json:"compound"`
TaxTotal string `json:"tax_total,omitempty"`
ShippingTaxTotal string `json:"shipping_tax_total,omitempty"`
}
type Webhook ¶
type Webhook struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
Topic string `json:"topic,omitempty"`
Resource string `json:"resource,omitempty"`
Event string `json:"event,omitempty"`
Hooks []string `json:"hooks,omitempty"`
DeliveryURL string `json:"delivery_url,omitempty"`
Secret string `json:"secret,omitempty"`
DateCreated string `json:"date_created,omitempty"`
DateCreatedGmt string `json:"date_created_gmt,omitempty"`
DateModified string `json:"date_modified,omitempty"`
DateModifiedGmt string `json:"date_modified_gmt,omitempty"`
Links *Links `json:"links,omitempty"`
}
type WebhookService ¶
type WebhookService struct {
// contains filtered or unexported fields
}
Webhooks service
func (*WebhookService) Batch ¶
func (service *WebhookService) Batch(ctx context.Context, opts *BatchWebhookUpdate) (*BatchWebhookUpdateResponse, *http.Response, error)
Batch update webhooks. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-webhooks
func (*WebhookService) Create ¶
func (service *WebhookService) Create(ctx context.Context, webhook *Webhook) (*Webhook, *http.Response, error)
Create a webhook. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-webhook
func (*WebhookService) Delete ¶
func (service *WebhookService) Delete(ctx context.Context, webhookID string, opts *DeleteWebhookParams) (*Webhook, *http.Response, error)
Delete a webhook. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-webhook
func (*WebhookService) Get ¶
func (service *WebhookService) Get(ctx context.Context, webhookID string) (*Webhook, *http.Response, error)
Get a webhook. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-webhook
func (*WebhookService) List ¶
func (service *WebhookService) List(ctx context.Context, opts *ListWebhooksParams) ([]Webhook, *http.Response, error)
List webhooks. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-webhooks
type WebhookServiceInterface ¶ added in v1.0.1
type WebhookServiceInterface interface {
Create(ctx context.Context, webhook *Webhook) (*Webhook, *http.Response, error)
Get(ctx context.Context, webhookID string) (*Webhook, *http.Response, error)
List(ctx context.Context, opts *ListWebhooksParams) ([]Webhook, *http.Response, error)
Update(ctx context.Context, webhookID string, webhook *Webhook) (*Webhook, *http.Response, error)
Delete(ctx context.Context, webhookID string, opts *DeleteWebhookParams) (*Webhook, *http.Response, error)
Batch(ctx context.Context, opts *BatchWebhookUpdate) (*BatchWebhookUpdateResponse, *http.Response, error)
}
type WooCommerce ¶ added in v1.0.2
type WooCommerce struct {
Products ProductsServiceInterface
Orders OrdersServiceInterface
Customers CustomersServiceInterface
Coupons CouponsServiceInterface
OrderNotes OrderNotesServiceInterface
Refunds RefundsServiceInterface
TaxRates TaxRatesServiceInterface
Webhooks WebhookServiceInterface
}
WooCommerce is the top-level client callers interact with. All fields are interfaces, so they can be swapped for mocks in tests.
Usage:
woo, err := woocommerce.New(woocommerce.Config{...})
products, _, err := woo.Products.List(ctx, nil)
func New ¶
func New(cfg Config) (*WooCommerce, error)
New creates a fully wired WooCommerce client from the given config.
func NewWithHTTPClient ¶ added in v1.0.2
func NewWithHTTPClient(hc HTTPClient) *WooCommerce
NewWithHTTPClient wires up services against any HTTPClient implementation. Use this in tests to inject a mock transport without going through New().
woo := woocommerce.NewWithHTTPClient(&myMockHTTPClient{})