PHP Class WC_API_Webhooks

Inheritance: extends WC_API_Resource
Show file Open project: woocommerce/woocommerce

Protected Properties

Property Type Description
$base string the route base

Public Methods

Method Description
create_webhook ( array $data ) : array Create an webhook
delete_webhook ( integer $id ) : array Delete a webhook
edit_webhook ( integer $id, array $data ) : array Edit a webhook
get_webhook ( integer $id, array $fields = null ) : array Get the webhook for the given ID
get_webhook_deliveries ( string $webhook_id, string | null $fields = null ) : array Get deliveries for a webhook
get_webhook_delivery ( string $webhook_id, string $id, string | null $fields = null ) : array Get the delivery log for the given webhook ID and delivery ID
get_webhooks ( array $fields = null, array $filter = [], $status = null, integer $page = 1 ) : array Get all webhooks
get_webhooks_count ( string $status = null, array $filter = [] ) : array Get the total number of webhooks
register_routes ( array $routes ) : array Register the routes for this class

Private Methods

Method Description
query_webhooks ( array $args ) : WP_Query Helper method to get webhook post objects

Method Details

create_webhook() public method

Create an webhook
Since: 2.2
public create_webhook ( array $data ) : array
$data array parsed webhook data
return array

delete_webhook() public method

Delete a webhook
Since: 2.2
public delete_webhook ( integer $id ) : array
$id integer webhook ID
return array

edit_webhook() public method

Edit a webhook
Since: 2.2
public edit_webhook ( integer $id, array $data ) : array
$id integer webhook ID
$data array parsed webhook data
return array

get_webhook() public method

Get the webhook for the given ID
Since: 2.2
public get_webhook ( integer $id, array $fields = null ) : array
$id integer webhook ID
$fields array
return array

get_webhook_deliveries() public method

Get deliveries for a webhook
Since: 2.2
public get_webhook_deliveries ( string $webhook_id, string | null $fields = null ) : array
$webhook_id string webhook ID
$fields string | null fields to include in response
return array

get_webhook_delivery() public method

Get the delivery log for the given webhook ID and delivery ID
Since: 2.2
public get_webhook_delivery ( string $webhook_id, string $id, string | null $fields = null ) : array
$webhook_id string webhook ID
$id string delivery log ID
$fields string | null fields to limit response to
return array

get_webhooks() public method

Get all webhooks
Since: 2.2
public get_webhooks ( array $fields = null, array $filter = [], $status = null, integer $page = 1 ) : array
$fields array
$filter array
$page integer
return array

get_webhooks_count() public method

Get the total number of webhooks
Since: 2.2
public get_webhooks_count ( string $status = null, array $filter = [] ) : array
$status string
$filter array
return array

register_routes() public method

Register the routes for this class
Since: 2.2
public register_routes ( array $routes ) : array
$routes array
return array

Property Details

$base protected property

the route base
protected string $base
return string