client

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const BaseUrl = "https://www.avanza.se"
View Source
const DefaultRetryCount = 3
View Source
const DefaultUserAgent = "Avanza GO API client"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTP *resty.Client

	AuthTokens *models.AuthSessionTokens
	// contains filtered or unexported fields
}

Client defines an HTTP client for the Avanza API.

func New

func New() *Client

func (*Client) Call

func (c *Client) Call(ctx context.Context, method, path string, params, response interface{}, opts ...models.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, params interface{}, opts ...models.RequestOption) error

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

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

Encoder defines a path and query param encoder that plays nicely with the Polygon REST API.

func NewEncoder

func NewEncoder() *Encoder

NewEncoder returns a new path and query param encoder.

func (*Encoder) EncodeParams

func (e *Encoder) EncodeParams(path string, params interface{}) (string, error)

EncodeParams encodes path and query params and returns a valid request URI.

Jump to

Keyboard shortcuts

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