Documentation ¶
Index ¶
- Constants
- func CheckRedirect(req *http.Request, via []*http.Request) error
- func DecodeBody(resp *http.Response, result any) error
- func DecodeError(resp *http.Response) error
- func DecodeJobID(resp *http.Response) string
- func DecodeJobIDAndBody(resp *http.Response, result any) (string, error)
- func DecodeJobIDOrBody(resp *http.Response, result any) (string, error)
- func EncodeBody(obj any) (io.Reader, error)
- func IgnoreRedirect(req *http.Request) *http.Request
- func IsIgnoredRedirect(req *http.Request) bool
- func IsResponseRedirect(statusCode int) bool
- func IsStatusIn(statusCode int, statuses ...int) bool
- func IsStatusSuccess(statusCode int) bool
- func NewAuthenticatedClient(ctx context.Context, baseClient *http.Client, ...) (*http.Client, error)
- type OAuthTokenSourceCreator
Constants ¶
const ( MaxRedirects = 10 ErrMaxRedirects = "stopped after maximum allowed redirects" )
Variables ¶
This section is empty.
Functions ¶
func CheckRedirect ¶
CheckRedirect checks the redirect policy for the HTTP client.
func DecodeBody ¶
DecodeBody unmarshalls the JSON response body if the result is non nil
func DecodeError ¶
func DecodeJobID ¶
DecodeJobID returns the jobGUID if specified in the Location response header
func DecodeJobIDAndBody ¶
DecodeJobIDAndBody returns the jobGUID if specified in the Location response header and unmarshalls the JSON response body to result if available
func DecodeJobIDOrBody ¶
DecodeJobIDOrBody returns the jobGUID if specified in the Location response header or unmarshalls the JSON response body if no job ID and result is non nil
func IgnoreRedirect ¶
IgnoreRedirect sets a flag in the request's context to indicate that redirects should be ignored.
func IsIgnoredRedirect ¶
IsIgnoredRedirect checks if the 'ignore redirect' flag is set in the request's context.
func IsResponseRedirect ¶
func IsStatusIn ¶
func IsStatusSuccess ¶
func NewAuthenticatedClient ¶
func NewAuthenticatedClient(ctx context.Context, baseClient *http.Client, tokenSourceCreator OAuthTokenSourceCreator) (*http.Client, error)
NewAuthenticatedClient creates a new http.Client with a retryableAuthTransport that supports re-authentication and request retry should a request cause a 401.
Types ¶
type OAuthTokenSourceCreator ¶
type OAuthTokenSourceCreator interface { // CreateOAuth2TokenSource creates a new OAuth2 TokenSource when called CreateOAuth2TokenSource(ctx context.Context) (oauth2.TokenSource, error) }
OAuthTokenSourceCreator implementations create OAuth2 TokenSources