浏览代码

Add user stats.

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

+ 15 - 0
src/MyDNSHostAPI.php

@@ -261,6 +261,21 @@
 			return isset($result['response']['stats']) ? $result['response']['stats'] : [];
 		}
 
+		/**
+		 * Get users statistics
+		 *
+		 * @param $type Statistics type.
+		 * @param $options Options to pass to statistics.
+		 * @param $userid User ID to get data for (Default: 'self')
+		 * @return Array of stats.
+		 */
+		public function getUserStats($type, $options = [], $userID = 'self') {
+			if ($this->auth === FALSE) { return NULL; }
+
+			$result = $this->api('/users/' . $userID . '/stats/' . $type, 'GET', $options);
+			return isset($result['response']['stats']) ? $result['response']['stats'] : [];
+		}
+
 		/**
 		 * Set information a given user id.
 		 *