Skip to content

Commit

Permalink
Merge pull request #10 from Gman98ish/put
Browse files Browse the repository at this point in the history
Can now use put on update
  • Loading branch information
Gman98ish authored Jan 24, 2023
2 parents 4d746b8 + 8f851a1 commit 1778176
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1778176

Please sign in to comment.