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.
This commit is contained in:
James Stephenson
2020-09-02 17:35:14 -04:00
committed by Paul Tyng
parent 35eda4f67b
commit bee58f48d4
8 changed files with 420 additions and 349 deletions

View File

@@ -23,15 +23,19 @@ type SpatialRecord struct {
NoDelete bool `json:"attr_no_delete,omitempty"`
NoEdit bool `json:"attr_no_edit,omitempty"`
Devices []struct {
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
Position struct {
X float64 `json:"x,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
Y float64 `json:"y,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
Z float64 `json:"z,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
} `json:"position,omitempty"`
} `json:"devices,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
Devices []SpatialRecord_Devices `json:"devices,omitempty"`
Name string `json:"name,omitempty"` // .{1,128}
}
type SpatialRecord_Devices struct {
MAC string `json:"mac,omitempty"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
Position SpatialRecord_Position `json:"position,omitempty"`
}
type SpatialRecord_Position struct {
X float64 `json:"x,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
Y float64 `json:"y,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
Z float64 `json:"z,omitempty"` // (^([-]?[\d]+)$)|(^([-]?[\d]+[.]?[\d]+)$)
}
func (c *Client) listSpatialRecord(ctx context.Context, site string) ([]SpatialRecord, error) {