Skip to content

Commit

Permalink
Allow for query params in GET requests
Browse files Browse the repository at this point in the history
  • Loading branch information
stephangroen committed Jun 28, 2017
1 parent dc360ad commit e5781b3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.phar
composer.lock
vendor/
.idea
5 changes: 3 additions & 2 deletions src/Picqer/Carriers/SendCloud/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,14 @@ public function apiUrl()
/**
* Perform a GET request
* @param string $url
* @param array $params
* @return array
* @throws SendCloudApiException
*/
public function get($url)
public function get($url, $params = [])
{
try {
$result = $this->client()->get($url);
$result = $this->client()->get($url, ['query' => $params]);
return $this->parseResponse($result);
} catch (RequestException $e) {
if ($e->hasResponse()) {
Expand Down
4 changes: 2 additions & 2 deletions src/Picqer/Carriers/SendCloud/Query/FindAll.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
trait FindAll
{

public function all()
public function all($params = [])
{
$result = $this->connection()->get($this->url);
$result = $this->connection()->get($this->url, $params);

return $this->collectionFromResult($result);
}
Expand Down

0 comments on commit e5781b3

Please sign in to comment.