Documentation ¶
Index ¶
- Variables
- func IsNotFound(err error) bool
- type BasicAuthTransport
- type BearerAuthTransport
- type CallLogger
- type Decoder
- type Encoder
- type HTTPClient
- func (client *HTTPClient) Delete(url string, params ...RequestParam) error
- func (client *HTTPClient) DeleteForBody(url string, requestBody interface{}, responseBody interface{}, ...) error
- func (client *HTTPClient) Get(url string, entity interface{}, params ...RequestParam) error
- func (client *HTTPClient) Head(url string, params ...RequestParam) error
- func (client *HTTPClient) Patch(url string, requestBody interface{}, params ...RequestParam) error
- func (client *HTTPClient) PatchForBody(url string, requestBody interface{}, responseBody interface{}, ...) error
- func (client *HTTPClient) Post(url string, requestBody interface{}, params ...RequestParam) error
- func (client *HTTPClient) PostForBody(url string, requestBody interface{}, responseBody interface{}, ...) error
- func (client *HTTPClient) PostForLocation(url string, requestBody interface{}, params ...RequestParam) (string, error)
- func (client *HTTPClient) PostForLocationAndBody(url string, requestBody interface{}, responseBody interface{}, ...) (string, error)
- func (client *HTTPClient) Put(url string, requestBody interface{}, params ...RequestParam) error
- func (client *HTTPClient) PutForBody(url string, requestBody interface{}, responseBody interface{}, ...) error
- type HTTPClientConfig
- type HTTPClientConfigOpt
- func BaseURL(url string) HTTPClientConfigOpt
- func CacheSize(size uint64) HTTPClientConfigOpt
- func DisableCache() HTTPClientConfigOpt
- func LogCalls(logger CallLogger) HTTPClientConfigOpt
- func MaxRetries(retries uint64) HTTPClientConfigOpt
- func NoRetries() HTTPClientConfigOpt
- func SetCheckRedirect(check func(req *http.Request, via []*http.Request) error) HTTPClientConfigOpt
- func SetGetBackoffCreator(creator func() backoff.BackOff) HTTPClientConfigOpt
- func SetOtherBackoffCreator(creator func() backoff.BackOff) HTTPClientConfigOpt
- func TLSConfig(tlsConfig *tls.Config) HTTPClientConfigOpt
- func Timeout(timeout time.Duration) HTTPClientConfigOpt
- func UseBasicAuth(username, password string) HTTPClientConfigOpt
- func UseBearerAuth(token string) HTTPClientConfigOpt
- func UseOAuth2(source oauth2.TokenSource) HTTPClientConfigOpt
- type HTTPClientError
- type Request
- type RequestParam
- func Accept(mediaType string) RequestParam
- func BasicAuth(username, password string) RequestParam
- func BearerAuth(token string) RequestParam
- func ClientToken(token string) RequestParamdeprecated
- func ContentType(contentType string) RequestParam
- func Context(ctx context.Context) RequestParam
- func SetDecoder(d Decoder) RequestParam
- func SetEncoder(e Encoder) RequestParam
- func SetHeader(name, value string) RequestParam
- func SetStreamDecoder(d StreamDecoder) RequestParam
- func UseRawDecoder() RequestParam
- func UseRawEncoder() RequestParam
- func UserAgent(userAgent string) RequestParam
- type StreamDecoder
Constants ¶
This section is empty.
Variables ¶
View Source
var HTTPClientDefaultConfig = HTTPClientConfig{ // contains filtered or unexported fields }
Functions ¶
func IsNotFound ¶ added in v0.0.21
Types ¶
type BasicAuthTransport ¶ added in v0.0.9
type BasicAuthTransport struct {
Username, Password string
Transport http.RoundTripper
}
type BearerAuthTransport ¶ added in v0.0.9
type BearerAuthTransport struct { Token string Transport http.RoundTripper }
type CallLogger ¶ added in v0.0.6
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶
func NewHTTPClient(opts ...HTTPClientConfigOpt) *HTTPClient
func (*HTTPClient) Delete ¶ added in v0.0.12
func (client *HTTPClient) Delete(url string, params ...RequestParam) error
func (*HTTPClient) DeleteForBody ¶ added in v0.0.31
func (client *HTTPClient) DeleteForBody(url string, requestBody interface{}, responseBody interface{}, params ...RequestParam) error
func (*HTTPClient) Get ¶
func (client *HTTPClient) Get(url string, entity interface{}, params ...RequestParam) error
func (*HTTPClient) Head ¶ added in v0.0.22
func (client *HTTPClient) Head(url string, params ...RequestParam) error
func (*HTTPClient) Patch ¶
func (client *HTTPClient) Patch(url string, requestBody interface{}, params ...RequestParam) error
func (*HTTPClient) PatchForBody ¶
func (client *HTTPClient) PatchForBody(url string, requestBody interface{}, responseBody interface{}, params ...RequestParam) error
func (*HTTPClient) Post ¶
func (client *HTTPClient) Post(url string, requestBody interface{}, params ...RequestParam) error
func (*HTTPClient) PostForBody ¶
func (client *HTTPClient) PostForBody(url string, requestBody interface{}, responseBody interface{}, params ...RequestParam) error
func (*HTTPClient) PostForLocation ¶ added in v0.0.13
func (client *HTTPClient) PostForLocation(url string, requestBody interface{}, params ...RequestParam) (string, error)
func (*HTTPClient) PostForLocationAndBody ¶ added in v0.0.16
func (client *HTTPClient) PostForLocationAndBody( url string, requestBody interface{}, responseBody interface{}, params ...RequestParam, ) (string, error)
func (*HTTPClient) Put ¶
func (client *HTTPClient) Put(url string, requestBody interface{}, params ...RequestParam) error
func (*HTTPClient) PutForBody ¶ added in v0.0.17
func (client *HTTPClient) PutForBody(url string, requestBody interface{}, responseBody interface{}, params ...RequestParam) error
type HTTPClientConfig ¶
type HTTPClientConfig struct {
// contains filtered or unexported fields
}
type HTTPClientConfigOpt ¶
type HTTPClientConfigOpt func(config *HTTPClientConfig)
func BaseURL ¶ added in v0.0.24
func BaseURL(url string) HTTPClientConfigOpt
func CacheSize ¶
func CacheSize(size uint64) HTTPClientConfigOpt
func DisableCache ¶
func DisableCache() HTTPClientConfigOpt
func LogCalls ¶ added in v0.0.6
func LogCalls(logger CallLogger) HTTPClientConfigOpt
func MaxRetries ¶
func MaxRetries(retries uint64) HTTPClientConfigOpt
func NoRetries ¶
func NoRetries() HTTPClientConfigOpt
func SetCheckRedirect ¶ added in v0.0.32
func SetGetBackoffCreator ¶ added in v0.0.18
func SetGetBackoffCreator(creator func() backoff.BackOff) HTTPClientConfigOpt
func SetOtherBackoffCreator ¶ added in v0.0.18
func SetOtherBackoffCreator(creator func() backoff.BackOff) HTTPClientConfigOpt
func TLSConfig ¶ added in v0.0.7
func TLSConfig(tlsConfig *tls.Config) HTTPClientConfigOpt
func Timeout ¶
func Timeout(timeout time.Duration) HTTPClientConfigOpt
func UseBasicAuth ¶ added in v0.0.9
func UseBasicAuth(username, password string) HTTPClientConfigOpt
func UseBearerAuth ¶ added in v0.0.8
func UseBearerAuth(token string) HTTPClientConfigOpt
func UseOAuth2 ¶ added in v0.0.4
func UseOAuth2(source oauth2.TokenSource) HTTPClientConfigOpt
type HTTPClientError ¶
func AsHTTPClientError ¶ added in v0.0.21
func AsHTTPClientError(err error) (HTTPClientError, bool)
func (HTTPClientError) Error ¶
func (err HTTPClientError) Error() string
type RequestParam ¶
type RequestParam func(*Request)
func Accept ¶
func Accept(mediaType string) RequestParam
func BasicAuth ¶ added in v0.0.15
func BasicAuth(username, password string) RequestParam
func BearerAuth ¶
func BearerAuth(token string) RequestParam
func ClientToken
deprecated
func ClientToken(token string) RequestParam
ClientToken set the "Client-Token" header
Deprecated: The use of the non-standard "Client-Token" header is deprecated. Use the "Authorization" header instead. See `BearerAuth(…)`
func ContentType ¶ added in v0.0.5
func ContentType(contentType string) RequestParam
func Context ¶ added in v0.0.26
func Context(ctx context.Context) RequestParam
func SetDecoder ¶ added in v0.0.5
func SetDecoder(d Decoder) RequestParam
func SetEncoder ¶ added in v0.0.5
func SetEncoder(e Encoder) RequestParam
func SetHeader ¶ added in v0.0.31
func SetHeader(name, value string) RequestParam
func SetStreamDecoder ¶ added in v0.0.27
func SetStreamDecoder(d StreamDecoder) RequestParam
func UseRawDecoder ¶ added in v0.0.19
func UseRawDecoder() RequestParam
func UseRawEncoder ¶ added in v0.0.19
func UseRawEncoder() RequestParam
func UserAgent ¶
func UserAgent(userAgent string) RequestParam
type StreamDecoder ¶ added in v0.0.27
Click to show internal directories.
Click to hide internal directories.