From e45cd8addfe56866011b361a8313fac4d213d7a5 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 12 Jun 2019 13:17:16 +0100 Subject: [PATCH] get_endpoint_data should be in core --- src/Server.php | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/src/Server.php b/src/Server.php index 19164810338..11a58b05630 100644 --- a/src/Server.php +++ b/src/Server.php @@ -49,27 +49,6 @@ class Server { } } - /** - * Get data from a WooCommerce API endpoint. - * - * @param string $endpoint Endpoint. - * @param array $params Params to passwith request. - * @return array|WP_Error - */ - public function get_endpoint_data( $endpoint, $params = array() ) { - $request = new \WP_REST_Request( 'GET', $endpoint ); - - if ( $params ) { - $request->set_query_params( $params ); - } - - $response = \rest_do_request( $request ); - $server = \rest_get_server(); - $json = wp_json_encode( $server->response_to_data( $response, false ) ); - - return json_decode( $json, true ); - } - /** * Get API namespaces - new namespaces should be registered here. *