Skip to content

Commit e5781b3

Browse files
committed
Allow for query params in GET requests
1 parent dc360ad commit e5781b3

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
composer.phar
33
composer.lock
44
vendor/
5+
.idea

src/Picqer/Carriers/SendCloud/Connection.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,14 @@ public function apiUrl()
111111
/**
112112
* Perform a GET request
113113
* @param string $url
114+
* @param array $params
114115
* @return array
115116
* @throws SendCloudApiException
116117
*/
117-
public function get($url)
118+
public function get($url, $params = [])
118119
{
119120
try {
120-
$result = $this->client()->get($url);
121+
$result = $this->client()->get($url, ['query' => $params]);
121122
return $this->parseResponse($result);
122123
} catch (RequestException $e) {
123124
if ($e->hasResponse()) {

src/Picqer/Carriers/SendCloud/Query/FindAll.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
trait FindAll
1515
{
1616

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

2121
return $this->collectionFromResult($result);
2222
}

0 commit comments

Comments
 (0)