Add functionality to list entities from REST endpoint

This commit is contained in:
Jakub Zimny
2025-01-20 23:32:12 +01:00
parent 05131faa98
commit 84f9726b09
2 changed files with 19 additions and 0 deletions

View File

@@ -40,6 +40,14 @@ func (c *HttpClient) GetState(entityId string) ([]byte, error) {
return resp, nil
}
func (c *HttpClient) States() ([]byte, error) {
resp, err := get(c.url+"/states", c.token)
if err != nil {
return nil, err
}
return resp, nil
}
func get(url, token string) ([]byte, error) {
req, err := http.NewRequest("GET", url, nil)
if err != nil {