Versions in this module Expand all Collapse all v0 v0.0.1 Oct 19, 2023 Changes in this version + func Elapsed(fn func()) time.Duration + type Client struct + func New(opts ...ClientOptions) *Client + func (c *Client) DELETE(ctx context.Context, route ...string) *Request + func (c *Client) GET(ctx context.Context, route ...string) *Request + func (c *Client) PATCH(ctx context.Context, route ...string) *Request + func (c *Client) POST(ctx context.Context, route ...string) *Request + func (c *Client) PUT(ctx context.Context, route ...string) *Request + func (c *Client) Request(ctx context.Context, method string, routes ...string) *Request + type ClientOptions func(client *Client) + func WithBaseURL(url string) ClientOptions + func WithClient(httpClient *http.Client) ClientOptions + type FallbackPolicy int + const FallbackPolicyExponential + const FallbackPolicyLinear + type Request struct + Error error + FallbackDuration time.Duration + FallbackPolicy FallbackPolicy + FallbackStatusCodes []int + Retries int + func (r *Request) Do(opts ...RequestOption) *Response + func (r *Request) Dry(opts ...RequestOption) (err error) + type RequestOption func(request *Request) (err error) + func WithRequestAuthorizationBasic(username, password string) RequestOption + func WithRequestAuthorizationBearer(fn func(ctx context.Context) (string, error)) RequestOption + func WithRequestBody(body io.Reader) RequestOption + func WithRequestFormData(form map[string][]byte) RequestOption + func WithRequestFormDataFile(filePath, field string, opts ...func(content []byte) []byte) RequestOption + func WithRequestFormURLEncoded(form map[string][]string) RequestOption + func WithRequestHeader(key string, value any) RequestOption + func WithRequestJSON(object any) RequestOption + func WithRequestOptions(opts ...RequestOption) RequestOption + func WithRequestRetryPolicy(retries int, duration time.Duration, policy FallbackPolicy, statuscodes ...int) RequestOption + func WithRequestTimeout(duration time.Duration) RequestOption + func WithRequestURL(rawUrl string) RequestOption + func WithRequestURLQuery(query map[string][]any) RequestOption + func WithRequestXML(object any) RequestOption + type Response struct + Err error + func (r *Response) Handle(opts ...ResponseOption) error + type ResponseOption func(request *Response) error + func WithResponseBody(object *T, unmarshaler func(data []byte, v any) error, statuscodes ...int) ResponseOption + func WithResponseJSON(object *T, statuscodes ...int) ResponseOption + func WithResponseStatusCodeAssertion(statusCodes ...int) ResponseOption + func WithResponseXML(object *T, statuscodes ...int) ResponseOption