PluginProbe
Media Cloud Sync / 1.3.11
Media Cloud Sync v1.3.11
1.4.0 1.3.12 1.3.11 1.3.10 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.2.0 1.2.10 1.2.11 1.2.12 1.2.13 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 All 34 releases
media-cloud-sync / includes / sdk / s3 / GuzzleHttp / ClientTrait.php

ClientTrait.php in Media Cloud Sync 1.3.11, at includes/sdk/s3/GuzzleHttp/ClientTrait.php

228 lines 8.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Dudlewebs\WPMCS\s3\GuzzleHttp;
4
5 use Dudlewebs\WPMCS\s3\GuzzleHttp\Exception\GuzzleException;
6 use Dudlewebs\WPMCS\s3\GuzzleHttp\Promise\PromiseInterface;
7 use Dudlewebs\WPMCS\s3\Psr\Http\Message\ResponseInterface;
8 use Dudlewebs\WPMCS\s3\Psr\Http\Message\UriInterface;
9 /**
10 * Client interface for sending HTTP requests.
11 */
12 trait ClientTrait
13 {
14 /**
15 * Create and send an HTTP request.
16 *
17 * Use an absolute path to override the base path of the client, or a
18 * relative path to append to the base path of the client. The URL can
19 * contain the query string as well.
20 *
21 * @param string $method HTTP method.
22 * @param string|UriInterface $uri URI object or string.
23 * @param array $options Request options to apply.
24 *
25 * @throws GuzzleException
26 */
27 public abstract function request(string $method, $uri, array $options = []) : ResponseInterface;
28 /**
29 * Create and send an HTTP GET request.
30 *
31 * Use an absolute path to override the base path of the client, or a
32 * relative path to append to the base path of the client. The URL can
33 * contain the query string as well.
34 *
35 * @param string|UriInterface $uri URI object or string.
36 * @param array $options Request options to apply.
37 *
38 * @throws GuzzleException
39 */
40 public function get($uri, array $options = []) : ResponseInterface
41 {
42 return $this->request('GET', $uri, $options);
43 }
44 /**
45 * Create and send an HTTP HEAD request.
46 *
47 * Use an absolute path to override the base path of the client, or a
48 * relative path to append to the base path of the client. The URL can
49 * contain the query string as well.
50 *
51 * @param string|UriInterface $uri URI object or string.
52 * @param array $options Request options to apply.
53 *
54 * @throws GuzzleException
55 */
56 public function head($uri, array $options = []) : ResponseInterface
57 {
58 return $this->request('HEAD', $uri, $options);
59 }
60 /**
61 * Create and send an HTTP PUT request.
62 *
63 * Use an absolute path to override the base path of the client, or a
64 * relative path to append to the base path of the client. The URL can
65 * contain the query string as well.
66 *
67 * @param string|UriInterface $uri URI object or string.
68 * @param array $options Request options to apply.
69 *
70 * @throws GuzzleException
71 */
72 public function put($uri, array $options = []) : ResponseInterface
73 {
74 return $this->request('PUT', $uri, $options);
75 }
76 /**
77 * Create and send an HTTP POST request.
78 *
79 * Use an absolute path to override the base path of the client, or a
80 * relative path to append to the base path of the client. The URL can
81 * contain the query string as well.
82 *
83 * @param string|UriInterface $uri URI object or string.
84 * @param array $options Request options to apply.
85 *
86 * @throws GuzzleException
87 */
88 public function post($uri, array $options = []) : ResponseInterface
89 {
90 return $this->request('POST', $uri, $options);
91 }
92 /**
93 * Create and send an HTTP PATCH request.
94 *
95 * Use an absolute path to override the base path of the client, or a
96 * relative path to append to the base path of the client. The URL can
97 * contain the query string as well.
98 *
99 * @param string|UriInterface $uri URI object or string.
100 * @param array $options Request options to apply.
101 *
102 * @throws GuzzleException
103 */
104 public function patch($uri, array $options = []) : ResponseInterface
105 {
106 return $this->request('PATCH', $uri, $options);
107 }
108 /**
109 * Create and send an HTTP DELETE request.
110 *
111 * Use an absolute path to override the base path of the client, or a
112 * relative path to append to the base path of the client. The URL can
113 * contain the query string as well.
114 *
115 * @param string|UriInterface $uri URI object or string.
116 * @param array $options Request options to apply.
117 *
118 * @throws GuzzleException
119 */
120 public function delete($uri, array $options = []) : ResponseInterface
121 {
122 return $this->request('DELETE', $uri, $options);
123 }
124 /**
125 * Create and send an asynchronous HTTP request.
126 *
127 * Use an absolute path to override the base path of the client, or a
128 * relative path to append to the base path of the client. The URL can
129 * contain the query string as well. Use an array to provide a URL
130 * template and additional variables to use in the URL template expansion.
131 *
132 * @param string $method HTTP method
133 * @param string|UriInterface $uri URI object or string.
134 * @param array $options Request options to apply.
135 */
136 public abstract function requestAsync(string $method, $uri, array $options = []) : PromiseInterface;
137 /**
138 * Create and send an asynchronous HTTP GET request.
139 *
140 * Use an absolute path to override the base path of the client, or a
141 * relative path to append to the base path of the client. The URL can
142 * contain the query string as well. Use an array to provide a URL
143 * template and additional variables to use in the URL template expansion.
144 *
145 * @param string|UriInterface $uri URI object or string.
146 * @param array $options Request options to apply.
147 */
148 public function getAsync($uri, array $options = []) : PromiseInterface
149 {
150 return $this->requestAsync('GET', $uri, $options);
151 }
152 /**
153 * Create and send an asynchronous HTTP HEAD request.
154 *
155 * Use an absolute path to override the base path of the client, or a
156 * relative path to append to the base path of the client. The URL can
157 * contain the query string as well. Use an array to provide a URL
158 * template and additional variables to use in the URL template expansion.
159 *
160 * @param string|UriInterface $uri URI object or string.
161 * @param array $options Request options to apply.
162 */
163 public function headAsync($uri, array $options = []) : PromiseInterface
164 {
165 return $this->requestAsync('HEAD', $uri, $options);
166 }
167 /**
168 * Create and send an asynchronous HTTP PUT request.
169 *
170 * Use an absolute path to override the base path of the client, or a
171 * relative path to append to the base path of the client. The URL can
172 * contain the query string as well. Use an array to provide a URL
173 * template and additional variables to use in the URL template expansion.
174 *
175 * @param string|UriInterface $uri URI object or string.
176 * @param array $options Request options to apply.
177 */
178 public function putAsync($uri, array $options = []) : PromiseInterface
179 {
180 return $this->requestAsync('PUT', $uri, $options);
181 }
182 /**
183 * Create and send an asynchronous HTTP POST request.
184 *
185 * Use an absolute path to override the base path of the client, or a
186 * relative path to append to the base path of the client. The URL can
187 * contain the query string as well. Use an array to provide a URL
188 * template and additional variables to use in the URL template expansion.
189 *
190 * @param string|UriInterface $uri URI object or string.
191 * @param array $options Request options to apply.
192 */
193 public function postAsync($uri, array $options = []) : PromiseInterface
194 {
195 return $this->requestAsync('POST', $uri, $options);
196 }
197 /**
198 * Create and send an asynchronous HTTP PATCH request.
199 *
200 * Use an absolute path to override the base path of the client, or a
201 * relative path to append to the base path of the client. The URL can
202 * contain the query string as well. Use an array to provide a URL
203 * template and additional variables to use in the URL template expansion.
204 *
205 * @param string|UriInterface $uri URI object or string.
206 * @param array $options Request options to apply.
207 */
208 public function patchAsync($uri, array $options = []) : PromiseInterface
209 {
210 return $this->requestAsync('PATCH', $uri, $options);
211 }
212 /**
213 * Create and send an asynchronous HTTP DELETE request.
214 *
215 * Use an absolute path to override the base path of the client, or a
216 * relative path to append to the base path of the client. The URL can
217 * contain the query string as well. Use an array to provide a URL
218 * template and additional variables to use in the URL template expansion.
219 *
220 * @param string|UriInterface $uri URI object or string.
221 * @param array $options Request options to apply.
222 */
223 public function deleteAsync($uri, array $options = []) : PromiseInterface
224 {
225 return $this->requestAsync('DELETE', $uri, $options);
226 }
227 }
228