feat: new, more customizable client supporting API Key and user/password authentication
This commit is contained in:
committed by
Mateusz Filipowicz
parent
8a0cf33e75
commit
f79f21c4ad
12
unifi/setting_dpi.generated.go
generated
12
unifi/setting_dpi.generated.go
generated
@@ -49,17 +49,17 @@ func (dst *SettingDpi) UnmarshalJSON(b []byte) error {
|
||||
|
||||
func (c *Client) getSettingDpi(ctx context.Context, site string) (*SettingDpi, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingDpi `json:"data"`
|
||||
}
|
||||
|
||||
err := c.do(ctx, "GET", fmt.Sprintf("s/%s/get/setting/dpi", site), nil, &respBody)
|
||||
err := c.Get(ctx, fmt.Sprintf("s/%s/get/setting/dpi", site), nil, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
return nil, NotFoundError
|
||||
}
|
||||
|
||||
d := respBody.Data[0]
|
||||
@@ -68,18 +68,18 @@ func (c *Client) getSettingDpi(ctx context.Context, site string) (*SettingDpi, e
|
||||
|
||||
func (c *Client) updateSettingDpi(ctx context.Context, site string, d *SettingDpi) (*SettingDpi, error) {
|
||||
var respBody struct {
|
||||
Meta meta `json:"meta"`
|
||||
Meta Meta `json:"meta"`
|
||||
Data []SettingDpi `json:"data"`
|
||||
}
|
||||
|
||||
d.Key = "dpi"
|
||||
err := c.do(ctx, "PUT", fmt.Sprintf("s/%s/set/setting/dpi", site), d, &respBody)
|
||||
err := c.Put(ctx, fmt.Sprintf("s/%s/set/setting/dpi", site), d, &respBody)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(respBody.Data) != 1 {
|
||||
return nil, &NotFoundError{}
|
||||
return nil, NotFoundError
|
||||
}
|
||||
|
||||
new := respBody.Data[0]
|
||||
|
||||
Reference in New Issue
Block a user