Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { Credentials credentials.Credentials Url *url.URL *voucher.Voucher // contains filtered or unexported fields }
Client is the primary struct that interacts with the Unifi controller using http requests. It holds the credentials, http client, url, and token for the Unifi controller Before using the client, the Login method must be called to authenticate with the Unifi controller. If no error is returned, the client is ready to add vouchers.
func (*Client) AddVoucher ¶
AddVoucher sends a request to the Unifi controller to add a voucher. If the request is successful, the voucher is stored in the client struct.
func (*Client) FetchVouchers ¶
func (c *Client) FetchVouchers() (UnifiVouchers, error)
type LoginResponse ¶
type LoginResponse struct { Meta Meta `json:"meta"` // Maps the "meta" field Data []interface{} `json:"data"` // Use []interface{} for arbitrary data; adjust as needed }
type UnifiVoucher ¶
type UnifiVoucher struct { Duration int `json:"duration"` QosOverwrite bool `json:"qos_overwrite"` Note string `json:"note"` Code string `json:"code"` ForHotspot bool `json:"for_hotspot"` CreateTime int64 `json:"create_time"` Quota int `json:"quota"` SiteID string `json:"site_id"` ID string `json:"_id"` AdminName string `json:"admin_name"` Used int `json:"used"` Status string `json:"status"` StatusExpires int `json:"status_expires"` }
UnifiVoucher Define struct for each item in the data array
type UnifiVouchers ¶
type UnifiVouchers []UnifiVoucher
type VoucherListResponse ¶
type VoucherListResponse struct { Meta Meta `json:"meta"` Data UnifiVouchers `json:"data"` }
VoucherListResponse Define struct for the top-level JSON object
Source Files ¶
Click to show internal directories.
Click to hide internal directories.