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 ¶
DeleteJSON makes a DELETE request and intialises target with JSON response if not nil
func (*Client) GetJSON ¶
GetJSON makes a GET request and intialises target with JSON response if not nil
func (*Client) PostJSON ¶
PostJSON makes a POST request and intialises target with JSON response if not nil
func (*Client) WithAPIKey ¶
func (*Client) WithBaseURL ¶
WithBaseURL updates the base URL used for requests.
func (*Client) WithCookie ¶
func (*Client) WithUserAgent ¶
Click to show internal directories.
Click to hide internal directories.