fix: explicitly set Setting key when updating a settings (#37)

This commit is contained in:
Mateusz Filipowicz
2025-02-23 14:00:19 +01:00
committed by GitHub
parent e79dcb13f0
commit bbc373a354
42 changed files with 42 additions and 1 deletions

View File

@@ -104,7 +104,7 @@ func (c *client) SetSetting(ctx context.Context, site, key string, reqBody inter
Meta Meta `json:"meta"`
Data []json.RawMessage `json:"data"`
}
err := c.Post(ctx, fmt.Sprintf("s/%s/set/setting/%s", site, key), reqBody, &respBody)
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/%s", site, key), reqBody, &respBody)
if err != nil {
return nil, err
}

View File

@@ -63,6 +63,7 @@ func (c *client) GetSettingAutoSpeedtest(ctx context.Context, site string) (*Set
// 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) {
s.Key = SettingAutoSpeedtestKey
result, err := c.SetSetting(ctx, site, SettingAutoSpeedtestKey, s)
if err != nil {
return nil, err

View File

@@ -65,6 +65,7 @@ func (c *client) GetSettingBaresip(ctx context.Context, site string) (*SettingBa
// 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) {
s.Key = SettingBaresipKey
result, err := c.SetSetting(ctx, site, SettingBaresipKey, s)
if err != nil {
return nil, err

View File

@@ -67,6 +67,7 @@ func (c *client) GetSettingBroadcast(ctx context.Context, site string) (*Setting
// 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) {
s.Key = SettingBroadcastKey
result, err := c.SetSetting(ctx, site, SettingBroadcastKey, s)
if err != nil {
return nil, err

View File

@@ -67,6 +67,7 @@ func (c *client) GetSettingConnectivity(ctx context.Context, site string) (*Sett
// 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) {
s.Key = SettingConnectivityKey
result, err := c.SetSetting(ctx, site, SettingConnectivityKey, s)
if err != nil {
return nil, err

View File

@@ -65,6 +65,7 @@ func (c *client) GetSettingCountry(ctx context.Context, site string) (*SettingCo
// 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) {
s.Key = SettingCountryKey
result, err := c.SetSetting(ctx, site, SettingCountryKey, s)
if err != nil {
return nil, err

View File

@@ -84,6 +84,7 @@ func (c *client) GetSettingDashboard(ctx context.Context, site string) (*Setting
// 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) {
s.Key = SettingDashboardKey
result, err := c.SetSetting(ctx, site, SettingDashboardKey, s)
if err != nil {
return nil, err

View File

@@ -86,6 +86,7 @@ func (c *client) GetSettingDoh(ctx context.Context, site string) (*SettingDoh, e
// 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) {
s.Key = SettingDohKey
result, err := c.SetSetting(ctx, site, SettingDohKey, s)
if err != nil {
return nil, err

View File

@@ -63,6 +63,7 @@ func (c *client) GetSettingDpi(ctx context.Context, site string) (*SettingDpi, e
// 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) {
s.Key = SettingDpiKey
result, err := c.SetSetting(ctx, site, SettingDpiKey, s)
if err != nil {
return nil, err

View File

@@ -64,6 +64,7 @@ func (c *client) GetSettingElementAdopt(ctx context.Context, site string) (*Sett
// 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) {
s.Key = SettingElementAdoptKey
result, err := c.SetSetting(ctx, site, SettingElementAdoptKey, s)
if err != nil {
return nil, err

View File

@@ -105,6 +105,7 @@ func (c *client) GetSettingEtherLighting(ctx context.Context, site string) (*Set
// 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) {
s.Key = SettingEtherLightingKey
result, err := c.SetSetting(ctx, site, SettingEtherLightingKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingEvaluationScore(ctx context.Context, site string) (*S
// 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) {
s.Key = SettingEvaluationScoreKey
result, err := c.SetSetting(ctx, site, SettingEvaluationScoreKey, s)
if err != nil {
return nil, err

View File

@@ -84,6 +84,7 @@ func (c *client) GetSettingGlobalAp(ctx context.Context, site string) (*SettingG
// 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) {
s.Key = SettingGlobalApKey
result, err := c.SetSetting(ctx, site, SettingGlobalApKey, s)
if err != nil {
return nil, err

View File

@@ -63,6 +63,7 @@ func (c *client) GetSettingGlobalNat(ctx context.Context, site string) (*Setting
// 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) {
s.Key = SettingGlobalNatKey
result, err := c.SetSetting(ctx, site, SettingGlobalNatKey, s)
if err != nil {
return nil, err

View File

@@ -92,6 +92,7 @@ func (c *client) GetSettingGlobalSwitch(ctx context.Context, site string) (*Sett
// 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) {
s.Key = SettingGlobalSwitchKey
result, err := c.SetSetting(ctx, site, SettingGlobalSwitchKey, s)
if err != nil {
return nil, err

View File

@@ -173,6 +173,7 @@ func (c *client) GetSettingGuestAccess(ctx context.Context, site string) (*Setti
// 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) {
s.Key = SettingGuestAccessKey
result, err := c.SetSetting(ctx, site, SettingGuestAccessKey, s)
if err != nil {
return nil, err

View File

@@ -238,6 +238,7 @@ func (c *client) GetSettingIps(ctx context.Context, site string) (*SettingIps, e
// 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) {
s.Key = SettingIpsKey
result, err := c.SetSetting(ctx, site, SettingIpsKey, s)
if err != nil {
return nil, err

View File

@@ -71,6 +71,7 @@ func (c *client) GetSettingLcm(ctx context.Context, site string) (*SettingLcm, e
// 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) {
s.Key = SettingLcmKey
result, err := c.SetSetting(ctx, site, SettingLcmKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingLocale(ctx context.Context, site string) (*SettingLoc
// 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) {
s.Key = SettingLocaleKey
result, err := c.SetSetting(ctx, site, SettingLocaleKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingMagicSiteToSiteVpn(ctx context.Context, site string)
// 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) {
s.Key = SettingMagicSiteToSiteVpnKey
result, err := c.SetSetting(ctx, site, SettingMagicSiteToSiteVpnKey, s)
if err != nil {
return nil, err

View File

@@ -109,6 +109,7 @@ func (c *client) GetSettingMgmt(ctx context.Context, site string) (*SettingMgmt,
// 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) {
s.Key = SettingMgmtKey
result, err := c.SetSetting(ctx, site, SettingMgmtKey, s)
if err != nil {
return nil, err

View File

@@ -85,6 +85,7 @@ func (c *client) GetSettingNetflow(ctx context.Context, site string) (*SettingNe
// 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) {
s.Key = SettingNetflowKey
result, err := c.SetSetting(ctx, site, SettingNetflowKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingNetworkOptimization(ctx context.Context, site string)
// 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) {
s.Key = SettingNetworkOptimizationKey
result, err := c.SetSetting(ctx, site, SettingNetworkOptimizationKey, s)
if err != nil {
return nil, err

View File

@@ -66,6 +66,7 @@ func (c *client) GetSettingNtp(ctx context.Context, site string) (*SettingNtp, e
// 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) {
s.Key = SettingNtpKey
result, err := c.SetSetting(ctx, site, SettingNtpKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingPorta(ctx context.Context, site string) (*SettingPort
// 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) {
s.Key = SettingPortaKey
result, err := c.SetSetting(ctx, site, SettingPortaKey, s)
if err != nil {
return nil, err

View File

@@ -129,6 +129,7 @@ func (c *client) GetSettingRadioAi(ctx context.Context, site string) (*SettingRa
// 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) {
s.Key = SettingRadioAiKey
result, err := c.SetSetting(ctx, site, SettingRadioAiKey, s)
if err != nil {
return nil, err

View File

@@ -76,6 +76,7 @@ func (c *client) GetSettingRadius(ctx context.Context, site string) (*SettingRad
// 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) {
s.Key = SettingRadiusKey
result, err := c.SetSetting(ctx, site, SettingRadiusKey, s)
if err != nil {
return nil, err

View File

@@ -77,6 +77,7 @@ func (c *client) GetSettingRsyslogd(ctx context.Context, site string) (*SettingR
// 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) {
s.Key = SettingRsyslogdKey
result, err := c.SetSetting(ctx, site, SettingRsyslogdKey, s)
if err != nil {
return nil, err

View File

@@ -66,6 +66,7 @@ func (c *client) GetSettingSnmp(ctx context.Context, site string) (*SettingSnmp,
// 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) {
s.Key = SettingSnmpKey
result, err := c.SetSetting(ctx, site, SettingSnmpKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingSslInspection(ctx context.Context, site string) (*Set
// 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) {
s.Key = SettingSslInspectionKey
result, err := c.SetSetting(ctx, site, SettingSslInspectionKey, s)
if err != nil {
return nil, err

View File

@@ -68,6 +68,7 @@ func (c *client) GetSettingSuperCloudaccess(ctx context.Context, site string) (*
// 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) {
s.Key = SettingSuperCloudaccessKey
result, err := c.SetSetting(ctx, site, SettingSuperCloudaccessKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingSuperEvents(ctx context.Context, site string) (*Setti
// 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) {
s.Key = SettingSuperEventsKey
result, err := c.SetSetting(ctx, site, SettingSuperEventsKey, s)
if err != nil {
return nil, err

View File

@@ -64,6 +64,7 @@ func (c *client) GetSettingSuperFwupdate(ctx context.Context, site string) (*Set
// 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) {
s.Key = SettingSuperFwupdateKey
result, err := c.SetSetting(ctx, site, SettingSuperFwupdateKey, s)
if err != nil {
return nil, err

View File

@@ -63,6 +63,7 @@ func (c *client) GetSettingSuperIdentity(ctx context.Context, site string) (*Set
// 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) {
s.Key = SettingSuperIdentityKey
result, err := c.SetSetting(ctx, site, SettingSuperIdentityKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingSuperMail(ctx context.Context, site string) (*Setting
// 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) {
s.Key = SettingSuperMailKey
result, err := c.SetSetting(ctx, site, SettingSuperMailKey, s)
if err != nil {
return nil, err

View File

@@ -127,6 +127,7 @@ func (c *client) GetSettingSuperMgmt(ctx context.Context, site string) (*Setting
// 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) {
s.Key = SettingSuperMgmtKey
result, err := c.SetSetting(ctx, site, SettingSuperMgmtKey, s)
if err != nil {
return nil, err

View File

@@ -67,6 +67,7 @@ func (c *client) GetSettingSuperSdn(ctx context.Context, site string) (*SettingS
// 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) {
s.Key = SettingSuperSdnKey
result, err := c.SetSetting(ctx, site, SettingSuperSdnKey, s)
if err != nil {
return nil, err

View File

@@ -73,6 +73,7 @@ func (c *client) GetSettingSuperSmtp(ctx context.Context, site string) (*Setting
// 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) {
s.Key = SettingSuperSmtpKey
result, err := c.SetSetting(ctx, site, SettingSuperSmtpKey, s)
if err != nil {
return nil, err

View File

@@ -63,6 +63,7 @@ func (c *client) GetSettingTeleport(ctx context.Context, site string) (*SettingT
// 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) {
s.Key = SettingTeleportKey
result, err := c.SetSetting(ctx, site, SettingTeleportKey, s)
if err != nil {
return nil, err

View File

@@ -174,6 +174,7 @@ func (c *client) GetSettingUsg(ctx context.Context, site string) (*SettingUsg, e
// 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) {
s.Key = SettingUsgKey
result, err := c.SetSetting(ctx, site, SettingUsgKey, s)
if err != nil {
return nil, err

View File

@@ -62,6 +62,7 @@ func (c *client) GetSettingUsw(ctx context.Context, site string) (*SettingUsw, e
// 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) {
s.Key = SettingUswKey
result, err := c.SetSetting(ctx, site, SettingUswKey, s)
if err != nil {
return nil, err