Documentation ¶
Index ¶
- Constants
- type Client
- func (c *Client) Call(ctx context.Context, method, path string, params, response any, ...) error
- func (c *Client) CallURL(ctx context.Context, method, uri string, response any, ...) error
- func (c *Client) Listen(ctx context.Context, path string, params any, handler EventStreamHandler, ...) error
- func (c *Client) SetBasicAuth(apiKey, apiSecret string) *Client
- func (c *Client) SetHeader(key, value string) *Client
- type Event
- type EventReader
- type EventStreamHandler
Constants ¶
View Source
const (
DefaultClientTimeout = 10 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { HTTP *resty.Client // contains filtered or unexported fields }
Client defines an HTTP client for the REST API.
func New ¶
func New( apiURL string, reader EventReader, logger *slog.Logger, ) *Client
New returns a new client with the specified API key and config.
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, method, path string, params, response any, opts ...model.RequestOption) error
Call makes an API call based on the request params and options. The response is automatically unmarshaled.
func (*Client) CallURL ¶
func (c *Client) CallURL(ctx context.Context, method, uri string, response any, opts ...model.RequestOption) error
CallURL makes an API call based on a request URI and options. The response is automatically unmarshaled.
func (*Client) Listen ¶
func (c *Client) Listen(ctx context.Context, path string, params any, handler EventStreamHandler, opts ...model.RequestOption) error
Listen to an event data stream. This is a blocking call that will continue to read from the stream until the context is canceled or the watch is stopped.
func (*Client) SetBasicAuth ¶
type EventReader ¶
Click to show internal directories.
Click to hide internal directories.