Automattic\WooCommerce\Admin\API\Reports
GenericStatsController::get_collection_params
Get the query params definition for collections. Adds fields & intervals to the generic list.
Method of the class: GenericStatsController{}
No Hooks.
Returns
Array.
Usage
$GenericStatsController = new GenericStatsController(); $GenericStatsController->get_collection_params();
GenericStatsController::get_collection_params() GenericStatsController::get collection params code WC 10.4.3
public function get_collection_params() {
$params = parent::get_collection_params();
$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',
),
);
$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',
);
return $params;
}