Add context support

This commit is contained in:
Paul Tyng
2020-03-26 16:12:52 -04:00
parent 19709dff50
commit d076e78005
65 changed files with 642 additions and 405 deletions

View File

@@ -1,6 +1,7 @@
package unifi
import (
"context"
"encoding/json"
)
@@ -27,26 +28,26 @@ func (n *WLAN) UnmarshalJSON(b []byte) error {
return nil
}
func (c *Client) CreateWLAN(site string, d *WLAN) (*WLAN, error) {
func (c *Client) CreateWLAN(ctx context.Context, site string, d *WLAN) (*WLAN, error) {
if d.Schedule == nil {
d.Schedule = []string{}
}
return c.createWLAN(site, d)
return c.createWLAN(ctx, site, d)
}
func (c *Client) ListWLAN(site string) ([]WLAN, error) {
return c.listWLAN(site)
func (c *Client) ListWLAN(ctx context.Context, site string) ([]WLAN, error) {
return c.listWLAN(ctx, site)
}
func (c *Client) GetWLAN(site, id string) (*WLAN, error) {
return c.getWLAN(site, id)
func (c *Client) GetWLAN(ctx context.Context, site, id string) (*WLAN, error) {
return c.getWLAN(ctx, site, id)
}
func (c *Client) DeleteWLAN(site, id string) error {
return c.deleteWLAN(site, id)
func (c *Client) DeleteWLAN(ctx context.Context, site, id string) error {
return c.deleteWLAN(ctx, site, id)
}
func (c *Client) UpdateWLAN(site string, d *WLAN) (*WLAN, error) {
return c.updateWLAN(site, d)
func (c *Client) UpdateWLAN(ctx context.Context, site string, d *WLAN) (*WLAN, error) {
return c.updateWLAN(ctx, site, d)
}