Nav apraksta

ClientInterface.php 2.7KB

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