| 1 |
<?php |
| 2 |
namespace StoreEngine\API\Schema; |
| 3 |
|
| 4 |
if ( ! defined( 'ABSPATH' ) ) { |
| 5 |
exit; |
| 6 |
} |
| 7 |
|
| 8 |
trait AnalyticsSchema { |
| 9 |
public function get_collection_params() { |
| 10 |
return array( |
| 11 |
'page' => array( |
| 12 |
'description' => __( 'Current page of the collection.', 'storeengine' ), |
| 13 |
'type' => 'integer', |
| 14 |
'default' => 1, |
| 15 |
'sanitize_callback' => 'absint', |
| 16 |
'validate_callback' => 'rest_validate_request_arg', |
| 17 |
'minimum' => 1, |
| 18 |
), |
| 19 |
'per_page' => array( |
| 20 |
'description' => __( 'Maximum number of items to be returned in result set.', 'storeengine' ), |
| 21 |
'type' => 'integer', |
| 22 |
'default' => 10, |
| 23 |
'minimum' => 1, |
| 24 |
'maximum' => 100, |
| 25 |
'sanitize_callback' => 'absint', |
| 26 |
'validate_callback' => 'rest_validate_request_arg', |
| 27 |
), |
| 28 |
'end_date' => array( |
| 29 |
'description' => __( 'Analytics end_date query date', 'storeengine' ), |
| 30 |
'type' => 'string', |
| 31 |
'sanitize_callback' => 'sanitize_text_field', |
| 32 |
'validate_callback' => 'rest_validate_request_arg', |
| 33 |
), |
| 34 |
'start_date' => array( |
| 35 |
'description' => __( 'Analytics start_date query date', 'storeengine' ), |
| 36 |
'type' => 'string', |
| 37 |
'sanitize_callback' => 'sanitize_text_field', |
| 38 |
'validate_callback' => 'rest_validate_request_arg', |
| 39 |
), |
| 40 |
'search' => array( |
| 41 |
'description' => __( 'Limit results to those matching a string.', 'storeengine' ), |
| 42 |
'type' => 'string', |
| 43 |
'sanitize_callback' => 'sanitize_text_field', |
| 44 |
'validate_callback' => 'rest_validate_request_arg', |
| 45 |
), |
| 46 |
); |
| 47 |
} |
| 48 |
} |
| 49 |
|