Change endpoint to wc-telemetry/tracker

Since this endpoint isn't a publicly documented endpoint, we'll keep it
out of the wc/v3 namespace. Instead we're introducing a new wc-telemetry
namespace. The name of the endpoint then is updating to tracker.

The wc-telemetry endpoint is unversioned for consistency with
wc-analytics and because it's not publicly documented.
This commit is contained in:
Josh Betz 2021-10-11 15:58:10 -05:00
parent eceb3f0df4
commit e7eba52ba5
3 changed files with 13 additions and 35 deletions

View File

@ -16,21 +16,21 @@ defined( 'ABSPATH' ) || exit;
* @package WooCommerce\RestApi
* @extends WC_REST_Controller
*/
class WC_REST_Telemetry_V2_Controller extends WC_REST_Controller {
class WC_REST_Telemetry_Controller extends WC_REST_Controller {
/**
* Endpoint namespace.
*
* @var string
*/
protected $namespace = 'wc/v2';
protected $namespace = 'wc-telemetry';
/**
* Route base.
*
* @var string
*/
protected $rest_base = 'telemetry';
protected $rest_base = 'tracker';
/**
* Register the route for /telemetry

View File

@ -1,27 +0,0 @@
<?php
/**
* REST API WC Telemetry Controller
*
* Handles requests to the /system_status/App/* endpoints.
*
* @package WooCommerce\RestApi
* @since 3.0.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Telemetry controller.
*
* @package WooCommerce\RestApi
* @extends WC_REST_Telemetry_V2_Controller
*/
class WC_REST_Telemetry_Controller extends WC_REST_Telemetry_V2_Controller {
/**
* Endpoint namespace.
*
* @var string
*/
protected $namespace = 'wc/v3';
}

View File

@ -52,9 +52,10 @@ class Server {
return apply_filters(
'woocommerce_rest_api_get_rest_namespaces',
array(
'wc/v1' => $this->get_v1_controllers(),
'wc/v2' => $this->get_v2_controllers(),
'wc/v3' => $this->get_v3_controllers(),
'wc/v1' => $this->get_v1_controllers(),
'wc/v2' => $this->get_v2_controllers(),
'wc/v3' => $this->get_v3_controllers(),
'wc-telemetry' => $this->get_telemetry_controllers(),
)
);
}
@ -121,7 +122,6 @@ class Server {
'shipping-zone-methods' => 'WC_REST_Shipping_Zone_Methods_V2_Controller',
'tax-classes' => 'WC_REST_Tax_Classes_V2_Controller',
'taxes' => 'WC_REST_Taxes_V2_Controller',
'telemetry' => 'WC_REST_Telemetry_V2_Controller',
'webhooks' => 'WC_REST_Webhooks_V2_Controller',
'webhook-deliveries' => 'WC_REST_Webhook_Deliveries_V2_Controller',
'system-status' => 'WC_REST_System_Status_V2_Controller',
@ -168,7 +168,6 @@ class Server {
'shipping-zone-methods' => 'WC_REST_Shipping_Zone_Methods_Controller',
'tax-classes' => 'WC_REST_Tax_Classes_Controller',
'taxes' => 'WC_REST_Taxes_Controller',
'telemetry' => 'WC_REST_Telemetry_Controller',
'webhooks' => 'WC_REST_Webhooks_Controller',
'system-status' => 'WC_REST_System_Status_Controller',
'system-status-tools' => 'WC_REST_System_Status_Tools_Controller',
@ -181,6 +180,12 @@ class Server {
);
}
protected function get_telemetry_controllers() {
return array(
'tracker' => 'WC_REST_Telemetry_Controller',
);
}
/**
* Return the path to the package.
*