diff --git a/fields/api.go.tmpl b/fields/api.go.tmpl index d0dadeb..47c9a7f 100644 --- a/fields/api.go.tmpl +++ b/fields/api.go.tmpl @@ -64,6 +64,8 @@ func (dst *{{ $k }}) UnmarshalJSON(b []byte) error { } {{ end }} +{{- $apiVersion2 := or (eq .StructName "APGroup") (eq .StructName "DNSRecord") }} + {{ if not .IsSetting }} func (c *Client) list{{ .StructName }}(ctx context.Context, site string) ([]{{ .StructName }}, error) { var respBody struct { @@ -71,7 +73,7 @@ func (c *Client) list{{ .StructName }}(ctx context.Context, site string) ([]{{ . Data []{{ .StructName }} `json:"data"` } - err := c.do(ctx, "GET", fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat/{{else if eq .StructName "APGroup" }}{{ else }}rest/{{ end }}{{ .ResourcePath }}", site), nil, &respBody) + err := c.do(ctx, "GET", fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat/{{ else if $apiVersion2 }}{{ else }}rest/{{ end }}{{ .ResourcePath }}", site), nil, &respBody) if err != nil { return nil, err } @@ -88,7 +90,7 @@ func (c *Client) get{{ .StructName }}(ctx context.Context, site{{ if not .IsSett {{ if .IsSetting }} err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/{{ .ResourcePath }}", site), nil, &respBody) {{- else }} - err := c.do(ctx, "GET", fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat{{ else }}rest{{ end }}/{{ .ResourcePath }}/%s", site, id), nil, &respBody) + err := c.do(ctx, "GET", fmt.Sprintf("{{ if eq .StructName "DNSRecord" }}%s/site/%s/{{ .ResourcePath }}/%s", c.apiV2Path{{ else }}s/%s/{{ if eq .StructName "Device" }}stat/{{ else }}rest/{{ end }}{{ .ResourcePath }}/%s"{{ end }}, site, id), nil, &respBody) {{- end }} if err != nil { return nil, err @@ -104,7 +106,7 @@ func (c *Client) get{{ .StructName }}(ctx context.Context, site{{ if not .IsSett {{ if not .IsSetting }} func (c *Client) delete{{ .StructName }}(ctx context.Context, site, id string) error { - err := c.do(ctx, "DELETE", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}/%s", site, id), struct{}{}, nil) + err := c.do(ctx, "DELETE", fmt.Sprintf("{{ if eq .StructName "DNSRecord" }}%s/site/%s/{{ .ResourcePath }}/%s", c.apiV2Path{{ else }}s/%s/rest/{{ .ResourcePath }}/%s"{{ end }}, site, id), struct{}{}, nil) if err != nil { return err } @@ -117,7 +119,7 @@ func (c *Client) create{{ .StructName }}(ctx context.Context, site string, d *{{ Data []{{ .StructName }} `json:"data"` } - err := c.do(ctx, "POST", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}", site), d, &respBody) + err := c.do(ctx, "POST", fmt.Sprintf("{{ if eq .StructName "DNSRecord" }}%s/site/%s/{{ .ResourcePath }}", c.apiV2Path{{ else }}s/%s/rest/{{ .ResourcePath }}"{{ end }}, site), d, &respBody) if err != nil { return nil, err } @@ -141,7 +143,7 @@ func (c *Client) update{{ .StructName }}(ctx context.Context, site string, d *{{ d.Key = "{{ .ResourcePath }}" err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/{{ .ResourcePath }}", site), d, &respBody) {{- else }} - err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}/%s", site, d.ID), d, &respBody) + err := c.do(ctx, "PUT", fmt.Sprintf("{{ if eq .StructName "DNSRecord" }}%s/site/%s/{{ .ResourcePath }}/%s", c.apiV2Path{{ else }}s/%s/rest/{{ .ResourcePath }}/%s"{{ end }}, site, d.ID), d, &respBody) {{- end }} if err != nil { return nil, err diff --git a/fields/client.go.tmpl b/fields/client.go.tmpl new file mode 100644 index 0000000..951c99f --- /dev/null +++ b/fields/client.go.tmpl @@ -0,0 +1,51 @@ +{{- $structName := .StructName }} + +{{ define "field" }} + {{ .FieldName }} {{ if .IsArray }}[]{{end}}{{ .FieldType }} `json:"{{ .JSONName }}{{ if .OmitEmpty }},omitempty{{ end }}"` {{ if .FieldValidation }}// {{ .FieldValidation }}{{ end }} {{- end }} +{{ define "field-customUnmarshalType" }} + {{- if eq .CustomUnmarshalType "" }}{{else}} + {{ .FieldName }} {{ if .IsArray }}[]{{end}}{{ .CustomUnmarshalType }} `json:"{{ .JSONName }}"`{{ end }} {{- end }} +{{ define "typecast" }} + {{- if ne .CustomUnmarshalFunc "" }} + dst.{{ .FieldName }}= {{ .CustomUnmarshalFunc }}(aux.{{ .FieldName }}) + {{- else if eq .CustomUnmarshalType "" }}{{else}} + {{- if .IsArray }} + dst.{{ .FieldName }}= make([]{{ .FieldType }}, len(aux.{{ .FieldName }})) + for i, v := range aux.{{ .FieldName }} { + dst.{{ .FieldName }}[i] = {{ .FieldType }}(v) + } + {{- else }} + dst.{{ .FieldName }} = {{ .FieldType }}(aux.{{ .FieldName }}) + {{- end }}{{- end }}{{- end }} +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +{{ if not .IsSetting }} +func (c *Client) List{{ .StructName }}(ctx context.Context, site string) ([]{{ .StructName }}, error) { + return c.list{{ .StructName }}(ctx, site) +} +{{- end }} + +func (c *Client) Get{{ .StructName }}(ctx context.Context, site{{ if not .IsSetting }}, id{{ end }} string) (*{{ .StructName }}, error) { + return c.get{{ .StructName }}(ctx, site{{ if not .IsSetting }}, id{{ end }}) +} + +{{ if not .IsSetting }} +func (c *Client) Delete{{ .StructName }}(ctx context.Context, site, id string) error { + return c.delete{{ .StructName }}(ctx, site, id) +} + +func (c *Client) Create{{ .StructName }}(ctx context.Context, site string, d *{{ .StructName }}) (*{{ .StructName }}, error) { + return c.create{{ .StructName }}(ctx, site, d) +} +{{- end }} + +func (c *Client) Update{{ .StructName }}(ctx context.Context, site string, d *{{ .StructName }}) (*{{ .StructName }}, error) { + return c.update{{ .StructName }}(ctx, site, d) +} \ No newline at end of file diff --git a/fields/custom/DNSRecord.json b/fields/custom/DNSRecord.json new file mode 100644 index 0000000..a7ba1cd --- /dev/null +++ b/fields/custom/DNSRecord.json @@ -0,0 +1,10 @@ +{ + "enabled": "false|true", + "key": ".{1,128}", + "port": "[0-9]{1,8}", + "priority": ".{1,128}", + "record_type": "A|AAAA|CNAME|MX|NS|PTR|SOA|SRV|TXT", + "ttl": "[0-9]{1,10}", + "value": ".{1,256}", + "weight": "[0-9]{1,10}" +} diff --git a/fields/extract.go b/fields/extract.go index 4481ebf..96c172a 100644 --- a/fields/extract.go +++ b/fields/extract.go @@ -159,6 +159,63 @@ func extractJSON(jarFile, fieldsDir string) error { } } + wd, err := os.Getwd() + if err != nil { + panic(err) + } + + rootDir := findModuleRoot(wd) + srcDir := path.Join(rootDir, "fields") + + files, err := os.ReadDir(path.Join(srcDir, "custom")) + if err != nil { + return fmt.Errorf("unable to read custom directory: %w", err) + } + + for _, file := range files { + if !file.IsDir() { + fs, err := os.Open(path.Join(srcDir, "custom", file.Name())) + if err != nil { + return fmt.Errorf("unable to open file: %w", err) + } + defer fs.Close() + rf, err := os.Create(filepath.Join(fieldsDir, file.Name())) + if err != nil { + return fmt.Errorf("unable to create file: %w", err) + } + defer rf.Close() + _, err = io.Copy(rf, fs) + if err != nil { + return fmt.Errorf("unable to copy file: %w", err) + } + _, err = io.ReadAll(fs) + if err != nil { + return fmt.Errorf("unable to read file: %w", err) + } + + } + fmt.Println(file.Name(), file.IsDir()) + } + // TODO: cleanup JSON return nil } + +func findModuleRoot(dir string) (roots string) { + if dir == "" { + panic("dir not set") + } + dir = filepath.Clean(dir) + // Look for enclosing go.mod. + for { + if fi, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil && !fi.IsDir() { + return dir + } + d := filepath.Dir(dir) + if d == dir { + break + } + dir = d + } + return "" +} diff --git a/fields/main.go b/fields/main.go index e777041..eb81f5b 100644 --- a/fields/main.go +++ b/fields/main.go @@ -148,6 +148,8 @@ func NewResource(structName string, resourcePath string) *Resource { // Removed in v7, retaining for backwards compatibility baseType.Fields["MdnsEnabled"] = NewFieldInfo("MdnsEnabled", "mdns_enabled", "bool", "", false, false, "") } + case resource.StructName == "DNSRecord": + resource.ResourcePath = "static-dns" case resource.StructName == "Device": baseType.Fields[" MAC"] = NewFieldInfo("MAC", "mac", "string", "", true, false, "") baseType.Fields["Adopted"] = NewFieldInfo("Adopted", "adopted", "bool", "", false, false, "") @@ -429,7 +431,7 @@ func main() { } var code string - if code, err = resource.generateCode(); err != nil { + if code, err = resource.generateCode(false); err != nil { panic(err) } @@ -437,6 +439,22 @@ func main() { if err := os.WriteFile(filepath.Join(outDir, goFile), ([]byte)(code), 0o644); err != nil { panic(err) } + + implFile := strcase.ToSnake(structName) + ".go" + implFilePath := filepath.Join(outDir, implFile) + + if _, err := os.Stat(implFilePath); err != nil { + if errors.Is(err, os.ErrNotExist) { + var implCode string + if implCode, err = resource.generateCode(true); err != nil { + panic(err) + } + + if err := os.WriteFile(filepath.Join(implFilePath), ([]byte)(implCode), 0o644); err != nil { + panic(err) + } + } + } } // Write version file. @@ -583,12 +601,20 @@ func (r *Resource) processJSON(b []byte) error { //go:embed api.go.tmpl var apiGoTemplate string -func (r *Resource) generateCode() (string, error) { +//go:embed client.go.tmpl +var clientGoTemplate string + +func (r *Resource) generateCode(isImpl bool) (string, error) { var err error var buf bytes.Buffer writer := io.Writer(&buf) - tpl := template.Must(template.New("api.go.tmpl").Parse(apiGoTemplate)) + var tpl *template.Template + if isImpl { + tpl = template.Must(template.New("client.go.tmpl").Parse(clientGoTemplate)) + } else { + tpl = template.Must(template.New("api.go.tmpl").Parse(apiGoTemplate)) + } err = tpl.Execute(writer, r) if err != nil { diff --git a/unifi/broadcast_group.go b/unifi/broadcast_group.go new file mode 100644 index 0000000..951dcdb --- /dev/null +++ b/unifi/broadcast_group.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListBroadcastGroup(ctx context.Context, site string) ([]BroadcastGroup, error) { + return c.listBroadcastGroup(ctx, site) +} + +func (c *Client) GetBroadcastGroup(ctx context.Context, site, id string) (*BroadcastGroup, error) { + return c.getBroadcastGroup(ctx, site, id) +} + +func (c *Client) DeleteBroadcastGroup(ctx context.Context, site, id string) error { + return c.deleteBroadcastGroup(ctx, site, id) +} + +func (c *Client) CreateBroadcastGroup(ctx context.Context, site string, d *BroadcastGroup) (*BroadcastGroup, error) { + return c.createBroadcastGroup(ctx, site, d) +} + +func (c *Client) UpdateBroadcastGroup(ctx context.Context, site string, d *BroadcastGroup) (*BroadcastGroup, error) { + return c.updateBroadcastGroup(ctx, site, d) +} diff --git a/unifi/channel_plan.go b/unifi/channel_plan.go new file mode 100644 index 0000000..412dd75 --- /dev/null +++ b/unifi/channel_plan.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListChannelPlan(ctx context.Context, site string) ([]ChannelPlan, error) { + return c.listChannelPlan(ctx, site) +} + +func (c *Client) GetChannelPlan(ctx context.Context, site, id string) (*ChannelPlan, error) { + return c.getChannelPlan(ctx, site, id) +} + +func (c *Client) DeleteChannelPlan(ctx context.Context, site, id string) error { + return c.deleteChannelPlan(ctx, site, id) +} + +func (c *Client) CreateChannelPlan(ctx context.Context, site string, d *ChannelPlan) (*ChannelPlan, error) { + return c.createChannelPlan(ctx, site, d) +} + +func (c *Client) UpdateChannelPlan(ctx context.Context, site string, d *ChannelPlan) (*ChannelPlan, error) { + return c.updateChannelPlan(ctx, site, d) +} diff --git a/unifi/dashboard.go b/unifi/dashboard.go new file mode 100644 index 0000000..30df90c --- /dev/null +++ b/unifi/dashboard.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListDashboard(ctx context.Context, site string) ([]Dashboard, error) { + return c.listDashboard(ctx, site) +} + +func (c *Client) GetDashboard(ctx context.Context, site, id string) (*Dashboard, error) { + return c.getDashboard(ctx, site, id) +} + +func (c *Client) DeleteDashboard(ctx context.Context, site, id string) error { + return c.deleteDashboard(ctx, site, id) +} + +func (c *Client) CreateDashboard(ctx context.Context, site string, d *Dashboard) (*Dashboard, error) { + return c.createDashboard(ctx, site, d) +} + +func (c *Client) UpdateDashboard(ctx context.Context, site string, d *Dashboard) (*Dashboard, error) { + return c.updateDashboard(ctx, site, d) +} diff --git a/unifi/dhcp_option.go b/unifi/dhcp_option.go new file mode 100644 index 0000000..1371427 --- /dev/null +++ b/unifi/dhcp_option.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListDHCPOption(ctx context.Context, site string) ([]DHCPOption, error) { + return c.listDHCPOption(ctx, site) +} + +func (c *Client) GetDHCPOption(ctx context.Context, site, id string) (*DHCPOption, error) { + return c.getDHCPOption(ctx, site, id) +} + +func (c *Client) DeleteDHCPOption(ctx context.Context, site, id string) error { + return c.deleteDHCPOption(ctx, site, id) +} + +func (c *Client) CreateDHCPOption(ctx context.Context, site string, d *DHCPOption) (*DHCPOption, error) { + return c.createDHCPOption(ctx, site, d) +} + +func (c *Client) UpdateDHCPOption(ctx context.Context, site string, d *DHCPOption) (*DHCPOption, error) { + return c.updateDHCPOption(ctx, site, d) +} diff --git a/unifi/dns_record.generated.go b/unifi/dns_record.generated.go new file mode 100644 index 0000000..0fcb8ba --- /dev/null +++ b/unifi/dns_record.generated.go @@ -0,0 +1,140 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + "encoding/json" + "fmt" +) + +// just to fix compile issues with the import +var ( + _ context.Context + _ fmt.Formatter + _ json.Marshaler +) + +type DNSRecord struct { + ID string `json:"_id,omitempty"` + SiteID string `json:"site_id,omitempty"` + + Hidden bool `json:"attr_hidden,omitempty"` + HiddenID string `json:"attr_hidden_id,omitempty"` + NoDelete bool `json:"attr_no_delete,omitempty"` + NoEdit bool `json:"attr_no_edit,omitempty"` + + Enabled bool `json:"enabled"` + Key string `json:"key,omitempty"` // .{1,128} + Port int `json:"port,omitempty"` + Priority string `json:"priority,omitempty"` // .{1,128} + RecordType string `json:"record_type,omitempty"` // A|AAAA|CNAME|MX|NS|PTR|SOA|SRV|TXT + Ttl int `json:"ttl,omitempty"` + Value string `json:"value,omitempty"` // .{1,256} + Weight int `json:"weight,omitempty"` +} + +func (dst *DNSRecord) UnmarshalJSON(b []byte) error { + type Alias DNSRecord + aux := &struct { + Port emptyStringInt `json:"port"` + Ttl emptyStringInt `json:"ttl"` + Weight emptyStringInt `json:"weight"` + + *Alias + }{ + Alias: (*Alias)(dst), + } + + err := json.Unmarshal(b, &aux) + if err != nil { + return fmt.Errorf("unable to unmarshal alias: %w", err) + } + dst.Port = int(aux.Port) + dst.Ttl = int(aux.Ttl) + dst.Weight = int(aux.Weight) + + return nil +} + +func (c *Client) listDNSRecord(ctx context.Context, site string) ([]DNSRecord, error) { + var respBody struct { + Meta meta `json:"meta"` + Data []DNSRecord `json:"data"` + } + + err := c.do(ctx, "GET", fmt.Sprintf("s/%s/static-dns", site), nil, &respBody) + if err != nil { + return nil, err + } + + return respBody.Data, nil +} + +func (c *Client) getDNSRecord(ctx context.Context, site, id string) (*DNSRecord, error) { + var respBody struct { + Meta meta `json:"meta"` + Data []DNSRecord `json:"data"` + } + + err := c.do(ctx, "GET", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, site, id), nil, &respBody) + if err != nil { + return nil, err + } + + if len(respBody.Data) != 1 { + return nil, &NotFoundError{} + } + + d := respBody.Data[0] + return &d, nil +} + +func (c *Client) deleteDNSRecord(ctx context.Context, site, id string) error { + err := c.do(ctx, "DELETE", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, site, id), struct{}{}, nil) + if err != nil { + return err + } + return nil +} + +func (c *Client) createDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) { + var respBody struct { + Meta meta `json:"meta"` + Data []DNSRecord `json:"data"` + } + + err := c.do(ctx, "POST", fmt.Sprintf("%s/site/%s/static-dns", c.apiV2Path, site), d, &respBody) + if err != nil { + return nil, err + } + + if len(respBody.Data) != 1 { + return nil, &NotFoundError{} + } + + new := respBody.Data[0] + + return &new, nil +} + +func (c *Client) updateDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) { + var respBody struct { + Meta meta `json:"meta"` + Data []DNSRecord `json:"data"` + } + + err := c.do(ctx, "PUT", fmt.Sprintf("%s/site/%s/static-dns/%s", c.apiV2Path, site, d.ID), d, &respBody) + if err != nil { + return nil, err + } + + if len(respBody.Data) != 1 { + return nil, &NotFoundError{} + } + + new := respBody.Data[0] + + return &new, nil +} diff --git a/unifi/dns_record.go b/unifi/dns_record.go new file mode 100644 index 0000000..62c5cdb --- /dev/null +++ b/unifi/dns_record.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListDNSRecord(ctx context.Context, site string) ([]DNSRecord, error) { + return c.listDNSRecord(ctx, site) +} + +func (c *Client) GetDNSRecord(ctx context.Context, site, id string) (*DNSRecord, error) { + return c.getDNSRecord(ctx, site, id) +} + +func (c *Client) DeleteDNSRecord(ctx context.Context, site, id string) error { + return c.deleteDNSRecord(ctx, site, id) +} + +func (c *Client) CreateDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) { + return c.createDNSRecord(ctx, site, d) +} + +func (c *Client) UpdateDNSRecord(ctx context.Context, site string, d *DNSRecord) (*DNSRecord, error) { + return c.updateDNSRecord(ctx, site, d) +} diff --git a/unifi/dpi_app.go b/unifi/dpi_app.go new file mode 100644 index 0000000..993771b --- /dev/null +++ b/unifi/dpi_app.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListDpiApp(ctx context.Context, site string) ([]DpiApp, error) { + return c.listDpiApp(ctx, site) +} + +func (c *Client) GetDpiApp(ctx context.Context, site, id string) (*DpiApp, error) { + return c.getDpiApp(ctx, site, id) +} + +func (c *Client) DeleteDpiApp(ctx context.Context, site, id string) error { + return c.deleteDpiApp(ctx, site, id) +} + +func (c *Client) CreateDpiApp(ctx context.Context, site string, d *DpiApp) (*DpiApp, error) { + return c.createDpiApp(ctx, site, d) +} + +func (c *Client) UpdateDpiApp(ctx context.Context, site string, d *DpiApp) (*DpiApp, error) { + return c.updateDpiApp(ctx, site, d) +} diff --git a/unifi/dpi_group.go b/unifi/dpi_group.go new file mode 100644 index 0000000..aaebf78 --- /dev/null +++ b/unifi/dpi_group.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListDpiGroup(ctx context.Context, site string) ([]DpiGroup, error) { + return c.listDpiGroup(ctx, site) +} + +func (c *Client) GetDpiGroup(ctx context.Context, site, id string) (*DpiGroup, error) { + return c.getDpiGroup(ctx, site, id) +} + +func (c *Client) DeleteDpiGroup(ctx context.Context, site, id string) error { + return c.deleteDpiGroup(ctx, site, id) +} + +func (c *Client) CreateDpiGroup(ctx context.Context, site string, d *DpiGroup) (*DpiGroup, error) { + return c.createDpiGroup(ctx, site, d) +} + +func (c *Client) UpdateDpiGroup(ctx context.Context, site string, d *DpiGroup) (*DpiGroup, error) { + return c.updateDpiGroup(ctx, site, d) +} diff --git a/unifi/heat_map.go b/unifi/heat_map.go new file mode 100644 index 0000000..da85c95 --- /dev/null +++ b/unifi/heat_map.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListHeatMap(ctx context.Context, site string) ([]HeatMap, error) { + return c.listHeatMap(ctx, site) +} + +func (c *Client) GetHeatMap(ctx context.Context, site, id string) (*HeatMap, error) { + return c.getHeatMap(ctx, site, id) +} + +func (c *Client) DeleteHeatMap(ctx context.Context, site, id string) error { + return c.deleteHeatMap(ctx, site, id) +} + +func (c *Client) CreateHeatMap(ctx context.Context, site string, d *HeatMap) (*HeatMap, error) { + return c.createHeatMap(ctx, site, d) +} + +func (c *Client) UpdateHeatMap(ctx context.Context, site string, d *HeatMap) (*HeatMap, error) { + return c.updateHeatMap(ctx, site, d) +} diff --git a/unifi/heat_map_point.go b/unifi/heat_map_point.go new file mode 100644 index 0000000..4e8a5a1 --- /dev/null +++ b/unifi/heat_map_point.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListHeatMapPoint(ctx context.Context, site string) ([]HeatMapPoint, error) { + return c.listHeatMapPoint(ctx, site) +} + +func (c *Client) GetHeatMapPoint(ctx context.Context, site, id string) (*HeatMapPoint, error) { + return c.getHeatMapPoint(ctx, site, id) +} + +func (c *Client) DeleteHeatMapPoint(ctx context.Context, site, id string) error { + return c.deleteHeatMapPoint(ctx, site, id) +} + +func (c *Client) CreateHeatMapPoint(ctx context.Context, site string, d *HeatMapPoint) (*HeatMapPoint, error) { + return c.createHeatMapPoint(ctx, site, d) +} + +func (c *Client) UpdateHeatMapPoint(ctx context.Context, site string, d *HeatMapPoint) (*HeatMapPoint, error) { + return c.updateHeatMapPoint(ctx, site, d) +} diff --git a/unifi/hotspot_2_conf.go b/unifi/hotspot_2_conf.go new file mode 100644 index 0000000..541d45a --- /dev/null +++ b/unifi/hotspot_2_conf.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListHotspot2Conf(ctx context.Context, site string) ([]Hotspot2Conf, error) { + return c.listHotspot2Conf(ctx, site) +} + +func (c *Client) GetHotspot2Conf(ctx context.Context, site, id string) (*Hotspot2Conf, error) { + return c.getHotspot2Conf(ctx, site, id) +} + +func (c *Client) DeleteHotspot2Conf(ctx context.Context, site, id string) error { + return c.deleteHotspot2Conf(ctx, site, id) +} + +func (c *Client) CreateHotspot2Conf(ctx context.Context, site string, d *Hotspot2Conf) (*Hotspot2Conf, error) { + return c.createHotspot2Conf(ctx, site, d) +} + +func (c *Client) UpdateHotspot2Conf(ctx context.Context, site string, d *Hotspot2Conf) (*Hotspot2Conf, error) { + return c.updateHotspot2Conf(ctx, site, d) +} diff --git a/unifi/hotspot_op.go b/unifi/hotspot_op.go new file mode 100644 index 0000000..f70bcf1 --- /dev/null +++ b/unifi/hotspot_op.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListHotspotOp(ctx context.Context, site string) ([]HotspotOp, error) { + return c.listHotspotOp(ctx, site) +} + +func (c *Client) GetHotspotOp(ctx context.Context, site, id string) (*HotspotOp, error) { + return c.getHotspotOp(ctx, site, id) +} + +func (c *Client) DeleteHotspotOp(ctx context.Context, site, id string) error { + return c.deleteHotspotOp(ctx, site, id) +} + +func (c *Client) CreateHotspotOp(ctx context.Context, site string, d *HotspotOp) (*HotspotOp, error) { + return c.createHotspotOp(ctx, site, d) +} + +func (c *Client) UpdateHotspotOp(ctx context.Context, site string, d *HotspotOp) (*HotspotOp, error) { + return c.updateHotspotOp(ctx, site, d) +} diff --git a/unifi/hotspot_package.go b/unifi/hotspot_package.go new file mode 100644 index 0000000..40c1675 --- /dev/null +++ b/unifi/hotspot_package.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListHotspotPackage(ctx context.Context, site string) ([]HotspotPackage, error) { + return c.listHotspotPackage(ctx, site) +} + +func (c *Client) GetHotspotPackage(ctx context.Context, site, id string) (*HotspotPackage, error) { + return c.getHotspotPackage(ctx, site, id) +} + +func (c *Client) DeleteHotspotPackage(ctx context.Context, site, id string) error { + return c.deleteHotspotPackage(ctx, site, id) +} + +func (c *Client) CreateHotspotPackage(ctx context.Context, site string, d *HotspotPackage) (*HotspotPackage, error) { + return c.createHotspotPackage(ctx, site, d) +} + +func (c *Client) UpdateHotspotPackage(ctx context.Context, site string, d *HotspotPackage) (*HotspotPackage, error) { + return c.updateHotspotPackage(ctx, site, d) +} diff --git a/unifi/json.go b/unifi/json.go index be950a8..3c009bc 100644 --- a/unifi/json.go +++ b/unifi/json.go @@ -86,5 +86,5 @@ func (e *booleanishString) UnmarshalJSON(b []byte) error { *e = booleanishString(false) return nil } - return errors.New("Could not unmarshal JSON value.") + return errors.New("could not unmarshal JSON value") } diff --git a/unifi/map.go b/unifi/map.go new file mode 100644 index 0000000..295c3bf --- /dev/null +++ b/unifi/map.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListMap(ctx context.Context, site string) ([]Map, error) { + return c.listMap(ctx, site) +} + +func (c *Client) GetMap(ctx context.Context, site, id string) (*Map, error) { + return c.getMap(ctx, site, id) +} + +func (c *Client) DeleteMap(ctx context.Context, site, id string) error { + return c.deleteMap(ctx, site, id) +} + +func (c *Client) CreateMap(ctx context.Context, site string, d *Map) (*Map, error) { + return c.createMap(ctx, site, d) +} + +func (c *Client) UpdateMap(ctx context.Context, site string, d *Map) (*Map, error) { + return c.updateMap(ctx, site, d) +} diff --git a/unifi/media_file.go b/unifi/media_file.go new file mode 100644 index 0000000..680f13e --- /dev/null +++ b/unifi/media_file.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) ListMediaFile(ctx context.Context, site string) ([]MediaFile, error) { + return c.listMediaFile(ctx, site) +} + +func (c *Client) GetMediaFile(ctx context.Context, site, id string) (*MediaFile, error) { + return c.getMediaFile(ctx, site, id) +} + +func (c *Client) DeleteMediaFile(ctx context.Context, site, id string) error { + return c.deleteMediaFile(ctx, site, id) +} + +func (c *Client) CreateMediaFile(ctx context.Context, site string, d *MediaFile) (*MediaFile, error) { + return c.createMediaFile(ctx, site, d) +} + +func (c *Client) UpdateMediaFile(ctx context.Context, site string, d *MediaFile) (*MediaFile, error) { + return c.updateMediaFile(ctx, site, d) +} diff --git a/unifi/schedule_task.go b/unifi/schedule_task.go new file mode 100644 index 0000000..d0067ad --- /dev/null +++ b/unifi/schedule_task.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) ListScheduleTask(ctx context.Context, site string) ([]ScheduleTask, error) { + return c.listScheduleTask(ctx, site) +} + +func (c *Client) GetScheduleTask(ctx context.Context, site, id string) (*ScheduleTask, error) { + return c.getScheduleTask(ctx, site, id) +} + +func (c *Client) DeleteScheduleTask(ctx context.Context, site, id string) error { + return c.deleteScheduleTask(ctx, site, id) +} + +func (c *Client) CreateScheduleTask(ctx context.Context, site string, d *ScheduleTask) (*ScheduleTask, error) { + return c.createScheduleTask(ctx, site, d) +} + +func (c *Client) UpdateScheduleTask(ctx context.Context, site string, d *ScheduleTask) (*ScheduleTask, error) { + return c.updateScheduleTask(ctx, site, d) +} diff --git a/unifi/setting_auto_speedtest.go b/unifi/setting_auto_speedtest.go new file mode 100644 index 0000000..fabc59d --- /dev/null +++ b/unifi/setting_auto_speedtest.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) GetSettingAutoSpeedtest(ctx context.Context, site string) (*SettingAutoSpeedtest, error) { + return c.getSettingAutoSpeedtest(ctx, site) +} + + +func (c *Client) UpdateSettingAutoSpeedtest(ctx context.Context, site string, d *SettingAutoSpeedtest) (*SettingAutoSpeedtest, error) { + return c.updateSettingAutoSpeedtest(ctx, site, d) +} diff --git a/unifi/setting_baresip.go b/unifi/setting_baresip.go new file mode 100644 index 0000000..ba8ee73 --- /dev/null +++ b/unifi/setting_baresip.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingBaresip(ctx context.Context, site string) (*SettingBaresip, error) { + return c.getSettingBaresip(ctx, site) +} + + +func (c *Client) UpdateSettingBaresip(ctx context.Context, site string, d *SettingBaresip) (*SettingBaresip, error) { + return c.updateSettingBaresip(ctx, site, d) +} diff --git a/unifi/setting_broadcast.go b/unifi/setting_broadcast.go new file mode 100644 index 0000000..80747f7 --- /dev/null +++ b/unifi/setting_broadcast.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingBroadcast(ctx context.Context, site string) (*SettingBroadcast, error) { + return c.getSettingBroadcast(ctx, site) +} + + +func (c *Client) UpdateSettingBroadcast(ctx context.Context, site string, d *SettingBroadcast) (*SettingBroadcast, error) { + return c.updateSettingBroadcast(ctx, site, d) +} diff --git a/unifi/setting_connectivity.go b/unifi/setting_connectivity.go new file mode 100644 index 0000000..03fb977 --- /dev/null +++ b/unifi/setting_connectivity.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingConnectivity(ctx context.Context, site string) (*SettingConnectivity, error) { + return c.getSettingConnectivity(ctx, site) +} + + +func (c *Client) UpdateSettingConnectivity(ctx context.Context, site string, d *SettingConnectivity) (*SettingConnectivity, error) { + return c.updateSettingConnectivity(ctx, site, d) +} diff --git a/unifi/setting_country.go b/unifi/setting_country.go new file mode 100644 index 0000000..9fec2b7 --- /dev/null +++ b/unifi/setting_country.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingCountry(ctx context.Context, site string) (*SettingCountry, error) { + return c.getSettingCountry(ctx, site) +} + + +func (c *Client) UpdateSettingCountry(ctx context.Context, site string, d *SettingCountry) (*SettingCountry, error) { + return c.updateSettingCountry(ctx, site, d) +} diff --git a/unifi/setting_dashboard.go b/unifi/setting_dashboard.go new file mode 100644 index 0000000..21ab653 --- /dev/null +++ b/unifi/setting_dashboard.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingDashboard(ctx context.Context, site string) (*SettingDashboard, error) { + return c.getSettingDashboard(ctx, site) +} + + +func (c *Client) UpdateSettingDashboard(ctx context.Context, site string, d *SettingDashboard) (*SettingDashboard, error) { + return c.updateSettingDashboard(ctx, site, d) +} diff --git a/unifi/setting_doh.go b/unifi/setting_doh.go new file mode 100644 index 0000000..8e2e33a --- /dev/null +++ b/unifi/setting_doh.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingDoh(ctx context.Context, site string) (*SettingDoh, error) { + return c.getSettingDoh(ctx, site) +} + + +func (c *Client) UpdateSettingDoh(ctx context.Context, site string, d *SettingDoh) (*SettingDoh, error) { + return c.updateSettingDoh(ctx, site, d) +} diff --git a/unifi/setting_dpi.go b/unifi/setting_dpi.go new file mode 100644 index 0000000..e24d78e --- /dev/null +++ b/unifi/setting_dpi.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingDpi(ctx context.Context, site string) (*SettingDpi, error) { + return c.getSettingDpi(ctx, site) +} + + +func (c *Client) UpdateSettingDpi(ctx context.Context, site string, d *SettingDpi) (*SettingDpi, error) { + return c.updateSettingDpi(ctx, site, d) +} diff --git a/unifi/setting_element_adopt.go b/unifi/setting_element_adopt.go new file mode 100644 index 0000000..99303e1 --- /dev/null +++ b/unifi/setting_element_adopt.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingElementAdopt(ctx context.Context, site string) (*SettingElementAdopt, error) { + return c.getSettingElementAdopt(ctx, site) +} + + +func (c *Client) UpdateSettingElementAdopt(ctx context.Context, site string, d *SettingElementAdopt) (*SettingElementAdopt, error) { + return c.updateSettingElementAdopt(ctx, site, d) +} diff --git a/unifi/setting_ether_lighting.go b/unifi/setting_ether_lighting.go new file mode 100644 index 0000000..e38fe4a --- /dev/null +++ b/unifi/setting_ether_lighting.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingEtherLighting(ctx context.Context, site string) (*SettingEtherLighting, error) { + return c.getSettingEtherLighting(ctx, site) +} + + +func (c *Client) UpdateSettingEtherLighting(ctx context.Context, site string, d *SettingEtherLighting) (*SettingEtherLighting, error) { + return c.updateSettingEtherLighting(ctx, site, d) +} diff --git a/unifi/setting_evaluation_score.go b/unifi/setting_evaluation_score.go new file mode 100644 index 0000000..6315992 --- /dev/null +++ b/unifi/setting_evaluation_score.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingEvaluationScore(ctx context.Context, site string) (*SettingEvaluationScore, error) { + return c.getSettingEvaluationScore(ctx, site) +} + + +func (c *Client) UpdateSettingEvaluationScore(ctx context.Context, site string, d *SettingEvaluationScore) (*SettingEvaluationScore, error) { + return c.updateSettingEvaluationScore(ctx, site, d) +} diff --git a/unifi/setting_global_ap.go b/unifi/setting_global_ap.go new file mode 100644 index 0000000..7c036bf --- /dev/null +++ b/unifi/setting_global_ap.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingGlobalAp(ctx context.Context, site string) (*SettingGlobalAp, error) { + return c.getSettingGlobalAp(ctx, site) +} + + +func (c *Client) UpdateSettingGlobalAp(ctx context.Context, site string, d *SettingGlobalAp) (*SettingGlobalAp, error) { + return c.updateSettingGlobalAp(ctx, site, d) +} diff --git a/unifi/setting_global_nat.go b/unifi/setting_global_nat.go new file mode 100644 index 0000000..4166a1e --- /dev/null +++ b/unifi/setting_global_nat.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingGlobalNat(ctx context.Context, site string) (*SettingGlobalNat, error) { + return c.getSettingGlobalNat(ctx, site) +} + + +func (c *Client) UpdateSettingGlobalNat(ctx context.Context, site string, d *SettingGlobalNat) (*SettingGlobalNat, error) { + return c.updateSettingGlobalNat(ctx, site, d) +} diff --git a/unifi/setting_global_switch.go b/unifi/setting_global_switch.go new file mode 100644 index 0000000..8182cf4 --- /dev/null +++ b/unifi/setting_global_switch.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingGlobalSwitch(ctx context.Context, site string) (*SettingGlobalSwitch, error) { + return c.getSettingGlobalSwitch(ctx, site) +} + + +func (c *Client) UpdateSettingGlobalSwitch(ctx context.Context, site string, d *SettingGlobalSwitch) (*SettingGlobalSwitch, error) { + return c.updateSettingGlobalSwitch(ctx, site, d) +} diff --git a/unifi/setting_guest_access.go b/unifi/setting_guest_access.go new file mode 100644 index 0000000..d58c5ca --- /dev/null +++ b/unifi/setting_guest_access.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingGuestAccess(ctx context.Context, site string) (*SettingGuestAccess, error) { + return c.getSettingGuestAccess(ctx, site) +} + + +func (c *Client) UpdateSettingGuestAccess(ctx context.Context, site string, d *SettingGuestAccess) (*SettingGuestAccess, error) { + return c.updateSettingGuestAccess(ctx, site, d) +} diff --git a/unifi/setting_ips.go b/unifi/setting_ips.go new file mode 100644 index 0000000..431f6f9 --- /dev/null +++ b/unifi/setting_ips.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingIps(ctx context.Context, site string) (*SettingIps, error) { + return c.getSettingIps(ctx, site) +} + + +func (c *Client) UpdateSettingIps(ctx context.Context, site string, d *SettingIps) (*SettingIps, error) { + return c.updateSettingIps(ctx, site, d) +} diff --git a/unifi/setting_lcm.go b/unifi/setting_lcm.go new file mode 100644 index 0000000..07463f8 --- /dev/null +++ b/unifi/setting_lcm.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingLcm(ctx context.Context, site string) (*SettingLcm, error) { + return c.getSettingLcm(ctx, site) +} + + +func (c *Client) UpdateSettingLcm(ctx context.Context, site string, d *SettingLcm) (*SettingLcm, error) { + return c.updateSettingLcm(ctx, site, d) +} diff --git a/unifi/setting_locale.go b/unifi/setting_locale.go new file mode 100644 index 0000000..40d4ed5 --- /dev/null +++ b/unifi/setting_locale.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingLocale(ctx context.Context, site string) (*SettingLocale, error) { + return c.getSettingLocale(ctx, site) +} + + +func (c *Client) UpdateSettingLocale(ctx context.Context, site string, d *SettingLocale) (*SettingLocale, error) { + return c.updateSettingLocale(ctx, site, d) +} diff --git a/unifi/setting_magic_site_to_site_vpn.go b/unifi/setting_magic_site_to_site_vpn.go new file mode 100644 index 0000000..8ea782a --- /dev/null +++ b/unifi/setting_magic_site_to_site_vpn.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingMagicSiteToSiteVpn(ctx context.Context, site string) (*SettingMagicSiteToSiteVpn, error) { + return c.getSettingMagicSiteToSiteVpn(ctx, site) +} + + +func (c *Client) UpdateSettingMagicSiteToSiteVpn(ctx context.Context, site string, d *SettingMagicSiteToSiteVpn) (*SettingMagicSiteToSiteVpn, error) { + return c.updateSettingMagicSiteToSiteVpn(ctx, site, d) +} diff --git a/unifi/setting_network_optimization.go b/unifi/setting_network_optimization.go new file mode 100644 index 0000000..223b17f --- /dev/null +++ b/unifi/setting_network_optimization.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingNetworkOptimization(ctx context.Context, site string) (*SettingNetworkOptimization, error) { + return c.getSettingNetworkOptimization(ctx, site) +} + + +func (c *Client) UpdateSettingNetworkOptimization(ctx context.Context, site string, d *SettingNetworkOptimization) (*SettingNetworkOptimization, error) { + return c.updateSettingNetworkOptimization(ctx, site, d) +} diff --git a/unifi/setting_ntp.go b/unifi/setting_ntp.go new file mode 100644 index 0000000..d77551a --- /dev/null +++ b/unifi/setting_ntp.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingNtp(ctx context.Context, site string) (*SettingNtp, error) { + return c.getSettingNtp(ctx, site) +} + + +func (c *Client) UpdateSettingNtp(ctx context.Context, site string, d *SettingNtp) (*SettingNtp, error) { + return c.updateSettingNtp(ctx, site, d) +} diff --git a/unifi/setting_porta.go b/unifi/setting_porta.go new file mode 100644 index 0000000..636cd02 --- /dev/null +++ b/unifi/setting_porta.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingPorta(ctx context.Context, site string) (*SettingPorta, error) { + return c.getSettingPorta(ctx, site) +} + + +func (c *Client) UpdateSettingPorta(ctx context.Context, site string, d *SettingPorta) (*SettingPorta, error) { + return c.updateSettingPorta(ctx, site, d) +} diff --git a/unifi/setting_radio_ai.go b/unifi/setting_radio_ai.go new file mode 100644 index 0000000..64b22ee --- /dev/null +++ b/unifi/setting_radio_ai.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error) { + return c.getSettingRadioAi(ctx, site) +} + + +func (c *Client) UpdateSettingRadioAi(ctx context.Context, site string, d *SettingRadioAi) (*SettingRadioAi, error) { + return c.updateSettingRadioAi(ctx, site, d) +} diff --git a/unifi/setting_rsyslogd.go b/unifi/setting_rsyslogd.go new file mode 100644 index 0000000..861db5d --- /dev/null +++ b/unifi/setting_rsyslogd.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingRsyslogd(ctx context.Context, site string) (*SettingRsyslogd, error) { + return c.getSettingRsyslogd(ctx, site) +} + + +func (c *Client) UpdateSettingRsyslogd(ctx context.Context, site string, d *SettingRsyslogd) (*SettingRsyslogd, error) { + return c.updateSettingRsyslogd(ctx, site, d) +} diff --git a/unifi/setting_snmp.go b/unifi/setting_snmp.go new file mode 100644 index 0000000..30bbe8f --- /dev/null +++ b/unifi/setting_snmp.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingSnmp(ctx context.Context, site string) (*SettingSnmp, error) { + return c.getSettingSnmp(ctx, site) +} + + +func (c *Client) UpdateSettingSnmp(ctx context.Context, site string, d *SettingSnmp) (*SettingSnmp, error) { + return c.updateSettingSnmp(ctx, site, d) +} diff --git a/unifi/setting_ssl_inspection.go b/unifi/setting_ssl_inspection.go new file mode 100644 index 0000000..97b6608 --- /dev/null +++ b/unifi/setting_ssl_inspection.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingSslInspection(ctx context.Context, site string) (*SettingSslInspection, error) { + return c.getSettingSslInspection(ctx, site) +} + + +func (c *Client) UpdateSettingSslInspection(ctx context.Context, site string, d *SettingSslInspection) (*SettingSslInspection, error) { + return c.updateSettingSslInspection(ctx, site, d) +} diff --git a/unifi/setting_super_cloudaccess.go b/unifi/setting_super_cloudaccess.go new file mode 100644 index 0000000..042b35b --- /dev/null +++ b/unifi/setting_super_cloudaccess.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingSuperCloudaccess(ctx context.Context, site string) (*SettingSuperCloudaccess, error) { + return c.getSettingSuperCloudaccess(ctx, site) +} + + +func (c *Client) UpdateSettingSuperCloudaccess(ctx context.Context, site string, d *SettingSuperCloudaccess) (*SettingSuperCloudaccess, error) { + return c.updateSettingSuperCloudaccess(ctx, site, d) +} diff --git a/unifi/setting_super_events.go b/unifi/setting_super_events.go new file mode 100644 index 0000000..1b6b41d --- /dev/null +++ b/unifi/setting_super_events.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) GetSettingSuperEvents(ctx context.Context, site string) (*SettingSuperEvents, error) { + return c.getSettingSuperEvents(ctx, site) +} + + +func (c *Client) UpdateSettingSuperEvents(ctx context.Context, site string, d *SettingSuperEvents) (*SettingSuperEvents, error) { + return c.updateSettingSuperEvents(ctx, site, d) +} diff --git a/unifi/setting_super_fwupdate.go b/unifi/setting_super_fwupdate.go new file mode 100644 index 0000000..2705854 --- /dev/null +++ b/unifi/setting_super_fwupdate.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingSuperFwupdate(ctx context.Context, site string) (*SettingSuperFwupdate, error) { + return c.getSettingSuperFwupdate(ctx, site) +} + + +func (c *Client) UpdateSettingSuperFwupdate(ctx context.Context, site string, d *SettingSuperFwupdate) (*SettingSuperFwupdate, error) { + return c.updateSettingSuperFwupdate(ctx, site, d) +} diff --git a/unifi/setting_super_identity.go b/unifi/setting_super_identity.go new file mode 100644 index 0000000..cdb1867 --- /dev/null +++ b/unifi/setting_super_identity.go @@ -0,0 +1,16 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) GetSettingSuperIdentity(ctx context.Context, site string) (*SettingSuperIdentity, error) { + return c.getSettingSuperIdentity(ctx, site) +} + +func (c *Client) UpdateSettingSuperIdentity(ctx context.Context, site string, d *SettingSuperIdentity) (*SettingSuperIdentity, error) { + return c.updateSettingSuperIdentity(ctx, site, d) +} diff --git a/unifi/setting_super_mail.go b/unifi/setting_super_mail.go new file mode 100644 index 0000000..8ee9e73 --- /dev/null +++ b/unifi/setting_super_mail.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingSuperMail(ctx context.Context, site string) (*SettingSuperMail, error) { + return c.getSettingSuperMail(ctx, site) +} + + +func (c *Client) UpdateSettingSuperMail(ctx context.Context, site string, d *SettingSuperMail) (*SettingSuperMail, error) { + return c.updateSettingSuperMail(ctx, site, d) +} diff --git a/unifi/setting_super_mgmt.go b/unifi/setting_super_mgmt.go new file mode 100644 index 0000000..96b828e --- /dev/null +++ b/unifi/setting_super_mgmt.go @@ -0,0 +1,15 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) GetSettingSuperMgmt(ctx context.Context, site string) (*SettingSuperMgmt, error) { + return c.getSettingSuperMgmt(ctx, site) +} +func (c *Client) UpdateSettingSuperMgmt(ctx context.Context, site string, d *SettingSuperMgmt) (*SettingSuperMgmt, error) { + return c.updateSettingSuperMgmt(ctx, site, d) +} diff --git a/unifi/setting_super_sdn.go b/unifi/setting_super_sdn.go new file mode 100644 index 0000000..b910d42 --- /dev/null +++ b/unifi/setting_super_sdn.go @@ -0,0 +1,16 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) GetSettingSuperSdn(ctx context.Context, site string) (*SettingSuperSdn, error) { + return c.getSettingSuperSdn(ctx, site) +} + +func (c *Client) UpdateSettingSuperSdn(ctx context.Context, site string, d *SettingSuperSdn) (*SettingSuperSdn, error) { + return c.updateSettingSuperSdn(ctx, site, d) +} diff --git a/unifi/setting_super_smtp.go b/unifi/setting_super_smtp.go new file mode 100644 index 0000000..5c322a6 --- /dev/null +++ b/unifi/setting_super_smtp.go @@ -0,0 +1,16 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) GetSettingSuperSmtp(ctx context.Context, site string) (*SettingSuperSmtp, error) { + return c.getSettingSuperSmtp(ctx, site) +} + +func (c *Client) UpdateSettingSuperSmtp(ctx context.Context, site string, d *SettingSuperSmtp) (*SettingSuperSmtp, error) { + return c.updateSettingSuperSmtp(ctx, site, d) +} diff --git a/unifi/setting_teleport.go b/unifi/setting_teleport.go new file mode 100644 index 0000000..1bfa8f8 --- /dev/null +++ b/unifi/setting_teleport.go @@ -0,0 +1,16 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) GetSettingTeleport(ctx context.Context, site string) (*SettingTeleport, error) { + return c.getSettingTeleport(ctx, site) +} + +func (c *Client) UpdateSettingTeleport(ctx context.Context, site string, d *SettingTeleport) (*SettingTeleport, error) { + return c.updateSettingTeleport(ctx, site, d) +} diff --git a/unifi/setting_usw.go b/unifi/setting_usw.go new file mode 100644 index 0000000..121b366 --- /dev/null +++ b/unifi/setting_usw.go @@ -0,0 +1,17 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) GetSettingUsw(ctx context.Context, site string) (*SettingUsw, error) { + return c.getSettingUsw(ctx, site) +} + + +func (c *Client) UpdateSettingUsw(ctx context.Context, site string, d *SettingUsw) (*SettingUsw, error) { + return c.updateSettingUsw(ctx, site, d) +} diff --git a/unifi/spatial_record.go b/unifi/spatial_record.go new file mode 100644 index 0000000..ae84e57 --- /dev/null +++ b/unifi/spatial_record.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) ListSpatialRecord(ctx context.Context, site string) ([]SpatialRecord, error) { + return c.listSpatialRecord(ctx, site) +} + +func (c *Client) GetSpatialRecord(ctx context.Context, site, id string) (*SpatialRecord, error) { + return c.getSpatialRecord(ctx, site, id) +} + +func (c *Client) DeleteSpatialRecord(ctx context.Context, site, id string) error { + return c.deleteSpatialRecord(ctx, site, id) +} + +func (c *Client) CreateSpatialRecord(ctx context.Context, site string, d *SpatialRecord) (*SpatialRecord, error) { + return c.createSpatialRecord(ctx, site, d) +} + +func (c *Client) UpdateSpatialRecord(ctx context.Context, site string, d *SpatialRecord) (*SpatialRecord, error) { + return c.updateSpatialRecord(ctx, site, d) +} diff --git a/unifi/tag.go b/unifi/tag.go new file mode 100644 index 0000000..afca1fa --- /dev/null +++ b/unifi/tag.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" +) + +func (c *Client) ListTag(ctx context.Context, site string) ([]Tag, error) { + return c.listTag(ctx, site) +} + +func (c *Client) GetTag(ctx context.Context, site, id string) (*Tag, error) { + return c.getTag(ctx, site, id) +} + +func (c *Client) DeleteTag(ctx context.Context, site, id string) error { + return c.deleteTag(ctx, site, id) +} + +func (c *Client) CreateTag(ctx context.Context, site string, d *Tag) (*Tag, error) { + return c.createTag(ctx, site, d) +} + +func (c *Client) UpdateTag(ctx context.Context, site string, d *Tag) (*Tag, error) { + return c.updateTag(ctx, site, d) +} diff --git a/unifi/unifi.go b/unifi/unifi.go index 8688c40..2ce70f6 100644 --- a/unifi/unifi.go +++ b/unifi/unifi.go @@ -6,7 +6,6 @@ import ( "encoding/json" "fmt" "io" - "io/ioutil" "net/http" "net/http/cookiejar" "net/url" @@ -114,7 +113,7 @@ func (c *Client) setAPIUrlStyle(ctx context.Context) error { return err } defer resp.Body.Close() - _, _ = io.Copy(ioutil.Discard, resp.Body) + _, _ = io.Copy(io.Discard, resp.Body) if resp.StatusCode == http.StatusOK { // the new API returns a 200 for a / request diff --git a/unifi/virtual_device.go b/unifi/virtual_device.go new file mode 100644 index 0000000..2efb086 --- /dev/null +++ b/unifi/virtual_device.go @@ -0,0 +1,28 @@ +// Code generated from ace.jar fields *.json files +// DO NOT EDIT. + +package unifi + +import ( + "context" + ) + +func (c *Client) ListVirtualDevice(ctx context.Context, site string) ([]VirtualDevice, error) { + return c.listVirtualDevice(ctx, site) +} + +func (c *Client) GetVirtualDevice(ctx context.Context, site, id string) (*VirtualDevice, error) { + return c.getVirtualDevice(ctx, site, id) +} + +func (c *Client) DeleteVirtualDevice(ctx context.Context, site, id string) error { + return c.deleteVirtualDevice(ctx, site, id) +} + +func (c *Client) CreateVirtualDevice(ctx context.Context, site string, d *VirtualDevice) (*VirtualDevice, error) { + return c.createVirtualDevice(ctx, site, d) +} + +func (c *Client) UpdateVirtualDevice(ctx context.Context, site string, d *VirtualDevice) (*VirtualDevice, error) { + return c.updateVirtualDevice(ctx, site, d) +}