Automattic\WooCommerce\Admin\API\Reports\Coupons\Stats

Controller::get_collection_params()publicWC 1.0

Get the query params for collections.

{} Это метод класса: Controller{}

Хуков нет.

Возвращает

Массив.

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

$Controller = new Controller();
$Controller->get_collection_params();

Код Controller::get_collection_params() WC 6.6.1

public function get_collection_params() {
	$params              = array();
	$params['context']   = $this->get_context_param( array( 'default' => 'view' ) );
	$params['page']      = array(
		'description'       => __( 'Current page of the collection.', 'woocommerce' ),
		'type'              => 'integer',
		'default'           => 1,
		'sanitize_callback' => 'absint',
		'validate_callback' => 'rest_validate_request_arg',
		'minimum'           => 1,
	);
	$params['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',
	);
	$params['after']     = array(
		'description'       => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
		'type'              => 'string',
		'format'            => 'date-time',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['before']    = array(
		'description'       => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
		'type'              => 'string',
		'format'            => 'date-time',
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['order']     = array(
		'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'desc',
		'enum'              => array( 'asc', 'desc' ),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['orderby']   = array(
		'description'       => __( 'Sort collection by object attribute.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'date',
		'enum'              => array(
			'date',
			'amount',
			'coupons_count',
			'orders_count',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['interval']  = array(
		'description'       => __( 'Time interval to use for buckets in the returned data.', 'woocommerce' ),
		'type'              => 'string',
		'default'           => 'week',
		'enum'              => array(
			'hour',
			'day',
			'week',
			'month',
			'quarter',
			'year',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['coupons']   = array(
		'description'       => __( 'Limit result set to coupons assigned specific coupon IDs.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_id_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'type' => 'integer',
		),
	);
	$params['segmentby'] = array(
		'description'       => __( 'Segment the response by additional constraint.', 'woocommerce' ),
		'type'              => 'string',
		'enum'              => array(
			'product',
			'variation',
			'category',
			'coupon',
		),
		'validate_callback' => 'rest_validate_request_arg',
	);
	$params['fields']    = array(
		'description'       => __( 'Limit stats fields to the specified items.', 'woocommerce' ),
		'type'              => 'array',
		'sanitize_callback' => 'wp_parse_slug_list',
		'validate_callback' => 'rest_validate_request_arg',
		'items'             => array(
			'type' => 'string',
		),
	);

	return $params;
}