浏览代码

Add getDomainStats function.

Shane Mc Cormack 8 年之前
父节点
当前提交
9fc277db03
共有 1 个文件被更改,包括 14 次插入0 次删除
  1. 14 0
      src/MyDNSHostAPI.php

+ 14 - 0
src/MyDNSHostAPI.php

@@ -536,6 +536,20 @@
 			return $this->api(($this->domainAdmin ? '/admin' : '') . '/domains/' . $domain . '/access', 'POST', $data);
 		}
 
+		/**
+		 * Get domain statistics
+		 *
+		 * @param $domain Domain to get stats for.
+		 * @param $options Options to pass to statistics.
+		 * @return Array of stats.
+		 */
+		public function getDomainStats($domain, $options = []) {
+			if ($this->auth === FALSE) { return []; }
+
+			$result = $this->api(($this->domainAdmin ? '/admin' : '') . '/domains/' . $domain . '/stats', 'GET', $options);
+			return isset($result['response']['stats']) ? $result['response']['stats'] : [];
+		}
+
 		/**
 		 * Attempt to sync the domain to the backends.
 		 *