Commit Graph

187 Commits

Author SHA1 Message Date
malle-pietje
9e092f8b85 Merge branch 'master' of github.com:Art-of-WiFi/UniFi-API-client
merge for device-basic
2023-03-28 12:22:42 +02:00
Sebastian Grodzicki
e4dc2e273c
Add stat/device-basic endpoint (#188)
Merge to include device-basic endpoint
2023-03-28 12:21:43 +02:00
malle-pietje
67d318ca91 - bumped version to class v1.1.80
- added generate_backup_site() method, contributed by @labo-jad
2023-03-28 12:19:29 +02:00
malle-pietje
cbe89d913c API client class v1.1.79
- updated README to reflect support for 7.X
- `get_last_error_message()` now always returns a string which is empty if no message is available
- applied PR #151 in slightly different way for consistency with other similar code sections, contributed by @banakito
- changed default argument values in several methods/functions from null to an empty string
2022-03-28 11:57:57 +02:00
malle-pietje
4fe1780e1d API client class v1.1.78
- fixed `create_radius_account()` method to make Tunnel Type and Medium optional parameters, reported by @CodeByJacob
2022-03-11 13:24:31 +01:00
malle-pietje
61bd2eda0d API client class v1.1.77
- removed unnecessary CURLOPT_HEADER from the login() method
- added several more possible attributes for client stats
- cast VLAN id to string in create_radius_account()
2022-03-11 12:08:40 +01:00
malle-pietje
746fb0933c API client class v1.1.76
- minor changes based on feedback by Scrutinizer
- removed use of CURLOPT_NOBODY in login() method
- switched to using cURL's default HTTP version
2021-12-29 15:01:12 +01:00
malle-pietje
aefbbdc5e1 API client class v1.1.75
- updated docblocks to be less USG-specific
- removed content-length header from the logout method, reported by @Olivier6767
- added notes to reflect successful tests with UDR running latest Pre-Release version of the UniFi controller (version 6.5.52)
- added checks in specific cases when using trim() to prevent PHP 8 from throwing an error when the variable is null, submitted by @djchen
2021-12-18 12:00:56 +01:00
malle-pietje
fbfd6a8246 API client class v1.1.74
- minor refactoring
- fixed minor typos
- updated README to reflect limited visibility when using read-only administrator accounts, reported by @KetchupBomb and @NickDunas
2021-11-08 10:30:22 +01:00
malle-pietje
310abc43b5 API client class v1.1.73
- minor spacing changes based on Scrutinizer feedback
- updated create_wlan() method/function to work with the new way of assigning a VLAN which now requires passing the _id value
of the VLAN, reported by @BeneReuthlinger
- merged #132, README update, contributed by @pauloboc
- merged #133, adds edit_client_name() method, contributed by @pauloboc
2021-10-23 11:14:25 +02:00
malle-pietje
01eafb516a Merge branch 'master' of github.com:Art-of-WiFi/UniFi-API-client
merge #133
2021-10-23 10:34:46 +02:00
Paulo Ferreira
c3c44d61e4
Add method rename client (#133)
* Update Client.php

Add method rename client

* Update README.md
2021-10-23 10:34:39 +02:00
malle-pietje
2e7b556d8e Merge branch 'master' of github.com:Art-of-WiFi/UniFi-API-client
merged #132
2021-10-23 10:32:41 +02:00
malle-pietje
e7e1540df4 - minor spacing changes based on Scrutinizer feedback
- updated create_wlan() method/function to work with the new way of assigning a VLAN which now requires passing the _id value
of the VLAN, reported by @BeneReuthlinger
2021-10-23 10:32:20 +02:00
Paulo Ferreira
adb98a3c8e
Update README.md (#132)
Fix parameters separations
2021-10-22 17:35:05 +02:00
malle-pietje
9cca43557c API client class v1.1.72
- added property $request_timeout to control the cURL option CURLOPT_TIMEOUT, contributed by @mreho
- added setter and getter for $request_timeout, contributed by @mreho
- changed default value for the cURL option CURLOPT_HTTP_VERSION to CURL_HTTP_VERSION_1_1:
    - as of cURL version 7.62.0 the default value is CURL_HTTP_VERSION_2TLS which may cause issues
    - https://curl.se/libcurl/c/CURLOPT_HTTP_VERSION.html
- added property for $curl_http_version to hold the value for CURLOPT_HTTP_VERSION
- added setter and getter for $curl_http_version
- switched to using a constant to hold the class version
- updated the README file
2021-10-19 10:39:17 +02:00
malle-pietje
13b6699889 API client class v1.1.71
- modified `create_radius_account()` method to make Tunnel Type and Medium optional parameters, contributed by @mreho
- added `advanced_adopt_device()` method for more advanced adoption capabilities, contributed by @Sarrus
- refactored several code sections
- updated connection test script
2021-09-29 10:41:39 +02:00
malle-pietje
665fed93e2 shortened several property names 2021-03-22 11:58:20 +01:00
malle-pietje
36c0fecaff minor improvements 2021-03-22 11:52:44 +01:00
malle-pietje
474578a9d5 removed non-compliant header suffix 2021-03-21 16:08:55 +01:00
malle-pietje
5281db56de API client class v1.1.69
- added list_device_states() function/method, as suggested by @hoerter
- implemented fix to prevent cURL from sending an `Expect: 100-continue` header with each POST request
- implemented a callback function with the CURLOPT_HEADERFUNCTION option to process the response headers after each request and extract the Cookie contents
- general cleanup
2021-03-21 16:03:05 +01:00
malle-pietje
021d01ba86 API client class v1.1.68
- fixed a bug that was introduced with 1.1.67 and would only occur in certain corner cases
2021-01-24 18:09:38 +01:00
malle-pietje
caf838abb9 API client class v1.1.67
- fixed a bug where the request headers for subsequent function calls within the same Client instance would not always be cleared
2021-01-24 17:58:23 +01:00
malle-pietje
aa778c9b7b API client class v1.1.66
- simplified code based on Scrutinizer reports
2021-01-24 14:21:26 +01:00
malle-pietje
0e9ee66cef updated README to include new functions/methods 2021-01-23 11:44:12 +01:00
malle-pietje
721ba7d084 API client class v1.1.65
- applied minor improvements based on Scrutinizer reports
- applied minor changes to `authorize_guest()` to further improve handling of 0/null/empty values passed
- restricted protocols to be used by cURL to only allow http and https for improved security
- added methods/functions `list_device_name_mappings()` and `stat_full_status()`
2021-01-23 11:41:52 +01:00
malle-pietje
bf3446bba0 API client class v1.1.64
- added information to several docblocks
- changed handling of request headers, added private property for this
- applied changes for improved use of require_once in the README and examples
- added `list_sites()` example
- *potential breaking changes:*
    renamed `get_request_type()` and `set_request_type()` functions/methods to `get_request_method()` and `set_request_method()` respectively
2021-01-21 10:59:27 +01:00
malle-pietje
a4998de3a9 API client class v1.1.63
- changed references to *UbiOS* back to *UniFi OS*
- removed capitalization from all header strings (per RFC, header fields are case-insensitive: https://tools.ietf.org/html/rfc7230#section-3.2)
- removed charset parameter from headers (not required per RFC)
- added x-csrf-token header to all requests except GET when talking to UniFi OS-based controllers, thanks go to @paciks for raising #86
2021-01-06 17:03:21 +01:00
malle-pietje
c82481a28a API client class v1.1.62
- added several monthly stats methods: `stat_monthly_gateway()`, `stat_monthly_site()`, `stat_monthly_aps()`, `stat_monthly_user()`, thanks go to @Roel Janssens for spotting these MongoDB collections
- test for `object` or `resource` in `get_curl_resource()`, closes PR #82 submitted by @banakito
- applied change to comments in `example/modify_smartpower_pdu_outlet.php` based on a suggestion by @thesohoguy
- removed unnecessary variable from `list_apgroups()`, thanks go to Stephen Davies for reporting
- added an optional parameter $ap_group_ids to the `create_wlan()` function/method for UniFi controller versions 6.0.X and higher, thanks go to Stephen Davies for contributing
2020-12-10 14:52:39 +01:00
malle-pietje
2c743563f8 API client class v1.1.61
- minor improvements of comments contents
- fixed naming error in comments for list_devices()
- updated supported controller versions in main README
- change variable names used from MBytes to megabytes for improved consistency
2020-11-26 13:19:53 +01:00
malle-pietje
32252e56d7 API client class v1.1.60
- minor syntax improvements based on Scrutinizer CI feedback
- added support for PATCH requests (for future use)
- completed updating method/function comments to PHPDoc format (PSR-5)
2020-11-12 11:09:37 +01:00
malle-pietje
120699d343 API client class v1.1.59
- added methods/functions to manage AP groups: list_apgroups(), create_apgroup(), edit_apgroup(), and delete_apgroup() (only supported with controller versions 6.0.X and higher)
- adapted code to handle the behavior of the new v2 API routes that were added with controller versions 6.0.X and higher
- merged PR #76 which adds methods/functions check_controller_update() and check_firmware_update(), contributed  by @brenard
- further work on updating method/function comments to PHPDoc format (PSR-5)
2020-10-26 09:51:41 +01:00
malle-pietje
d26cba1f66 API client class v1.1.58
- changed several references from UniFi SDN controller to UniFi Network controller
- added optional payload parameter to the list_alarms() method/function, contributed by @MikeSiekkinen through PR #68
- added example showing how to disable/enable a UniFi switch port
- updated restart_device() function/method, thanks go to @leonardogyn for reporting this
- added example to modify outlet settings on a UniFi SmartPower PDU Pro, thanks go to @panthergm for providing access
2020-10-22 14:23:29 +02:00
malle-pietje
69b43df148 API client class v1.1.57
- increased minimum required PHP version to 5.5.0
- minor syntax improvement based on Scrutinizer feedback
- added create_dynamicdns() and set_dynamicdns() methods, "borrowed" routes from @smos
- added set_element_adoption() method, contributed by @VWT-Dan
- made a start at changing the function/method comments to PHPDoc format (PSR-5) which will support auto-generated class documentation (https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#5-the-phpdoc-format)
- added check to throw an error when the $baseurl ends with a / character, thanks to @infraweavers for submitting #66
- fixed issue with logout() on UDM PROs, thanks go to @Olivier6767 for providing access to a UDM PRO, addresses #63
- applied several code styling improvements
2020-08-22 17:47:50 +02:00
malle-pietje
2b34890a67 - minor syntax improvement based on Scrutinizer feedback
- added create_dynamicdns() and set_dynamicdns() methods, "borrowed" routes from @smos
- made a start at changing the function/method comments to PHPDoc format (PSR-5) which will support auto-generated class documentation
(https://github.com/php-fig/fig-standards/blob/master/proposed/phpdoc.md#5-the-phpdoc-format)
2020-06-20 16:12:13 +02:00
malle-pietje
0d99d4a776 API client class v1.1.56
- switched to use of curl_setopt_array instead of curl_setopt which should slightly reduce the overall PHP execution time (https://gist.github.com/masakielastic/3330620)
- several minor code improvements
2020-06-13 12:28:43 +02:00
malle-pietje
89ce2fd8dd - general code clean up
- removed repetitive code (checks using $this->is_loggedin())
- updated the main README to include the latest added functions/methods
2020-06-08 12:52:32 +02:00
malle-pietje
c77913fded API client class v1.1.54
- fixed list_alarms() method/function
2020-06-07 14:23:44 +02:00
malle-pietje
329ad595c9 API client class v1.1.53
- added list_routing() method/function, contributed by @VWT-Dan
- added list_firmware() method/function
- added get_class_version() method/function, returns the (semantic) version number of the Class
- cleaned up the class to remove repetitive code
- changed names of several protected functions for improved consistency
- general code clean up
- minor additions to the main README file
2020-06-07 14:11:52 +02:00
malle-pietje
badb615627 API client class v1.1.52
- fixed exec_curl() for cases where the cookie has expired and we need to re-login
- removed obsolete functions/methods
2020-04-14 14:59:00 +02:00
malle-pietje
49d0986bd7 API client class v1.1.51
- updated README with all getter and setter methods/functions
- updated get_cookies() and get_cookie() for consistency
- get_cookie() remains for backward compatibility only, should not be used in new code
- fix rare cases where the client would end up in a loop, e.g. issuing a request for a site the cached credentials have no
access to
2020-03-19 16:07:31 +01:00
malle-pietje
0ebbb4efac API client class v1.1.50
- removed several if statements
- added getter and setter for unifi_os property
- fixed logout method when working with UniFi OS-based controllers
2020-02-22 17:19:32 +01:00
malle-pietje
903d3e47d5 API client class v1.1.49
- improvements to internal use of $_SESSION['unificookie']
- other minor code improvements
- applies several applied patches as suggested by scrutinizer-ci.com
2020-02-07 08:27:39 +01:00
malle-pietje
e72dea7357 API client class v1.1.48
- applied several patches to Client.php as suggested by scrutinizer-ci.com
- moved resource checks to get_curl_resource() method/function
- extended create_user() function/method with several optional parameters
- changed headers that are passed with each request containing a payload
2020-02-06 11:51:20 +01:00
malle-pietje
17d895076f API client class v1.1.47
- applied patches to update_switch_poe-mode.php as suggested by scrutinizer-ci.com
- code clean up and improvements in preparation of support for UniFi OS-based controllers
- added support for UniFi OS-based controllers, thanks to @Scyto for providing access
- adapt login route and method, and base URL for UniFi OS-based controllers
- automatically identify UniFi OS-based controllers, thanks to @TwitchCaptain for this and several other suggestions
- relaxed URL validation to allow UniFi OS-based controllers to pass
- changed default HTTP method to GET
- many improvements throughout the code
2020-02-06 08:52:49 +01:00
malle-pietje
961d692125 - added support for UniFi OS-based controllers 2020-02-04 14:42:03 +01:00
malle-pietje
796ad9a82d code cleanup and improvements in preparation of support for UniFi OS-based controllers 2020-02-04 07:41:43 +01:00
malle-pietje
a3fc0732e2 API client class v1.1.46
- applied patches to update_switch_poe-mode.php as suggested by scrutinizer-ci.com
- placed warning that UniFI OS is not (yet) supported
2020-01-31 12:14:52 +01:00
malle-pietje
ca25c8ab52 re-added PHP_EOL in several places 2020-01-30 10:14:55 +01:00
malle-pietje
6754eb5041 API client class v1.1.45
- added function/method force_provision(), contributed by @VWT-Dan
- added example update_switch_poe-mode.php, contributed by @Kaltt
2020-01-30 10:09:34 +01:00