38 Commits

Author SHA1 Message Date
shadyeip
74c1746ff5 feat: add network_ids support to FirewallZonePolicyDestination
- Add NetworkIDs and MatchOppositeNetworks fields to destination struct
- Add NETWORK to MatchingTarget validation for destination
- Update codegen schema to include destination network targeting
- Add AggregateNumPorts to DevicePortOverrides (compatibility fix)

This enables firewall zone policies to target specific destination
networks, matching the existing source.network_ids functionality.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 13:26:28 -05:00
filipowm
831fea8c4b feat: update to the controller version 9.2.87 2025-06-23 10:01:10 +02: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
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
d79f581c1f chore: apply linter fixes 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
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
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]
f3077d3b3c [create-pull-request] automated change (#143)
Co-authored-by: joshuaspence <joshuaspence@users.noreply.github.com>
2023-06-07 09:25:13 +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
49ed8b85a7 fix compile error 2022-10-31 15:53:30 -04:00
Paul Tyng
6de33139b5 change stp_priority to numberOrString 2022-10-31 15:48:42 -04:00
jeanluc
1ac863de1f Fix type of lte_ext_ant/lte_poe fields (#89) 2022-08-10 11:34:05 +10:00
github-actions[bot]
8f0bac78f6 [create-pull-request] automated change (#90)
Co-authored-by: joshuaspence <joshuaspence@users.noreply.github.com>
2022-08-10 11:06:46 +10:00
github-actions[bot]
9d4150d235 [create-pull-request] automated change (#63)
Co-authored-by: joshuaspence <joshuaspence@users.noreply.github.com>
2022-03-06 09:47:34 +11:00
Oskar
3e7bd072ea Omit empty NetworkID in account resource (#59)
* Omit empty NetworkID in account

* Run `go generate`

* Fix tests

Co-authored-by: Joshua Spence <josh@joshuaspence.com>
2022-01-31 15:58:42 +11:00
Joshua Spence
8d4ca5f389 Revert "Add controller version to generated files" (#47)
This reverts commit 13d5677bf3.
2021-09-24 07:21:34 +10:00
Joshua Spence
7d87194aef Update to latest controller version (#46)
* Update to latest controller version

* Fix tests
2021-09-21 23:26:12 +10:00
Joshua Spence
0cb7d3e514 Add AdoptDevice and ForgetDevice methods (#45)
* Add `AdoptDevice` and `ForgetDevice` methods

* Address comments
2021-09-17 11:16:56 +10:00
Paul Tyng
13d5677bf3 Add controller version to generated files 2021-08-31 09:02:23 -04:00
Johannes Heck
4e9d935af2 fix Ht fieldType for device import 2021-08-18 16:10:47 -04:00
Joshua Spence
a9d0f1de5a Use --latest 2021-08-11 11:40:15 +10:00
James Stephenson
fbed685c37 Fixing unmarshalling of numberOrString
New unmarshalling rules for fields which could be numeric or string
values were not properly typecasted upon being deserialized.

Cleaned up the api template file and moved custom unmarshalling type
logic into go code out of the template.
2021-04-16 13:41:01 -04:00
Paul Tyng
4ab4036985 Bump to 6.0.43, use go generate
Also moved fetching of JSON information to Go for cross-OS usage.
2021-04-09 09:51:50 -04:00
Paul Tyng
4702e34c81 Fix unmarshalling of tx_power 2021-03-21 21:34:29 -04:00
Paul Tyng
82a3baaf00 Handle marshaling of numbers and strings for channels 2021-03-21 21:13:58 -04:00
Paul Tyng
9c60a9de6f Change to string for auto support 2021-03-20 11:30:10 -04:00
Hendrik "T4cC0re" Meyer
4aed7d703d Generate UnmarshalJSON to handle emptyStringInt types
This commit changes the code generator to generate a `UnmarshalJSON` for each
struct, so that if unmarshalled it properly handles UniFis varying integer values
via the `emptyStringInt` type.

Structs not including a field of `int` type will still have the function generated,
but it will effectively do nothing.

Fixes #18
2021-01-03 13:21:53 -05:00
Paul Tyng
abc676f62b Add support for 6.0.23 2020-10-20 10:10:32 -04:00
James Stephenson
6203ee9620 Renaming PortConf to PortProfile; cleanup Device API func names 2020-10-09 08:56:24 -04:00
James Stephenson
e93f92a066 Expose Device API 2020-10-09 08:56:24 -04:00
James Stephenson
16c246525b Refactored field processing in generator.
* Allows for specifying more customizations per field in each type.
  Previously, the switch clause didn't allow sub-types to be modified, but
  that became a problem with some of the more complex types.

* Fixed several problematic fields in the Device resource

* Removed the underscore separator from generated type names
2020-09-10 08:50:21 -04:00
James Stephenson
fa5012f42a Updated types to 5.14.23 2020-09-10 08:50:21 -04:00
James Stephenson
bee58f48d4 Regenerated types so that sub-types are not embedded.
This allows callers to create complex payloads; for example, to create a
Device type for a Unifi Switch with PortOverrides, the caller needs to
create these sub-types, which is not possible when it's purely embedded.
2020-09-10 08:50:21 -04:00
James Stephenson
35eda4f67b Refactor type generator
* Allows for generating top-level types for any embedded struct so
  that sub-types can be properly instantiated from calling code
  * Specifying `-no-embedded-types` will generate top-level types
    rather than embedding the struct

* Refactored "Device" API
  * All fields set to `omitempty` because it describes all possible
    device types, so effectively any field could be omitted any time
  * Fixed `get` call for "Device" API; replacing `rest` with `stat`

* Generated `get` and `update` calls for `Setting*` APIs

* Added `5.14.23` JSON files
2020-09-10 08:50:21 -04:00
Paul Tyng
8e63bffebb Generate from 5.12.72 fields 2020-05-20 22:01:47 -04:00