Skip to content

Commit

Permalink
Fix maxsta unmarshaling
Browse files Browse the repository at this point in the history
  • Loading branch information
paultyng committed Feb 6, 2020
1 parent f740d52 commit 95a2437
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions unifi/wlan_group.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
package unifi

import "encoding/json"

func (n *WLANGroup) UnmarshalJSON(b []byte) error {
type Alias WLANGroup
aux := &struct {
Maxsta json.Number `json:"maxsta"`
*Alias
}{
Alias: (*Alias)(n),
}
err := json.Unmarshal(b, &aux)
if err != nil {
return err
}
n.Maxsta = 0
if aux.Maxsta.String() != "" {
maxsta, err := aux.Maxsta.Int64()
if err != nil {
return err
}
n.Maxsta = int(maxsta)
}
return nil
}

func (c *Client) ListWLANGroup(site string) ([]WLANGroup, error) {
return c.listWLANGroup(site)
}
Expand Down

0 comments on commit 95a2437

Please sign in to comment.