-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathAdapter.php
More file actions
36 lines (32 loc) · 1.04 KB
/
Adapter.php
File metadata and controls
36 lines (32 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace Utopia\Fetch;
use Utopia\Fetch\Options\Request as RequestOptions;
/**
* Adapter interface
* Defines the contract for HTTP adapters
* @package Utopia\Fetch
*/
interface Adapter
{
/**
* Send an HTTP request
*
* @param string $url The URL to send the request to
* @param string $method The HTTP method (GET, POST, etc.)
* @param mixed $body The request body (string, array, or null)
* @param array<string, string> $headers The request headers (formatted as key-value pairs)
* @param RequestOptions $options Request options (timeout, connectTimeout, maxRedirects, allowRedirects, userAgent)
* @param callable|null $chunkCallback Optional callback for streaming chunks
* @return Response The HTTP response
* @throws Exception If the request fails
*/
public function send(
string $url,
string $method,
mixed $body,
array $headers,
RequestOptions $options,
?callable $chunkCallback = null
): Response;
}