Added `filter_empty` parameter
This commit is contained in:
parent
109b9bfb2e
commit
7f8aa07cdc
|
@ -73,6 +73,7 @@ class Controller extends GenericController implements ExportableInterface {
|
||||||
$args['customers'] = $request['customers'];
|
$args['customers'] = $request['customers'];
|
||||||
$args['users'] = $request['users'];
|
$args['users'] = $request['users'];
|
||||||
$args['force_cache_refresh'] = $request['force_cache_refresh'];
|
$args['force_cache_refresh'] = $request['force_cache_refresh'];
|
||||||
|
$args['filter_empty'] = $request['filter_empty'];
|
||||||
|
|
||||||
$between_params_numeric = array( 'orders_count', 'total_spend', 'avg_order_value' );
|
$between_params_numeric = array( 'orders_count', 'total_spend', 'avg_order_value' );
|
||||||
$normalized_params_numeric = TimeInterval::normalize_between_params( $request, $between_params_numeric, false );
|
$normalized_params_numeric = TimeInterval::normalize_between_params( $request, $between_params_numeric, false );
|
||||||
|
@ -522,6 +523,25 @@ class Controller extends GenericController implements ExportableInterface {
|
||||||
'type' => 'integer',
|
'type' => 'integer',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
$params['filter_empty'] = array(
|
||||||
|
'description' => __( 'Filter out results where all passed fields are empty', 'woocommerce' ),
|
||||||
|
'type' => 'array',
|
||||||
|
'validate_callback' => 'rest_validate_request_arg',
|
||||||
|
'items' => array(
|
||||||
|
'type' => array(
|
||||||
|
'description' => __( 'Fields that required to be not empty', 'woocommerce' ),
|
||||||
|
'type' => 'string',
|
||||||
|
'enum' => array(
|
||||||
|
'email',
|
||||||
|
'name',
|
||||||
|
'country',
|
||||||
|
'city',
|
||||||
|
'region',
|
||||||
|
'postcode',
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue