| 1 |
<?php |
| 2 |
|
| 3 |
declare(strict_types=1); |
| 4 |
|
| 5 |
namespace AATXT\App\Infrastructure\Http; |
| 6 |
|
| 7 |
/** |
| 8 |
* Interface for HTTP client implementations. |
| 9 |
* |
| 10 |
* Abstracts HTTP communication to allow dependency injection and testing. |
| 11 |
* Concrete implementations should wrap WordPress HTTP functions or other HTTP libraries. |
| 12 |
*/ |
| 13 |
interface HttpClientInterface |
| 14 |
{ |
| 15 |
/** |
| 16 |
* Perform an HTTP POST request. |
| 17 |
* |
| 18 |
* @param string $url The URL to send the request to |
| 19 |
* @param array<string, string> $headers HTTP headers as key-value pairs |
| 20 |
* @param array<string, mixed> $body Request body data |
| 21 |
* |
| 22 |
* @return array<string, mixed> The response data |
| 23 |
* |
| 24 |
* @throws \Exception If the HTTP request fails |
| 25 |
*/ |
| 26 |
public function post(string $url, array $headers, array $body): array; |
| 27 |
|
| 28 |
/** |
| 29 |
* Perform an HTTP GET request. |
| 30 |
* |
| 31 |
* @param string $url The URL to send the request to |
| 32 |
* @param array<string, string> $headers HTTP headers as key-value pairs |
| 33 |
* |
| 34 |
* @return array<string, mixed> The response data |
| 35 |
* |
| 36 |
* @throws \Exception If the HTTP request fails |
| 37 |
*/ |
| 38 |
public function get(string $url, array $headers = []): array; |
| 39 |
} |
| 40 |
|