Compare commits

...

7 Commits

Author SHA1 Message Date
malle-pietje
ff9e6f0225 merged #244 for a small change to the start_rolling_upgrade() method, contributed by @Jacobtims
minor additional change to allow changes to the payload of the `start_rolling_upgrade()` method
2024-10-17 16:41:45 +02:00
Jacob Timmerman
00a637dbc4 Add "uxg" to start_rolling_upgrade payload (#244)
* Fix payload start_rolling_upgrade method

* Add "uxg" to start_rolling_upgrade payload
2024-10-17 16:31:25 +02:00
malle-pietje
6498b0255b Merge branch 'master' of github.com:Art-of-WiFi/UniFi-API-client
merging #243
2024-10-17 14:56:47 +02:00
malle-pietje
05e791bcf0 minor changes 2024-10-17 14:56:36 +02:00
Jacob Timmerman
192a1262c3 Fix payload start_rolling_upgrade method (#243) 2024-10-17 14:55:54 +02:00
malle-pietje
30056f50fc - bumped version to 1.1.96
- removed @version tag in docblock as it contained redundant information
- merged #241 which adds a method to download a generated backup, (contributed by @Jacobtims)
2024-10-14 14:34:48 +02:00
Jacob Timmerman
d040c512a7 Add method to download generated backup (#241)
Merged PR #241
2024-10-14 14:31:44 +02:00

View File

@@ -13,7 +13,6 @@ namespace UniFi_API;
*
* @package UniFi_Controller_API_Client_Class
* @author Art of WiFi <info@artofwifi.net>
* @version Release: 1.1.92
* @license This class is subject to the MIT license that is bundled with this package in the file LICENSE.md
* @example This directory in the package repository contains a collection of examples:
* https://github.com/Art-of-WiFi/UniFi-API-client/tree/master/examples
@@ -21,7 +20,7 @@ namespace UniFi_API;
class Client
{
/** Constants. */
const CLASS_VERSION = '1.1.95';
const CLASS_VERSION = '1.1.96';
const CURL_METHODS_ALLOWED = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH'];
const DEFAULT_CURL_METHOD = 'GET';
@@ -1490,7 +1489,7 @@ class Client
}
/**
* Fetch known rogue access points
* Fetch known rogue access points.
*
* @return array|bool containing known rogue access point objects
*/
@@ -1500,7 +1499,7 @@ class Client
}
/**
* Generate a backup
* Generate a backup.
*
* @note this is an experimental function, please do not use unless you know exactly what you're doing
* @param int $days number of days for which the backup must be generated
@@ -1514,7 +1513,19 @@ class Client
}
/**
* Fetch auto backups
* Download a generated backup file.
*
* @note this is an experimental function, please do not use unless you know exactly what you're doing
* @param string $filepath the path to the generated backup file
* @return string|bool the raw content of the backup file, false upon failure
*/
public function download_backup(string $filepath)
{
return $this->exec_curl($filepath);
}
/**
* Fetch auto backups.
*
* @return array|bool containing objects with backup details on success
*/
@@ -1526,7 +1537,7 @@ class Client
}
/**
* Generate a backup/export of the current site
* Generate a backup/export of the current site.
*
* @note this is an experimental function, please do not use unless you know exactly what you're doing
* @return array|bool URL from where the backup/export file can be downloaded once generated, false upon failure
@@ -3096,13 +3107,14 @@ class Client
/**
* Start rolling upgrade.
*
* @note updates all UniFi devices to the latest firmware known to the controller in a
* @note upgrades all UniFi devices to the latest firmware known to the controller in a
* staggered/rolling fashion
* @param array $payload optional, array of device types to upgrade, default is all device types
* @return bool true upon success
*/
public function start_rolling_upgrade(): bool
public function start_rolling_upgrade(array $payload = ['uap', 'usw', 'ugw', 'uxg']): bool
{
return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr/set-rollupgrade');
return $this->fetch_results_boolean('/api/s/' . $this->site . '/cmd/devmgr/set-rollupgrade', $payload);
}
/**