Documentation
¶
Overview ¶
Package https provides a unified HTTP client for making API requests with centralized auth, error handling, and debug logging.
Index ¶
- type Client
- func (c *Client) APIKey() string
- func (c *Client) Client() *http.Client
- func (c *Client) DELETE(ctx context.Context, path string) (*http.Response, error)
- func (c *Client) GET(ctx context.Context, path string, params map[string]string) (*http.Response, error)
- func (c *Client) POST(ctx context.Context, path string, body interface{}) (*http.Response, error)
- type HTTPError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a unified HTTP client for API requests.
func NewClient ¶
NewClient creates a new HTTP client with the given credentials and base URL. The baseURL parameter is the base URL (e.g., "https://api.braintrust.dev" or "https://www.braintrust.dev").
func NewWrappedClient ¶ added in v0.0.2
NewWrappedClient creates a new HTTP client with a custom http.Client. This is useful for tests that need to wrap the HTTP client (e.g., with VCR).
func (*Client) Client ¶ added in v0.1.0
Client returns the underlying http.Client. This is useful for extracting the client for auth.Session when using VCR.
func (*Client) DELETE ¶
DELETE makes a DELETE request. The path is appended to the base URL (e.g., "/v1/function/123").