| 1 |
<?php |
| 2 |
|
| 3 |
namespace Yoast\WP\SEO\AI_HTTP_Request\Application; |
| 4 |
|
| 5 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Bad_Request_Exception; |
| 6 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Forbidden_Exception; |
| 7 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Internal_Server_Error_Exception; |
| 8 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Not_Found_Exception; |
| 9 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Payment_Required_Exception; |
| 10 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Request_Timeout_Exception; |
| 11 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Service_Unavailable_Exception; |
| 12 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Too_Many_Requests_Exception; |
| 13 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Unauthorized_Exception; |
| 14 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Request; |
| 15 |
use Yoast\WP\SEO\AI_HTTP_Request\Domain\Response; |
| 16 |
|
| 17 |
interface Request_Handler_Interface { |
| 18 |
|
| 19 |
/** |
| 20 |
* Executes the request to the API. |
| 21 |
* |
| 22 |
* @param Request $request The request to execute. |
| 23 |
* |
| 24 |
* @return Response The response from the API. |
| 25 |
* |
| 26 |
* @throws Bad_Request_Exception When the request fails for any other reason. |
| 27 |
* @throws Forbidden_Exception When the response code is 403. |
| 28 |
* @throws Internal_Server_Error_Exception When the response code is 500. |
| 29 |
* @throws Not_Found_Exception When the response code is 404. |
| 30 |
* @throws Payment_Required_Exception When the response code is 402. |
| 31 |
* @throws Request_Timeout_Exception When the response code is 408. |
| 32 |
* @throws Service_Unavailable_Exception When the response code is 503. |
| 33 |
* @throws Too_Many_Requests_Exception When the response code is 429. |
| 34 |
* @throws Unauthorized_Exception When the response code is 401. |
| 35 |
*/ |
| 36 |
public function handle( Request $request ): Response; |
| 37 |
} |
| 38 |
|