feat: initial implementation with docs and system_config

This commit is contained in:
2026-06-01 11:19:02 -04:00
commit 1337034f07
39 changed files with 3451 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
package client
import (
"fmt"
"io"
"net/http"
)
type Client struct {
HostURL string
HTTPClient *http.Client
Token string
}
func NewClient(host, token string) *Client {
return &Client{
HTTPClient: &http.Client{},
HostURL: host,
Token: token,
}
}
func (c *Client) doRequest(req *http.Request) ([]byte, error) {
req.Header.Set("x-api-key", c.Token)
req.Header.Set("Content-Type", "application/json")
res, err := c.HTTPClient.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
return nil, err
}
if res.StatusCode < 200 || res.StatusCode >= 300 {
return nil, fmt.Errorf("status: %d, body: %s", res.StatusCode, string(body))
}
return body, nil
}