mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 07:57:13 +08:00
21 lines
409 B
Go
21 lines
409 B
Go
package client
|
|
|
|
import (
|
|
"bytes"
|
|
"net/http"
|
|
"net/url"
|
|
|
|
"github.com/datarhei/core/v16/encoding/json"
|
|
)
|
|
|
|
func (c *APIClient) NodeSetState(origin string, nodeid string, r SetNodeStateRequest) error {
|
|
data, err := json.Marshal(r)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
_, err = c.call(http.MethodPut, "/v1/node/"+url.PathEscape(nodeid)+"/state", "application/json", bytes.NewReader(data), origin)
|
|
|
|
return err
|
|
}
|