use struct for toggle endpoint
This commit is contained in:
parent
e05efa9d57
commit
c0c49b6d7c
@ -75,9 +75,7 @@ func (s *Client) SetState(selector string, state *State) ([]Result, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Client) Toggle(selector string, duration float64) ([]Result, error) {
|
func (s *Client) Toggle(selector string, duration float64) ([]Result, error) {
|
||||||
m := make(map[string]interface{})
|
j, err := json.Marshal(&Toggle{Duration: duration})
|
||||||
m["duration"] = duration
|
|
||||||
j, err := json.Marshal(m)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,10 @@ type (
|
|||||||
Result struct {
|
Result struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Label string `json:"label"`
|
Label string `json:"label"`
|
||||||
Status string `json:"status"`
|
Status Status `json:"status"`
|
||||||
|
}
|
||||||
|
|
||||||
|
Toggle struct {
|
||||||
|
Duration float64 `json:"duration,omitempty"`
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user