PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.6
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.6
28.6 28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 All 130 releases
wordpress-seo / src / dashboard / infrastructure / search-console / site-kit-search-console-api-call.php

site-kit-search-console-api-call.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 28.6, at src/dashboard/infrastructure/search-console/site-kit-search-console-api-call.php

35 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // phpcs:disable Yoast.NamingConventions.NamespaceName.TooLong
4 // phpcs:disable Yoast.NamingConventions.NamespaceName.MaxExceeded
5 namespace Yoast\WP\SEO\Dashboard\Infrastructure\Search_Console;
6
7 use WP_REST_Request;
8 use WP_REST_Response;
9
10 /**
11 * Class that hold the code to do the REST call to the Site Kit api.
12 *
13 * @phpcs:disable Yoast.NamingConventions.ObjectNameDepth.MaxExceeded
14 */
15 class Site_Kit_Search_Console_Api_Call {
16
17 /**
18 * The search analytics API route path.
19 */
20 private const SEARCH_CONSOLE_DATA_SEARCH_ANALYTICS_ROUTE = '/google-site-kit/v1/modules/search-console/data/searchanalytics';
21
22 /**
23 * Runs the internal REST api call.
24 *
25 * @param array<string, array<string, string>> $api_parameters The api parameters.
26 *
27 * @return WP_REST_Response
28 */
29 public function do_request( array $api_parameters ): WP_REST_Response {
30 $request = new WP_REST_Request( 'GET', self::SEARCH_CONSOLE_DATA_SEARCH_ANALYTICS_ROUTE );
31 $request->set_query_params( $api_parameters );
32 return \rest_do_request( $request );
33 }
34 }
35