Commit Graph

133 Commits

Author SHA1 Message Date
Mateusz Filipowicz
a10b02ca2c fix: revert allowed empty fields for NTP servers 2025-03-11 00:54:44 +01:00
Mateusz Filipowicz
55cfe22636 fix: allow more empty fields on rsyslogd, NTP, IPS and USG settings (#45) 2025-03-05 12:29:46 +01:00
Mateusz Filipowicz
278a72fbb9 feat: add support for uploading Hotspot Captive Portal files (like background image, logo) (#42)
* feat: add support for uploading Hotspot Captive Portal files (like background image, logo)

* feat: add UploadPortalFileFromReader
2025-03-03 02:03:10 +01:00
Mateusz Filipowicz
bdc73a9811 docs: fix invalid godoc for generated settings methods 2025-03-02 22:27:49 +01:00
Mateusz Filipowicz
a5955a6358 feat: support checking supported and enabled controller features (#41)
* feat: support checking supported and enabled controller features

* linting
2025-03-02 22:22:18 +01:00
Mateusz Filipowicz
4e6e9d97b7 fix: add missing ip_group_id to firewall zone policy to support firewall groups of address-group type (ipv4) (#39)
fixes #38
2025-03-02 21:15:18 +01:00
Mateusz Filipowicz
bbc373a354 fix: explicitly set Setting key when updating a settings (#37) 2025-02-23 14:00:19 +01:00
Mateusz Filipowicz
e79dcb13f0 feat: add logging and support for custom logger (#36)
* feat: add support for logging

* fix linting

* chore: remove old APIError in favor of ServerError
2025-02-23 12:59:46 +01:00
Mateusz Filipowicz
95a4ff87ea fix: add missing field mapping for settings (#35)
* feat: add missing field mapping for settings

* fix: guest access settings expire should be int
2025-02-21 16:53:43 +01:00
Mateusz Filipowicz
ae23f73810 fix: passing setting response body as pointer to Post method (#34) 2025-02-21 15:59:06 +01:00
Mateusz Filipowicz
637809c663 feat: support Zone-Based Firewalls (#33)
* feat: support Zone-Based Firewalls

* chore: add usage example of zone-based firewall

* chore: add note to readme to support unifi controller v2

* fix: invalid path for reordering firewall zone policies
2025-02-20 18:48:04 +01:00
Mateusz Filipowicz
16f71e7fe9 feat: add Version method to client to provide system version information (#32) 2025-02-19 09:19:20 +01:00
Mateusz Filipowicz
d3a3d5a342 feat: allow creating own http.RoundTripper for http.Client with HttpRoundTripperProvider when customizing pre-configured http.Transport with HttpTransportCustomizer is not sufficient (#31)
feat: allow creating own http.RoundTripper for http.Client with `HttpRoundTripperProvider` when customizing pre-configured http.Transport with `HttpTransportCustomizer` is not sufficient
2025-02-19 01:28:11 +01:00
Mateusz Filipowicz
7c7ef98c03 feat: rename HttpCustomizer to HttpTransportCustomizer and make it return http.Transport that is later used (#30)
* feat: rename HttpCustomizer to HttpTransportCustomizer and make it return http.Transport that is later used

* linting
2025-02-19 01:03:21 +01:00
Mateusz Filipowicz
35e7b2c3cc docs: add detailed usage documentation together with examples (#29)
* feat: rename Pass to Password in ClientConfig

* docs: add more detailed usage documentation together with examples

* chore: update issue templates

* docs: add codeowners, code of conduct and contributing docs

* chore: add editorconfig

* chore: apply linter
2025-02-18 22:36:08 +01:00
Mateusz Filipowicz
7432260d3e feat: expose all available actions on all resources through Client (#27) 2025-02-18 10:23:18 +01:00
Mateusz Filipowicz
7b35725921 feat(experimental): add support for reading and updating all settings (#25) 2025-02-18 07:43:04 +01:00
Mateusz Filipowicz
0e2736fa54 feat: remove deprecated SettingProviderCapabilities (#24) 2025-02-17 17:06:14 +01:00
Mateusz Filipowicz
aa188a6faa feat: add API v2 support by adding APGroup and DNSRecord resource handling with generated code (#23)
* feat: add API v2 support by adding APGroup and DNSRecord resource handling with generated code

* fix tests
2025-02-17 15:39:54 +01:00
Mateusz Filipowicz
dca894e8e7 feat: use Client interface instead of client struct when interacting with UniFi SDK (#21)
* feat: use Client interface instead of client struct when interacting with UniFi SDK

Breaking change!

* chore: linting

* chore: linting
2025-02-17 09:38:41 +01:00
Mateusz Filipowicz
c6e20b675c refactor: major refactor of unifi.go to split it into multiple files for cohesiveness and readability.
Even more documentation
2025-02-10 22:59:39 +01:00
Mateusz Filipowicz
473a5d0d5c chore: increase test coverage of unifi 2025-02-10 19:02:30 +01:00
Mateusz Filipowicz
35b786277c feat: use sysinfo API for getting system information with fallback to old API (#10)
* feat: use sysinfo API for getting system information with fallback to old API

* chore: apply linting
2025-02-10 18:43:20 +01:00
Mateusz Filipowicz
7f5968314d feat: make error handling more verbose and collect more error information from API errors, support API V2 error format (#8)
feat: make error handling more verbose and collect more error information from Unifi Controller, support API V2 error format
2025-02-10 03:03:56 +01:00
Mateusz Filipowicz
53bb1a13b9 feat: generate fields validation and use it when sending requests to API (#7)
* feat: generate fields validation and use it when issuing requests to API with soft (default) or hard modes

* chore: apply linter fixes

* feat: enable field validation on int fields

* feat: add validation for ^[\w]+$ fields

* feat: add validation for MAC address fields

* fix: trim wrappers for all comments

* feat: add validation for IPv4, IPv6 and IP(IPv4/IPv6) fields

* feat: add validation for numeric, non-zero based fields

* fix: one of validation can contain dot (.) sign in values

* feat: add second notation of MAC address validation

* fix: one of validation can start with ^( and end with )$

* feat: add option to disable validation and use soft validation by default

* chore: fix test

* docs: add readme about client-side validation
2025-02-09 21:08:21 +01:00
Mateusz Filipowicz
c7e81e2b18 feat: add validation of ClientConfig fields for improved data integrity (#5)
* feat: add validation of ClientConfig fields for improved data integrity

* chore: add tests for client config validation
2025-02-09 04:21:15 +01:00
Mateusz Filipowicz
d79f581c1f chore: apply linter fixes 2025-02-09 01:51:47 +01:00
Mateusz Filipowicz
685572d5ce test: add tests for Unifi client 2025-02-09 01:51:47 +01:00
Mateusz Filipowicz
f79f21c4ad feat: new, more customizable client supporting API Key and user/password authentication 2025-02-09 01:51:47 +01:00
Mateusz Filipowicz
e629288cba feat(codegen): rename "fields" to "codegen" for more meaningful naming 2025-02-07 17:42:05 +01:00
Mateusz Filipowicz
88080fe551 feat: add support for DNS records 2025-02-07 15:41:34 +01:00
Mateusz Filipowicz
c393dcbe71 fix: WAN network support was broken 2025-02-07 15:40:42 +01:00
Mateusz Filipowicz
4be261d2a8 feat: support update port profile API 2025-02-04 18:25:07 +01:00
Mateusz Filipowicz
5552bb8a2d fix: add ulp_user_id to fix account tests 2025-01-07 11:30:28 +01:00
Mateusz Filipowicz
3fda37369e feat: removed -latest flag and instead support latest version marker, refactor (#233)
* feat: remove -latest flag and instead support latest version marker

* refactor: move determining unifi version, download URL and downloading resources and field definitions to dedicated files

* refactor: move writing version file to version.go file

* refactor: move code generation code to dedicated generator.go file

* chore: fix linting issues

* chore: add version tests
2025-01-07 12:10:23 +11:00
oldztimer
df68605117 Add Error.Is interface method on the custom error type APIError. (#162)
This method supports doing "errors.Is" checks so downstream can handle API errors more specifically.

In my case, since I copied your lazyClient example, but I'm using it in a server, the Login needs to be refreshed if an API call errors out with "api.err.LoginRequired".
There was no clean way to check for this specific error in order to refresh the login and retry.
2025-01-07 12:02:23 +11:00
github-actions[bot]
525ebe5e22 [create-pull-request] automated change (#239)
Co-authored-by: joshuaspence <234676+joshuaspence@users.noreply.github.com>
2025-01-07 11:50:37 +11:00
Joshua Spence
7ebc6da3f8 Enable more golangci-lint rules (#227)
* WIP

* Enable `paralleltest` linter

* Enable `perfsprint` linter
2024-11-22 17:37:44 +11:00
dependabot[bot]
7af621d15f Bump github.com/golangci/golangci-lint from 1.55.2 to 1.62.0 (#224)
* Bump github.com/golangci/golangci-lint from 1.55.2 to 1.62.0

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.55.2 to 1.62.0.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/golangci/golangci-lint/compare/v1.55.2...v1.62.0)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Linter fixes

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Josh Spence <jspence@anduril.com>
2024-11-22 10:43:58 +11:00
github-actions[bot]
b0330e377b [create-pull-request] automated change (#156)
Co-authored-by: joshuaspence <234676+joshuaspence@users.noreply.github.com>
2024-11-12 19:20:44 +11:00
github-actions[bot]
513ba5f266 [create-pull-request] automated change (#153)
Co-authored-by: joshuaspence <joshuaspence@users.noreply.github.com>
2023-07-07 10:26:53 +10:00
Joshua Spence
206f4be940 Make golangci-lint more strict (#150)
* Reformat some YAML files

* Make `golangci-lint` more strict
2023-06-23 09:00:12 +10:00
jeanluc
2f40c2d150 Support firewall reorder command (#127) 2023-06-22 10:46:45 +10:00
Joshua Spence
1348f74e9e Fix tests for UniFi Network 7.4 (#146) 2023-06-07 13:21:32 +10:00
github-actions[bot]
f3077d3b3c [create-pull-request] automated change (#143)
Co-authored-by: joshuaspence <joshuaspence@users.noreply.github.com>
2023-06-07 09:25:13 +10:00
David Dollar
93d9584462 suport kick user call (#136)
* support kick user call

* fix kick-sta params
2023-05-26 10:40:57 +10:00
Joshua Spence
dd2fd56a6f Add more device fields (#111)
These fields will be used to improve acceptance tests.
2023-02-28 20:20:02 +11:00
Michon van Dooren
3add31c46b Don't omitempty Device.PortOverrides (#104) 2023-02-28 09:35:41 +11:00
github-actions[bot]
2ee9596dad [create-pull-request] automated change (#98)
Co-authored-by: joshuaspence <joshuaspence@users.noreply.github.com>
2023-02-15 13:10:53 +11:00
Paul Tyng
71e11b19f0 remove unused func (wrong signature) 2022-10-31 15:53:41 -04:00