option

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RequestOption

type RequestOption = func(*requestconfig.RequestConfig) error

func WithAPIKey

func WithAPIKey(key string) RequestOption

func WithBaseURL

func WithBaseURL(base string) RequestOption

func WithEnvironmentProduction

func WithEnvironmentProduction() RequestOption

func WithEnvironmentSandbox

func WithEnvironmentSandbox() RequestOption

func WithHTTPClient

func WithHTTPClient(client *http.Client) RequestOption

WithHTTPClient changes the underlying http.Client used to make this request, which by default is http.DefaultClient.

func WithHeader

func WithHeader(key, value string) RequestOption

WithHeader sets the header value to the associated key. It overwrites any value if there was one already present.

func WithHeaderAdd

func WithHeaderAdd(key, value string) RequestOption

WithHeaderAdd adds the header value to the associated key. It appends onto any existing values.

func WithHeaderDel

func WithHeaderDel(key string) RequestOption

WithHeaderDel deletes the header value(s) associated with the given key

func WithJSONDel

func WithJSONDel(key string) RequestOption

WithJSONDel deletes the body's JSON value associated with the key. The key accepts a string as defined by the [sjson format](https://github.com/tidwall/sjson)

func WithJSONSet

func WithJSONSet(key string, value interface{}) RequestOption

WithJSONSet sets the body's JSON value associated with the key. The key accepts a string as defined by the [sjson format](https://github.com/tidwall/sjson)

func WithMaxRetries

func WithMaxRetries(retries int) RequestOption

func WithQuery

func WithQuery(key, value string) RequestOption

WithQuery sets the query value to the associated key. It overwrites any value if there was one already present.

func WithQueryAdd

func WithQueryAdd(key, value string) RequestOption

WithQueryAdd adds the query value to the associated key. It appends onto any existing values.

func WithQueryDel

func WithQueryDel(key string) RequestOption

WithQueryDel deletes the query value(s) associated with the key

func WithRequestTimeout

func WithRequestTimeout(dur time.Duration) RequestOption

WithRequestTimeout sets the timeout for each request attempt. This should be smaller than the timeout defined in the context, which spans all retries.

func WithResponseBodyInto

func WithResponseBodyInto(dst any) RequestOption

WithResponseBodyInto overwrites the deserialization target with the given destination. If provided, we don't deserialize into the default struct.

func WithResponseInto

func WithResponseInto(dst **http.Response) RequestOption

WithResponseInto copies the `*http.Response` into the given address.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL