1 | <?php
|
---|
2 |
|
---|
3 | namespace GuzzleHttp;
|
---|
4 |
|
---|
5 | use GuzzleHttp\Exception\GuzzleException;
|
---|
6 | use GuzzleHttp\Promise\PromiseInterface;
|
---|
7 | use Psr\Http\Message\RequestInterface;
|
---|
8 | use Psr\Http\Message\ResponseInterface;
|
---|
9 | use Psr\Http\Message\UriInterface;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Client interface for sending HTTP requests.
|
---|
13 | */
|
---|
14 | interface ClientInterface
|
---|
15 | {
|
---|
16 | /**
|
---|
17 | * The Guzzle major version.
|
---|
18 | */
|
---|
19 | public const MAJOR_VERSION = 7;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Send an HTTP request.
|
---|
23 | *
|
---|
24 | * @param RequestInterface $request Request to send
|
---|
25 | * @param array $options Request options to apply to the given
|
---|
26 | * request and to the transfer.
|
---|
27 | *
|
---|
28 | * @throws GuzzleException
|
---|
29 | */
|
---|
30 | public function send(RequestInterface $request, array $options = []): ResponseInterface;
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Asynchronously send an HTTP request.
|
---|
34 | *
|
---|
35 | * @param RequestInterface $request Request to send
|
---|
36 | * @param array $options Request options to apply to the given
|
---|
37 | * request and to the transfer.
|
---|
38 | */
|
---|
39 | public function sendAsync(RequestInterface $request, array $options = []): PromiseInterface;
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Create and send an HTTP request.
|
---|
43 | *
|
---|
44 | * Use an absolute path to override the base path of the client, or a
|
---|
45 | * relative path to append to the base path of the client. The URL can
|
---|
46 | * contain the query string as well.
|
---|
47 | *
|
---|
48 | * @param string $method HTTP method.
|
---|
49 | * @param string|UriInterface $uri URI object or string.
|
---|
50 | * @param array $options Request options to apply.
|
---|
51 | *
|
---|
52 | * @throws GuzzleException
|
---|
53 | */
|
---|
54 | public function request(string $method, $uri, array $options = []): ResponseInterface;
|
---|
55 |
|
---|
56 | /**
|
---|
57 | * Create and send an asynchronous HTTP request.
|
---|
58 | *
|
---|
59 | * Use an absolute path to override the base path of the client, or a
|
---|
60 | * relative path to append to the base path of the client. The URL can
|
---|
61 | * contain the query string as well. Use an array to provide a URL
|
---|
62 | * template and additional variables to use in the URL template expansion.
|
---|
63 | *
|
---|
64 | * @param string $method HTTP method
|
---|
65 | * @param string|UriInterface $uri URI object or string.
|
---|
66 | * @param array $options Request options to apply.
|
---|
67 | */
|
---|
68 | public function requestAsync(string $method, $uri, array $options = []): PromiseInterface;
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Get a client configuration option.
|
---|
72 | *
|
---|
73 | * These options include default request options of the client, a "handler"
|
---|
74 | * (if utilized by the concrete client), and a "base_uri" if utilized by
|
---|
75 | * the concrete client.
|
---|
76 | *
|
---|
77 | * @param string|null $option The config option to retrieve.
|
---|
78 | *
|
---|
79 | * @return mixed
|
---|
80 | *
|
---|
81 | * @deprecated ClientInterface::getConfig will be removed in guzzlehttp/guzzle:8.0.
|
---|
82 | */
|
---|
83 | public function getConfig(?string $option = null);
|
---|
84 | }
|
---|