Skip to content

Latest commit

 

History

History
37 lines (28 loc) · 859 Bytes

option.md

File metadata and controls

37 lines (28 loc) · 859 Bytes

Options

WithServerURL

WithServerURL allows providing an alternative server URL.

operations.WithServerURL("http://api.example.com")

WithTemplatedServerURL

WithTemplatedServerURL allows providing an alternative server URL with templated parameters.

operations.WithTemplatedServerURL("http://{host}:{port}", map[string]string{
    "host": "api.example.com",
    "port": "8080",
})

WithRetries

WithRetries allows customizing the default retry configuration. Only usable with methods that mention they support retries.

operations.WithRetries(retry.Config{
    Strategy: "backoff",
    Backoff: retry.BackoffStrategy{
        InitialInterval: 500 * time.Millisecond,
        MaxInterval: 60 * time.Second,
        Exponent: 1.5,
        MaxElapsedTime: 5 * time.Minute,
    },
    RetryConnectionErrors: true,
})