Commit Graph

47 Commits

Author SHA1 Message Date
Patrick Collins c55b43115b login before checking status
the status enpoint requires auth, at least in my Cloud Key Firmware 2.X
(UniFi OS) setup.
Presumably there are benefits to checking status before logging in; in
which case I expect this PR will need to be edited.
2021-01-31 15:27:53 -05:00
dependabot[bot] b5c55d88f4 Bump github.com/iancoleman/strcase from 0.1.2 to 0.1.3
Bumps [github.com/iancoleman/strcase](https://github.com/iancoleman/strcase) from 0.1.2 to 0.1.3.
- [Release notes](https://github.com/iancoleman/strcase/releases)
- [Commits](https://github.com/iancoleman/strcase/compare/v0.1.2...v0.1.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-15 09:11:15 -05:00
dependabot[bot] 1aff93dbbb Bump github.com/stretchr/testify from 1.6.1 to 1.7.0
Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.6.1 to 1.7.0.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](https://github.com/stretchr/testify/compare/v1.6.1...v1.7.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-14 14:22:49 -05: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 c5ff8c8593 Allow unmarshalling of string for rule index 2020-12-01 12:31:29 -05:00
Paul Tyng 54b85782ca Cleanup mod 2020-12-01 12:31:12 -05:00
Russell Parks 55b1bac0bc Fix /status for UDMP (#17) 2020-11-02 13:15:08 -05:00
Paul Tyng abc676f62b Add support for 6.0.23 2020-10-20 10:10:32 -04:00
John Losito 020dad41e7 Allow dependabot to check go modules daily 2020-10-20 08:44:46 -04:00
Kurt McAlpine d14cec1fad Add method to get site 2020-10-13 09:08:26 -04:00
Kurt McAlpine cb425568b4 Add method to update site 2020-10-13 09:08:26 -04:00
Kurt McAlpine d6dded588f Add method to delete site 2020-10-13 09:08:26 -04:00
Kurt McAlpine de011d682d Add method to create site 2020-10-13 09:08:26 -04:00
Ben Davies df937016b0 Moved handling of string response to int using the existing emptyStringInt method as part of UnmarshalJSON as per Pauls suggestion 2020-10-09 13:42:28 -04:00
Ben Davies e7f9c5eb97 Added WAN egress qos fix 2020-10-09 13:42:28 -04:00
James Stephenson 6203ee9620 Renaming PortConf to PortProfile; cleanup Device API func names 2020-10-09 08:56:24 -04:00
James Stephenson 4b8ec1e2f8 Expose SettingRadius API 2020-10-09 08:56:24 -04:00
James Stephenson 3f0b230368 Expose SettingUsg API 2020-10-09 08:56:24 -04:00
James Stephenson e93f92a066 Expose Device API 2020-10-09 08:56:24 -04:00
James Stephenson 14e88eece9 Expose PortConf ("port profiles") API 2020-10-09 08:56:24 -04:00
Chris Hasenpflug b2581f5eb3 client: add content-type and csrf headers
required for UnifiOS controllers (UDM, UDM Pro)

Ref paultyng/terraform-provider-unifi#55
2020-10-03 20:40:42 -04:00
Paul Tyng 8f15aa6dff gofmt -s 2020-09-24 16:57:25 -04:00
Paul Tyng 3d37110380 Fix API path style issues on UDM Pro API proxy 2020-09-24 16:57:04 -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 79542b4006 Expose routing API 2020-08-27 23:06:31 -04:00
Paul Tyng 5726e0ab76 sort ascending 2020-08-27 21:52:32 -04:00
Paul Tyng 1e71303dd8 Merge pull request #6 from paultyng/account
Expose the Account API (RADIUS users)
2020-08-27 21:49:47 -04:00
James Stephenson 47fa522aba Expose the Account API (RADIUS users)
* Adds Account CRUD API
* Enahnces `emptyStringInt` with a predicate for dynamically setting
  which value should be interpreted as a blank JSON payload
2020-08-27 21:48:13 -04:00
Paul Tyng ae40573bb7 Surface radius profiles 2020-05-20 22:01:47 -04:00
Paul Tyng 8e63bffebb Generate from 5.12.72 fields 2020-05-20 22:01:47 -04:00
Paul Tyng 3d21ebbab0 Add 5.12.72 fields JSON 2020-05-20 22:01:47 -04:00
Paul Tyng f0da875a46 Improve fields fetching 2020-05-20 22:01:47 -04:00
Paul Tyng 2c982433c3 Return wrapped errors in client 2020-03-26 16:13:57 -04:00
Paul Tyng f74d29bd54 Fix empty string int marshalling in go 1.14 2020-03-26 16:13:36 -04:00
Paul Tyng d076e78005 Add context support 2020-03-26 16:12:52 -04:00
Paul Tyng 19709dff50 Add support for IP on User 2020-02-19 10:32:44 -05:00
Paul Tyng 3fb1d0badb Fix unmarshaling of dhcpd_leasetime
Issue #2
2020-02-10 11:07:31 -05:00
Paul Tyng 95a2437dcc Fix maxsta unmarshaling 2020-02-06 11:12:45 -05:00
Paul Tyng f740d52490 Typo 2020-02-02 15:58:43 -05:00
Paul Tyng 1f8ef07e63 Cleanup firewall rule names 2020-01-12 10:30:42 -05:00
Paul Tyng 091aff2b90 Update README.md 2020-01-12 10:15:02 -05:00
Paul Tyng 2849cbdf67 Update README.md 2020-01-10 14:44:53 -05:00
Paul Tyng ca7112178a Add godoc badge 2020-01-10 14:37:27 -05:00
Paul Tyng 435ecf9d6f Initial version
Extracted from paultyng/terraform-provider-unifi@ef25893f14
2020-01-10 14:31:12 -05:00