Documentation
¶
Index ¶
- Variables
- type APIClient
- func (c *APIClient) Do(req *http.Request) (*http.Response, error)
- func (c *APIClient) Get(ctx context.Context, path string, v any) error
- func (c *APIClient) HealthCheck(ctx context.Context) error
- func (c *APIClient) NewRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error)
- func (c *APIClient) Post(ctx context.Context, path string, request, response any) error
- func (c *APIClient) PostFile(ctx context.Context, path, fieldName, filePath string) error
- func (c *APIClient) Stream(ctx context.Context, path string, handler func(data string) bool) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("resource not found")
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient handles communication with the haloy API
func NewWithTimeout ¶
func (*APIClient) Do ¶
Do executes a request using the client's http.Client. Use with NewRequest for custom requests that don't fit Get/Post patterns.
func (*APIClient) NewRequest ¶
func (c *APIClient) NewRequest(ctx context.Context, method, path string, body io.Reader) (*http.Request, error)
NewRequest creates an authenticated request with the base URL and auth header set. Callers can customize the request (add headers, etc.) before calling Do.
Click to show internal directories.
Click to hide internal directories.