Skip to content

Commit 362b3e6

Browse files
committed
Add parameter to add query parameters
1 parent 46c657f commit 362b3e6

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/Clients/GuzzleClient.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,51 +41,51 @@ public function __construct(array $options = [])
4141
$this->guzzle = new HttpClient($options);
4242
}
4343

44-
public function get($endpoint)
44+
public function get($endpoint, $query = [])
4545
{
46-
$request = new Request('GET',$this->buildUri($endpoint), $this->buildHeaders());
46+
$request = new Request('GET',$this->buildUri($endpoint, $query), $this->buildHeaders());
4747

4848
$response = $this->guzzle->send($request);
4949

5050
return $this->handle($response);
5151
}
5252

53-
public function post($endpoint, $data)
53+
public function post($endpoint, $data, $query = [])
5454
{
5555
$data = $this->prepareData($data);
5656

57-
$request = new Request('POST',$this->buildUri($endpoint),$this->buildHeaders(),$data);
57+
$request = new Request('POST',$this->buildUri($endpoint, $query),$this->buildHeaders(),$data);
5858

5959
$response = $this->guzzle->send($request);
6060

6161
return $this->handle($response);
6262
}
6363

64-
public function put($endpoint, $data)
64+
public function put($endpoint, $data, $query = [])
6565
{
6666
$data = $this->prepareData($data);
6767

68-
$request = new Request('PUT',$this->buildUri($endpoint),$this->buildHeaders(),$data);
68+
$request = new Request('PUT',$this->buildUri($endpoint, $query),$this->buildHeaders(),$data);
6969

7070
$response = $this->guzzle->send($request);
7171

7272
return $this->handle($response);
7373
}
7474

75-
public function patch($endpoint, $data)
75+
public function patch($endpoint, $data, $query = [])
7676
{
7777
$data = $this->prepareData($data);
7878

79-
$request = new Request('PATCH',$this->buildUri($endpoint),$this->buildHeaders(),$data);
79+
$request = new Request('PATCH',$this->buildUri($endpoint, $query),$this->buildHeaders(),$data);
8080

8181
$response = $this->guzzle->send($request);
8282

8383
return $this->handle($response);
8484
}
8585

86-
public function delete($endpoint)
86+
public function delete($endpoint, $query = [])
8787
{
88-
$request = new Request('DELETE',$this->buildUri($endpoint), $this->buildHeaders());
88+
$request = new Request('DELETE',$this->buildUri($endpoint, $query), $this->buildHeaders());
8989

9090
$response = $this->guzzle->send($request);
9191

src/Firebase.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,35 +51,35 @@ public function __construct($base, $token, ClientInterface $client = null)
5151
$this->setClient($client);
5252
}
5353

54-
public function get($endpoint)
54+
public function get($endpoint, $query = [])
5555
{
56-
$this->response = $this->client->get($endpoint);
56+
$this->response = $this->client->get($endpoint,$query);
5757

5858
return $this;
5959
}
6060

61-
public function post($endpoint, $data)
61+
public function post($endpoint, $data, $query = [])
6262
{
6363
$this->response = $this->client->post($endpoint,$data);
6464

6565
return $this;
6666
}
6767

68-
public function put($endpoint, $data)
68+
public function put($endpoint, $data, $query = [])
6969
{
7070
$this->response = $this->client->put($endpoint,$data);
7171

7272
return $this;
7373
}
7474

75-
public function patch($endpoint, $data)
75+
public function patch($endpoint, $data, $query = [])
7676
{
7777
$this->response = $this->client->patch($endpoint,$data);
7878

7979
return $this;
8080
}
8181

82-
public function delete($endpoint)
82+
public function delete($endpoint, $query = [])
8383
{
8484
$this->response = $this->client->delete($endpoint);
8585

0 commit comments

Comments
 (0)