Commit Graph

262 Commits

Author SHA1 Message Date
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
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
dependabot[bot]
21fdc16149 Bump github.com/golangci/golangci-lint from 1.62.2 to 1.63.4 (#237)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.62.2 to 1.63.4.
- [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.62.2...v1.63.4)

---
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-01-07 11:43:59 +11:00
dependabot[bot]
2702e091b8 Bump golang.org/x/tools from 0.27.0 to 0.29.0 (#238)
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.27.0 to 0.29.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.27.0...v0.29.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-01-07 11:40:08 +11:00
Mateusz Filipowicz
bee7bea744 feat: improve logging of code generator, including debug log option (#232) 2025-01-02 11:30:34 +11:00
dependabot[bot]
a03f10bb02 Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#229)
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.9.0...v1.10.0)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  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>
2024-11-26 20:37:37 +11:00
dependabot[bot]
cc7c842c80 Bump github.com/golangci/golangci-lint from 1.62.0 to 1.62.2 (#228)
Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.62.0 to 1.62.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.62.0...v1.62.2)

---
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>
2024-11-26 20:14:35 +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]
53b7fc278f Bump github.com/docker/docker (#226)
Bumps [github.com/docker/docker](https://github.com/docker/docker) from 26.1.3+incompatible to 26.1.5+incompatible.
- [Release notes](https://github.com/docker/docker/releases)
- [Commits](https://github.com/docker/docker/compare/v26.1.3...v26.1.5)

---
updated-dependencies:
- dependency-name: github.com/docker/docker
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-22 11:01:21 +11:00
dependabot[bot]
dc9df9cf2e Bump golangci/golangci-lint-action from 3 to 6 (#209)
* Bump golangci/golangci-lint-action from 3 to 6

Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3 to 6.
- [Release notes](https://github.com/golangci/golangci-lint-action/releases)
- [Commits](https://github.com/golangci/golangci-lint-action/compare/v3...v6)

---
updated-dependencies:
- dependency-name: golangci/golangci-lint-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

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

* Update config

---------

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:59:49 +11:00
dependabot[bot]
9ecd0f357a Bump peter-evans/create-pull-request from 6 to 7 (#221)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 6 to 7.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v6...v7)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-22 10:50:20 +11:00
dependabot[bot]
95ecc14af5 Bump github.com/goreleaser/goreleaser from 1.21.2 to 1.26.2 (#225)
Bumps [github.com/goreleaser/goreleaser](https://github.com/goreleaser/goreleaser) from 1.21.2 to 1.26.2.
- [Release notes](https://github.com/goreleaser/goreleaser/releases)
- [Changelog](https://github.com/goreleaser/goreleaser/blob/main/.goreleaser.yaml)
- [Commits](https://github.com/goreleaser/goreleaser/compare/v1.21.2...v1.26.2)

---
updated-dependencies:
- dependency-name: github.com/goreleaser/goreleaser
  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>
2024-11-22 10:49:19 +11:00
dependabot[bot]
bba57f4aa9 Bump github.com/golang-jwt/jwt/v4 from 4.5.0 to 4.5.1 (#223)
Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.0...v4.5.1)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-22 10:49:04 +11:00
dependabot[bot]
0f8f47edb0 Bump goreleaser/goreleaser-action from 5 to 6 (#222)
Bumps [goreleaser/goreleaser-action](https://github.com/goreleaser/goreleaser-action) from 5 to 6.
- [Release notes](https://github.com/goreleaser/goreleaser-action/releases)
- [Commits](https://github.com/goreleaser/goreleaser-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: goreleaser/goreleaser-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-22 10:46:52 +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
dependabot[bot]
31189f2e53 Bump github.com/sigstore/cosign/v2 from 2.2.1 to 2.2.4 (#204)
Bumps [github.com/sigstore/cosign/v2](https://github.com/sigstore/cosign) from 2.2.1 to 2.2.4.
- [Release notes](https://github.com/sigstore/cosign/releases)
- [Changelog](https://github.com/sigstore/cosign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sigstore/cosign/compare/v2.2.1...v2.2.4)

---
updated-dependencies:
- dependency-name: github.com/sigstore/cosign/v2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Josh Spence <jspence@anduril.com>
2024-11-12 19:24:32 +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
dependabot[bot]
d9b65a48c2 Bump github.com/ulikunitz/xz from 0.5.11 to 0.5.12 (#220)
Bumps [github.com/ulikunitz/xz](https://github.com/ulikunitz/xz) from 0.5.11 to 0.5.12.
- [Commits](https://github.com/ulikunitz/xz/compare/v0.5.11...v0.5.12)

---
updated-dependencies:
- dependency-name: github.com/ulikunitz/xz
  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>
2024-10-09 12:36:39 +11:00