Automattic\WooCommerce\Internal\RestApi\Routes\V4\Customers

CollectionQuery::get_query_schema │ public │ WC 1.0

Get query schema.

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

Хуков нет.

Возвращает

array.

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

$CollectionQuery = new CollectionQuery();
$CollectionQuery->get_query_schema(): array;

Код CollectionQuery::get_query_schema() WC 11.2.2

public function get_query_schema(): array {
	return array(
		'page'     => array(
			'description'       => __( 'Current page of the collection.', 'woocommerce' ),
			'type'              => 'integer',
			'default'           => 1,
			'sanitize_callback' => 'absint',
			'validate_callback' => 'rest_validate_request_arg',
			'minimum'           => 1,
		),
		'per_page' => array(
			'description'       => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
			'type'              => 'integer',
			'default'           => 10,
			'minimum'           => 1,
			'maximum'           => 100,
			'sanitize_callback' => 'absint',
			'validate_callback' => 'rest_validate_request_arg',
		),
		'search'   => array(
			'description'       => __( 'Limit results to those matching a string.', 'woocommerce' ),
			'type'              => 'string',
			'sanitize_callback' => 'sanitize_text_field',
			'validate_callback' => 'rest_validate_request_arg',
		),
		'exclude'  => array(
			'description'       => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
			'type'              => 'array',
			'items'             => array(
				'type' => 'integer',
			),
			'default'           => array(),
			'sanitize_callback' => 'wp_parse_id_list',
		),
		'include'  => array(
			'description'       => __( 'Limit result set to specific IDs.', 'woocommerce' ),
			'type'              => 'array',
			'items'             => array(
				'type' => 'integer',
			),
			'default'           => array(),
			'sanitize_callback' => 'wp_parse_id_list',
		),
		'order'    => array(
			'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
			'type'              => 'string',
			'default'           => 'asc',
			'enum'              => array( 'asc', 'desc' ),
			'sanitize_callback' => 'sanitize_key',
			'validate_callback' => 'rest_validate_request_arg',
		),
		'orderby'  => array(
			'description'       => __( 'Sort collection by object attribute.', 'woocommerce' ),
			'type'              => 'string',
			'default'           => 'name',
			'enum'              => array(
				'id',
				'name',
				'registered_date',
				'order_count',
				'total_spent',
				'last_active',
			),
			'sanitize_callback' => 'sanitize_key',
			'validate_callback' => 'rest_validate_request_arg',
		),
		'role'     => array(
			'description'       => __( 'Limit result set to resources with a specific role.', 'woocommerce' ),
			'type'              => 'string',
			'default'           => 'customer',
			'enum'              => array( 'customer', 'all' ),
			'validate_callback' => 'rest_validate_request_arg',
		),
	);
}