2019-05-10 16:56:07 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* REST API Reports controller
|
|
|
|
*
|
|
|
|
* Handles requests to the reports endpoint.
|
|
|
|
*
|
2019-06-21 09:40:39 +00:00
|
|
|
* @package Automattic/WooCommerce/RestApi
|
2019-05-10 16:56:07 +00:00
|
|
|
* @since 2.6.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* REST API Reports controller class.
|
|
|
|
*
|
2019-06-21 09:40:39 +00:00
|
|
|
* @package Automattic/WooCommerce/RestApi
|
2019-05-10 16:56:07 +00:00
|
|
|
* @extends WC_REST_Reports_V2_Controller
|
|
|
|
*/
|
|
|
|
class WC_REST_Reports_Controller extends WC_REST_Reports_V2_Controller {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Endpoint namespace.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $namespace = 'wc/v3';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get reports list.
|
|
|
|
*
|
|
|
|
* @since 3.5.0
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function get_reports() {
|
|
|
|
$reports = parent::get_reports();
|
|
|
|
|
|
|
|
$reports[] = array(
|
|
|
|
'slug' => 'orders/totals',
|
2020-08-06 12:48:18 +00:00
|
|
|
'description' => __( 'Orders totals.', 'woocommerce' ),
|
2019-05-10 16:56:07 +00:00
|
|
|
);
|
|
|
|
$reports[] = array(
|
|
|
|
'slug' => 'products/totals',
|
2020-08-06 12:48:18 +00:00
|
|
|
'description' => __( 'Products totals.', 'woocommerce' ),
|
2019-05-10 16:56:07 +00:00
|
|
|
);
|
|
|
|
$reports[] = array(
|
|
|
|
'slug' => 'customers/totals',
|
2020-08-06 12:48:18 +00:00
|
|
|
'description' => __( 'Customers totals.', 'woocommerce' ),
|
2019-05-10 16:56:07 +00:00
|
|
|
);
|
|
|
|
$reports[] = array(
|
|
|
|
'slug' => 'coupons/totals',
|
2020-08-06 12:48:18 +00:00
|
|
|
'description' => __( 'Coupons totals.', 'woocommerce' ),
|
2019-05-10 16:56:07 +00:00
|
|
|
);
|
|
|
|
$reports[] = array(
|
|
|
|
'slug' => 'reviews/totals',
|
2020-08-06 12:48:18 +00:00
|
|
|
'description' => __( 'Reviews totals.', 'woocommerce' ),
|
2019-05-10 16:56:07 +00:00
|
|
|
);
|
|
|
|
$reports[] = array(
|
|
|
|
'slug' => 'categories/totals',
|
2020-08-06 12:48:18 +00:00
|
|
|
'description' => __( 'Categories totals.', 'woocommerce' ),
|
2019-05-10 16:56:07 +00:00
|
|
|
);
|
|
|
|
$reports[] = array(
|
|
|
|
'slug' => 'tags/totals',
|
2020-08-06 12:48:18 +00:00
|
|
|
'description' => __( 'Tags totals.', 'woocommerce' ),
|
2019-05-10 16:56:07 +00:00
|
|
|
);
|
|
|
|
$reports[] = array(
|
|
|
|
'slug' => 'attributes/totals',
|
2020-08-06 12:48:18 +00:00
|
|
|
'description' => __( 'Attributes totals.', 'woocommerce' ),
|
2019-05-10 16:56:07 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return $reports;
|
|
|
|
}
|
|
|
|
}
|