WC_API_Customers::register_routes()publicWC 2.2

Register the routes for this class

GET /customers GET /customers/count GET /customers/<id> GET /customers/<id>/orders

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

Хуков нет.

Возвращает

Массив.

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

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

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

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

Код WC_API_Customers::register_routes() WC 8.9.3

public function register_routes( $routes ) {

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

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

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

	# GET /customers/email/<email>
	$routes[ $this->base . '/email/(?P<email>.+)' ] = array(
		array( array( $this, 'get_customer_by_email' ), WC_API_Server::READABLE ),
	);

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

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

	# POST|PUT /customers/bulk
	$routes[ $this->base . '/bulk' ] = array(
		array( array( $this, 'bulk' ), WC_API_Server::EDITABLE | WC_API_Server::ACCEPT_DATA ),
	);

	return $routes;
}