Add basic node handling

This commit is contained in:
Ingo Oppermann
2022-08-03 22:05:28 +02:00
parent 11c3fce812
commit fe889aa4e2
35 changed files with 3988 additions and 22 deletions

25
client/metrics.go Normal file
View File

@@ -0,0 +1,25 @@
package client
import (
"bytes"
"encoding/json"
"github.com/datarhei/core/v16/http/api"
)
func (r *restclient) Metrics(query api.MetricsQuery) (api.MetricsResponse, error) {
var m api.MetricsResponse
var buf bytes.Buffer
e := json.NewEncoder(&buf)
e.Encode(query)
data, err := r.call("POST", "/metrics", "application/json", &buf)
if err != nil {
return m, err
}
err = json.Unmarshal(data, &m)
return m, err
}