Documentation ¶
Index ¶
- func NewCachedClient(httpClient *http.Client, cacheTTL time.Duration) *http.Client
- func NewHTTPClient(io *iostreams.IOStreams, unixSocket string) (*http.Client, error)
- type Client
- type ClientOption
- func AddHeader(name, value string) ClientOption
- func AddHeaderFunc(name string, getValue func(*http.Request) (string, error)) ClientOption
- func CacheResponse(ttl time.Duration, dir string) ClientOption
- func ExtractHeader(name string, dest *string) ClientOption
- func ReplaceTripper(tr http.RoundTripper) ClientOption
- func VerboseLog(out io.Writer, logTraffic bool, colorize bool) ClientOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCachedClient ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client facilitates making HTTP requests to the GitHub API
type ClientOption ¶
type ClientOption = func(http.RoundTripper) http.RoundTripper
ClientOption represents an argument to NewClient
func AddHeader ¶
func AddHeader(name, value string) ClientOption
AddHeader turns a RoundTripper into one that adds a request header
func AddHeaderFunc ¶
AddHeaderFunc is an AddHeader that gets the string value from a function
func CacheResponse ¶
func CacheResponse(ttl time.Duration, dir string) ClientOption
CacheResponse produces a RoundTripper that caches HTTP responses to disk for a specified amount of time
func ExtractHeader ¶
func ExtractHeader(name string, dest *string) ClientOption
ExtractHeader extracts a named header from any response received by this client and, if non-blank, saves it to dest.
func ReplaceTripper ¶
func ReplaceTripper(tr http.RoundTripper) ClientOption
ReplaceTripper substitutes the underlying RoundTripper with a custom one
func VerboseLog ¶
func VerboseLog(out io.Writer, logTraffic bool, colorize bool) ClientOption
VerboseLog enables request/response logging within a RoundTripper
Click to show internal directories.
Click to hide internal directories.