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