Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 200 lines (182 sloc) 6.829 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
<?php

namespace Guzzle\Http;

use Guzzle\Guzzle;
use Guzzle\Common\HasDispatcherInterface;
use Guzzle\Common\Collection;
use Guzzle\Http\Message\RequestInterface;
use Guzzle\Http\Curl\CurlMultiInterface;

/**
* Client interface for send HTTP requests
*/
interface ClientInterface extends HasDispatcherInterface
{
    /**
* Set the configuration object to use with the client
*
* @param array|Collection|string $config Parameters that define how the
* client behaves and connects to a webservice. Pass an array or a
* Collection object.
*
* @return ClientInterface
*/
    function setConfig($config);

    /**
* Get a configuration setting or all of the configuration settings
*
* @param bool|string $key Configuration value to retrieve. Set to FALSE
* to retrieve all values of the client. The object return can be
* modified, and modifications will affect the client's config.
*
* @return mixed|Collection
*/
    function getConfig($key = false);

    /**
* Inject configuration values into a formatted string with {{param}} as a
* parameter delimiter (replace param with the configuration value name)
*
* @param string $string String to inject config values into
*
* @return string
*/
    function inject($string);

    /**
* Create and return a new {@see RequestInterface} configured for the client
*
* @param string $method (optional) HTTP method. Defaults to GET
* @param string $uri (optional) Resource URI. Use an absolute path to
* override the base path of the client, or a relative path to append
* to the base path of the client. The URI can contain the
* querystring as well.
* @param array|Collection $headers (optional) HTTP headers
* @param string|resource|array|EntityBody $body (optional) Entity body of
* request (POST/PUT) or response (GET)
*
* @return RequestInterface
*/
    function createRequest($method = RequestInterface::GET, $uri = null, $headers = null, $body = null);

    /**
* Prepare a request to be sent from the Client by adding client specific
* behaviors and properties to the request.
*
* This method should only be called when using the default RequestFactory
* is not an option and the request sent from the client must be created
* manually.
*
* @param RequestInterface $request Request to prepare for the client
*
* @return RequestInterface
*/
    function prepareRequest(RequestInterface $request);

    /**
* Get the base service endpoint URL with configuration options injected
* into the configuration setting.
*
* @param bool $inject (optional) Set to FALSE to get the raw base URL
*
* @return string
* @throws RuntimeException if a base URL has not been set
*/
    function getBaseUrl($inject = true);

    /**
* Set the base service endpoint URL
*
* @param string $url The base service endpoint URL of the webservice
*
* @return ClientInterface
*/
    function setBaseUrl($url);

    /**
* Set the name of your application and application version that will be
* appended to the User-Agent header of all reqeusts.
*
* @param string $userAgent User agent string
* @param bool $includeDefault (optional) Set to TRUE to append the default
* Guzzle user agent
*
* @return ClientInterface
*/
    function setUserAgent($userAgent, $includeDefault = false);

    /**
* Create a GET request for the client
*
* @param string $path (optional) Resource URI of the request. Use an
* absolute path to override the base path, or a relative path to append
* @param array|Collection $headers (optional) HTTP headers
* @param string|resource|array|EntityBody $body (optional) Where to store
* the response entity body
*
* @return RequestInterface
*/
    function get($uri = null, $headers = null, $body = null);

    /**
* Create a HEAD request for the client
*
* @param string $uri (optional) Resource URI of the request. Use an
* absolute path to override the base path, or a relative path to append
* @param array|Collection $headers (optional) HTTP headers
*
* @return RequestInterface
*/
    function head($uri = null, $headers = null);

    /**
* Create a DELETE request for the client
*
* @param string $uri (optional) Resource URI of the request. Use an
* absolute path to override the base path, or a relative path to append
* @param array|Collection $headers (optional) HTTP headers
*
* @return RequestInterface
*/
    function delete($uri = null, $headers = null);

    /**
* Create a PUT request for the client
*
* @param string $uri (optional) Resource URI of the request. Use an
* absolute path to override the base path, or a relative path to append
* @param array|Collection $headers (optional) HTTP headers
* @param string|resource|array|EntityBody $body Body to send in the request
*
* @return EntityEnclosingRequest
*/
    function put($uri = null, $headers = null, $body = null);

    /**
* Create a POST request for the client
*
* @param string $uri (optional) Resource URI of the request. Use an absolute path to
* override the base path, or a relative path to append it.
* @param array|Collection $headers (optional) HTTP headers
* @param array|Collection|string|EntityBody $postBody (optional) POST
* body. Can be a string, EntityBody, or associative array of POST
* fields to send in the body of the request. Prefix a value in the
* array with the @ symbol reference a file.
*
* @return EntityEnclosingRequest
*/
    function post($uri = null, $headers = null, $postBody = null);

    /**
* Create an OPTIONS request for the client
*
* @param string $uri (optional) Resource URI of the request. Use an
* absolute path to override the base path, or relative path to append
*
* @return RequestInterface
*/
    function options($uri = null);

    /**
* Sends a single request or an array of requests in parallel
*
* @param array $requests Request(s) to send
*
* @return array Returns the response(s)
*/
    public function send($requests);

    /**
* Set a curl multi object to be used internally by the client for
* transferring requests.
*
* @param CurlMultiInterface $curlMulti Mulit object
*
* @return Client
*/
    public function setCurlMulti(CurlMultiInterface $curlMulti);
}
Something went wrong with that request. Please try again.