httpclient

package
v0.0.0-...-24aa6cd Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package httpclient contains an http client

Index

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 New

func New() *Client

New creates a new internal HTTP client.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string) (*http.Response, error)

Delete makes a DELETE request.

func (*Client) DeleteJSON

func (c *Client) DeleteJSON(ctx context.Context, path string, target any) error

DeleteJSON makes a DELETE request and intialises target with JSON response if not nil

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, params any) (*http.Response, error)

Get makes a GET request.

func (*Client) GetJSON

func (c *Client) GetJSON(ctx context.Context, path string, params any, target any) error

GetJSON makes a GET request and intialises target with JSON response if not nil

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body any) (*http.Response, error)

Post makes a POST request.

func (*Client) PostJSON

func (c *Client) PostJSON(ctx context.Context, path string, body any, target any) error

PostJSON makes a POST request and intialises target with JSON response if not nil

func (*Client) WithAPIKey

func (c *Client) WithAPIKey(key string) *Client

func (*Client) WithBaseURL

func (c *Client) WithBaseURL(baseURL string) *Client

WithBaseURL updates the base URL used for requests.

func (*Client) WithCookie

func (c *Client) WithCookie(cookie string) *Client

func (*Client) WithHeader

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

func (*Client) WithUserAgent

func (c *Client) WithUserAgent(userAgent string) *Client

Jump to

Keyboard shortcuts

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