client

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	// contains filtered or unexported fields
}

HTTP is a HTTP client.

func NewHTTP

func NewHTTP(opts ...Option) *HTTP

NewHTTP creates a new HTTP client and returns it.

func (*HTTP) Do

func (h *HTTP) Do(req *http.Request) (*http.Response, error)

Do dispatches the HTTP request to the network

type Limiter

type Limiter interface {
	// Wait must block until limiter
	// permits another request to proceed.
	Wait(context.Context) error
}

Limiter is used to apply rate limits. NOTE: you can use off the shelf limiter from https://pkg.go.dev/golang.org/x/time/rate#Limiter

type Option

type Option func(*Options)

Option is functional graph option.

func WithHTTPClient

func WithHTTPClient(c *http.Client) Option

WithHTTPClient sets the HTTP client.

func WithLimiter

func WithLimiter(l Limiter) Option

WithLimiter sets the http rate limiter.

type Options

type Options struct {
	HTTPClient *http.Client
	Limiter    Limiter
}

Options are client options

Jump to

Keyboard shortcuts

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