Browse Source

Allow passing query params to the getDomains() call.

Shane Mc Cormack 6 years ago
parent
commit
784268b94e
1 changed files with 7 additions and 2 deletions
  1. 7 2
      src/MyDNSHostAPI.php

+ 7 - 2
src/MyDNSHostAPI.php

@@ -630,12 +630,17 @@
 		/**
 		 * Get list of our domains.
 		 *
+		 * @param $queryParams (Optional) Array of query params to use.
 		 * @return Array of domains or an empty array.
 		 */
-		public function getDomains() {
+		public function getDomains($queryParams = []) {
 			if ($this->auth === FALSE) { return []; }
 
-			$result = $this->api(($this->domainAdmin ? '/admin' : '') . '/domains');
+			$url = ($this->domainAdmin ? '/admin' : '') . '/domains';
+			$qs = http_build_query($queryParams);
+			if (!empty($qs)) { $url .= '?' . $qs; }
+
+			$result = $this->api($url);
 			return isset($result['response']) ? $result['response'] : [];
 		}