Documentation
¶
Overview ¶
Package httpclient contains an http client
Index ¶
- type Client
- func (c *Client) Delete(ctx context.Context, path string) (*http.Response, error)
- func (c *Client) DeleteJSON(ctx context.Context, path string, target any) error
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) Get(ctx context.Context, path string, params any) (*http.Response, error)
- func (c *Client) GetJSON(ctx context.Context, path string, params any, target any) error
- func (c *Client) Post(ctx context.Context, path string, body any) (*http.Response, error)
- func (c *Client) PostJSON(ctx context.Context, path string, body any, target any) error
- func (c *Client) WithAPIKey(key string) *Client
- func (c *Client) WithBaseURL(baseURL string) *Client
- func (c *Client) WithCookie(cookie string) *Client
- func (c *Client) WithHeader(key string, value string) *Client
- func (c *Client) WithUserAgent(userAgent string) *Client
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 manages making HTTP requests to the API.
func (*Client) DeleteJSON ¶ added in v0.1.8
DeleteJSON makes a DELETE request and intialises target with JSON response if not nil
func (*Client) GetJSON ¶ added in v0.1.8
GetJSON makes a GET request and intialises target with JSON response if not nil
func (*Client) PostJSON ¶ added in v0.1.8
PostJSON makes a POST request and intialises target with JSON response if not nil
func (*Client) WithAPIKey ¶ added in v0.1.8
func (*Client) WithBaseURL ¶ added in v0.1.8
WithBaseURL updates the base URL used for requests.
func (*Client) WithCookie ¶ added in v0.1.8
func (*Client) WithHeader ¶ added in v0.1.8
func (*Client) WithUserAgent ¶ added in v0.1.8
Click to show internal directories.
Click to hide internal directories.