WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
класс не описан

Automattic\WooCommerce\Admin\API\Reports\Customers\Stats

Controller{} WC 1.0

REST API Reports customers stats controller class.

Возвращает

Null. Ничего.

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

$Controller = new Controller();
// use class methods

Методы

  1. ERROR: no method name found on line ` * @return array|WP_Error`
  2. ERROR: no method name found on line ` *`
  3. ERROR: no method name found on line ` $args['name_excludes'] = $request['name_excludes'];`
  4. ERROR: no method name found on line ` */`
  5. ERROR: no method name found on line ` 'validate_callback' => 'rest_validate_request_arg',`
  6. ERROR: no method name found on line ``
  7. ERROR: no method name found on line ``
  8. ERROR: no method name found on line ` ),`
  9. ERROR: no method name found on line ` 'type' => 'number',`
  10. ERROR: no method name found on line ``
  11. ERROR: no method name found on line ` 'validate_callback' => 'rest_validate_request_arg',`
  12. ERROR: no method name found on line ` 'all',`
  13. ERROR: no method name found on line ` );`
  14. ERROR: no method name found on line ``
  15. ERROR: no method name found on line ` 'type' => 'string',`
  16. ERROR: no method name found on line ` 'type' => 'string',`
  17. ERROR: no method name found on line ` 'type' => 'string',`
  18. ERROR: no method name found on line ` ),`
  19. array(
  20. ERROR: no method name found on line ` 'any',`
  21. ERROR: no method name found on line ``
  22. ERROR: no method name found on line ` 'validate_callback' => 'rest_validate_request_arg',`
  23. array(
  24. ERROR: no method name found on line ` 'readonly' => true,`
  25. get_collection_params()
  26. ERROR: no method name found on line ` 'type' => 'number',`
  27. ERROR: no method name found on line ``
  28. ERROR: no method name found on line ` );`
  29. ERROR: no method name found on line ` 'validate_callback' => 'rest_validate_request_arg',`
  30. ERROR: no method name found on line ` 'validate_callback' => 'rest_validate_request_arg',`
  31. __( 'Limit response to objects excluding specfic names.', 'woocommerce' )
  32. __( 'Limit response to objects last active after (or at) a given ISO8601 compliant datetime.', 'woocommerce' )
  33. array(
  34. __( 'Limit response to objects with a total order spend greater than or equal to given number.', 'woocommerce' )
  35. ERROR: no method name found on line ` );`
  36. __( 'Limit response to objects with an order count less than or equal to given integer.', 'woocommerce' )
  37. ERROR: no method name found on line ` );`
  38. ERROR: no method name found on line ` 'type' => 'integer',`
  39. array(
  40. ERROR: no method name found on line ` 'validate_callback' => 'rest_validate_request_arg',`
  41. ERROR: no method name found on line ` );`
  42. ERROR: no method name found on line ` 'type' => 'integer',`
  43. ERROR: no method name found on line ``
  44. ERROR: no method name found on line ` return $args;`
  45. ERROR: no method name found on line ``
  46. ERROR: no method name found on line ``
  47. ERROR: no method name found on line ` );`
  48. array(
  49. ERROR: no method name found on line ``
  50. ERROR: no method name found on line ` 'type' => 'string',`
  51. ERROR: no method name found on line ``
  52. __( 'Limit response to objects with a total order spend less than or equal to given number.', 'woocommerce' )
  53. array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' )
  54. ERROR: no method name found on line ``
  55. ERROR: no method name found on line ` }`
  56. ERROR: no method name found on line ` /**`
  57. ERROR: no method name found on line ` // @todo Should any of these be 'indicator's?`
  58. array(
  59. ERROR: no method name found on line ` 'type' => 'string',`
  60. ERROR: no method name found on line ` 'validate_callback' => 'rest_validate_request_arg',`
  61. ERROR: no method name found on line ` ),`
  62. ERROR: no method name found on line ` 'type' => 'string',`
  63. ERROR: no method name found on line ` 'type' => 'integer',`
  64. get_item_schema()
  65. ERROR: no method name found on line ` 'username',`
  66. ERROR: no method name found on line ``
  67. ERROR: no method name found on line ` ),`
  68. ERROR: no method name found on line ` '$schema' => 'http://json-schema.org/draft-04/schema#',`
  69. __( 'Totals data.', 'woocommerce' )
  70. __( 'Average AOV per customer.', 'woocommerce' )
  71. ERROR: no method name found on line ` ),`
  72. ERROR: no method name found on line ` 'format' => 'currency',`
  73. ERROR: no method name found on line ` 'readonly' => true,`
  74. __( 'Totals data.', 'woocommerce' )
  75. ERROR: no method name found on line ` 'format' => 'currency',`
  76. array( 'view', 'edit' )
  77. __( 'Totals data.', 'woocommerce' )
  78. ERROR: no method name found on line ` 'title' => 'report_customers_stats',`
  79. ERROR: no method name found on line ``
  80. array(
  81. get_items( $request )
  82. array(
  83. get_items( $request )
  84. ERROR: no method name found on line ` *`
  85. ERROR: no method name found on line ``
  86. normalize_between_params( $request, $between_params_numeric, false )
  87. array()
  88. ERROR: no method name found on line ` }`
  89. ERROR: no method name found on line ` $args['fields'] = $request['fields'];`
  90. ERROR: no method name found on line ` $args['customers'] = $request['customers'];`
  91. ERROR: no method name found on line ` $args['avg_order_value_min'] = $request['avg_order_value_min'];`
  92. ERROR: no method name found on line ` /**`
  93. ERROR: no method name found on line ` /**`
  94. ERROR: no method name found on line ` $args['orders_count_max'] = $request['orders_count_max'];`
  95. ERROR: no method name found on line ` $args['email_excludes'] = $request['email_excludes'];`
  96. array( 'last_active', 'registered' )
  97. ERROR: no method name found on line ` $args['fields'] = $request['fields'];`
  98. ERROR: no method name found on line ` $args['orders_count_min'] = $request['orders_count_min'];`
  99. ERROR: no method name found on line ` return $args;`
  100. ERROR: no method name found on line ` */`
  101. ERROR: no method name found on line ``
  102. ERROR: no method name found on line ` $args['total_spend_min'] = $request['total_spend_min'];`
  103. ERROR: no method name found on line ` 'type' => 'string',`
  104. array( 'last_active', 'registered' )
  105. ERROR: no method name found on line ` // Wrap the data in a response object.`
  106. array()
  107. ERROR: no method name found on line ` );`
  108. array(
  109. ERROR: no method name found on line ` * @return array|WP_Error`
  110. ERROR: no method name found on line ``
  111. ERROR: no method name found on line ` 'type' => 'array',`
  112. ERROR: no method name found on line ``
  113. ERROR: no method name found on line ` $args['email_excludes'] = $request['email_excludes'];`
  114. get_data()
  115. ERROR: no method name found on line ` ),`
  116. __( 'Number of customers.', 'woocommerce' )
  117. ERROR: no method name found on line ``
  118. rest_ensure_response( $data )
  119. array(
  120. ERROR: no method name found on line ` 'default' => 'all',`
  121. __( 'Totals data.', 'woocommerce' )
  122. ERROR: no method name found on line ``
  123. ERROR: no method name found on line ``
  124. array(
  125. ERROR: no method name found on line ` );`
  126. ERROR: no method name found on line ``
  127. ERROR: no method name found on line ``
  128. ERROR: no method name found on line ``
  129. ERROR: no method name found on line ` 'type' => 'integer',`
  130. ERROR: no method name found on line ` 'type' => 'integer',`
  131. ERROR: no method name found on line ``
  132. prepare_item_for_response( $report, $request )
  133. ERROR: no method name found on line ` 'type' => 'object',`
  134. ERROR: no method name found on line ``
  135. __( 'Totals data.', 'woocommerce' )
  136. ERROR: no method name found on line ` *`
  137. ERROR: no method name found on line ``
  138. __( 'Average number of orders.', 'woocommerce' )
  139. rest_ensure_response( $data )
  140. ERROR: no method name found on line ` *`
  141. empty( $request['context'] )
  142. ERROR: no method name found on line ` */`
  143. ERROR: no method name found on line ` }`
  144. get_item_schema()
  145. rest_ensure_response( $data )
  146. __( 'Average number of orders.', 'woocommerce' )
  147. ERROR: no method name found on line ` * @param object $report The original report object.`
  148. ERROR: no method name found on line ` /**`
  149. __( 'Limit response to objects with a customer field containing the search term. Searches the field provided by `searchby`.', 'woocommerce' )
  150. ERROR: no method name found on line ` $args['last_active_after'] = $request['last_active_after'];`
  151. ERROR: no method name found on line ` );`
  152. __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' )
  153. ERROR: no method name found on line ``
  154. __( 'Average total spend per customer.', 'woocommerce' )
  155. ERROR: no method name found on line ` ),`
  156. ERROR: no method name found on line ` 'type' => 'integer',`
  157. array(
  158. __( 'Average number of orders.', 'woocommerce' )
  159. array( 'view', 'edit' )
  160. array( 'view', 'edit' )
  161. ERROR: no method name found on line ` 'type' => 'number',`
  162. array(
  163. prepare_reports_query( $request )
  164. ERROR: no method name found on line ` $args['name_excludes'] = $request['name_excludes'];`
  165. ERROR: no method name found on line ` * Get the Report's schema, conforming to JSON Schema.`
  166. ERROR: no method name found on line ` */`
  167. array( 'last_active', 'registered' )
  168. ERROR: no method name found on line ` $args['name_includes'] = $request['name_includes'];`
  169. ERROR: no method name found on line ` $args['registered_before'] = $request['registered_before'];`
  170. array()
  171. array()
  172. ERROR: no method name found on line ` $args['registered_before'] = $request['registered_before'];`
  173. ERROR: no method name found on line ` $args['username_includes'] = $request['username_includes'];`
  174. ERROR: no method name found on line ` $args['registered_before'] = $request['registered_before'];`
  175. array()
  176. ERROR: no method name found on line ` 'totals' => $report_data,`
  177. ERROR: no method name found on line ` * @param array $request Request array.`
  178. ERROR: no method name found on line ` */`
  179. ERROR: no method name found on line ` *`
  180. ERROR: no method name found on line ` * Prepare a report object for serialization.`
  181. array(
  182. ERROR: no method name found on line ` $args['name_includes'] = $request['name_includes'];`
  183. __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce' )
  184. ERROR: no method name found on line ` 'validate_callback' => 'rest_validate_request_arg',`

Код Controller{} WC 4.6.1

<?php
class Controller extends \WC_REST_Reports_Controller {
	/**
	 * Endpoint namespace.
	 *
	 * @var string
	 */
	protected $namespace = 'wc-analytics';

	/**
	 * Route base.
	 *
	 * @var string
	 */
	protected $rest_base = 'reports/customers/stats';

	/**
	 * Maps query arguments from the REST request.
	 *
	 * @param array $request Request array.
	 * @return array
	 */
	protected function prepare_reports_query( $request ) {
		$args                        = array();
		$args['registered_before']   = $request['registered_before'];
		$args['registered_after']    = $request['registered_after'];
		$args['match']               = $request['match'];
		$args['search']              = $request['search'];
		$args['name_includes']       = $request['name_includes'];
		$args['name_excludes']       = $request['name_excludes'];
		$args['username_includes']   = $request['username_includes'];
		$args['username_excludes']   = $request['username_excludes'];
		$args['email_includes']      = $request['email_includes'];
		$args['email_excludes']      = $request['email_excludes'];
		$args['country_includes']    = $request['country_includes'];
		$args['country_excludes']    = $request['country_excludes'];
		$args['last_active_before']  = $request['last_active_before'];
		$args['last_active_after']   = $request['last_active_after'];
		$args['orders_count_min']    = $request['orders_count_min'];
		$args['orders_count_max']    = $request['orders_count_max'];
		$args['total_spend_min']     = $request['total_spend_min'];
		$args['total_spend_max']     = $request['total_spend_max'];
		$args['avg_order_value_min'] = $request['avg_order_value_min'];
		$args['avg_order_value_max'] = $request['avg_order_value_max'];
		$args['last_order_before']   = $request['last_order_before'];
		$args['last_order_after']    = $request['last_order_after'];
		$args['customers']           = $request['customers'];
		$args['fields']              = $request['fields'];

		$between_params_numeric    = array( 'orders_count', 'total_spend', 'avg_order_value' );
		$normalized_params_numeric = TimeInterval::normalize_between_params( $request, $between_params_numeric, false );
		$between_params_date       = array( 'last_active', 'registered' );
		$normalized_params_date    = TimeInterval::normalize_between_params( $request, $between_params_date, true );
		$args                      = array_merge( $args, $normalized_params_numeric, $normalized_params_date );

		return $args;
	}

	/**
	 * Get all reports.
	 *
	 * @param WP_REST_Request $request Request data.
	 * @return array|WP_Error
	 */
	public function get_items( $request ) {
		$query_args      = $this->prepare_reports_query( $request );
		$customers_query = new Query( $query_args );
		$report_data     = $customers_query->get_data();
		$out_data        = array(
			'totals' => $report_data,
		);

		return rest_ensure_response( $out_data );
	}

	/**
	 * Prepare a report object for serialization.
	 *
	 * @param Array           $report  Report data.
	 * @param WP_REST_Request $request Request object.
	 * @return WP_REST_Response
	 */
	public function prepare_item_for_response( $report, $request ) {
		$data = $report;

		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
		$data    = $this->add_additional_fields_to_object( $data, $request );
		$data    = $this->filter_response_by_context( $data, $context );

		// Wrap the data in a response object.
		$response = rest_ensure_response( $data );

		/**
		 * Filter a report returned from the API.
		 *
		 * Allows modification of the report data right before it is returned.
		 *
		 * @param WP_REST_Response $response The response object.
		 * @param object           $report   The original report object.
		 * @param WP_REST_Request  $request  Request used to generate the response.
		 */
		return apply_filters( 'woocommerce_rest_prepare_report_customers_stats', $response, $report, $request );
	}

	/**
	 * Get the Report's schema, conforming to JSON Schema.
	 *
	 * @return array
	 */
	public function get_item_schema() {
		// @todo Should any of these be 'indicator's?
		$totals = array(
			'customers_count'     => array(
				'description' => __( 'Number of customers.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'avg_orders_count'    => array(
				'description' => __( 'Average number of orders.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
			),
			'avg_total_spend'     => array(
				'description' => __( 'Average total spend per customer.', 'woocommerce' ),
				'type'        => 'number',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
				'format'      => 'currency',
			),
			'avg_avg_order_value' => array(
				'description' => __( 'Average AOV per customer.', 'woocommerce' ),
				'type'        => 'number',
				'context'     => array( 'view', 'edit' ),
				'readonly'    => true,
				'format'      => 'currency',
			),
		);

		$schema = array(
			'$schema'    => 'http://json-schema.org/draft-04/schema#',
			'title'      => 'report_customers_stats',
			'type'       => 'object',
			'properties' => array(
				'totals' => array(
					'description' => __( 'Totals data.', 'woocommerce' ),
					'type'        => 'object',
					'context'     => array( 'view', 'edit' ),
					'readonly'    => true,
					'properties'  => $totals,
				),
			),
		);

		return $this->add_additional_fields_schema( $schema );
	}

	/**
	 * Get the query params for collections.
	 *
	 * @return array
	 */
	public function get_collection_params() {
		$params                            = array();
		$params['context']                 = $this->get_context_param( array( 'default' => 'view' ) );
		$params['registered_before']       = array(
			'description'       => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'string',
			'format'            => 'date-time',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['registered_after']        = array(
			'description'       => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'string',
			'format'            => 'date-time',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['match']                   = array(
			'description'       => __( 'Indicates whether all the conditions should be true for the resulting set, or if any one of them is sufficient. Match affects the following parameters: status_is, status_is_not, product_includes, product_excludes, coupon_includes, coupon_excludes, customer, categories', 'woocommerce' ),
			'type'              => 'string',
			'default'           => 'all',
			'enum'              => array(
				'all',
				'any',
			),
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['search']                  = array(
			'description'       => __( 'Limit response to objects with a customer field containing the search term. Searches the field provided by `searchby`.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['searchby']                = array(
			'description' => 'Limit results with `search` and `searchby` to specific fields containing the search term.',
			'type'        => 'string',
			'default'     => 'name',
			'enum'        => array(
				'name',
				'username',
				'email',
			),
		);
		$params['name_includes']           = array(
			'description'       => __( 'Limit response to objects with specfic names.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['name_excludes']           = array(
			'description'       => __( 'Limit response to objects excluding specfic names.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['username_includes']       = array(
			'description'       => __( 'Limit response to objects with specfic usernames.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['username_excludes']       = array(
			'description'       => __( 'Limit response to objects excluding specfic usernames.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['email_includes']          = array(
			'description'       => __( 'Limit response to objects including emails.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['email_excludes']          = array(
			'description'       => __( 'Limit response to objects excluding emails.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['country_includes']        = array(
			'description'       => __( 'Limit response to objects with specfic countries.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['country_excludes']        = array(
			'description'       => __( 'Limit response to objects excluding specfic countries.', 'woocommerce' ),
			'type'              => 'string',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['last_active_before']      = array(
			'description'       => __( 'Limit response to objects last active before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'string',
			'format'            => 'date-time',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['last_active_after']       = array(
			'description'       => __( 'Limit response to objects last active after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'string',
			'format'            => 'date-time',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['last_active_between']     = array(
			'description'       => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'array',
			'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ),
			'items'             => array(
				'type' => 'string',
			),
		);
		$params['registered_before']       = array(
			'description'       => __( 'Limit response to objects registered before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'string',
			'format'            => 'date-time',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['registered_after']        = array(
			'description'       => __( 'Limit response to objects registered after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'string',
			'format'            => 'date-time',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['registered_between']      = array(
			'description'       => __( 'Limit response to objects last active between two given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'array',
			'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_date_arg' ),
			'items'             => array(
				'type' => 'string',
			),
		);
		$params['orders_count_min']        = array(
			'description'       => __( 'Limit response to objects with an order count greater than or equal to given integer.', 'woocommerce' ),
			'type'              => 'integer',
			'sanitize_callback' => 'absint',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['orders_count_max']        = array(
			'description'       => __( 'Limit response to objects with an order count less than or equal to given integer.', 'woocommerce' ),
			'type'              => 'integer',
			'sanitize_callback' => 'absint',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['orders_count_between']    = array(
			'description'       => __( 'Limit response to objects with an order count between two given integers.', 'woocommerce' ),
			'type'              => 'array',
			'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
			'items'             => array(
				'type' => 'integer',
			),
		);
		$params['total_spend_min']         = array(
			'description'       => __( 'Limit response to objects with a total order spend greater than or equal to given number.', 'woocommerce' ),
			'type'              => 'number',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['total_spend_max']         = array(
			'description'       => __( 'Limit response to objects with a total order spend less than or equal to given number.', 'woocommerce' ),
			'type'              => 'number',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['total_spend_between']     = array(
			'description'       => __( 'Limit response to objects with a total order spend between two given numbers.', 'woocommerce' ),
			'type'              => 'array',
			'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
			'items'             => array(
				'type' => 'integer',
			),
		);
		$params['avg_order_value_min']     = array(
			'description'       => __( 'Limit response to objects with an average order spend greater than or equal to given number.', 'woocommerce' ),
			'type'              => 'number',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['avg_order_value_max']     = array(
			'description'       => __( 'Limit response to objects with an average order spend less than or equal to given number.', 'woocommerce' ),
			'type'              => 'number',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['avg_order_value_between'] = array(
			'description'       => __( 'Limit response to objects with an average order spend between two given numbers.', 'woocommerce' ),
			'type'              => 'array',
			'validate_callback' => array( '\Automattic\WooCommerce\Admin\API\Reports\TimeInterval', 'rest_validate_between_numeric_arg' ),
			'items'             => array(
				'type' => 'integer',
			),
		);
		$params['last_order_before']       = array(
			'description'       => __( 'Limit response to objects with last order before (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'string',
			'format'            => 'date-time',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['last_order_after']        = array(
			'description'       => __( 'Limit response to objects with last order after (or at) a given ISO8601 compliant datetime.', 'woocommerce' ),
			'type'              => 'string',
			'format'            => 'date-time',
			'validate_callback' => 'rest_validate_request_arg',
		);
		$params['customers']               = array(
			'description'       => __( 'Limit result to items with specified customer ids.', 'woocommerce' ),
			'type'              => 'array',
			'sanitize_callback' => 'wp_parse_id_list',
			'validate_callback' => 'rest_validate_request_arg',
			'items'             => array(
				'type' => 'integer',
			),
		);
		$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;
	}
}