This commit is contained in:
David Newhall II 2019-06-14 20:12:28 -07:00
parent 9cac7db859
commit cec0cfec60
5 changed files with 10 additions and 7 deletions

View File

@ -1,5 +1,10 @@
package unifi
// Clients contains a list that contains all of the unifi clients from a controller.
type Clients struct {
UCLs []UCL
}
// UCL defines all the data a connected-network client contains.
type UCL struct {
ID string `json:"_id"`

View File

@ -10,7 +10,7 @@ import (
// Points generates Unifi Sites' datapoints for InfluxDB.
// These points can be passed directly to influx.
func (u Site) Points() ([]*influx.Point, error) {
points := make([]*influx.Point, 1)
var points []*influx.Point
for _, s := range u.Health {
tags := map[string]string{
"id": u.ID,

View File

@ -1,5 +1,8 @@
package unifi
// Sites is a struct to match Devices and Clients.
type Sites []Site
// Site represents a site's data.
type Site struct {
ID string `json:"_id"`

View File

@ -54,11 +54,6 @@ type Devices struct {
USWs []USW
}
// Clients contains a list that contains all of the unifi clients from a controller.
type Clients struct {
UCLs []UCL
}
// Unifi is what you get in return for providing a password! Unifi represents
// a controller that you can make authenticated requests to. Use this to make
// additional requests for devices, clients or other custom data.

View File

@ -125,7 +125,7 @@ func (u *Unifi) GetDevices(sites []Site) (*Devices, error) {
}
// GetSites returns a list of configured sites on the Unifi controller.
func (u *Unifi) GetSites() ([]Site, error) {
func (u *Unifi) GetSites() (Sites, error) {
var response struct {
Data []Site `json:"data"`
}