Documentation
¶
Index ¶
- Constants
- func CheckResponseError(r *http.Response) error
- func ShopBaseURL(shopName string) string
- type App
- type Billing
- type Client
- func (c *Client) CreateAndDo(method, relPath string, data, options, resource interface{}) error
- func (c *Client) Delete(path string, options, resource interface{}) error
- func (c *Client) Do(req *http.Request, v interface{}) error
- func (c *Client) Get(path string, resource, options interface{}) error
- func (c *Client) NewRequest(method, relPath string, body, options interface{}) (*http.Request, error)
- func (c *Client) Post(path string, data, resource interface{}) error
- func (c *Client) Put(path string, data, resource interface{}) error
- type CouponLine
- type DeleteOption
- type FeeLine
- type LeveledLogger
- type LeveledLoggerInterface
- type LineItem
- type Links
- type ListOptions
- type MetaData
- type Option
- type Order
- type OrderBatchOption
- type OrderBatchResource
- type OrderListOption
- type OrderNote
- type OrderNoteService
- type OrderNoteServiceOp
- func (n *OrderNoteServiceOp) Create(orderId int64, text string) (*OrderNote, error)
- func (n *OrderNoteServiceOp) Delete(orderId int64, noteId int64, options interface{}) (*OrderNote, error)
- func (n *OrderNoteServiceOp) Get(orderId int64, noteId int64) (*OrderNote, error)
- func (n *OrderNoteServiceOp) List(orderId int64, options interface{}) (*[]OrderNote, error)
- type OrderRefund
- type OrderRefundService
- type OrderService
- type OrderServiceOp
- func (o *OrderServiceOp) Batch(data OrderBatchOption) (*OrderBatchResource, error)
- func (o *OrderServiceOp) Create(order Order) (*Order, error)
- func (o *OrderServiceOp) Delete(orderID int64, options interface{}) (*Order, error)
- func (o *OrderServiceOp) Get(orderID int64, options interface{}) (*Order, error)
- func (o *OrderServiceOp) List(options interface{}) ([]Order, error)
- func (o *OrderServiceOp) ListWithPagination(options interface{}) ([]Order, *Pagination, error)
- func (o *OrderServiceOp) Update(order *Order) (*Order, error)
- type Pagination
- type PaymentGateway
- type PaymentGatewayService
- type PaymentGatewayServiceOp
- type PaymentSetting
- type Product
- type ProductService
- type ProductServiceOp
- type RateLimitError
- type RateLimitInfo
- type Refund
- type ResponseDecodingError
- type ResponseError
- type Setting
- type Shipping
- type ShippingLines
- type TaxLine
- type Webhook
- type WebhookBatchOption
- type WebhookBatchResource
- type WebhookDeleteOption
- type WebhookListOption
- type WebhookService
- type WebhookServiceOp
- func (w *WebhookServiceOp) Batch(data WebhookBatchOption) (*WebhookBatchResource, error)
- func (w *WebhookServiceOp) Create(webhook Webhook) (*Webhook, error)
- func (w *WebhookServiceOp) Delete(webhookID int64, options interface{}) (*Webhook, error)
- func (w *WebhookServiceOp) Get(webhookID int64, options interface{}) (*Webhook, error)
- func (w *WebhookServiceOp) List(options interface{}) ([]Webhook, error)
- func (w *WebhookServiceOp) Update(webhook *Webhook) (*Webhook, error)
Constants ¶
const ( LevelError = iota + 1 LevelWarn LevelInfo LevelDebug )
const (
UserAgent = "woocommerce/1.0.0"
)
Variables ¶
This section is empty.
Functions ¶
func CheckResponseError ¶
func ShopBaseURL ¶
ShopBaseURL return a shop's base https base url
Types ¶
type App ¶
type App struct { CustomerKey string CustomerSecret string AppName string UserId string Scope string ReturnUrl string CallbackUrl string Client *Client }
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 { Client *http.Client RateLimits RateLimitInfo Product ProductService Order OrderService OrderNote OrderNoteService Webhook WebhookService PaymentGateway PaymentGatewayService // contains filtered or unexported fields }
func NewClient ¶
NewClient Returns a new WooCommerce API client with an already authenticated shopname and token. The shopName parameter is the shop's wooCommerce website domain, e.g. "shop.gitvim.com"
func (*Client) CreateAndDo ¶
CreateAndDo performs a web request to WooCommerce with the given method (GET, POST, PUT, DELETE) and relative path (e.g. "/wp-admin/v3").
func (*Client) Do ¶
Do sends an API request and populates the given interface with the parsed response. It does not make much sense to call Do without a prepared interface instance.
func (*Client) Get ¶
Get performs a GET request for the given path and saves the result in the given resource.
func (*Client) NewRequest ¶
func (c *Client) NewRequest(method, relPath string, body, options interface{}) (*http.Request, error)
Creates an API request. A relative URL can be provided in urlStr, which will be resolved to the BaseURL of the Client. Relative URLS should always be specified without a preceding slash. If specified, the value pointed to by body is JSON encoded and included as the request body.
type CouponLine ¶
type DeleteOption ¶
type DeleteOption struct {
Force bool `json:"force,omitempty"`
}
DeleteOption is the only option for delete order record. dangerous when the force is true, it will permanently delete the resource while the force is false, you should get the order from Get Restful API but the order's status became to be trash. it is better to setting force's column value be "false" rather then "true"
type FeeLine ¶
type FeeLine struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` TaxClass string `json:"tax_class,omitempty"` TaxStatus string `json:"tax_status,omitempty"` Total string `json:"total,omitempty"` TotalTax string `json:"total_tax,omitempty"` Taxes []TaxLine `json:"taxes,omitempty"` MetaData []MetaData `json:"meta_data,omitempty"` }
type LeveledLogger ¶
type LeveledLogger struct { // Level is the minimum logging level that will be emitted by this logger. // // For example, a Level set to LevelWarn will emit warnings and errors, but // not informational or debug messages. // // Always set this with a constant like LevelWarn because the individual // values are not guaranteed to be stable. Level int // contains filtered or unexported fields }
It prints warnings and errors to `os.Stderr` and other messages to `os.Stdout`.
func (*LeveledLogger) Debugf ¶
func (l *LeveledLogger) Debugf(format string, v ...interface{})
Debugf logs a debug message using Printf conventions.
func (*LeveledLogger) Errorf ¶
func (l *LeveledLogger) Errorf(format string, v ...interface{})
Errorf logs a warning message using Printf conventions.
func (*LeveledLogger) Infof ¶
func (l *LeveledLogger) Infof(format string, v ...interface{})
Infof logs an informational message using Printf conventions.
func (*LeveledLogger) Warnf ¶
func (l *LeveledLogger) Warnf(format string, v ...interface{})
Warnf logs a warning message using Printf conventions.
type LeveledLoggerInterface ¶
type LineItem ¶
type LineItem struct { ID int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` ProductID int64 `json:"product_id,omitempty"` VariantID int64 `json:"variant_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 []TaxLine `json:"taxes,omitempty"` MetaData []MetaData `json:"meta_data,omitempty"` SKU string `json:"sku,omitempty"` Price float64 `json:"price,omitempty"` }
type ListOptions ¶
type ListOptions 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"` Exclude []int64 `url:"exclude,omitempty"` Include []int64 `url:"include,omitempty"` Offset int `url:"offset,omitempty"` Order string `url:"order,omitempty"` Orderby string `url:"orderby,omitempty"` }
ListOptions represent ist options that can be used for most collections of entities.
type Order ¶
type Order struct { ID int64 `json:"id,omitempty"` ParentId int64 `json:"parent_id,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"` DiscountsTotal json.RawMessage `json:"discount_total,omitempty,string"` DiscountsTax 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"` PricesIncludeTax bool `json:"prices_include_tax,omitempty"` CustomerId int64 `json:"customer_id,omitempty"` CustomerIpAddress string `json:"customer_ip_address,omitempty"` CustomerUserAgent string `json:"customer_user_agent,omitempty"` CustomerNote string `json:"customer_note,omitempty"` Billing *Billing `json:"billing,omitempty"` Shipping *Shipping `json:"shipping,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"` MetaData []MetaData `json:"meta_data,omitempty"` LineItems []LineItem `json:"line_items,omitempty"` TaxLines []TaxLine `json:"tax_lines,omitempty"` ShippingLines []ShippingLines `json:"shipping_lines,omitempty"` FeeLines []FeeLine `json:"fee_lines,omitempty"` CouponLines []CouponLine `json:"coupon_lines,omitempty"` Refunds []Refund `json:"refunds,omitempty"` CurrencySymbol string `json:"currency_symbol,omitempty"` Links Links `json:"_links"` SetPaid bool `json:"set_paid,omitempty"` }
Order represents a WooCommerce Order https://woocommerce.github.io/woocommerce-rest-api-docs/#order-properties
type OrderBatchOption ¶
type OrderBatchOption struct { Create []Order `json:"create,omitempty"` Update []Order `json:"update,omitempty"` Delete []int64 `json:"delete,omitempty"` }
OrderBatchOption setting operate for order in batch way https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-orders
type OrderBatchResource ¶
type OrderBatchResource struct { Create []*Order `json:"create,omitempty"` Update []*Order `json:"update,omitempty"` Delete []*Order `json:"delete,omitempty"` }
OrderBatchResource conservation the response struct for OrderBatchOption request
type OrderListOption ¶
type OrderListOption struct { ListOptions Parent []int64 `url:"parent,omitempty"` ParentExclude []int64 `url:"parent_exclude,omitempty"` Status []string `url:"status,omitempty"` Customer int64 `url:"customer,omitempty"` Product int64 `url:"product,omitempty"` Dp int `url:"id,omitempty"` }
OrderListOption list all thee order list option request params refrence url: https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-orders parameters: context string Scope under which the request is made; determines fields present in response. Options: view and edit. Default is view. page integer Current page of the collection. Default is 1. per_page integer Maximum number of items to be returned in result set. Default is 10. search string Limit results to those matching a string. after string Limit response to resources published after a given ISO8601 compliant date. before string Limit response to resources published before a given ISO8601 compliant date. exclude array Ensure result set excludes specific IDs. include array Limit result set to specific ids. offset integer Offset the result set by a specific number of items. order string Order sort attribute ascending or descending. Options: asc and desc. Default is desc. orderby string Sort collection by object attribute. Options: date, id, include, title and slug. Default is date. parent array Limit result set to those of particular parent IDs. parent_exclude array Limit result set to all items except those of a particular parent ID. status array Limit result set to orders assigned a specific status. Options: any, pending, processing, on-hold, completed, cancelled, refunded, failed and trash. Default is any. customer integer Limit result set to orders assigned a specific customer. product integer Limit result set to orders assigned a specific product. dp integer Number of decimal points to use in each resource. Default is 2.
type OrderNote ¶
type OrderNote struct { ID int64 `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 string `json:"customer_note,omitempty"` AddedByUser bool `json:"added_by_user,omitempty"` }
OrderNote represent a WooCommerce Order note https://woocommerce.github.io/woocommerce-rest-api-docs/#order-notes
type OrderNoteService ¶
type OrderNoteService interface { Create(orderId int64, text string) (*OrderNote, error) Get(orderId int64, noteId int64) (*OrderNote, error) List(orderId int64, options interface{}) (*[]OrderNote, error) Delete(orderId int64, noteId int64, options interface{}) (*OrderNote, error) }
OrderNoteService operate Woo-Commerce Order note, eg: create, view, and delete individual order notes. https://woocommerce.github.io/woocommerce-rest-api-docs/#order-notes
type OrderNoteServiceOp ¶
type OrderNoteServiceOp struct {
// contains filtered or unexported fields
}
func (*OrderNoteServiceOp) Create ¶
func (n *OrderNoteServiceOp) Create(orderId int64, text string) (*OrderNote, error)
func (*OrderNoteServiceOp) Delete ¶
func (n *OrderNoteServiceOp) Delete(orderId int64, noteId int64, options interface{}) (*OrderNote, error)
type OrderRefund ¶
type OrderRefund struct { ID int64 `json:"id,omitempty"` DateCreated string `json:"date_created,omitempty"` DateCreatedGmt string `json:"date_created_gmt,omitempty"` Amount string `json:"amount,omitempty"` }
OrderRefund represent a WooCommerce Order Refund https://woocommerce.github.io/woocommerce-rest-api-docs/#order-refund-properties
type OrderRefundService ¶
type OrderRefundService interface { Create() Get() Delete() List() }
OrderRefundService allows you to create, view, and delete individual WooCommerce Order refunds. https://woocommerce.github.io/woocommerce-rest-api-docs/#refunds
type OrderService ¶
type OrderService interface { Create(order Order) (*Order, error) Get(orderId int64, options interface{}) (*Order, error) List(options interface{}) ([]Order, error) Update(order *Order) (*Order, error) Delete(orderID int64, options interface{}) (*Order, error) Batch(option OrderBatchOption) (*OrderBatchResource, error) }
OrderService is an interface for interfacing with the orders endpoints of woocommerce API https://woocommerce.github.io/woocommerce-rest-api-docs/#orders
type OrderServiceOp ¶
type OrderServiceOp struct {
// contains filtered or unexported fields
}
OrderServiceOp handles communication with the order related methods of WooCommerce'API
func (*OrderServiceOp) Batch ¶
func (o *OrderServiceOp) Batch(data OrderBatchOption) (*OrderBatchResource, error)
func (*OrderServiceOp) Delete ¶
func (o *OrderServiceOp) Delete(orderID int64, options interface{}) (*Order, error)
func (*OrderServiceOp) Get ¶
func (o *OrderServiceOp) Get(orderID int64, options interface{}) (*Order, error)
Get individual order
func (*OrderServiceOp) List ¶
func (o *OrderServiceOp) List(options interface{}) ([]Order, error)
func (*OrderServiceOp) ListWithPagination ¶
func (o *OrderServiceOp) ListWithPagination(options interface{}) ([]Order, *Pagination, error)
ListWithPagination lists products and return pagination to retrieve next/previous results.
type Pagination ¶
type Pagination struct { NextPageOptions *ListOptions PreviousPageOptions *ListOptions FirstPageOptions *ListOptions LastPageOptions *ListOptions }
Pagination of results
type PaymentGateway ¶
type PaymentGateway struct { ID string `json:"id,omitempty"` Title string `json:"title,omitempty"` Description string `json:"description,omitempty"` Order string `json:"order,omitempty"` Enabled bool `json:"enabled,omitempty"` MethodTitle string `json:"method_title,omitempty"` MethodDescription string `json:"method_description,omitempty"` MethodSupports []string `json:"method_supports,omitempty"` Settings *Setting `json:"settings,omitempty"` Links Links `json:"_links,omitempty"` }
PaymentGateway represents a woocommerce payment_gateway https://woocommerce.github.io/woocommerce-rest-api-docs/#payment-gateway-properties
type PaymentGatewayService ¶
type PaymentGatewayService interface { Get(id string) (*PaymentGateway, error) List(options interface{}) ([]PaymentGateway, error) Update(pg *PaymentGateway) (*PaymentGateway, error) }
PaymentGatewayService is an interface for interfacing with the payment-gateways endpoints of woocommerce API https://woocommerce.github.io/woocommerce-rest-api-docs/#payment-gateways
type PaymentGatewayServiceOp ¶
type PaymentGatewayServiceOp struct {
// contains filtered or unexported fields
}
PaymentGatewayServiceOp handles communication with the payment gateway related methods of WooCommerce restful api
func (*PaymentGatewayServiceOp) Get ¶
func (p *PaymentGatewayServiceOp) Get(id string) (*PaymentGateway, error)
Get implement for retrieve and view a specific payment gateway https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-an-payment-gateway
func (*PaymentGatewayServiceOp) List ¶
func (p *PaymentGatewayServiceOp) List(options interface{}) ([]PaymentGateway, error)
List return multiple payment gateway https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-payment-gateways
func (*PaymentGatewayServiceOp) Update ¶
func (p *PaymentGatewayServiceOp) Update(pg *PaymentGateway) (*PaymentGateway, error)
Update method allow you to make changes to a payment gateway https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-payment-gateway
type PaymentSetting ¶
type PaymentSetting struct { ID string `json:"id,omitempty"` Label string `json:"label,omitempty"` Description string `json:"description,omitempty"` Type string `json:"type,omitempty"` Value string `json:"value,omitempty"` Default string `json:"default,omitempty"` Tip string `json:"tip,omitempty"` Placeholder string `json:"placeholder,omitempty"` }
PaymentSetting represents a WooCommerce payment-gateway https://woocommerce.github.io/woocommerce-rest-api-docs/#payment-gateway-settings-properties id string A unique identifier for the setting.READ-ONLY label string A human readable label for the setting used in interfaces.READ-ONLY description string A human readable description for the setting used in interfaces.READ-ONLY type string Type of setting. Options: text, email, number, color, password, textarea, select, multiselect, radio, image_width and checkbox.READ-ONLY value string Setting value. default string Default value for the setting.READ-ONLY tip string Additional help text shown to the user about the setting.READ-ONLY placeholder string Placeholder text to be displayed in text inputs.
type Product ¶
type Product struct { }
Product represent WooCommerce Product https://woocommerce.github.io/woocommerce-rest-api-docs/#product-properties
type ProductService ¶
type ProductService interface { Create() Get() Delete() List() Update() BatchUpdate() }
ProductService allows you to create, view, update, and delete individual, or a batch, of products https://woocommerce.github.io/woocommerce-rest-api-docs/#products
type ProductServiceOp ¶
type ProductServiceOp struct {
// contains filtered or unexported fields
}
func (*ProductServiceOp) BatchUpdate ¶
func (p *ProductServiceOp) BatchUpdate()
func (*ProductServiceOp) Create ¶
func (p *ProductServiceOp) Create()
func (*ProductServiceOp) Delete ¶
func (p *ProductServiceOp) Delete()
func (*ProductServiceOp) Get ¶
func (p *ProductServiceOp) Get()
func (*ProductServiceOp) List ¶
func (p *ProductServiceOp) List()
func (*ProductServiceOp) Update ¶
func (p *ProductServiceOp) Update()
type RateLimitError ¶
type RateLimitError struct { ResponseError RetryAfter int }
An error specific to a rate-limiting response. Embeds the ResponseError to allow consumers to handle it the same was a normal ResponseError.
type RateLimitInfo ¶
type ResponseDecodingError ¶
ResponseDecodingError occurs when the response body from WooCommerce could not be parsed.
func (ResponseDecodingError) Error ¶
func (e ResponseDecodingError) Error() string
type ResponseError ¶
ResponseError is A general response error that follows a similar layout to WooCommerce's response errors, i.e. either a single message or a list of messages. https://woocommerce.github.io/woocommerce-rest-api-docs/#request-response-format
func (ResponseError) Error ¶
func (e ResponseError) Error() string
type Setting ¶
type Setting struct { Title *PaymentSetting `json:"title,omitempty"` Email *PaymentSetting `json:"email,omitempty"` Advanced *PaymentSetting `json:"advanced,omitempty"` Instructions *PaymentSetting `json:"instructions,omitempty"` TestMode *PaymentSetting `json:"testmode,omitempty"` Debug *PaymentSetting `json:"debug,omitempty"` ImageUrl *PaymentSetting `json:"image_url,omitempty"` PageStyle *PaymentSetting `json:"page_style,omitempty"` Paymentaction *PaymentSetting `json:"paymentaction,omitempty"` AddressOverride *PaymentSetting `json:"address_override,omitempty"` SendShipping *PaymentSetting `json:"send_shipping,omitempty"` InvoicePrefix *PaymentSetting `json:"invoice_prefix,omitempty"` IdentityToken *PaymentSetting `json:"identity_token,omitempty"` ReceiverEmail *PaymentSetting `json:"receiver_email,omitempty"` IpnNotification *PaymentSetting `json:"ipn_notification,omitempty"` EnableForMethods *PaymentSetting `json:"enable_for_methods,omitempty"` EnableForVirtual *PaymentSetting `json:"enable_for_virtual,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"` }
type ShippingLines ¶
type ShippingLines struct { ID int64 `json:"id,omitempty"` MethodTitle string `json:"method_title,omitempty"` MethodID string `json:"method_id,omitempty"` Total string `json:"total,omitempty"` TotalTax string `json:"total_tax,omitempty"` Taxes []TaxLine `json:"tax_lines,omitempty"` MetaData []MetaData `json:"meta_data,omitempty"` }
type TaxLine ¶
type TaxLine struct { ID int64 `json:"id,omitempty"` RateCode string `json:"rate_code,omitempty"` RateId string `json:"rate_id,omitempty"` Label string `json:"label,omitempty"` Compound bool `json:"compound,omitempty"` TaxTotal string `json:"tax_total"` ShippingTaxTotal string `json:"shipping_tax_total,omitempty"` MetaData []MetaData `json:"meta_data,omitempty"` }
type Webhook ¶
type Webhook struct { ID int64 `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"` }
Webhook represent a wooCommerce webhook's All properties columns
type WebhookBatchOption ¶
type WebhookBatchOption struct { Create []Webhook `json:"create,omitempty"` Update []Webhook `json:"update,omitempty"` Delete []int64 `json:"delete,omitempty"` }
OrderBatchOption setting operate for order in batch way
type WebhookBatchResource ¶
type WebhookBatchResource struct { Create []*Webhook `json:"create,omitempty"` Update []*Webhook `json:"update,omitempty"` Delete []*Webhook `json:"delete,omitempty"` }
WebhookBatchResource conservation the response struct for WebhookBatchOption's request
type WebhookDeleteOption ¶
type WebhookDeleteOption struct {
Force bool
}
WebhookDeleteOption config webhook's Delete operation option
type WebhookListOption ¶
type WebhookListOption struct { ListOptions Status string `json:"status,omitempty"` }
WebhookListOption config webhook's List method request option
type WebhookService ¶
type WebhookService interface { List(options interface{}) ([]Webhook, error) Create(webhook Webhook) (*Webhook, error) Get(webhookID int64, options interface{}) (*Webhook, error) Update(webhook *Webhook) (*Webhook, error) Delete(webhookID int64, options interface{}) (*Webhook, error) Batch(data WebhookBatchOption) (*WebhookBatchResource, error) }
WebhookService is an interface for interfacing with the webhook endpoints of the WooCommerce webhooks restful API https://woocommerce.github.io/woocommerce-rest-api-docs/#webhooks
type WebhookServiceOp ¶
type WebhookServiceOp struct {
// contains filtered or unexported fields
}
WebhookServiceOp handles communication with the webhooks related methods of WooCommerce restful api
func (*WebhookServiceOp) Batch ¶
func (w *WebhookServiceOp) Batch(data WebhookBatchOption) (*WebhookBatchResource, error)
Batch helps you to batch create, update and delete multiple webhooks WooCommerce docs Notes : By default it's limited to up to 100 objects to be created, updated or deleted. reference : https://woocommerce.github.io/woocommerce-rest-api-docs/#batch-update-webhooks
func (*WebhookServiceOp) Create ¶
func (w *WebhookServiceOp) Create(webhook Webhook) (*Webhook, error)
Create handle create a new webhook. https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-webhook
func (*WebhookServiceOp) Delete ¶
func (w *WebhookServiceOp) Delete(webhookID int64, options interface{}) (*Webhook, error)
Delete delete a webhook https://woocommerce.github.io/woocommerce-rest-api-docs/#delete-a-webhook
func (*WebhookServiceOp) Get ¶
func (w *WebhookServiceOp) Get(webhookID int64, options interface{}) (*Webhook, error)
Get implement for retrieve and view a specific webhook https://woocommerce.github.io/woocommerce-rest-api-docs/#retrieve-a-webhook
func (*WebhookServiceOp) List ¶
func (w *WebhookServiceOp) List(options interface{}) ([]Webhook, error)
List return multiple webhooks https://woocommerce.github.io/woocommerce-rest-api-docs/#list-all-webhooks
func (*WebhookServiceOp) Update ¶
func (w *WebhookServiceOp) Update(webhook *Webhook) (*Webhook, error)
Update method allow you to make changes to a webhook https://woocommerce.github.io/woocommerce-rest-api-docs/#update-a-webhook