WC_API_Webhooks::register_routes()publicWC 2.2

Register the routes for this class

Метод класса: WC_API_Webhooks{}

Хуков нет.

Возвращает

Массив.

Использование

$WC_API_Webhooks = new WC_API_Webhooks();
$WC_API_Webhooks->register_routes( $routes );
$routes(массив) (обязательный)
-

Список изменений

С версии 2.2 Введена.

Код WC_API_Webhooks::register_routes() WC 8.7.0

public function register_routes( $routes ) {

	# GET|POST /webhooks
	$routes[ $this->base ] = array(
		array( array( $this, 'get_webhooks' ),     WC_API_Server::READABLE ),
		array( array( $this, 'create_webhook' ),   WC_API_Server::CREATABLE | WC_API_Server::ACCEPT_DATA ),
	);

	# GET /webhooks/count
	$routes[ $this->base . '/count' ] = array(
		array( array( $this, 'get_webhooks_count' ), WC_API_Server::READABLE ),
	);

	# GET|PUT|DELETE /webhooks/<id>
	$routes[ $this->base . '/(?P<id>\d+)' ] = array(
		array( array( $this, 'get_webhook' ),  WC_API_Server::READABLE ),
		array( array( $this, 'edit_webhook' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ),
		array( array( $this, 'delete_webhook' ), WC_API_Server::DELETABLE ),
	);

	# GET /webhooks/<id>/deliveries
	$routes[ $this->base . '/(?P<webhook_id>\d+)/deliveries' ] = array(
		array( array( $this, 'get_webhook_deliveries' ), WC_API_Server::READABLE ),
	);

	# GET /webhooks/<webhook_id>/deliveries/<id>
	$routes[ $this->base . '/(?P<webhook_id>\d+)/deliveries/(?P<id>\d+)' ] = array(
		array( array( $this, 'get_webhook_delivery' ), WC_API_Server::READABLE ),
	);

	return $routes;
}