diff --git a/core/unifi/unidev.go b/core/unifi/unidev.go index 7f2d7f54..0738e0fa 100644 --- a/core/unifi/unidev.go +++ b/core/unifi/unidev.go @@ -34,6 +34,11 @@ type Devices struct { USWs []USW } +// Clients conptains a list of all the unifi clients from a controller. +type Clients struct { + UCLs []UCL +} + // Unifi is what you get in return for providing a password! type Unifi struct { *http.Client diff --git a/core/unifi/unifi.go b/core/unifi/unifi.go index 5c2645af..2c62af33 100644 --- a/core/unifi/unifi.go +++ b/core/unifi/unifi.go @@ -8,7 +8,7 @@ import ( ) // GetClients returns a response full of clients' data from the Unifi Controller. -func (u *Unifi) GetClients() ([]UCL, error) { +func (u *Unifi) GetClients() (*Clients, error) { var response struct { Clients []UCL `json:"data"` } @@ -28,7 +28,7 @@ func (u *Unifi) GetClients() ([]UCL, error) { } else if err = json.Unmarshal(body, &response); err != nil { return nil, errors.Wrap(err, "json.Unmarshal([]UCL)") } - return response.Clients, nil + return &Clients{UCLs: response.Clients}, nil } // GetDevices returns a response full of devices' data from the Unifi Controller.