woocommerce

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 12 Imported by: 0

README

go-woocommerce-api

A Woocommerce API Golang Wrapper for the Woocommerce Rest API (v3)

Install

$ go get github.com/adirkuhn/go-woocommerce-api

Tests

$ go test ./...

Usage

Create a new API client and authenticate with your REST API keys. You should specify the URL protocol by prefixing your domain name with https:// or http://. Follow the Woocommerce documentation to create your API keys through the Wordpress admin interface or using the authentication endpoint.

import (
  "github.com/adirkuhn/go-woocommerce-api"
)

func main(){
  shopURL := "https://example.com"
  key := "ck_xxxxxxx"
  secret := "cs_xxxxxxx"

  client, err := woocommerce.New(shopURL)

  if err != nil {
    // handle error

    return
  }

  client.Authenticate(key, secret)
}

The API routes are broken down into services, the supported services are:

  • Coupons (Create, Get, List, Update, Delete, Batch)
  • Customers (Create, Get, List, Update, Delete, Batch, GetDownloads)
  • Orders (Create, Get, List, Update, Delete, Batch)
  • OrderNotes (Create, Get, List, Delete)
  • Refunds (Create, Get, List, Delete)
  • Products (Create, Get, List, Update, Delete, Batch)
  • Webhooks (Create, Get, List, Update, Delete, Batch)
  • TaxRates (Create, Get, List, Update, Delete, Batch)

List Orders by customer ID and page number.

func (client *woocommerce.Client) listOrders() {
  customerID := 3
  pageNumber := 1
  
  opts := woocommerce.ListOrdersParams{
    Customer: customerID,
    Page: pageNumber,
  }

  ctx := context.Background()
  orders, resp, err := client.Orders.List(ctx, opts)

  if err != nil {
    // Handle errors

    return
  }

  // Pagination headers.
  totalPages := resp.Header.Get("X-Wp-Totalpages")
  totalItems := resp.Header.Get("X-Wp-Total")

  // ....

}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchCouponUpdate

type BatchCouponUpdate struct {
	Create *[]Coupon `json:"create,omitempty"`
	Update *[]Coupon `json:"update,omitempty"`
	Delete *[]int    `json:"delete,omitempty"`
}

type BatchCouponUpdateResponse

type BatchCouponUpdateResponse struct {
	Create *[]Coupon `json:"create,omitempty"`
	Update *[]Coupon `json:"update,omitempty"`
	Delete *[]Coupon `json:"delete,omitempty"`
}

type BatchCustomerUpdate

type BatchCustomerUpdate struct {
	Create *[]Customer `json:"create,omitempty"`
	Update *[]Customer `json:"update,omitempty"`
	Delete *[]int      `json:"delete,omitempty"`
}

type BatchCustomerUpdateResponse

type BatchCustomerUpdateResponse struct {
	Create *[]Customer `json:"create,omitempty"`
	Update *[]Customer `json:"update,omitempty"`
	Delete *[]Customer `json:"delete,omitempty"`
}

type BatchOrderUpdate

type BatchOrderUpdate struct {
	Create *[]Order `json:"create,omitempty"`
	Update *[]Order `json:"update,omitempty"`
	Delete *[]int   `json:"delete,omitempty"`
}

type BatchOrderUpdateResponse

type BatchOrderUpdateResponse struct {
	Create *[]Order `json:"create,omitempty"`
	Update *[]Order `json:"update,omitempty"`
	Delete *[]Order `json:"delete,omitempty"`
}

type BatchProductUpdate

type BatchProductUpdate struct {
	Create *[]Product `json:"create,omitempty"`
	Update *[]Product `json:"update,omitempty"`
	Delete *[]int     `json:"delete,omitempty"`
}

type BatchProductUpdateResponse

type BatchProductUpdateResponse struct {
	Create *[]Product `json:"create,omitempty"`
	Update *[]Product `json:"update,omitempty"`
	Delete *[]Product `json:"delete,omitempty"`
}

type BatchTaxRateUpdate

type BatchTaxRateUpdate struct {
	Create *[]TaxRate `json:"create,omitempty"`
	Update *[]TaxRate `json:"update,omitempty"`
	Delete *[]int     `json:"delete,omitempty"`
}

type BatchTaxRateUpdateResponse

type BatchTaxRateUpdateResponse struct {
	Create *[]TaxRate `json:"create,omitempty"`
	Update *[]TaxRate `json:"update,omitempty"`
	Delete *[]TaxRate `json:"delete,omitempty"`
}

type BatchWebhookUpdate

type BatchWebhookUpdate struct {
	Create *[]Webhook `json:"create,omitempty"`
	Delete *[]int     `json:"delete,omitempty"`
}

type BatchWebhookUpdateResponse

type BatchWebhookUpdateResponse struct {
	Create *[]Webhook `json:"create,omitempty"`
	Delete *[]Webhook `json:"delete,omitempty"`
}

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 Client

type Client struct {
	Coupons    CouponsServiceInterface
	Customers  CustomersServiceInterface
	Orders     OrdersServiceInterface
	OrderNotes OrderNotesServiceInterface
	Refunds    RefundsServiceInterface
	Products   ProductsServiceInterface
	TaxRates   TaxRatesServiceInterface
	Webhooks   WebhookServiceInterface
	// contains filtered or unexported fields
}

func New

func New(shopURL string) (*Client, error)

func NewWithConfig

func NewWithConfig(config ClientConfig) (*Client, error)

func (*Client) Authenticate

func (client *Client) Authenticate(consumer_key string, consumer_secret string)

Authenticate saves authentication parameters for the client.

func (*Client) Do

func (client *Client) Do(req *http.Request, v any) (*http.Response, error)

Do sends an API request and decodes the response into v.

func (*Client) NewRequest

