@@ -1091,6 +1091,45 @@ public function list_clients(?string $mac = null)
1091
1091
return $ this ->fetch_results ('/api/s/ ' . $ this ->site . '/stat/sta/ ' . $ mac );
1092
1092
}
1093
1093
1094
+ /**
1095
+ * Fetch active client devices
1096
+ *
1097
+ * @param bool $includeTrafficUsage include the traffic usage of the client devices in the response
1098
+ * @param bool $includeUnifiDevices include UniFi devices in the response
1099
+ * @return array|bool returns an array of active client device objects, false upon error
1100
+ * @throws Exception
1101
+ */
1102
+ public function list_active_clients (bool $ includeTrafficUsage = true , bool $ includeUnifiDevices = true )
1103
+ {
1104
+ $ query = http_build_query ([
1105
+ 'includeTrafficUsage ' => $ includeTrafficUsage ,
1106
+ 'includeUnifiDevices ' => $ includeUnifiDevices ,
1107
+ ]);
1108
+
1109
+ return $ this ->fetch_results ('/v2/api/site/ ' . $ this ->site . '/clients/active? ' . $ query );
1110
+ }
1111
+
1112
+ /**
1113
+ * Fetch client devices history (offline client devices)
1114
+ *
1115
+ * @param bool $onlyNonBlocked include non-blocked client devices in the response
1116
+ * @param bool $includeUnifiDevices include UniFi devices in the response
1117
+ * @param int $withinHours the number of hours a device has been offline to be included in the response
1118
+ * (0 = no limit)
1119
+ * @return array|bool returns an array of (offline) client device objects, false upon error
1120
+ * @throws Exception
1121
+ */
1122
+ public function list_clients_history (bool $ onlyNonBlocked = true , bool $ includeUnifiDevices = true , int $ withinHours = 0 )
1123
+ {
1124
+ $ query = http_build_query ([
1125
+ 'onlyNonBlocked ' => $ onlyNonBlocked ,
1126
+ 'includeUnifiDevices ' => $ includeUnifiDevices ,
1127
+ 'withinHours ' => $ withinHours ,
1128
+ ]);
1129
+
1130
+ return $ this ->fetch_results ('/v2/api/site/ ' . $ this ->site . '/clients/history? ' . $ query );
1131
+ }
1132
+
1094
1133
/**
1095
1134
* Fetch details for a single client device
1096
1135
*
0 commit comments