api

package module
v0.0.0-...-0159803 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: MIT Imports: 9 Imported by: 0

README

Go Retryable HTTPClient

This module is a wrapper around github.com/hashicorp/go-retryablehttp

This module provides two key features:

Getting Started

go get github.com/dcaf-labs/solana-go-retryable-http-client

Usage

examples/solanago will show an example useage with thegagliardetto/solana-go lib.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeRequestBody

func DecodeRequestBody[V any](resp *http.Response, res V) (V, error)

func GetDefaultCheckRetry

func GetDefaultCheckRetry(_ context.Context, resp *http.Response, err error) (bool, error)

Types

type RateLimitHTTPClientOptions

type RateLimitHTTPClientOptions struct {
	CallsPerSecond   float64
	HttpClient       http.Client
	MaxRetries       int
	MinRetryDuration time.Duration
	CheckRetry       retryablehttp.CheckRetry
}

func GetDefaultRateLimitHTTPClientOptions

func GetDefaultRateLimitHTTPClientOptions() RateLimitHTTPClientOptions

type RetryableHTTPClient

type RetryableHTTPClient struct {
	*retryablehttp.Client
}

func GetDefaultRateLimitedHTTPClient

func GetDefaultRateLimitedHTTPClient(options RateLimitHTTPClientOptions) RetryableHTTPClient

func (RetryableHTTPClient) CloseIdleConnections

func (r RetryableHTTPClient) CloseIdleConnections()

func (RetryableHTTPClient) Do

func (r RetryableHTTPClient) Do(request *http.Request) (*http.Response, error)

type RetryableHTTPClientProvider

type RetryableHTTPClientProvider func(options RateLimitHTTPClientOptions) RetryableHTTPClient

func GetDefaultClientProvider

func GetDefaultClientProvider() RetryableHTTPClientProvider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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