rest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2025 License: BSD-3-Clause Imports: 9 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(
	apiKey string,
	logger *slog.Logger,
) *Client

func (*Client) Call

func (c *Client) Call(ctx context.Context, method, path string, params, response any, opts ...model.RequestOption) (*resty.Response, 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) (*resty.Response, error)

CallURL makes an API call based on a request URI and options. The response is automatically unmarshaled.

Jump to

Keyboard shortcuts

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