14
14
use UniFi_API \Exceptions \LoginFailedException ;
15
15
use UniFi_API \Exceptions \LoginRequiredException ;
16
16
use UniFi_API \Exceptions \MethodDeprecatedException ;
17
- use UniFi_API \Exceptions \NotAnOsConsoleException ;
17
+ use UniFi_API \Exceptions \NotAUnifiOsConsoleException ;
18
18
19
19
/**
20
20
* The UniFi API client class.
34
34
class Client
35
35
{
36
36
/** Constants. */
37
- const CLASS_VERSION = '2.0.3 ' ;
37
+ const CLASS_VERSION = '2.0.5 ' ;
38
38
const CURL_METHODS_ALLOWED = ['GET ' , 'POST ' , 'PUT ' , 'DELETE ' , 'PATCH ' ];
39
39
const DEFAULT_CURL_METHOD = 'GET ' ;
40
40
@@ -85,7 +85,7 @@ class Client
85
85
*
86
86
* @param string $user username to use when connecting to the UniFi controller
87
87
* @param string $password password to use when connecting to the UniFi controller
88
- * @param string $baseurl base URL of the UniFi controller which *must* include an 'https://' prefix,
88
+ * @param string $baseurl base URL of the UniFi controller which *must* include a 'https://' prefix,
89
89
* a port suffix (e.g. :8443) is required for non-UniFi OS controllers,
90
90
* do not add trailing slashes, defaults to 'https://127.0.0.1:8443'
91
91
* @param string|null $site short site name to access, defaults to 'default'
@@ -302,8 +302,8 @@ public function logout(): bool
302
302
* @param int|null $up optional, upload speed limit in kbps
303
303
* @param int|null $down optional, download speed limit in kbps
304
304
* @param int|null $megabytes optional, data transfer limit in MB
305
- * @param string|null $ap_mac optional, AP MAC address to which client is connected, should result in faster
306
- * authorization for the client device
305
+ * @param string|null $ap_mac optional, AP MAC address to which the client is connected
306
+ * (should result in faster authorization for the client device)
307
307
* @return bool true upon success
308
308
* @throws Exception
309
309
*/
@@ -725,8 +725,8 @@ public function stat_monthly_aps(?int $start = null, ?int $end = null, ?string $
725
725
* - only supported with UniFi controller versions 5.8.X and higher
726
726
* - make sure that the retention policy for 5-minute stats is set to the correct value in
727
727
* the controller settings
728
- * - make sure that "Clients Historical Data" has been enabled in the UniFi controller settings in the Maintenance
729
- * section
728
+ * - make sure that the "Clients Historical Data" option has been enabled in the UniFi controller settings in
729
+ * the Maintenance section
730
730
* @param string|null $mac optional, MAC address of the user/client device to return stats for
731
731
* @param int|null $start optional, Unix timestamp in milliseconds
732
732
* @param int|null $end optional, Unix timestamp in milliseconds
@@ -1095,16 +1095,16 @@ public function list_clients(?string $mac = null)
1095
1095
/**
1096
1096
* Fetch active client devices
1097
1097
*
1098
- * @param bool $includeTrafficUsage include the traffic usage of the client devices in the response
1099
- * @param bool $includeUnifiDevices include UniFi devices in the response
1098
+ * @param bool $include_traffic_usage include the traffic usage of the client devices in the response
1099
+ * @param bool $include_unifi_devices include UniFi devices in the response
1100
1100
* @return array|bool returns an array of active client device objects, false upon error
1101
1101
* @throws Exception
1102
1102
*/
1103
- public function list_active_clients (bool $ includeTrafficUsage = true , bool $ includeUnifiDevices = true )
1103
+ public function list_active_clients (bool $ include_traffic_usage = true , bool $ include_unifi_devices = true )
1104
1104
{
1105
1105
$ query = http_build_query ([
1106
- 'includeTrafficUsage ' => $ includeTrafficUsage ,
1107
- 'includeUnifiDevices ' => $ includeUnifiDevices ,
1106
+ 'include_traffic_usage ' => $ include_traffic_usage ,
1107
+ 'include_unifi_devices ' => $ include_unifi_devices ,
1108
1108
]);
1109
1109
1110
1110
return $ this ->fetch_results ('/v2/api/site/ ' . $ this ->site . '/clients/active? ' . $ query );
@@ -1113,19 +1113,19 @@ public function list_active_clients(bool $includeTrafficUsage = true, bool $incl
1113
1113
/**
1114
1114
* Fetch client devices history (offline client devices)
1115
1115
*
1116
- * @param bool $onlyNonBlocked include non-blocked client devices in the response
1117
- * @param bool $includeUnifiDevices include UniFi devices in the response
1118
- * @param int $withinHours the number of hours a device has been offline to be included in the response
1116
+ * @param bool $only_non_blocked include non-blocked client devices in the response
1117
+ * @param bool $include_unifi_devices include UniFi devices in the response
1118
+ * @param int $within_hours the number of hours a device has been offline to be included in the response
1119
1119
* (0 = no limit)
1120
1120
* @return array|bool returns an array of (offline) client device objects, false upon error
1121
1121
* @throws Exception
1122
1122
*/
1123
- public function list_clients_history (bool $ onlyNonBlocked = true , bool $ includeUnifiDevices = true , int $ withinHours = 0 )
1123
+ public function list_clients_history (bool $ only_non_blocked = true , bool $ include_unifi_devices = true , int $ within_hours = 0 )
1124
1124
{
1125
1125
$ query = http_build_query ([
1126
- 'onlyNonBlocked ' => $ onlyNonBlocked ,
1127
- 'includeUnifiDevices ' => $ includeUnifiDevices ,
1128
- 'withinHours ' => $ withinHours ,
1126
+ 'only_non_blocked ' => $ only_non_blocked ,
1127
+ 'include_unifi_devices ' => $ include_unifi_devices ,
1128
+ 'within_hours ' => $ within_hours ,
1129
1129
]);
1130
1130
1131
1131
return $ this ->fetch_results ('/v2/api/site/ ' . $ this ->site . '/clients/history? ' . $ query );
@@ -3268,7 +3268,7 @@ public function check_controller_update()
3268
3268
public function get_update_os_console ()
3269
3269
{
3270
3270
if (!$ this ->is_unifi_os ) {
3271
- throw new NotAnOsConsoleException ();
3271
+ throw new NotAUnifiOsConsoleException ();
3272
3272
}
3273
3273
3274
3274
return $ this ->fetch_results ('/api/firmware/update ' , null , false , true , false );
@@ -3284,7 +3284,7 @@ public function get_update_os_console()
3284
3284
public function update_os_console (): bool
3285
3285
{
3286
3286
if (!$ this ->is_unifi_os ) {
3287
- throw new NotAnOsConsoleException ();
3287
+ throw new NotAUnifiOsConsoleException ();
3288
3288
}
3289
3289
3290
3290
$ payload = ['persistFullData ' => true ];
@@ -4453,7 +4453,7 @@ protected function create_x_csrf_token_header()
4453
4453
/**
4454
4454
* Callback function for cURL to extract and store cookies as needed.
4455
4455
*
4456
- * @param object|resource $ch the cURL instance (type hinting is unavailable for cURL resources)
4456
+ * @param object|resource|false $ch the cURL instance (type hinting is unavailable for cURL resources)
4457
4457
* @param string $header_line the response header line number
4458
4458
* @return int length of the header line
4459
4459
*/
0 commit comments