client

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPError

func NewHTTPError(resp *http.Response) error

NewHTTPError creates a new HTTP error from a response

Types

type Client

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

Client is an HTTP client with retry logic, authentication, and logging

func NewClient

func NewClient(cfg *Config) (*Client, error)

NewClient creates a new HTTP client with the given configuration

func (*Client) Delete

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

Delete performs a DELETE request

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, body io.Reader) (*http.Response, error)

Do performs an HTTP request with retry logic

func (*Client) Get

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

Get performs a GET request

func (*Client) Post

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

Post performs a POST request

func (*Client) Put

func (c *Client) Put(ctx context.Context, path string, body []byte) (*http.Response, error)

Put performs a PUT request

type Config

type Config struct {
	BaseURL       string
	Auth          auth.Provider
	CustomHeaders map[string]string
	Logger        *zerolog.Logger
	Timeout       time.Duration
	MaxRetries    int
	RetryDelay    time.Duration
	SSLVerify     bool
	HTTPProxy     string
	HTTPSProxy    string
	SOCKSProxy    string
	NoProxy       string
}

Config holds the configuration for creating a new client

type HTTPError

type HTTPError struct {
	StatusCode int
	Status     string
	Body       string
}

HTTPError represents an HTTP error response

func (*HTTPError) Error

func (e *HTTPError) Error() string

Jump to

Keyboard shortcuts

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