feat(experimental): add support for reading and updating all settings (#25)
This commit is contained in:
committed by
GitHub
parent
0e2736fa54
commit
7b35725921
@@ -35,6 +35,10 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
{{ if .IsSetting }}
|
||||
const {{ .StructName }}Key = "{{ .ResourcePath }}"
|
||||
{{- end }}
|
||||
|
||||
{{ range $k, $v := .Types }}
|
||||
type {{ $k }} struct {
|
||||
{{ range $fk, $fv := $v.Fields }}{{ if not $fv }}
|
||||
@@ -80,16 +84,26 @@ func (c *client) list{{ .StructName }}(ctx context.Context, site string) ([]{{ .
|
||||
}
|
||||
{{- end }}
|
||||
|
||||
func (c *client) get{{ .StructName }}(ctx context.Context, site{{ if not .IsSetting }}, id{{ end }} string) (*{{ .StructName }}, error) {
|
||||
{{ if .IsSetting }}
|
||||
// Update {{ .StructName }} Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) Get{{ .StructName }}(ctx context.Context, site string) (*{{ .StructName }}, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, {{ .StructName }}Key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.Key != {{ .StructName }}Key {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", {{ .StructName }}Key, s.Key)
|
||||
}
|
||||
return f.(*{{ .StructName }}), nil
|
||||
}
|
||||
{{- else }}
|
||||
func (c *client) get{{ .StructName }}(ctx context.Context, site, id string) (*{{ .StructName }}, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []{{ .StructName }} `json:"data"`
|
||||
}
|
||||
{{ if .IsSetting }}
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/{{ .ResourcePath }}", site), nil, &respBody)
|
||||
{{- else }}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/{{ if eq .StructName "Device" }}stat{{ else }}rest{{ end }}/{{ .ResourcePath }}/%s", site, id), nil, &respBody)
|
||||
{{- end }}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -101,6 +115,7 @@ func (c *client) get{{ .StructName }}(ctx context.Context, site{{ if not .IsSett
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
}
|
||||
{{- end }}
|
||||
|
||||
{{ if not .IsSetting }}
|
||||
func (c *client) delete{{ .StructName }}(ctx context.Context, site, id string) error {
|
||||
@@ -132,17 +147,25 @@ func (c *client) create{{ .StructName }}(ctx context.Context, site string, d *{{
|
||||
}
|
||||
{{- end }}
|
||||
|
||||
{{ if .IsSetting }}
|
||||
// Update {{ .StructName }} Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) Update{{ .StructName }}(ctx context.Context, site string, s *{{ .StructName}}) (*{{ .StructName }}, error) {
|
||||
result, err := c.SetSetting(ctx, site, {{ .StructName }}Key, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result.(*{{ .StructName }}), nil
|
||||
}
|
||||
|
||||
{{- else }}
|
||||
|
||||
func (c *client) update{{ .StructName }}(ctx context.Context, site string, d *{{ .StructName }}) (*{{ .StructName }}, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []{{ .StructName }} `json:"data"`
|
||||
}
|
||||
{{ if .IsSetting }}
|
||||
d.Key = "{{ .ResourcePath }}"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/{{ .ResourcePath }}", site), d, &respBody)
|
||||
{{- else }}
|
||||
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/rest/{{ .ResourcePath }}/%s", site, d.ID), d, &respBody)
|
||||
{{- end }}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -155,3 +178,4 @@ func (c *client) update{{ .StructName }}(ctx context.Context, site string, d *{{
|
||||
|
||||
return &new, nil
|
||||
}
|
||||
{{- end }}
|
||||
@@ -12,7 +12,6 @@ customizations:
|
||||
- "Map"
|
||||
- "MediaFile"
|
||||
- "ScheduleTask"
|
||||
- "Setting*" # Exclude all resources that start with "Setting"
|
||||
- "SpatialRecord"
|
||||
- "Tag"
|
||||
- "VirtualDevice"
|
||||
|
||||
320
unifi/client.generated.go
generated
320
unifi/client.generated.go
generated
@@ -273,6 +273,326 @@ type Client interface {
|
||||
|
||||
GetSetting(ctx context.Context, site string, key string) (*Setting, interface{}, error)
|
||||
|
||||
// ==== client methods for SettingAutoSpeedtest resource ====
|
||||
|
||||
// GetSettingAutoSpeedtest retrieves the settings for a resource
|
||||
GetSettingAutoSpeedtest(ctx context.Context, site string) (*SettingAutoSpeedtest, error)
|
||||
|
||||
// UpdateSettingAutoSpeedtest updates a resource
|
||||
UpdateSettingAutoSpeedtest(ctx context.Context, site string, s *SettingAutoSpeedtest) (*SettingAutoSpeedtest, error)
|
||||
|
||||
// ==== client methods for SettingBaresip resource ====
|
||||
|
||||
// GetSettingBaresip retrieves the settings for a resource
|
||||
GetSettingBaresip(ctx context.Context, site string) (*SettingBaresip, error)
|
||||
|
||||
// UpdateSettingBaresip updates a resource
|
||||
UpdateSettingBaresip(ctx context.Context, site string, s *SettingBaresip) (*SettingBaresip, error)
|
||||
|
||||
// ==== client methods for SettingBroadcast resource ====
|
||||
|
||||
// GetSettingBroadcast retrieves the settings for a resource
|
||||
GetSettingBroadcast(ctx context.Context, site string) (*SettingBroadcast, error)
|
||||
|
||||
// UpdateSettingBroadcast updates a resource
|
||||
UpdateSettingBroadcast(ctx context.Context, site string, s *SettingBroadcast) (*SettingBroadcast, error)
|
||||
|
||||
// ==== client methods for SettingConnectivity resource ====
|
||||
|
||||
// GetSettingConnectivity retrieves the settings for a resource
|
||||
GetSettingConnectivity(ctx context.Context, site string) (*SettingConnectivity, error)
|
||||
|
||||
// UpdateSettingConnectivity updates a resource
|
||||
UpdateSettingConnectivity(ctx context.Context, site string, s *SettingConnectivity) (*SettingConnectivity, error)
|
||||
|
||||
// ==== client methods for SettingCountry resource ====
|
||||
|
||||
// GetSettingCountry retrieves the settings for a resource
|
||||
GetSettingCountry(ctx context.Context, site string) (*SettingCountry, error)
|
||||
|
||||
// UpdateSettingCountry updates a resource
|
||||
UpdateSettingCountry(ctx context.Context, site string, s *SettingCountry) (*SettingCountry, error)
|
||||
|
||||
// ==== client methods for SettingDashboard resource ====
|
||||
|
||||
// GetSettingDashboard retrieves the settings for a resource
|
||||
GetSettingDashboard(ctx context.Context, site string) (*SettingDashboard, error)
|
||||
|
||||
// UpdateSettingDashboard updates a resource
|
||||
UpdateSettingDashboard(ctx context.Context, site string, s *SettingDashboard) (*SettingDashboard, error)
|
||||
|
||||
// ==== client methods for SettingDoh resource ====
|
||||
|
||||
// GetSettingDoh retrieves the settings for a resource
|
||||
GetSettingDoh(ctx context.Context, site string) (*SettingDoh, error)
|
||||
|
||||
// UpdateSettingDoh updates a resource
|
||||
UpdateSettingDoh(ctx context.Context, site string, s *SettingDoh) (*SettingDoh, error)
|
||||
|
||||
// ==== client methods for SettingDpi resource ====
|
||||
|
||||
// GetSettingDpi retrieves the settings for a resource
|
||||
GetSettingDpi(ctx context.Context, site string) (*SettingDpi, error)
|
||||
|
||||
// UpdateSettingDpi updates a resource
|
||||
UpdateSettingDpi(ctx context.Context, site string, s *SettingDpi) (*SettingDpi, error)
|
||||
|
||||
// ==== client methods for SettingElementAdopt resource ====
|
||||
|
||||
// GetSettingElementAdopt retrieves the settings for a resource
|
||||
GetSettingElementAdopt(ctx context.Context, site string) (*SettingElementAdopt, error)
|
||||
|
||||
// UpdateSettingElementAdopt updates a resource
|
||||
UpdateSettingElementAdopt(ctx context.Context, site string, s *SettingElementAdopt) (*SettingElementAdopt, error)
|
||||
|
||||
// ==== client methods for SettingEtherLighting resource ====
|
||||
|
||||
// GetSettingEtherLighting retrieves the settings for a resource
|
||||
GetSettingEtherLighting(ctx context.Context, site string) (*SettingEtherLighting, error)
|
||||
|
||||
// UpdateSettingEtherLighting updates a resource
|
||||
UpdateSettingEtherLighting(ctx context.Context, site string, s *SettingEtherLighting) (*SettingEtherLighting, error)
|
||||
|
||||
// ==== client methods for SettingEvaluationScore resource ====
|
||||
|
||||
// GetSettingEvaluationScore retrieves the settings for a resource
|
||||
GetSettingEvaluationScore(ctx context.Context, site string) (*SettingEvaluationScore, error)
|
||||
|
||||
// UpdateSettingEvaluationScore updates a resource
|
||||
UpdateSettingEvaluationScore(ctx context.Context, site string, s *SettingEvaluationScore) (*SettingEvaluationScore, error)
|
||||
|
||||
// ==== client methods for SettingGlobalAp resource ====
|
||||
|
||||
// GetSettingGlobalAp retrieves the settings for a resource
|
||||
GetSettingGlobalAp(ctx context.Context, site string) (*SettingGlobalAp, error)
|
||||
|
||||
// UpdateSettingGlobalAp updates a resource
|
||||
UpdateSettingGlobalAp(ctx context.Context, site string, s *SettingGlobalAp) (*SettingGlobalAp, error)
|
||||
|
||||
// ==== client methods for SettingGlobalNat resource ====
|
||||
|
||||
// GetSettingGlobalNat retrieves the settings for a resource
|
||||
GetSettingGlobalNat(ctx context.Context, site string) (*SettingGlobalNat, error)
|
||||
|
||||
// UpdateSettingGlobalNat updates a resource
|
||||
UpdateSettingGlobalNat(ctx context.Context, site string, s *SettingGlobalNat) (*SettingGlobalNat, error)
|
||||
|
||||
// ==== client methods for SettingGlobalSwitch resource ====
|
||||
|
||||
// GetSettingGlobalSwitch retrieves the settings for a resource
|
||||
GetSettingGlobalSwitch(ctx context.Context, site string) (*SettingGlobalSwitch, error)
|
||||
|
||||
// UpdateSettingGlobalSwitch updates a resource
|
||||
UpdateSettingGlobalSwitch(ctx context.Context, site string, s *SettingGlobalSwitch) (*SettingGlobalSwitch, error)
|
||||
|
||||
// ==== client methods for SettingGuestAccess resource ====
|
||||
|
||||
// GetSettingGuestAccess retrieves the settings for a resource
|
||||
GetSettingGuestAccess(ctx context.Context, site string) (*SettingGuestAccess, error)
|
||||
|
||||
// UpdateSettingGuestAccess updates a resource
|
||||
UpdateSettingGuestAccess(ctx context.Context, site string, s *SettingGuestAccess) (*SettingGuestAccess, error)
|
||||
|
||||
// ==== client methods for SettingIps resource ====
|
||||
|
||||
// GetSettingIps retrieves the settings for a resource
|
||||
GetSettingIps(ctx context.Context, site string) (*SettingIps, error)
|
||||
|
||||
// UpdateSettingIps updates a resource
|
||||
UpdateSettingIps(ctx context.Context, site string, s *SettingIps) (*SettingIps, error)
|
||||
|
||||
// ==== client methods for SettingLcm resource ====
|
||||
|
||||
// GetSettingLcm retrieves the settings for a resource
|
||||
GetSettingLcm(ctx context.Context, site string) (*SettingLcm, error)
|
||||
|
||||
// UpdateSettingLcm updates a resource
|
||||
UpdateSettingLcm(ctx context.Context, site string, s *SettingLcm) (*SettingLcm, error)
|
||||
|
||||
// ==== client methods for SettingLocale resource ====
|
||||
|
||||
// GetSettingLocale retrieves the settings for a resource
|
||||
GetSettingLocale(ctx context.Context, site string) (*SettingLocale, error)
|
||||
|
||||
// UpdateSettingLocale updates a resource
|
||||
UpdateSettingLocale(ctx context.Context, site string, s *SettingLocale) (*SettingLocale, error)
|
||||
|
||||
// ==== client methods for SettingMagicSiteToSiteVpn resource ====
|
||||
|
||||
// GetSettingMagicSiteToSiteVpn retrieves the settings for a resource
|
||||
GetSettingMagicSiteToSiteVpn(ctx context.Context, site string) (*SettingMagicSiteToSiteVpn, error)
|
||||
|
||||
// UpdateSettingMagicSiteToSiteVpn updates a resource
|
||||
UpdateSettingMagicSiteToSiteVpn(ctx context.Context, site string, s *SettingMagicSiteToSiteVpn) (*SettingMagicSiteToSiteVpn, error)
|
||||
|
||||
// ==== client methods for SettingMgmt resource ====
|
||||
|
||||
// GetSettingMgmt retrieves the settings for a resource
|
||||
GetSettingMgmt(ctx context.Context, site string) (*SettingMgmt, error)
|
||||
|
||||
// UpdateSettingMgmt updates a resource
|
||||
UpdateSettingMgmt(ctx context.Context, site string, s *SettingMgmt) (*SettingMgmt, error)
|
||||
|
||||
// ==== client methods for SettingNetflow resource ====
|
||||
|
||||
// GetSettingNetflow retrieves the settings for a resource
|
||||
GetSettingNetflow(ctx context.Context, site string) (*SettingNetflow, error)
|
||||
|
||||
// UpdateSettingNetflow updates a resource
|
||||
UpdateSettingNetflow(ctx context.Context, site string, s *SettingNetflow) (*SettingNetflow, error)
|
||||
|
||||
// ==== client methods for SettingNetworkOptimization resource ====
|
||||
|
||||
// GetSettingNetworkOptimization retrieves the settings for a resource
|
||||
GetSettingNetworkOptimization(ctx context.Context, site string) (*SettingNetworkOptimization, error)
|
||||
|
||||
// UpdateSettingNetworkOptimization updates a resource
|
||||
UpdateSettingNetworkOptimization(ctx context.Context, site string, s *SettingNetworkOptimization) (*SettingNetworkOptimization, error)
|
||||
|
||||
// ==== client methods for SettingNtp resource ====
|
||||
|
||||
// GetSettingNtp retrieves the settings for a resource
|
||||
GetSettingNtp(ctx context.Context, site string) (*SettingNtp, error)
|
||||
|
||||
// UpdateSettingNtp updates a resource
|
||||
UpdateSettingNtp(ctx context.Context, site string, s *SettingNtp) (*SettingNtp, error)
|
||||
|
||||
// ==== client methods for SettingPorta resource ====
|
||||
|
||||
// GetSettingPorta retrieves the settings for a resource
|
||||
GetSettingPorta(ctx context.Context, site string) (*SettingPorta, error)
|
||||
|
||||
// UpdateSettingPorta updates a resource
|
||||
UpdateSettingPorta(ctx context.Context, site string, s *SettingPorta) (*SettingPorta, error)
|
||||
|
||||
// ==== client methods for SettingRadioAi resource ====
|
||||
|
||||
// GetSettingRadioAi retrieves the settings for a resource
|
||||
GetSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error)
|
||||
|
||||
// UpdateSettingRadioAi updates a resource
|
||||
UpdateSettingRadioAi(ctx context.Context, site string, s *SettingRadioAi) (*SettingRadioAi, error)
|
||||
|
||||
// ==== client methods for SettingRadius resource ====
|
||||
|
||||
// GetSettingRadius retrieves the settings for a resource
|
||||
GetSettingRadius(ctx context.Context, site string) (*SettingRadius, error)
|
||||
|
||||
// UpdateSettingRadius updates a resource
|
||||
UpdateSettingRadius(ctx context.Context, site string, s *SettingRadius) (*SettingRadius, error)
|
||||
|
||||
// ==== client methods for SettingRsyslogd resource ====
|
||||
|
||||
// GetSettingRsyslogd retrieves the settings for a resource
|
||||
GetSettingRsyslogd(ctx context.Context, site string) (*SettingRsyslogd, error)
|
||||
|
||||
// UpdateSettingRsyslogd updates a resource
|
||||
UpdateSettingRsyslogd(ctx context.Context, site string, s *SettingRsyslogd) (*SettingRsyslogd, error)
|
||||
|
||||
// ==== client methods for SettingSnmp resource ====
|
||||
|
||||
// GetSettingSnmp retrieves the settings for a resource
|
||||
GetSettingSnmp(ctx context.Context, site string) (*SettingSnmp, error)
|
||||
|
||||
// UpdateSettingSnmp updates a resource
|
||||
UpdateSettingSnmp(ctx context.Context, site string, s *SettingSnmp) (*SettingSnmp, error)
|
||||
|
||||
// ==== client methods for SettingSslInspection resource ====
|
||||
|
||||
// GetSettingSslInspection retrieves the settings for a resource
|
||||
GetSettingSslInspection(ctx context.Context, site string) (*SettingSslInspection, error)
|
||||
|
||||
// UpdateSettingSslInspection updates a resource
|
||||
UpdateSettingSslInspection(ctx context.Context, site string, s *SettingSslInspection) (*SettingSslInspection, error)
|
||||
|
||||
// ==== client methods for SettingSuperCloudaccess resource ====
|
||||
|
||||
// GetSettingSuperCloudaccess retrieves the settings for a resource
|
||||
GetSettingSuperCloudaccess(ctx context.Context, site string) (*SettingSuperCloudaccess, error)
|
||||
|
||||
// UpdateSettingSuperCloudaccess updates a resource
|
||||
UpdateSettingSuperCloudaccess(ctx context.Context, site string, s *SettingSuperCloudaccess) (*SettingSuperCloudaccess, error)
|
||||
|
||||
// ==== client methods for SettingSuperEvents resource ====
|
||||
|
||||
// GetSettingSuperEvents retrieves the settings for a resource
|
||||
GetSettingSuperEvents(ctx context.Context, site string) (*SettingSuperEvents, error)
|
||||
|
||||
// UpdateSettingSuperEvents updates a resource
|
||||
UpdateSettingSuperEvents(ctx context.Context, site string, s *SettingSuperEvents) (*SettingSuperEvents, error)
|
||||
|
||||
// ==== client methods for SettingSuperFwupdate resource ====
|
||||
|
||||
// GetSettingSuperFwupdate retrieves the settings for a resource
|
||||
GetSettingSuperFwupdate(ctx context.Context, site string) (*SettingSuperFwupdate, error)
|
||||
|
||||
// UpdateSettingSuperFwupdate updates a resource
|
||||
UpdateSettingSuperFwupdate(ctx context.Context, site string, s *SettingSuperFwupdate) (*SettingSuperFwupdate, error)
|
||||
|
||||
// ==== client methods for SettingSuperIdentity resource ====
|
||||
|
||||
// GetSettingSuperIdentity retrieves the settings for a resource
|
||||
GetSettingSuperIdentity(ctx context.Context, site string) (*SettingSuperIdentity, error)
|
||||
|
||||
// UpdateSettingSuperIdentity updates a resource
|
||||
UpdateSettingSuperIdentity(ctx context.Context, site string, s *SettingSuperIdentity) (*SettingSuperIdentity, error)
|
||||
|
||||
// ==== client methods for SettingSuperMail resource ====
|
||||
|
||||
// GetSettingSuperMail retrieves the settings for a resource
|
||||
GetSettingSuperMail(ctx context.Context, site string) (*SettingSuperMail, error)
|
||||
|
||||
// UpdateSettingSuperMail updates a resource
|
||||
UpdateSettingSuperMail(ctx context.Context, site string, s *SettingSuperMail) (*SettingSuperMail, error)
|
||||
|
||||
// ==== client methods for SettingSuperMgmt resource ====
|
||||
|
||||
// GetSettingSuperMgmt retrieves the settings for a resource
|
||||
GetSettingSuperMgmt(ctx context.Context, site string) (*SettingSuperMgmt, error)
|
||||
|
||||
// UpdateSettingSuperMgmt updates a resource
|
||||
UpdateSettingSuperMgmt(ctx context.Context, site string, s *SettingSuperMgmt) (*SettingSuperMgmt, error)
|
||||
|
||||
// ==== client methods for SettingSuperSdn resource ====
|
||||
|
||||
// GetSettingSuperSdn retrieves the settings for a resource
|
||||
GetSettingSuperSdn(ctx context.Context, site string) (*SettingSuperSdn, error)
|
||||
|
||||
// UpdateSettingSuperSdn updates a resource
|
||||
UpdateSettingSuperSdn(ctx context.Context, site string, s *SettingSuperSdn) (*SettingSuperSdn, error)
|
||||
|
||||
// ==== client methods for SettingSuperSmtp resource ====
|
||||
|
||||
// GetSettingSuperSmtp retrieves the settings for a resource
|
||||
GetSettingSuperSmtp(ctx context.Context, site string) (*SettingSuperSmtp, error)
|
||||
|
||||
// UpdateSettingSuperSmtp updates a resource
|
||||
UpdateSettingSuperSmtp(ctx context.Context, site string, s *SettingSuperSmtp) (*SettingSuperSmtp, error)
|
||||
|
||||
// ==== client methods for SettingTeleport resource ====
|
||||
|
||||
// GetSettingTeleport retrieves the settings for a resource
|
||||
GetSettingTeleport(ctx context.Context, site string) (*SettingTeleport, error)
|
||||
|
||||
// UpdateSettingTeleport updates a resource
|
||||
UpdateSettingTeleport(ctx context.Context, site string, s *SettingTeleport) (*SettingTeleport, error)
|
||||
|
||||
// ==== client methods for SettingUsg resource ====
|
||||
|
||||
// GetSettingUsg retrieves the settings for a resource
|
||||
GetSettingUsg(ctx context.Context, site string) (*SettingUsg, error)
|
||||
|
||||
// UpdateSettingUsg updates a resource
|
||||
UpdateSettingUsg(ctx context.Context, site string, s *SettingUsg) (*SettingUsg, error)
|
||||
|
||||
// ==== client methods for SettingUsw resource ====
|
||||
|
||||
// GetSettingUsw retrieves the settings for a resource
|
||||
GetSettingUsw(ctx context.Context, site string) (*SettingUsw, error)
|
||||
|
||||
// UpdateSettingUsw updates a resource
|
||||
UpdateSettingUsw(ctx context.Context, site string, s *SettingUsw) (*SettingUsw, error)
|
||||
|
||||
CreateSite(ctx context.Context, description string) ([]Site, error)
|
||||
|
||||
DeleteSite(ctx context.Context, id string) ([]Site, error)
|
||||
|
||||
@@ -77,6 +77,43 @@ func (s *Setting) newFields() (interface{}, error) {
|
||||
return nil, fmt.Errorf("unexpected key %q", s.Key)
|
||||
}
|
||||
|
||||
func (c *client) SetSetting(ctx context.Context, site, key string, reqBody interface{}) (interface{}, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []json.RawMessage `json:"data"`
|
||||
}
|
||||
err := c.Post(ctx, fmt.Sprintf("s/%s/set/setting/%s", site, key), reqBody, respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var raw json.RawMessage
|
||||
var setting *Setting
|
||||
for _, d := range respBody.Data {
|
||||
err = json.Unmarshal(d, &setting)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if setting.Key == key {
|
||||
raw = d
|
||||
break
|
||||
}
|
||||
}
|
||||
if setting == nil {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
fields, err := setting.newFields()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(raw, &fields)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return fields, nil
|
||||
}
|
||||
|
||||
func (c *client) GetSetting(ctx context.Context, site, key string) (*Setting, interface{}, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"Meta"`
|
||||
|
||||
41
unifi/setting_auto_speedtest.generated.go
generated
41
unifi/setting_auto_speedtest.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingAutoSpeedtestKey = "auto_speedtest"
|
||||
|
||||
type SettingAutoSpeedtest struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -47,42 +49,23 @@ func (dst *SettingAutoSpeedtest) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingAutoSpeedtest(ctx context.Context, site string) (*SettingAutoSpeedtest, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingAutoSpeedtest `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/auto_speedtest", site), nil, &respBody)
|
||||
// Update SettingAutoSpeedtest Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingAutoSpeedtest(ctx context.Context, site string) (*SettingAutoSpeedtest, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingAutoSpeedtestKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingAutoSpeedtestKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingAutoSpeedtestKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingAutoSpeedtest), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingAutoSpeedtest(ctx context.Context, site string, d *SettingAutoSpeedtest) (*SettingAutoSpeedtest, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingAutoSpeedtest `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "auto_speedtest"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/auto_speedtest", site), d, &respBody)
|
||||
// Update SettingAutoSpeedtest Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingAutoSpeedtest(ctx context.Context, site string, s *SettingAutoSpeedtest) (*SettingAutoSpeedtest, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingAutoSpeedtestKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingAutoSpeedtest), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_baresip.generated.go
generated
41
unifi/setting_baresip.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingBaresipKey = "baresip"
|
||||
|
||||
type SettingBaresip struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -49,42 +51,23 @@ func (dst *SettingBaresip) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingBaresip(ctx context.Context, site string) (*SettingBaresip, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingBaresip `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/baresip", site), nil, &respBody)
|
||||
// Update SettingBaresip Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingBaresip(ctx context.Context, site string) (*SettingBaresip, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingBaresipKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingBaresipKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingBaresipKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingBaresip), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingBaresip(ctx context.Context, site string, d *SettingBaresip) (*SettingBaresip, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingBaresip `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "baresip"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/baresip", site), d, &respBody)
|
||||
// Update SettingBaresip Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingBaresip(ctx context.Context, site string, s *SettingBaresip) (*SettingBaresip, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingBaresipKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingBaresip), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_broadcast.generated.go
generated
41
unifi/setting_broadcast.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingBroadcastKey = "broadcast"
|
||||
|
||||
type SettingBroadcast struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -51,42 +53,23 @@ func (dst *SettingBroadcast) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingBroadcast(ctx context.Context, site string) (*SettingBroadcast, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingBroadcast `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/broadcast", site), nil, &respBody)
|
||||
// Update SettingBroadcast Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingBroadcast(ctx context.Context, site string) (*SettingBroadcast, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingBroadcastKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingBroadcastKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingBroadcastKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingBroadcast), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingBroadcast(ctx context.Context, site string, d *SettingBroadcast) (*SettingBroadcast, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingBroadcast `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "broadcast"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/broadcast", site), d, &respBody)
|
||||
// Update SettingBroadcast Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingBroadcast(ctx context.Context, site string, s *SettingBroadcast) (*SettingBroadcast, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingBroadcastKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingBroadcast), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_connectivity.generated.go
generated
41
unifi/setting_connectivity.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingConnectivityKey = "connectivity"
|
||||
|
||||
type SettingConnectivity struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -51,42 +53,23 @@ func (dst *SettingConnectivity) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingConnectivity(ctx context.Context, site string) (*SettingConnectivity, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingConnectivity `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/connectivity", site), nil, &respBody)
|
||||
// Update SettingConnectivity Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingConnectivity(ctx context.Context, site string) (*SettingConnectivity, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingConnectivityKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingConnectivityKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingConnectivityKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingConnectivity), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingConnectivity(ctx context.Context, site string, d *SettingConnectivity) (*SettingConnectivity, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingConnectivity `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "connectivity"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/connectivity", site), d, &respBody)
|
||||
// Update SettingConnectivity Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingConnectivity(ctx context.Context, site string, s *SettingConnectivity) (*SettingConnectivity, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingConnectivityKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingConnectivity), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_country.generated.go
generated
41
unifi/setting_country.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingCountryKey = "country"
|
||||
|
||||
type SettingCountry struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -49,42 +51,23 @@ func (dst *SettingCountry) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingCountry(ctx context.Context, site string) (*SettingCountry, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingCountry `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/country", site), nil, &respBody)
|
||||
// Update SettingCountry Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingCountry(ctx context.Context, site string) (*SettingCountry, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingCountryKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingCountryKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingCountryKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingCountry), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingCountry(ctx context.Context, site string, d *SettingCountry) (*SettingCountry, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingCountry `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "country"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/country", site), d, &respBody)
|
||||
// Update SettingCountry Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingCountry(ctx context.Context, site string, s *SettingCountry) (*SettingCountry, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingCountryKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingCountry), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_dashboard.generated.go
generated
41
unifi/setting_dashboard.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingDashboardKey = "dashboard"
|
||||
|
||||
type SettingDashboard struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -68,42 +70,23 @@ func (dst *SettingDashboardWidgets) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingDashboard(ctx context.Context, site string) (*SettingDashboard, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingDashboard `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/dashboard", site), nil, &respBody)
|
||||
// Update SettingDashboard Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingDashboard(ctx context.Context, site string) (*SettingDashboard, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingDashboardKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingDashboardKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingDashboardKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingDashboard), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingDashboard(ctx context.Context, site string, d *SettingDashboard) (*SettingDashboard, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingDashboard `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "dashboard"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/dashboard", site), d, &respBody)
|
||||
// Update SettingDashboard Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingDashboard(ctx context.Context, site string, s *SettingDashboard) (*SettingDashboard, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingDashboardKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingDashboard), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_doh.generated.go
generated
41
unifi/setting_doh.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingDohKey = "doh"
|
||||
|
||||
type SettingDoh struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -70,42 +72,23 @@ func (dst *SettingDohCustomServers) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingDoh(ctx context.Context, site string) (*SettingDoh, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingDoh `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/doh", site), nil, &respBody)
|
||||
// Update SettingDoh Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingDoh(ctx context.Context, site string) (*SettingDoh, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingDohKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingDohKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingDohKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingDoh), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingDoh(ctx context.Context, site string, d *SettingDoh) (*SettingDoh, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingDoh `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "doh"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/doh", site), d, &respBody)
|
||||
// Update SettingDoh Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingDoh(ctx context.Context, site string, s *SettingDoh) (*SettingDoh, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingDohKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingDoh), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_dpi.generated.go
generated
41
unifi/setting_dpi.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingDpiKey = "dpi"
|
||||
|
||||
type SettingDpi struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -47,42 +49,23 @@ func (dst *SettingDpi) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingDpi(ctx context.Context, site string) (*SettingDpi, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingDpi `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/dpi", site), nil, &respBody)
|
||||
// Update SettingDpi Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingDpi(ctx context.Context, site string) (*SettingDpi, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingDpiKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingDpiKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingDpiKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingDpi), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingDpi(ctx context.Context, site string, d *SettingDpi) (*SettingDpi, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingDpi `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "dpi"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/dpi", site), d, &respBody)
|
||||
// Update SettingDpi Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingDpi(ctx context.Context, site string, s *SettingDpi) (*SettingDpi, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingDpiKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingDpi), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_element_adopt.generated.go
generated
41
unifi/setting_element_adopt.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingElementAdoptKey = "element_adopt"
|
||||
|
||||
type SettingElementAdopt struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -48,42 +50,23 @@ func (dst *SettingElementAdopt) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingElementAdopt(ctx context.Context, site string) (*SettingElementAdopt, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingElementAdopt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/element_adopt", site), nil, &respBody)
|
||||
// Update SettingElementAdopt Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingElementAdopt(ctx context.Context, site string) (*SettingElementAdopt, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingElementAdoptKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingElementAdoptKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingElementAdoptKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingElementAdopt), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingElementAdopt(ctx context.Context, site string, d *SettingElementAdopt) (*SettingElementAdopt, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingElementAdopt `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "element_adopt"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/element_adopt", site), d, &respBody)
|
||||
// Update SettingElementAdopt Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingElementAdopt(ctx context.Context, site string, s *SettingElementAdopt) (*SettingElementAdopt, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingElementAdoptKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingElementAdopt), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_ether_lighting.generated.go
generated
41
unifi/setting_ether_lighting.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingEtherLightingKey = "ether_lighting"
|
||||
|
||||
type SettingEtherLighting struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -89,42 +91,23 @@ func (dst *SettingEtherLightingSpeedOverrides) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingEtherLighting(ctx context.Context, site string) (*SettingEtherLighting, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingEtherLighting `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/ether_lighting", site), nil, &respBody)
|
||||
// Update SettingEtherLighting Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingEtherLighting(ctx context.Context, site string) (*SettingEtherLighting, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingEtherLightingKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingEtherLightingKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingEtherLightingKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingEtherLighting), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingEtherLighting(ctx context.Context, site string, d *SettingEtherLighting) (*SettingEtherLighting, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingEtherLighting `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "ether_lighting"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/ether_lighting", site), d, &respBody)
|
||||
// Update SettingEtherLighting Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingEtherLighting(ctx context.Context, site string, s *SettingEtherLighting) (*SettingEtherLighting, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingEtherLightingKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingEtherLighting), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_evaluation_score.generated.go
generated
41
unifi/setting_evaluation_score.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingEvaluationScoreKey = "evaluation_score"
|
||||
|
||||
type SettingEvaluationScore struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingEvaluationScore) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingEvaluationScore(ctx context.Context, site string) (*SettingEvaluationScore, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingEvaluationScore `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/evaluation_score", site), nil, &respBody)
|
||||
// Update SettingEvaluationScore Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingEvaluationScore(ctx context.Context, site string) (*SettingEvaluationScore, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingEvaluationScoreKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingEvaluationScoreKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingEvaluationScoreKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingEvaluationScore), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingEvaluationScore(ctx context.Context, site string, d *SettingEvaluationScore) (*SettingEvaluationScore, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingEvaluationScore `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "evaluation_score"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/evaluation_score", site), d, &respBody)
|
||||
// Update SettingEvaluationScore Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingEvaluationScore(ctx context.Context, site string, s *SettingEvaluationScore) (*SettingEvaluationScore, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingEvaluationScoreKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingEvaluationScore), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_global_ap.generated.go
generated
41
unifi/setting_global_ap.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingGlobalApKey = "global_ap"
|
||||
|
||||
type SettingGlobalAp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -68,42 +70,23 @@ func (dst *SettingGlobalAp) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingGlobalAp(ctx context.Context, site string) (*SettingGlobalAp, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingGlobalAp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/global_ap", site), nil, &respBody)
|
||||
// Update SettingGlobalAp Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingGlobalAp(ctx context.Context, site string) (*SettingGlobalAp, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingGlobalApKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingGlobalApKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingGlobalApKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingGlobalAp), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingGlobalAp(ctx context.Context, site string, d *SettingGlobalAp) (*SettingGlobalAp, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingGlobalAp `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "global_ap"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/global_ap", site), d, &respBody)
|
||||
// Update SettingGlobalAp Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingGlobalAp(ctx context.Context, site string, s *SettingGlobalAp) (*SettingGlobalAp, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingGlobalApKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingGlobalAp), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_global_nat.generated.go
generated
41
unifi/setting_global_nat.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingGlobalNatKey = "global_nat"
|
||||
|
||||
type SettingGlobalNat struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -47,42 +49,23 @@ func (dst *SettingGlobalNat) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingGlobalNat(ctx context.Context, site string) (*SettingGlobalNat, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingGlobalNat `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/global_nat", site), nil, &respBody)
|
||||
// Update SettingGlobalNat Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingGlobalNat(ctx context.Context, site string) (*SettingGlobalNat, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingGlobalNatKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingGlobalNatKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingGlobalNatKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingGlobalNat), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingGlobalNat(ctx context.Context, site string, d *SettingGlobalNat) (*SettingGlobalNat, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingGlobalNat `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "global_nat"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/global_nat", site), d, &respBody)
|
||||
// Update SettingGlobalNat Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingGlobalNat(ctx context.Context, site string, s *SettingGlobalNat) (*SettingGlobalNat, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingGlobalNatKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingGlobalNat), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_global_switch.generated.go
generated
41
unifi/setting_global_switch.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingGlobalSwitchKey = "global_switch"
|
||||
|
||||
type SettingGlobalSwitch struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -76,42 +78,23 @@ func (dst *SettingGlobalSwitchAclL3Isolation) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingGlobalSwitch(ctx context.Context, site string) (*SettingGlobalSwitch, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingGlobalSwitch `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/global_switch", site), nil, &respBody)
|
||||
// Update SettingGlobalSwitch Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingGlobalSwitch(ctx context.Context, site string) (*SettingGlobalSwitch, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingGlobalSwitchKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingGlobalSwitchKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingGlobalSwitchKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingGlobalSwitch), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingGlobalSwitch(ctx context.Context, site string, d *SettingGlobalSwitch) (*SettingGlobalSwitch, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingGlobalSwitch `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "global_switch"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/global_switch", site), d, &respBody)
|
||||
// Update SettingGlobalSwitch Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingGlobalSwitch(ctx context.Context, site string, s *SettingGlobalSwitch) (*SettingGlobalSwitch, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingGlobalSwitchKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingGlobalSwitch), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_guest_access.generated.go
generated
41
unifi/setting_guest_access.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingGuestAccessKey = "guest_access"
|
||||
|
||||
type SettingGuestAccess struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -155,42 +157,23 @@ func (dst *SettingGuestAccess) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingGuestAccess(ctx context.Context, site string) (*SettingGuestAccess, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingGuestAccess `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/guest_access", site), nil, &respBody)
|
||||
// Update SettingGuestAccess Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingGuestAccess(ctx context.Context, site string) (*SettingGuestAccess, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingGuestAccessKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingGuestAccessKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingGuestAccessKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingGuestAccess), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingGuestAccess(ctx context.Context, site string, d *SettingGuestAccess) (*SettingGuestAccess, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingGuestAccess `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "guest_access"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/guest_access", site), d, &respBody)
|
||||
// Update SettingGuestAccess Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingGuestAccess(ctx context.Context, site string, s *SettingGuestAccess) (*SettingGuestAccess, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingGuestAccessKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingGuestAccess), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_ips.generated.go
generated
41
unifi/setting_ips.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingIpsKey = "ips"
|
||||
|
||||
type SettingIps struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -222,42 +224,23 @@ func (dst *SettingIpsWhitelist) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingIps(ctx context.Context, site string) (*SettingIps, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingIps `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/ips", site), nil, &respBody)
|
||||
// Update SettingIps Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingIps(ctx context.Context, site string) (*SettingIps, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingIpsKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingIpsKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingIpsKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingIps), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingIps(ctx context.Context, site string, d *SettingIps) (*SettingIps, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingIps `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "ips"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/ips", site), d, &respBody)
|
||||
// Update SettingIps Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingIps(ctx context.Context, site string, s *SettingIps) (*SettingIps, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingIpsKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingIps), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_lcm.generated.go
generated
41
unifi/setting_lcm.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingLcmKey = "lcm"
|
||||
|
||||
type SettingLcm struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -55,42 +57,23 @@ func (dst *SettingLcm) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingLcm(ctx context.Context, site string) (*SettingLcm, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingLcm `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/lcm", site), nil, &respBody)
|
||||
// Update SettingLcm Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingLcm(ctx context.Context, site string) (*SettingLcm, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingLcmKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingLcmKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingLcmKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingLcm), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingLcm(ctx context.Context, site string, d *SettingLcm) (*SettingLcm, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingLcm `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "lcm"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/lcm", site), d, &respBody)
|
||||
// Update SettingLcm Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingLcm(ctx context.Context, site string, s *SettingLcm) (*SettingLcm, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingLcmKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingLcm), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_locale.generated.go
generated
41
unifi/setting_locale.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingLocaleKey = "locale"
|
||||
|
||||
type SettingLocale struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingLocale) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingLocale(ctx context.Context, site string) (*SettingLocale, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingLocale `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/locale", site), nil, &respBody)
|
||||
// Update SettingLocale Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingLocale(ctx context.Context, site string) (*SettingLocale, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingLocaleKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingLocaleKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingLocaleKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingLocale), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingLocale(ctx context.Context, site string, d *SettingLocale) (*SettingLocale, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingLocale `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "locale"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/locale", site), d, &respBody)
|
||||
// Update SettingLocale Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingLocale(ctx context.Context, site string, s *SettingLocale) (*SettingLocale, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingLocaleKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingLocale), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_magic_site_to_site_vpn.generated.go
generated
41
unifi/setting_magic_site_to_site_vpn.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingMagicSiteToSiteVpnKey = "magic_site_to_site_vpn"
|
||||
|
||||
type SettingMagicSiteToSiteVpn struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingMagicSiteToSiteVpn) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingMagicSiteToSiteVpn(ctx context.Context, site string) (*SettingMagicSiteToSiteVpn, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingMagicSiteToSiteVpn `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/magic_site_to_site_vpn", site), nil, &respBody)
|
||||
// Update SettingMagicSiteToSiteVpn Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingMagicSiteToSiteVpn(ctx context.Context, site string) (*SettingMagicSiteToSiteVpn, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingMagicSiteToSiteVpnKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingMagicSiteToSiteVpnKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingMagicSiteToSiteVpnKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingMagicSiteToSiteVpn), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingMagicSiteToSiteVpn(ctx context.Context, site string, d *SettingMagicSiteToSiteVpn) (*SettingMagicSiteToSiteVpn, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingMagicSiteToSiteVpn `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "magic_site_to_site_vpn"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/magic_site_to_site_vpn", site), d, &respBody)
|
||||
// Update SettingMagicSiteToSiteVpn Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingMagicSiteToSiteVpn(ctx context.Context, site string, s *SettingMagicSiteToSiteVpn) (*SettingMagicSiteToSiteVpn, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingMagicSiteToSiteVpnKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingMagicSiteToSiteVpn), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_mgmt.generated.go
generated
41
unifi/setting_mgmt.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingMgmtKey = "mgmt"
|
||||
|
||||
type SettingMgmt struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -93,42 +95,23 @@ func (dst *SettingMgmtXSshKeys) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingMgmt(ctx context.Context, site string) (*SettingMgmt, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingMgmt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/mgmt", site), nil, &respBody)
|
||||
// Update SettingMgmt Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingMgmt(ctx context.Context, site string) (*SettingMgmt, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingMgmtKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingMgmtKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingMgmtKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingMgmt), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingMgmt(ctx context.Context, site string, d *SettingMgmt) (*SettingMgmt, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingMgmt `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "mgmt"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/mgmt", site), d, &respBody)
|
||||
// Update SettingMgmt Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingMgmt(ctx context.Context, site string, s *SettingMgmt) (*SettingMgmt, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingMgmtKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingMgmt), nil
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *client) GetSettingMgmt(ctx context.Context, site string) (*SettingMgmt, error) {
|
||||
return c.getSettingMgmt(ctx, site)
|
||||
}
|
||||
|
||||
func (c *client) UpdateSettingMgmt(ctx context.Context, site string, d *SettingMgmt) (*SettingMgmt, error) {
|
||||
d.Key = "mgmt"
|
||||
return c.updateSettingMgmt(ctx, site, d)
|
||||
}
|
||||
41
unifi/setting_netflow.generated.go
generated
41
unifi/setting_netflow.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingNetflowKey = "netflow"
|
||||
|
||||
type SettingNetflow struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -69,42 +71,23 @@ func (dst *SettingNetflow) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingNetflow(ctx context.Context, site string) (*SettingNetflow, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingNetflow `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/netflow", site), nil, &respBody)
|
||||
// Update SettingNetflow Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingNetflow(ctx context.Context, site string) (*SettingNetflow, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingNetflowKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingNetflowKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingNetflowKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingNetflow), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingNetflow(ctx context.Context, site string, d *SettingNetflow) (*SettingNetflow, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingNetflow `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "netflow"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/netflow", site), d, &respBody)
|
||||
// Update SettingNetflow Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingNetflow(ctx context.Context, site string, s *SettingNetflow) (*SettingNetflow, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingNetflowKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingNetflow), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_network_optimization.generated.go
generated
41
unifi/setting_network_optimization.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingNetworkOptimizationKey = "network_optimization"
|
||||
|
||||
type SettingNetworkOptimization struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingNetworkOptimization) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingNetworkOptimization(ctx context.Context, site string) (*SettingNetworkOptimization, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingNetworkOptimization `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/network_optimization", site), nil, &respBody)
|
||||
// Update SettingNetworkOptimization Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingNetworkOptimization(ctx context.Context, site string) (*SettingNetworkOptimization, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingNetworkOptimizationKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingNetworkOptimizationKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingNetworkOptimizationKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingNetworkOptimization), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingNetworkOptimization(ctx context.Context, site string, d *SettingNetworkOptimization) (*SettingNetworkOptimization, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingNetworkOptimization `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "network_optimization"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/network_optimization", site), d, &respBody)
|
||||
// Update SettingNetworkOptimization Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingNetworkOptimization(ctx context.Context, site string, s *SettingNetworkOptimization) (*SettingNetworkOptimization, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingNetworkOptimizationKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingNetworkOptimization), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_ntp.generated.go
generated
41
unifi/setting_ntp.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingNtpKey = "ntp"
|
||||
|
||||
type SettingNtp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -50,42 +52,23 @@ func (dst *SettingNtp) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingNtp(ctx context.Context, site string) (*SettingNtp, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingNtp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/ntp", site), nil, &respBody)
|
||||
// Update SettingNtp Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingNtp(ctx context.Context, site string) (*SettingNtp, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingNtpKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingNtpKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingNtpKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingNtp), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingNtp(ctx context.Context, site string, d *SettingNtp) (*SettingNtp, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingNtp `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "ntp"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/ntp", site), d, &respBody)
|
||||
// Update SettingNtp Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingNtp(ctx context.Context, site string, s *SettingNtp) (*SettingNtp, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingNtpKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingNtp), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_porta.generated.go
generated
41
unifi/setting_porta.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingPortaKey = "porta"
|
||||
|
||||
type SettingPorta struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingPorta) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingPorta(ctx context.Context, site string) (*SettingPorta, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingPorta `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/porta", site), nil, &respBody)
|
||||
// Update SettingPorta Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingPorta(ctx context.Context, site string) (*SettingPorta, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingPortaKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingPortaKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingPortaKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingPorta), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingPorta(ctx context.Context, site string, d *SettingPorta) (*SettingPorta, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingPorta `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "porta"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/porta", site), d, &respBody)
|
||||
// Update SettingPorta Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingPorta(ctx context.Context, site string, s *SettingPorta) (*SettingPorta, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingPortaKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingPorta), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_radio_ai.generated.go
generated
41
unifi/setting_radio_ai.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingRadioAiKey = "radio_ai"
|
||||
|
||||
type SettingRadioAi struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -113,42 +115,23 @@ func (dst *SettingRadioAiChannelsBlacklist) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingRadioAi `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/radio_ai", site), nil, &respBody)
|
||||
// Update SettingRadioAi Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingRadioAi(ctx context.Context, site string) (*SettingRadioAi, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingRadioAiKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingRadioAiKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingRadioAiKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingRadioAi), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingRadioAi(ctx context.Context, site string, d *SettingRadioAi) (*SettingRadioAi, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingRadioAi `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "radio_ai"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/radio_ai", site), d, &respBody)
|
||||
// Update SettingRadioAi Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingRadioAi(ctx context.Context, site string, s *SettingRadioAi) (*SettingRadioAi, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingRadioAiKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingRadioAi), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_radius.generated.go
generated
41
unifi/setting_radius.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingRadiusKey = "radius"
|
||||
|
||||
type SettingRadius struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -60,42 +62,23 @@ func (dst *SettingRadius) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingRadius(ctx context.Context, site string) (*SettingRadius, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingRadius `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/radius", site), nil, &respBody)
|
||||
// Update SettingRadius Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingRadius(ctx context.Context, site string) (*SettingRadius, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingRadiusKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingRadiusKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingRadiusKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingRadius), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingRadius(ctx context.Context, site string, d *SettingRadius) (*SettingRadius, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingRadius `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "radius"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/radius", site), d, &respBody)
|
||||
// Update SettingRadius Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingRadius(ctx context.Context, site string, s *SettingRadius) (*SettingRadius, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingRadiusKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingRadius), nil
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *client) GetSettingRadius(ctx context.Context, site string) (*SettingRadius, error) {
|
||||
return c.getSettingRadius(ctx, site)
|
||||
}
|
||||
|
||||
func (c *client) UpdateSettingRadius(ctx context.Context, site string, d *SettingRadius) (*SettingRadius, error) {
|
||||
return c.updateSettingRadius(ctx, site, d)
|
||||
}
|
||||
41
unifi/setting_rsyslogd.generated.go
generated
41
unifi/setting_rsyslogd.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingRsyslogdKey = "rsyslogd"
|
||||
|
||||
type SettingRsyslogd struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -61,42 +63,23 @@ func (dst *SettingRsyslogd) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingRsyslogd(ctx context.Context, site string) (*SettingRsyslogd, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingRsyslogd `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/rsyslogd", site), nil, &respBody)
|
||||
// Update SettingRsyslogd Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingRsyslogd(ctx context.Context, site string) (*SettingRsyslogd, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingRsyslogdKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingRsyslogdKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingRsyslogdKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingRsyslogd), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingRsyslogd(ctx context.Context, site string, d *SettingRsyslogd) (*SettingRsyslogd, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingRsyslogd `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "rsyslogd"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/rsyslogd", site), d, &respBody)
|
||||
// Update SettingRsyslogd Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingRsyslogd(ctx context.Context, site string, s *SettingRsyslogd) (*SettingRsyslogd, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingRsyslogdKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingRsyslogd), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_snmp.generated.go
generated
41
unifi/setting_snmp.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSnmpKey = "snmp"
|
||||
|
||||
type SettingSnmp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -50,42 +52,23 @@ func (dst *SettingSnmp) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSnmp(ctx context.Context, site string) (*SettingSnmp, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSnmp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/snmp", site), nil, &respBody)
|
||||
// Update SettingSnmp Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSnmp(ctx context.Context, site string) (*SettingSnmp, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSnmpKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSnmpKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSnmpKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSnmp), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSnmp(ctx context.Context, site string, d *SettingSnmp) (*SettingSnmp, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSnmp `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "snmp"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/snmp", site), d, &respBody)
|
||||
// Update SettingSnmp Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSnmp(ctx context.Context, site string, s *SettingSnmp) (*SettingSnmp, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSnmpKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSnmp), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_ssl_inspection.generated.go
generated
41
unifi/setting_ssl_inspection.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSslInspectionKey = "ssl_inspection"
|
||||
|
||||
type SettingSslInspection struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingSslInspection) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSslInspection(ctx context.Context, site string) (*SettingSslInspection, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSslInspection `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/ssl_inspection", site), nil, &respBody)
|
||||
// Update SettingSslInspection Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSslInspection(ctx context.Context, site string) (*SettingSslInspection, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSslInspectionKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSslInspectionKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSslInspectionKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSslInspection), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSslInspection(ctx context.Context, site string, d *SettingSslInspection) (*SettingSslInspection, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSslInspection `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "ssl_inspection"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/ssl_inspection", site), d, &respBody)
|
||||
// Update SettingSslInspection Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSslInspection(ctx context.Context, site string, s *SettingSslInspection) (*SettingSslInspection, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSslInspectionKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSslInspection), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_super_cloudaccess.generated.go
generated
41
unifi/setting_super_cloudaccess.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSuperCloudaccessKey = "super_cloudaccess"
|
||||
|
||||
type SettingSuperCloudaccess struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -52,42 +54,23 @@ func (dst *SettingSuperCloudaccess) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSuperCloudaccess(ctx context.Context, site string) (*SettingSuperCloudaccess, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperCloudaccess `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/super_cloudaccess", site), nil, &respBody)
|
||||
// Update SettingSuperCloudaccess Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSuperCloudaccess(ctx context.Context, site string) (*SettingSuperCloudaccess, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSuperCloudaccessKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSuperCloudaccessKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSuperCloudaccessKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSuperCloudaccess), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSuperCloudaccess(ctx context.Context, site string, d *SettingSuperCloudaccess) (*SettingSuperCloudaccess, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperCloudaccess `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "super_cloudaccess"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/super_cloudaccess", site), d, &respBody)
|
||||
// Update SettingSuperCloudaccess Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSuperCloudaccess(ctx context.Context, site string, s *SettingSuperCloudaccess) (*SettingSuperCloudaccess, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSuperCloudaccessKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSuperCloudaccess), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_super_events.generated.go
generated
41
unifi/setting_super_events.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSuperEventsKey = "super_events"
|
||||
|
||||
type SettingSuperEvents struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingSuperEvents) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSuperEvents(ctx context.Context, site string) (*SettingSuperEvents, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperEvents `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/super_events", site), nil, &respBody)
|
||||
// Update SettingSuperEvents Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSuperEvents(ctx context.Context, site string) (*SettingSuperEvents, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSuperEventsKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSuperEventsKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSuperEventsKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSuperEvents), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSuperEvents(ctx context.Context, site string, d *SettingSuperEvents) (*SettingSuperEvents, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperEvents `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "super_events"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/super_events", site), d, &respBody)
|
||||
// Update SettingSuperEvents Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSuperEvents(ctx context.Context, site string, s *SettingSuperEvents) (*SettingSuperEvents, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSuperEventsKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSuperEvents), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_super_fwupdate.generated.go
generated
41
unifi/setting_super_fwupdate.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSuperFwupdateKey = "super_fwupdate"
|
||||
|
||||
type SettingSuperFwupdate struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -48,42 +50,23 @@ func (dst *SettingSuperFwupdate) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSuperFwupdate(ctx context.Context, site string) (*SettingSuperFwupdate, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperFwupdate `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/super_fwupdate", site), nil, &respBody)
|
||||
// Update SettingSuperFwupdate Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSuperFwupdate(ctx context.Context, site string) (*SettingSuperFwupdate, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSuperFwupdateKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSuperFwupdateKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSuperFwupdateKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSuperFwupdate), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSuperFwupdate(ctx context.Context, site string, d *SettingSuperFwupdate) (*SettingSuperFwupdate, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperFwupdate `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "super_fwupdate"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/super_fwupdate", site), d, &respBody)
|
||||
// Update SettingSuperFwupdate Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSuperFwupdate(ctx context.Context, site string, s *SettingSuperFwupdate) (*SettingSuperFwupdate, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSuperFwupdateKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSuperFwupdate), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_super_identity.generated.go
generated
41
unifi/setting_super_identity.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSuperIdentityKey = "super_identity"
|
||||
|
||||
type SettingSuperIdentity struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -47,42 +49,23 @@ func (dst *SettingSuperIdentity) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSuperIdentity(ctx context.Context, site string) (*SettingSuperIdentity, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperIdentity `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/super_identity", site), nil, &respBody)
|
||||
// Update SettingSuperIdentity Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSuperIdentity(ctx context.Context, site string) (*SettingSuperIdentity, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSuperIdentityKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSuperIdentityKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSuperIdentityKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSuperIdentity), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSuperIdentity(ctx context.Context, site string, d *SettingSuperIdentity) (*SettingSuperIdentity, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperIdentity `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "super_identity"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/super_identity", site), d, &respBody)
|
||||
// Update SettingSuperIdentity Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSuperIdentity(ctx context.Context, site string, s *SettingSuperIdentity) (*SettingSuperIdentity, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSuperIdentityKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSuperIdentity), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_super_mail.generated.go
generated
41
unifi/setting_super_mail.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSuperMailKey = "super_mail"
|
||||
|
||||
type SettingSuperMail struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingSuperMail) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSuperMail(ctx context.Context, site string) (*SettingSuperMail, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperMail `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/super_mail", site), nil, &respBody)
|
||||
// Update SettingSuperMail Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSuperMail(ctx context.Context, site string) (*SettingSuperMail, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSuperMailKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSuperMailKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSuperMailKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSuperMail), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSuperMail(ctx context.Context, site string, d *SettingSuperMail) (*SettingSuperMail, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperMail `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "super_mail"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/super_mail", site), d, &respBody)
|
||||
// Update SettingSuperMail Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSuperMail(ctx context.Context, site string, s *SettingSuperMail) (*SettingSuperMail, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSuperMailKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSuperMail), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_super_mgmt.generated.go
generated
41
unifi/setting_super_mgmt.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSuperMgmtKey = "super_mgmt"
|
||||
|
||||
type SettingSuperMgmt struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -111,42 +113,23 @@ func (dst *SettingSuperMgmt) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSuperMgmt(ctx context.Context, site string) (*SettingSuperMgmt, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperMgmt `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/super_mgmt", site), nil, &respBody)
|
||||
// Update SettingSuperMgmt Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSuperMgmt(ctx context.Context, site string) (*SettingSuperMgmt, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSuperMgmtKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSuperMgmtKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSuperMgmtKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSuperMgmt), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSuperMgmt(ctx context.Context, site string, d *SettingSuperMgmt) (*SettingSuperMgmt, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperMgmt `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "super_mgmt"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/super_mgmt", site), d, &respBody)
|
||||
// Update SettingSuperMgmt Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSuperMgmt(ctx context.Context, site string, s *SettingSuperMgmt) (*SettingSuperMgmt, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSuperMgmtKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSuperMgmt), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_super_sdn.generated.go
generated
41
unifi/setting_super_sdn.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSuperSdnKey = "super_sdn"
|
||||
|
||||
type SettingSuperSdn struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -51,42 +53,23 @@ func (dst *SettingSuperSdn) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSuperSdn(ctx context.Context, site string) (*SettingSuperSdn, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperSdn `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/super_sdn", site), nil, &respBody)
|
||||
// Update SettingSuperSdn Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSuperSdn(ctx context.Context, site string) (*SettingSuperSdn, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSuperSdnKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSuperSdnKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSuperSdnKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSuperSdn), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSuperSdn(ctx context.Context, site string, d *SettingSuperSdn) (*SettingSuperSdn, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperSdn `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "super_sdn"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/super_sdn", site), d, &respBody)
|
||||
// Update SettingSuperSdn Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSuperSdn(ctx context.Context, site string, s *SettingSuperSdn) (*SettingSuperSdn, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSuperSdnKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSuperSdn), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_super_smtp.generated.go
generated
41
unifi/setting_super_smtp.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingSuperSmtpKey = "super_smtp"
|
||||
|
||||
type SettingSuperSmtp struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -57,42 +59,23 @@ func (dst *SettingSuperSmtp) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingSuperSmtp(ctx context.Context, site string) (*SettingSuperSmtp, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperSmtp `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/super_smtp", site), nil, &respBody)
|
||||
// Update SettingSuperSmtp Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingSuperSmtp(ctx context.Context, site string) (*SettingSuperSmtp, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingSuperSmtpKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingSuperSmtpKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingSuperSmtpKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingSuperSmtp), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingSuperSmtp(ctx context.Context, site string, d *SettingSuperSmtp) (*SettingSuperSmtp, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingSuperSmtp `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "super_smtp"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/super_smtp", site), d, &respBody)
|
||||
// Update SettingSuperSmtp Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingSuperSmtp(ctx context.Context, site string, s *SettingSuperSmtp) (*SettingSuperSmtp, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingSuperSmtpKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingSuperSmtp), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_teleport.generated.go
generated
41
unifi/setting_teleport.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingTeleportKey = "teleport"
|
||||
|
||||
type SettingTeleport struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -47,42 +49,23 @@ func (dst *SettingTeleport) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingTeleport(ctx context.Context, site string) (*SettingTeleport, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingTeleport `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/teleport", site), nil, &respBody)
|
||||
// Update SettingTeleport Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingTeleport(ctx context.Context, site string) (*SettingTeleport, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingTeleportKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingTeleportKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingTeleportKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingTeleport), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingTeleport(ctx context.Context, site string, d *SettingTeleport) (*SettingTeleport, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingTeleport `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "teleport"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/teleport", site), d, &respBody)
|
||||
// Update SettingTeleport Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingTeleport(ctx context.Context, site string, s *SettingTeleport) (*SettingTeleport, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingTeleportKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingTeleport), nil
|
||||
}
|
||||
|
||||
41
unifi/setting_usg.generated.go
generated
41
unifi/setting_usg.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingUsgKey = "usg"
|
||||
|
||||
type SettingUsg struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -158,42 +160,23 @@ func (dst *SettingUsgDNSVerification) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingUsg(ctx context.Context, site string) (*SettingUsg, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingUsg `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/usg", site), nil, &respBody)
|
||||
// Update SettingUsg Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingUsg(ctx context.Context, site string) (*SettingUsg, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingUsgKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingUsgKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingUsgKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingUsg), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingUsg(ctx context.Context, site string, d *SettingUsg) (*SettingUsg, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingUsg `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "usg"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/usg", site), d, &respBody)
|
||||
// Update SettingUsg Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingUsg(ctx context.Context, site string, s *SettingUsg) (*SettingUsg, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingUsgKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingUsg), nil
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package unifi
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (c *client) GetSettingUsg(ctx context.Context, site string) (*SettingUsg, error) {
|
||||
return c.getSettingUsg(ctx, site)
|
||||
}
|
||||
|
||||
func (c *client) UpdateSettingUsg(ctx context.Context, site string, d *SettingUsg) (*SettingUsg, error) {
|
||||
return c.updateSettingUsg(ctx, site, d)
|
||||
}
|
||||
41
unifi/setting_usw.generated.go
generated
41
unifi/setting_usw.generated.go
generated
@@ -16,6 +16,8 @@ var (
|
||||
_ json.Marshaler
|
||||
)
|
||||
|
||||
const SettingUswKey = "usw"
|
||||
|
||||
type SettingUsw struct {
|
||||
ID string `json:"_id,omitempty"`
|
||||
SiteID string `json:"site_id,omitempty"`
|
||||
@@ -46,42 +48,23 @@ func (dst *SettingUsw) UnmarshalJSON(b []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *client) getSettingUsw(ctx context.Context, site string) (*SettingUsw, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingUsw `json:"data"`
|
||||
}
|
||||
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/usw", site), nil, &respBody)
|
||||
// Update SettingUsw Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) GetSettingUsw(ctx context.Context, site string) (*SettingUsw, error) {
|
||||
s, f, err := c.GetSetting(ctx, site, SettingUswKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
if s.Key != SettingUswKey {
|
||||
return nil, fmt.Errorf("unexpected setting key received. Requested: %q, received: %q", SettingUswKey, s.Key)
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
return &d, nil
|
||||
return f.(*SettingUsw), nil
|
||||
}
|
||||
|
||||
func (c *client) updateSettingUsw(ctx context.Context, site string, d *SettingUsw) (*SettingUsw, error) {
|
||||
var respBody struct {
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingUsw `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "usw"
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/usw", site), d, &respBody)
|
||||
// Update SettingUsw Experimental! This function is not yet stable and may change in the future.
|
||||
func (c *client) UpdateSettingUsw(ctx context.Context, site string, s *SettingUsw) (*SettingUsw, error) {
|
||||
result, err := c.SetSetting(ctx, site, SettingUswKey, s)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, ErrNotFound
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
return &new, nil
|
||||
return result.(*SettingUsw), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user