Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php
2
 
3
namespace Guzzle\Http;
4
 
5
use Guzzle\Common\HasDispatcherInterface;
6
use Guzzle\Common\Collection;
7
use Guzzle\Common\Exception\InvalidArgumentException;
8
use Guzzle\Http\Message\EntityEnclosingRequestInterface;
9
use Guzzle\Http\Message\RequestInterface;
10
 
11
/**
12
 * Client interface for send HTTP requests
13
 */
14
interface ClientInterface extends HasDispatcherInterface
15
{
16
    const CREATE_REQUEST = 'client.create_request';
17
 
18
    /** @var string RFC 1123 HTTP-Date */
19
    const HTTP_DATE = 'D, d M Y H:i:s \G\M\T';
20
 
21
    /**
22
     * Set the configuration object to use with the client
23
     *
24
     * @param array|Collection $config Parameters that define how the client behaves
25
     *
26
     * @return self
27
     */
28
    public function setConfig($config);
29
 
30
    /**
31
     * Get a configuration setting or all of the configuration settings. The Collection result of this method can be
32
     * modified to change the configuration settings of a client.
33
     *
34
     * A client should honor the following special values:
35
     *
36
     * - request.options: Associative array of default RequestFactory options to apply to each request
37
     * - request.params: Associative array of request parameters (data values) to apply to each request
38
     * - curl.options: Associative array of cURL configuration settings to apply to each request
39
     * - ssl.certificate_authority: Path a CAINFO, CAPATH, true to use strict defaults, or false to disable verification
40
     * - redirect.disable: Set to true to disable redirects
41
     *
42
     * @param bool|string $key Configuration value to retrieve. Set to FALSE to retrieve all values of the client.
43
     *                         The object return can be modified, and modifications will affect the client's config.
44
     * @return mixed|Collection
45
     * @see \Guzzle\Http\Message\RequestFactoryInterface::applyOptions for a full list of request.options options
46
     */
47
    public function getConfig($key = false);
48
 
49
    /**
50
     * Create and return a new {@see RequestInterface} configured for the client.
51
     *
52
     * Use an absolute path to override the base path of the client, or a relative path to append to the base path of
53
     * the client. The URI can contain the query string as well. Use an array to provide a URI template and additional
54
     * variables to use in the URI template expansion.
55
     *
56
     * @param string                                    $method  HTTP method. Defaults to GET
57
     * @param string|array                              $uri     Resource URI.
58
     * @param array|Collection                          $headers HTTP headers
59
     * @param string|resource|array|EntityBodyInterface $body    Entity body of request (POST/PUT) or response (GET)
60
     * @param array                                     $options Array of options to apply to the request
61
     *
62
     * @return RequestInterface
63
     * @throws InvalidArgumentException if a URI array is passed that does not contain exactly two elements: the URI
64
     *                                  followed by template variables
65
     */
66
    public function createRequest(
67
        $method = RequestInterface::GET,
68
        $uri = null,
69
        $headers = null,
70
        $body = null,
71
        array $options = array()
72
    );
73
 
74
    /**
75
     * Create a GET request for the client
76
     *
77
     * @param string|array     $uri     Resource URI
78
     * @param array|Collection $headers HTTP headers
79
     * @param array            $options Options to apply to the request. For BC compatibility, you can also pass a
80
     *                                  string to tell Guzzle to download the body of the response to a particular
81
     *                                  location. Use the 'body' option instead for forward compatibility.
82
     * @return RequestInterface
83
     * @see    Guzzle\Http\ClientInterface::createRequest()
84
     */
85
    public function get($uri = null, $headers = null, $options = array());
86
 
87
    /**
88
     * Create a HEAD request for the client
89
     *
90
     * @param string|array     $uri     Resource URI
91
     * @param array|Collection $headers HTTP headers
92
     * @param array            $options Options to apply to the request
93
     *
94
     * @return RequestInterface
95
     * @see    Guzzle\Http\ClientInterface::createRequest()
96
     */
97
    public function head($uri = null, $headers = null, array $options = array());
98
 
99
    /**
100
     * Create a DELETE request for the client
101
     *
102
     * @param string|array                        $uri     Resource URI
103
     * @param array|Collection                    $headers HTTP headers
104
     * @param string|resource|EntityBodyInterface $body    Body to send in the request
105
     * @param array                               $options Options to apply to the request
106
     *
107
     * @return EntityEnclosingRequestInterface
108
     * @see    Guzzle\Http\ClientInterface::createRequest()
109
     */
110
    public function delete($uri = null, $headers = null, $body = null, array $options = array());
111
 
112
    /**
113
     * Create a PUT request for the client
114
     *
115
     * @param string|array                        $uri     Resource URI
116
     * @param array|Collection                    $headers HTTP headers
117
     * @param string|resource|EntityBodyInterface $body    Body to send in the request
118
     * @param array                               $options Options to apply to the request
119
     *
120
     * @return EntityEnclosingRequestInterface
121
     * @see    Guzzle\Http\ClientInterface::createRequest()
122
     */
123
    public function put($uri = null, $headers = null, $body = null, array $options = array());
124
 
125
    /**
126
     * Create a PATCH request for the client
127
     *
128
     * @param string|array                        $uri     Resource URI
129
     * @param array|Collection                    $headers HTTP headers
130
     * @param string|resource|EntityBodyInterface $body    Body to send in the request
131
     * @param array                               $options Options to apply to the request
132
     *
133
     * @return EntityEnclosingRequestInterface
134
     * @see    Guzzle\Http\ClientInterface::createRequest()
135
     */
136
    public function patch($uri = null, $headers = null, $body = null, array $options = array());
137
 
138
    /**
139
     * Create a POST request for the client
140
     *
141
     * @param string|array                                $uri      Resource URI
142
     * @param array|Collection                            $headers  HTTP headers
143
     * @param array|Collection|string|EntityBodyInterface $postBody POST body. Can be a string, EntityBody, or
144
     *                                                    associative array of POST fields to send in the body of the
145
     *                                                    request. Prefix a value in the array with the @ symbol to
146
     *                                                    reference a file.
147
     * @param array                                       $options Options to apply to the request
148
     *
149
     * @return EntityEnclosingRequestInterface
150
     * @see    Guzzle\Http\ClientInterface::createRequest()
151
     */
152
    public function post($uri = null, $headers = null, $postBody = null, array $options = array());
153
 
154
    /**
155
     * Create an OPTIONS request for the client
156
     *
157
     * @param string|array $uri     Resource URI
158
     * @param array        $options Options to apply to the request
159
     *
160
     * @return RequestInterface
161
     * @see    Guzzle\Http\ClientInterface::createRequest()
162
     */
163
    public function options($uri = null, array $options = array());
164
 
165
    /**
166
     * Sends a single request or an array of requests in parallel
167
     *
168
     * @param array|RequestInterface $requests One or more RequestInterface objects to send
169
     *
170
     * @return \Guzzle\Http\Message\Response|array Returns a single Response or an array of Response objects
171
     */
172
    public function send($requests);
173
 
174
    /**
175
     * Get the client's base URL as either an expanded or raw URI template
176
     *
177
     * @param bool $expand Set to FALSE to get the raw base URL without URI template expansion
178
     *
179
     * @return string|null
180
     */
181
    public function getBaseUrl($expand = true);
182
 
183
    /**
184
     * Set the base URL of the client
185
     *
186
     * @param string $url The base service endpoint URL of the webservice
187
     *
188
     * @return self
189
     */
190
    public function setBaseUrl($url);
191
 
192
    /**
193
     * Set the User-Agent header to be used on all requests from the client
194
     *
195
     * @param string $userAgent      User agent string
196
     * @param bool   $includeDefault Set to true to prepend the value to Guzzle's default user agent string
197
     *
198
     * @return self
199
     */
200
    public function setUserAgent($userAgent, $includeDefault = false);
201
 
202
    /**
203
     * Set SSL verification options.
204
     *
205
     * Setting $certificateAuthority to TRUE will result in the bundled cacert.pem being used to verify against the
206
     * remote host.
207
     *
208
     * Alternate certificates to verify against can be specified with the $certificateAuthority option set to the full
209
     * path to a certificate file, or the path to a directory containing certificates.
210
     *
211
     * Setting $certificateAuthority to FALSE will turn off peer verification, unset the bundled cacert.pem, and
212
     * disable host verification. Please don't do this unless you really know what you're doing, and why you're doing
213
     * it.
214
     *
215
     * @param string|bool $certificateAuthority bool, file path, or directory path
216
     * @param bool        $verifyPeer           FALSE to stop from verifying the peer's certificate.
217
     * @param int         $verifyHost           Set to 1 to check the existence of a common name in the SSL peer
218
     *                                          certificate. 2 to check the existence of a common name and also verify
219
     *                                          that it matches the hostname provided.
220
     * @return self
221
     */
222
    public function setSslVerification($certificateAuthority = true, $verifyPeer = true, $verifyHost = 2);
223
}