Commit Graph

329 Commits

Author SHA1 Message Date
Mateusz Filipowicz
ede158ad33 chore(deps): update golang to 1.23.5 2025-02-17 15:47:19 +01:00
dependabot[bot]
a3f50c64a9 chore(deps): bump github.com/golangci/golangci-lint from 1.64.2 to 1.64.5 (#19)
chore(deps): bump github.com/golangci/golangci-lint

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.64.2 to 1.64.5.
- [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.64.2...v1.64.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-17 15:46:29 +01:00
dependabot[bot]
75092b8220 chore(deps): bump github.com/go-playground/validator/v10 from 10.24.0 to 10.25.0 (#22)
chore(deps): bump github.com/go-playground/validator/v10

Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.24.0 to 10.25.0.
- [Release notes](https://github.com/go-playground/validator/releases)
- [Commits](https://github.com/go-playground/validator/compare/v10.24.0...v10.25.0)

---
updated-dependencies:
- dependency-name: github.com/go-playground/validator/v10
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-17 15:40:10 +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
fadc5ada8b feat: add client customization option (#20)
* feat: add client customization

* chore: fix linting

* feat: allow excluding client function by resource name
2025-02-16 23:00:05 +01:00
Mateusz Filipowicz
5a403dbb39 feat: simplified generated resources code customizations with yaml file config (#17)
* feat: simplified generated code customizations with yaml file config

* chore: apply linting
2025-02-12 09:18:44 +01:00
dependabot[bot]
8c99b428d9 chore(deps): bump github.com/golangci/golangci-lint from 1.63.4 to 1.64.2 (#16)
chore(deps): bump github.com/golangci/golangci-lint

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.63.4 to 1.64.2.
- [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.63.4...v1.64.2)

---
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>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-12 08:52:27 +01:00
dependabot[bot]
b964de6fcc chore(deps): bump golang.org/x/tools from 0.29.0 to 0.30.0 (#12)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.29.0 to 0.30.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.29.0...v0.30.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-12 00:33:23 +01:00
dependabot[bot]
f72f5799c4 chore(deps): bump golang.org/x/net from 0.34.0 to 0.35.0 (#13)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.34.0 to 0.35.0.
- [Commits](https://github.com/golang/net/compare/v0.34.0...v0.35.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-12 00:13:13 +01:00
Mateusz Filipowicz
bb21419c0e test: add comprehensive testing of codegen (#14) 2025-02-12 00:10:46 +01:00
Mateusz Filipowicz
6016a3d34a feat: add code generation for Unifi client interface (#11)
* feat: add code generation for Unifi client interface

* chore: apply linter hints

* chore: add tests

* fix: nondeterministic client function signature due to iteration of map params

* chore: add move version tests

* chore: add more generator tests

* chore: lint
2025-02-11 16:28:29 +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
dependabot[bot]
103da3baaa chore(deps): bump fgrosse/go-coverage-report from 1.1.1 to 1.2.0
Bumps [fgrosse/go-coverage-report](https://github.com/fgrosse/go-coverage-report) from 1.1.1 to 1.2.0.
- [Release notes](https://github.com/fgrosse/go-coverage-report/releases)
- [Changelog](https://github.com/fgrosse/go-coverage-report/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fgrosse/go-coverage-report/compare/v1.1.1...v1.2.0)

---
updated-dependencies:
- dependency-name: fgrosse/go-coverage-report
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 18:01:36 +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
9f4fe33d07 ci: code coverage reporting in PR 2025-02-09 14:24:03 +01:00
Mateusz Filipowicz
6d239a890b ci: enable coverage generation 2025-02-09 14:19:00 +01:00
Mateusz Filipowicz
32f8cbf789 chore: use GPG for signing release 2025-02-09 10:34:14 +01:00
Mateusz Filipowicz
1b3d2a51d8 chore: use Github changelog autogeneration with goreleaser 2025-02-09 05:07:06 +01:00
Mateusz Filipowicz
7675214e5b chore: fix release yml name for changelog generation configuration 2025-02-09 05:00:04 +01:00
Mateusz Filipowicz
7b61fb7857 ci: fetch full depth when releasing 2025-02-09 04:55:45 +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
e99645cf93 fix: renamed generator template to use ErrNotFound instead of NotFoundError 2025-02-09 02:07:44 +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
8a0cf33e75 chore: update go-git 2025-02-07 18:51:46 +01:00
Mateusz Filipowicz
cac05add7a docs: update README 2025-02-07 18:35:45 +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
f396b2f712 chore: improve logging and add trace logging with --trace flag 2025-02-07 17:42:05 +01:00
Mateusz Filipowicz
399c5cde86 ci: apply permissions and linting 2025-02-07 17:42:05 +01:00
Mateusz Filipowicz
2cfed99cf5 fix: arbitrary file access during archive extraction
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2025-02-07 17:42:05 +01:00
Mateusz Filipowicz
d3371d58bd chore: add missing .unifi-version file 2025-02-07 15:50:13 +01:00
Mateusz Filipowicz
0ad61e976a ci: run generation on pull request to ensure it works properly 2025-02-07 15:48:17 +01:00
Mateusz Filipowicz
d8f38a84e8 chore: applying linter fixes 2025-02-07 15:41:34 +01:00
Mateusz Filipowicz
384cd0a76f ci: add Unifi version used when updating generated controlled modules to commit and PR messages 2025-02-07 15:41:34 +01:00
Mateusz Filipowicz
a4652c03c2 ci: generate changelog based on labels 2025-02-07 15:41:34 +01:00
Mateusz Filipowicz
3db2b31f6f ci: assign automatically labels to PRs based on conventional commits 2025-02-07 15:41:34 +01:00
Mateusz Filipowicz
f794153790 feat: write used latest Unifi version to .unifi-version file to be used as marker 2025-02-07 15:41:34 +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
9b82c99bde Merge branch 'paultyng:main' into main 2025-02-04 18:02:30 +01:00
Mateusz Filipowicz
86740ec4d4 fix: add ulp_user_id to fix account tests (#241) 2025-01-07 23:40:16 +11: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