use struct for toggle endpoint

This commit is contained in:
2020-02-28 22:14:55 -06:00
parent e05efa9d57
commit c0c49b6d7c
2 changed files with 6 additions and 4 deletions

View File

@ -75,9 +75,7 @@ func (s *Client) SetState(selector string, state *State) ([]Result, error) {
}
func (s *Client) Toggle(selector string, duration float64) ([]Result, error) {
m := make(map[string]interface{})
m["duration"] = duration
j, err := json.Marshal(m)
j, err := json.Marshal(&Toggle{Duration: duration})
if err != nil {
return nil, err
}