client

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRetryCount    = 3
	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 Polygon REST API.

func New

func New(
	apiURL string,
	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 unmarshalled.

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 unmarshalled.

func (*Client) SetAuthScheme

func (c *Client) SetAuthScheme(scheme string) *Client

func (*Client) SetAuthToken

func (c *Client) SetAuthToken(apiKey string) *Client

func (*Client) SetHeader

func (c *Client) SetHeader(key, value string) *Client

func (*Client) SetLogger

func (c *Client) SetLogger(logger *slog.Logger) *Client

type Event

type Event interface {
	GetData() []byte
	GetTimestamp() time.Time
}

type EventReader

type EventReader interface {
	Listen(ctx context.Context, stream io.Reader) (<-chan Event, <-chan error)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL