diff --git a/client.go b/client.go index 6cd509c..7ef28c8 100644 --- a/client.go +++ b/client.go @@ -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 } diff --git a/structs.go b/structs.go index cd7d73b..f038202 100644 --- a/structs.go +++ b/structs.go @@ -28,6 +28,10 @@ type ( Result struct { ID string `json:"id"` Label string `json:"label"` - Status string `json:"status"` + Status Status `json:"status"` + } + + Toggle struct { + Duration float64 `json:"duration,omitempty"` } )