From 8f851a1fd2f785c2c27f9e9dc9e91d404edcf1ba Mon Sep 17 00:00:00 2001 From: George Kelly Date: Tue, 24 Jan 2023 14:05:39 +0000 Subject: [PATCH] Can now use put on update --- src/Client.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Client.php b/src/Client.php index 16f7bf3..741c09b 100644 --- a/src/Client.php +++ b/src/Client.php @@ -83,14 +83,15 @@ public function createAsync($path, $body, $params = [], $headers = []) }); } - public function update($path, $body, $params = [], $headers = []) + public function update($path, $body, $params = [], $headers = [], $usePut = false) { - return $this->updateAsync($path, $body, $params, $headers)->wait(); + return $this->updateAsync($path, $body, $params, $headers, $usePut)->wait(); } - public function updateAsync($path, $body, $params = [], $headers = []) + public function updateAsync($path, $body, $params = [], $headers = [], $usePut = false) { - $promise = $this->guzzle->patchAsync($this->path($path), [ + $method = ($usePut ? 'put' : 'patch') . 'Async'; + $promise = $this->guzzle->$method($this->path($path), [ 'query' => $this->formatQueryParams($params), 'headers' => $this->headers($headers), 'json' => $body,