@@ 146-155 (lines=10) @@ | ||
143 | * @throws \Http\Client\Exception |
|
144 | * @throws \Exception |
|
145 | */ |
|
146 | protected function put($path, array $params = null, array $headers = null) |
|
147 | { |
|
148 | if (null === $headers) { |
|
149 | $headers = ['Content-Type' => 'application/x-www-form-urlencoded']; |
|
150 | } |
|
151 | ||
152 | return $this->httpClient->sendRequest( |
|
153 | $this->requestBuilder->create('PUT', $path, $headers, \http_build_query($params)) |
|
154 | ); |
|
155 | } |
|
156 | ||
157 | /** |
|
158 | * Create and send PSR-7 PATCH request |
|
@@ 169-178 (lines=10) @@ | ||
166 | * @throws \Http\Client\Exception |
|
167 | * @throws \Exception |
|
168 | */ |
|
169 | protected function patch($path, array $params = null, array $headers = null) |
|
170 | { |
|
171 | if (null === $headers) { |
|
172 | $headers = ['Content-Type' => 'application/json']; |
|
173 | } |
|
174 | ||
175 | return $this->httpClient->sendRequest( |
|
176 | $this->requestBuilder->create('PATCH', $path, $headers, \json_encode($params)) |
|
177 | ); |
|
178 | } |
|
179 | ||
180 | /** |
|
181 | * Create and send PSR-7 DELETE request |
|
@@ 192-201 (lines=10) @@ | ||
189 | * @throws \Http\Client\Exception |
|
190 | * @throws \Exception |
|
191 | */ |
|
192 | protected function delete($path, array $params = null, array $headers = null) |
|
193 | { |
|
194 | if (null === $headers) { |
|
195 | $headers = ['Content-Type' => 'application/x-www-form-urlencoded']; |
|
196 | } |
|
197 | ||
198 | return $this->httpClient->sendRequest( |
|
199 | $this->requestBuilder->create('DELETE', $path, $headers, \http_build_query($params)) |
|
200 | ); |
|
201 | } |
|
202 | ||
203 | /** |
|
204 | * Handle API errors |