ClientInterface.php 2.8 KB

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