Documentation ¶
Index ¶
- Constants
- func ExponentialJitterBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration
- func Hmac256Signer(publicKey, secret string, body []byte) (string, error)
- func LinearJitterBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration
- type Backoff
- type Client
- type Config
- type LogLevel
- type Logger
- type LoggerFunc
- type Signer
Constants ¶
View Source
const (
// BaseURLV3 is base url for API version 3
BaseURLV3 = "https://api.client.ch/v3"
)
Variables ¶
This section is empty.
Functions ¶
func ExponentialJitterBackoff ¶
func ExponentialJitterBackoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration
ExponentialJitterBackoff returns exponential backoff with jitter seep = rand(minDelay, min(maxDelay, base * 2 ** attemptNum))
func Hmac256Signer ¶
Hmac256Signer is default request signer
Types ¶
type Client ¶
type Client interface { Call(method string, params, result interface{}) error CallWithContext(ctx context.Context, method string, params, result interface{}) error }
Client is provided methods to all API
type Config ¶
type Config struct { BaseURL string Logger Logger RetryWaitMin time.Duration // Minimum time to wait RetryWaitMax time.Duration // Maximum time to wait RetryMax int // Maximum number of retries // contains filtered or unexported fields }
Config is client configuration object
type Logger ¶
Logger interfaces defines minimalistic interface to log messages
func NewDefaultLogger ¶
NewDefaultLogger returns a Logger which will write log messages to stdout
func NewNullLogger ¶
func NewNullLogger() Logger
NewNullLogger returns a Logger which prevents logging of unnecessary messages
type LoggerFunc ¶
LoggerFunc provides a convenient way to wrap any function to Logger interface
func (LoggerFunc) Logf ¶
func (f LoggerFunc) Logf(level LogLevel, format string, args ...interface{})
Logf calls the wrapped function with the arguments provided
Click to show internal directories.
Click to hide internal directories.