func (client *Client) NewRequest(ctx context.Context, method, urlStr string, opts any, body any) (*http.Request, error)

NewRequest creates an API request. ctx must be non-nil.

type ClientConfig

type ClientConfig struct {
	HttpClient          *http.Client
	RestEndpointURL     string
	RestEndpointVersion string
}

type Collection

type Collection struct {
	Href string `json:"href,omitempty"`
}

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 CouponLine struct {
	ID          int       `json:"id,omitempty"`
	Code        string    `json:"code,omitempty"`
	Discount    string    `json:"discount,omitempty"`
	DiscountTax string    `json:"discountTax,omitempty"`
	MetaData    *MetaData `json:"metaData,omitempty"`
}

type CouponsService

type CouponsService service

Coupon service

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

func (*CouponsService) Update

func (service *CouponsService) Update(ctx context.Context, couponID string, coupon *Coupon) (*Coupon, *http.Response, error)

Update a coupon. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-coupon

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 service

Customer service

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

func (*CustomersService) Update

func (service *CustomersService) Update(ctx context.Context, customerID string, customer *Customer) (*Customer, *http.Response, error)

Update a customer. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-customer

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 DefaultAttributes struct {
	ID     int    `json:"id,omitempty"`
	Name   string `json:"name,omitempty"`
	Option string `json:"option,omitempty"`
}

type DeleteCouponParams

type DeleteCouponParams struct {
	Force string `json:"force,omitempty"`
}

type DeleteCustomerParams

type DeleteCustomerParams struct {
	Force    string `json:"force,omitempty"`
	Reassign int    `json:"reassign,omitempty"`
}

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 ErrorData

type ErrorData struct {
	Status int `json:"status"`
}

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 (response *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 File

type File struct {
	Name string `json:"name,omitempty"`
	File string `json:"file,omitempty"`
}

type GetOrderParams

type GetOrderParams struct {
	DecimalPoints int `url:"dp,omitempty"`
}

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 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"`
	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"`
	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"`
	Include *[]int `url:"include,omitempty"`
	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 ListOrderNotesParams struct {
	Context string `url:"context,omitempty"`
	Type    string `url:"type,omitempty"`
}

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"`
	Include        *[]int    `url:"include,omitempty"`
	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"`
	ParentExclude  *[]int    `url:"parent_exclude,omitempty"`
	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"`
}

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"`
	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"`
	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"`
	ParentExclude  *[]int `url:"parent_exclude,omitempty"`
}

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"`
	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"`
	Parent        *[]int `url:"parent,omitempty"`
	ParentExclude *[]int `url:"parent_exclude,omitempty"`
	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"`
	Include *[]int `url:"include,omitempty"`
	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 MetaData

type MetaData struct {
	ID         int    `json:"id,omitempty"`
	Key        string `json:"key,omitempty"`
	Value      any    `json:"value,omitempty"`
	DisplayKey string `json:"display_key"`
}

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 service

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 OrderRefund struct {
	ID     int    `json:"id,omitempty"`
	Reason string `json:"reason,omitempty"`
	Total  string `json:"total,omitempty"`
}

type OrdersService

type OrdersService service

Orders service

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

func (*OrdersService) Update

func (service *OrdersService) Update(ctx context.Context, orderID string, order *Order) (*Order, *http.Response, error)

Update an order. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#update-an-order

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             string              `json:"price,omitempty"`
	RegularPrice      string              `json:"regular_price,omitempty"`
	SalePrice         string              `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          []int               `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 ProductAttributes struct {
	ID        int      `json:"id,omitempty"`
	Name      string   `json:"name,omitempty"`
	Position  int      `json:"position,omitempty"`
	Visible   bool     `json:"visible,omitempty"`
	Variation bool     `json:"variation,omitempty"`
	Options   []string `json:"options,omitempty"`
}

type ProductCategory

type ProductCategory struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	Slug string `json:"slug,omitempty"`
}

type ProductDimensions

type ProductDimensions struct {
	Length string `json:"length,omitempty"`
	Width  string `json:"width,omitempty"`
	Height string `json:"height,omitempty"`
}

type ProductDownloads

type ProductDownloads struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	File string `json:"file,omitempty"`
}

type ProductTag

type ProductTag struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	Slug string `json:"slug,omitempty"`
}

type ProductsService

type ProductsService service

Product service

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

func (*ProductsService) Update

func (service *ProductsService) Update(ctx context.Context, productID string, product *Product) (*Product, *http.Response, error)

Update a product. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-product

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    int          `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       string       `json:"price,omitempty"`
	RefundTotal float64      `json:"refund_total,omitempty"`
	Taxes       *[]RefundTax `json:"taxes,omitempty"`
	MetaData    *[]MetaData  `json:"meta_data,omitempty"`
}

type RefundTax

type RefundTax struct {
	ID          int     `json:"id,omitempty"`
	Total       string  `json:"total,omitempty"`
	Subtotal    string  `json:"subtotal,omitempty"`
	RefundTotal float64 `json:"refund_total,omitempty"`
}

type RefundsService

type RefundsService service

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 Self

type Self struct {
	Href string `json:"href,omitempty"`
}

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       *[]any `json:"taxes,omitempty"`
	MetaData    *[]any `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         *[]any  `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 service

Tax Rates service

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

func (*TaxRatesService) Update

func (service *TaxRatesService) Update(ctx context.Context, taxRateID string, taxRate *TaxRate) (*TaxRate, *http.Response, error)

Update a tax rate. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-tax-rate

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 service

Webhooks service

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

func (*WebhookService) Update

func (service *WebhookService) Update(ctx context.Context, webhookID string, webhook *Webhook) (*Webhook, *http.Response, error)

Update a webhook. Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-webhook

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)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL