Adds the query parameter to the guzzle call for GET requests.
This commit is contained in:
@@ -35,7 +35,7 @@ interface Adapter
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(String $uri, array $headers): ResponseInterface;
|
||||
public function get(String $uri, array $query, array $headers): ResponseInterface;
|
||||
|
||||
/**
|
||||
* @param String $uri
|
||||
|
||||
@@ -38,9 +38,9 @@ class Guzzle implements Adapter
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function get(String $uri, array $headers = array()): ResponseInterface
|
||||
public function get(String $uri, array $query = array(), array $headers = array()): ResponseInterface
|
||||
{
|
||||
$response = $this->client->get($uri, ['headers' => $headers]);
|
||||
$response = $this->client->get($uri, ['query' => $query, 'headers' => $headers]);
|
||||
|
||||
$this->checkError($response);
|
||||
return $response;
|
||||
|
||||
@@ -60,35 +60,33 @@ class DNS implements API
|
||||
string $direction = "",
|
||||
string $match = "all"
|
||||
): \stdClass {
|
||||
$options = [
|
||||
$query = [
|
||||
'page' => $page,
|
||||
'per_page' => $perPage,
|
||||
'match' => $match
|
||||
];
|
||||
|
||||
if (!empty($type)) {
|
||||
$options['type'] = $type;
|
||||
$query['type'] = $type;
|
||||
}
|
||||
|
||||
if (!empty($name)) {
|
||||
$options['name'] = $name;
|
||||
$query['name'] = $name;
|
||||
}
|
||||
|
||||
if (!empty($content)) {
|
||||
$options['content'] = $content;
|
||||
$query['content'] = $content;
|
||||
}
|
||||
|
||||
if (!empty($order)) {
|
||||
$options['order'] = $order;
|
||||
$query['order'] = $order;
|
||||
}
|
||||
|
||||
if (!empty($direction)) {
|
||||
$options['direction'] = $direction;
|
||||
$query['direction'] = $direction;
|
||||
}
|
||||
|
||||
$query = http_build_query($options);
|
||||
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/dns_records?' . $query, []);
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/dns_records', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
@@ -100,7 +98,7 @@ class DNS implements API
|
||||
|
||||
public function getRecordDetails(string $zoneID, string $recordID): \stdClass
|
||||
{
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/dns_records/' . $recordID, []);
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/dns_records/' . $recordID, [], []);
|
||||
$body = json_decode($user->getBody());
|
||||
return $body->result;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class IPs implements API
|
||||
}
|
||||
|
||||
public function listIPs(): \stdClass {
|
||||
$ips = $this->adapter->get('ips', []);
|
||||
$ips = $this->adapter->get('ips', [], []);
|
||||
$body = json_decode($ips->getBody());
|
||||
|
||||
return $body->result;
|
||||
|
||||
@@ -77,16 +77,14 @@ class PageRules implements API
|
||||
throw new EndpointException('Match can only be any or all.');
|
||||
}
|
||||
|
||||
$options = [
|
||||
$query = [
|
||||
'status' => $status,
|
||||
'order' => $order,
|
||||
'direction' => $direction,
|
||||
'match' => $match
|
||||
];
|
||||
|
||||
$query = http_build_query($options);
|
||||
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/pagerules?' . $query, []);
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/pagerules', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
@@ -98,7 +96,7 @@ class PageRules implements API
|
||||
|
||||
public function getPageRuleDetails(string $zoneID, string $ruleID): \stdClass
|
||||
{
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/pagerules/' . $ruleID, []);
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/pagerules/' . $ruleID, [], []);
|
||||
$body = json_decode($user->getBody());
|
||||
return $body->result;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,12 @@ class UARules implements API
|
||||
int $page = 1,
|
||||
int $perPage = 20
|
||||
): \stdClass {
|
||||
$options = [
|
||||
$query = [
|
||||
'page' => $page,
|
||||
'per_page' => $perPage
|
||||
];
|
||||
|
||||
$query = http_build_query($options);
|
||||
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/ua_rules?' . $query, []);
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/ua_rules', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
|
||||
@@ -21,7 +21,7 @@ class User implements API
|
||||
|
||||
public function getUserDetails(): \stdClass
|
||||
{
|
||||
$user = $this->adapter->get('user', []);
|
||||
$user = $this->adapter->get('user', [], []);
|
||||
$body = json_decode($user->getBody());
|
||||
return $body->result;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,12 @@ class ZoneLockdown implements API
|
||||
int $page = 1,
|
||||
int $perPage = 20
|
||||
): \stdClass {
|
||||
$options = [
|
||||
$query = [
|
||||
'page' => $page,
|
||||
'per_page' => $perPage
|
||||
];
|
||||
|
||||
$query = http_build_query($options);
|
||||
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns?' . $query, []);
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
@@ -75,7 +73,7 @@ class ZoneLockdown implements API
|
||||
|
||||
public function getLockdownDetails(string $zoneID, string $lockdownID): \stdClass
|
||||
{
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID, []);
|
||||
$user = $this->adapter->get('zones/' . $zoneID . '/firewall/lockdowns/' . $lockdownID, [], []);
|
||||
$body = json_decode($user->getBody());
|
||||
return $body->result;
|
||||
}
|
||||
|
||||
@@ -58,31 +58,29 @@ class Zones implements API
|
||||
string $direction = "",
|
||||
string $match = "all"
|
||||
): \stdClass {
|
||||
$options = [
|
||||
$query = [
|
||||
'page' => $page,
|
||||
'per_page' => $perPage,
|
||||
'match' => $match
|
||||
];
|
||||
|
||||
if (!empty($name)) {
|
||||
$options['name'] = $name;
|
||||
$query['name'] = $name;
|
||||
}
|
||||
|
||||
if (!empty($status)) {
|
||||
$options['status'] = $status;
|
||||
$query['status'] = $status;
|
||||
}
|
||||
|
||||
if (!empty($order)) {
|
||||
$options['order'] = $order;
|
||||
$query['order'] = $order;
|
||||
}
|
||||
|
||||
if (!empty($direction)) {
|
||||
$options['direction'] = $direction;
|
||||
$query['direction'] = $direction;
|
||||
}
|
||||
|
||||
$query = http_build_query($options);
|
||||
|
||||
$user = $this->adapter->get('zones?' . $query, []);
|
||||
$user = $this->adapter->get('zones', $query, []);
|
||||
$body = json_decode($user->getBody());
|
||||
|
||||
$result = new \stdClass();
|
||||
|
||||
Reference in New Issue
Block a user