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) {
|
||||
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
|
||||
}
|
||||
|
@ -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"`
|
||||
}
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user