Commit Graph

120 Commits

Author SHA1 Message Date
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
malle-pietje
2ac791a353 API client class v1.1.44
- added example script reconnect_client.php
- fixed typo in URL linking to UniFi section on the UI.com site
- add function/method reboot_cloudkey(), contributed by @leonardogyn
2020-01-27 13:19:49 +01:00
malle-pietje
3fd8e69b4a API client class v1.1.43
- updated code and instructions for `set_guestlogin_settings()`, thanks to @stoehrmark for reporting the issue
- added list_connected_users.php example contributed by @gahujipo
- added restart_device() which replaces restart_ap(), contributed by @leonardogyn
- code styling cleanup across `Client.php`
2019-12-13 09:15:10 +01:00
malle-pietje
c7d1eee3e3 fixed minor syntax error/typo in an example 2019-10-15 14:41:16 +02:00
malle-pietje
17bfe0087c clean up of example code based on feedback from scrutinizer-ci.com 2019-10-15 14:27:28 +02:00
malle-pietje
b3521d8c1d updated main README to include the newly added functions/methods
added example to demonstrate the use of set_super_mgmt_settings_base()
2019-10-15 14:16:23 +02:00
malle-pietje
727cd6dc9c API client class v1.1.42
changed variable name $url to $path in custom_api_request() for consistency and clarity
rearranged layout of Client.php
added check to verify whether $ch is a resource
renamed get_curl_obj() to get_curl_resource() to reflect the variable type it returns

Added the new functions/methods:
* set_super_mgmt_settings_base()
* set_super_smtp_settings_base()
* set_super_identity_settings_base()
2019-10-15 14:04:37 +02:00
malle-pietje
09db47affd API client class v1.1.41
changed create_wlan function/method to not include passphrase in payload when security = "open" and passphrase = null
fixed indentations in several places
added custom_api_request() function/method which allows a programmer to issue custom API requests that may not yet be supported by this client (to be used with care!)
added example to demonstrate use of custom_api_request()
removed repetitive code and optimized exec_curl() when creating the final payload, resulting in 10-20% performance increase and slightly lower memory consumption by PHP
2019-04-29 17:35:09 +02:00
malle-pietje
55867197e3 fixed functions assign_existing_admin() and invite_admin() to support controller versions 5.9 and higher because of changes in controller behavior 2019-01-21 09:41:47 +01:00
malle-pietje
78bed0895d minor code tweaks for improved readability
added function/method assign_existing_admin()
fixed code for function/method invite_admin()
2019-01-19 15:17:53 +01:00
malle-pietje
77cc1d87a4 made regex to extract cookies case insensitive, though this would only be needed for corner cases this is still RFC compliant (https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2)
changed the layout of the README file to put more emphasis on the installation options and the basic example, and less on the list of methods/functions
2018-12-14 11:27:20 +01:00
malle-pietje
5389f3a486 API client class v1.1.37
updated both READMEs
added cmd_stat() function, can currently only be used to reset DPI counters for the current site
added optional group_id parameter to list_firewallgroups() which allows you to select a single firewall group, thanks to @VWT-Dan for the suggestion
2018-11-05 12:18:10 +01:00
malle-pietje
2a566ad18a API client class v1.1.36
added methods stat_ips_events(), set_ips_settings_base(), supported with controllers 5.9.10 and higher
thanks go to @leonardogyn for providing access to a controller and test network for test/validation purposes
2018-10-24 09:54:43 +02:00
malle-pietje
1714e9587c general code cleanup
added spaces throughout Client.php following PSR-2 guidelines that were skipped with the previous commit
added visibility to constructor and destructor methods following PSR-2 recommendations
declare user and password properties and visibility following PSR-2 recommendations
updated README to add recently added functions/methods
minor general changes to the README
2018-10-20 14:29:08 +02:00
malle-pietje
cd92192cb8 API client class v1.1.34
- added spaces throughout Client.php following PSR-2 guidelines
- changed checks to prevent 0 (zero) values from being submitted to the API for routes where this can have negative side effects
2018-10-10 10:14:00 +02:00
malle-pietje
7c6cd4eb85 removed and added spaces, and changed brackets usage following PSR-2 guidelines 2018-10-02 13:16:48 +02:00
malle-pietje
30f4230cfd Merge branch 'master' of github.com:Art-of-WiFi/UniFi-API-client into tempbranch 2018-10-02 12:10:46 +02:00
Jamie Aitken
88263f6863 getters and setters for private variables (#28)
Merging PR #28
2018-10-02 11:12:34 +02:00