Documentation ¶
Index ¶
- type AccessToken
- type Client
- func (client *Client) Execute(ctx context.Context, deviceId string, commands ...interface{}) error
- func (client *Client) GetDevices(ctx context.Context) (devices Devices, err error)
- func (client *Client) GetStatuses(ctx context.Context, ids ...string) (devices []DeviceIdAndStatus, err error)
- func (client *Client) GetToken(ctx context.Context) error
- func (client *Client) Request(ctx context.Context, method, path string, body interface{}, ...) (err error)
- type Device
- type DeviceIdAndStatus
- type Devices
- type Statuses
- type Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type Client ¶
type Client struct { ClientId string ClientSecret string AccessToken *AccessToken Host string // defaults to "https://openapi.tuyacn.com" }
func (*Client) GetDevices ¶
GetDevices returns all devices.
func (*Client) GetStatuses ¶ added in v1.0.1
func (client *Client) GetStatuses(ctx context.Context, ids ...string) (devices []DeviceIdAndStatus, err error)
GetStatuses returns statuses of given devices. You should provide at least one device and at most 20 devices.
func (*Client) Request ¶
func (client *Client) Request(ctx context.Context, method, path string, body interface{}, targets ...interface{}) (err error)
Request makes a new request given a method, URL, and optional body, parses the JSON response and stores the result in the value pointed to by the optional targets. Error is returned if network has connectivity problem or server responded an error.
type DeviceIdAndStatus ¶ added in v1.0.1
Click to show internal directories.
Click to hide internal directories.