| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\AI_HTTP_Request\Infrastructure; |
| 4 |
|
| 5 |
use Exception; |
| 6 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\WP_Request_Exception; |
| 7 |
|
| 8 |
/** |
| 9 |
* Interface for the API client. |
| 10 |
*/ |
| 11 |
|
| 12 |
interface API_Client_Interface { |
| 13 |
|
| 14 |
/** |
| 15 |
* Performs a request to the API. |
| 16 |
* |
| 17 |
* @param string $action_path The action path for the request. |
| 18 |
* @param array<string> $body The body of the request. |
| 19 |
* @param array<string> $headers The headers for the request. |
| 20 |
* @param bool $is_post Whether the request is a POST request. |
| 21 |
* |
| 22 |
* @return array<int|string|array<string>> The response from the API. |
| 23 |
* |
| 24 |
* @throws WP_Request_Exception When the wp_remote_post() returns an error. |
| 25 |
*/ |
| 26 |
public function perform_request( string $action_path, $body, $headers, bool $is_post ): array; |
| 27 |
|
| 28 |
/** |
| 29 |
* Gets the timeout of the requests in seconds. |
| 30 |
* |
| 31 |
* @return int The timeout of the suggestion requests in seconds. |
| 32 |
*/ |
| 33 |
public function get_request_timeout(): int; |
| 34 |
} |
| 35 |
|