Documentation
¶
Overview ¶
Package httpclient provides a generic HTTP client base shared by all API client packages.
Index ¶
- func ApplyAutoRefresh[F Fault](ctx context.Context, c *Client[F]) error
- func ApplyHTTPClient[F Fault](c *Client[F], client *http.Client) error
- func ApplyHTTPTracing[F Fault](c *Client[F], debug bool) error
- func ApplyRateLimiter[F Fault](c *Client[F], r *rate.Limiter) error
- func ApplyTransport[F Fault](c *Client[F], t http.RoundTripper) error
- type Client
- type Fault
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAutoRefresh ¶
ApplyAutoRefresh replaces the HTTP client with one that automatically refreshes oauth2 tokens, using the Client's Config and Token.
func ApplyHTTPClient ¶
ApplyHTTPClient replaces the HTTP client entirely.
func ApplyHTTPTracing ¶
ApplyHTTPTracing wraps the HTTP client's transport with verbose logging when debug is true.
func ApplyRateLimiter ¶
ApplyRateLimiter wraps the HTTP client's transport with a rate limiter.
func ApplyTransport ¶
func ApplyTransport[F Fault](c *Client[F], t http.RoundTripper) error
ApplyTransport sets the HTTP client's transport.
Types ¶
type Client ¶
type Client[F Fault] struct { HTTP *http.Client Token *oauth2.Token Config oauth2.Config // contains filtered or unexported fields }
Client holds the common HTTP state shared by all API clients. F is the package-specific error type used when an HTTP response indicates failure.
Click to show internal directories.
Click to hide internal directories.