Documentation
¶
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 represents a generic HTTP client with retry logic and middleware support
func NewClientWithHTTPClient ¶ added in v0.4.0
NewClientWithHTTPClient creates a new HTTP client using an existing *http.Client. Useful for injecting custom transports such as oauth2-wrapped clients.
func (*Client) AddRoundTripper ¶
func (c *Client) AddRoundTripper(rt RoundTripper)
AddRoundTripper adds a middleware RoundTripper to the client. This method is not safe for concurrent use and should only be called during client initialization before making any requests.
type Config ¶
type Config struct {
// Timeout is the HTTP client timeout for requests
Timeout time.Duration
// MaxRetries is the maximum number of retry attempts for failed requests
MaxRetries int
// RetryDelay is the delay between retry attempts
RetryDelay time.Duration
// RetryBackoff enables exponential backoff for retries
RetryBackoff bool
// MaxDelay is the maximum delay for exponential backoff (default: 30s)
MaxDelay time.Duration
}
Config holds the configuration for the HTTP client
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a Config with sensible defaults
type RetryableError ¶
RetryableError represents an error that can be retried
func (*RetryableError) Error ¶
func (e *RetryableError) Error() string
Click to show internal directories.
Click to hide internal directories.