client

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the client for HTTP requests.

func New

func New(opt ...Option) *Client

New creates a new client.

func (*Client) Delete added in v0.0.2

func (c *Client) Delete(ctx context.Context, req *Request, resp interface{}) error

func (*Client) Get added in v0.0.2

func (c *Client) Get(ctx context.Context, req *Request, resp interface{}) error

func (*Client) Post added in v0.0.2

func (c *Client) Post(ctx context.Context, req *Request, resp interface{}) error

func (*Client) Put added in v0.0.2

func (c *Client) Put(ctx context.Context, req *Request, resp interface{}) error

type Option added in v0.0.2

type Option interface {
	Apply(cli *Client)
}

func WithGlobalTimeout added in v0.0.2

func WithGlobalTimeout(timeout time.Duration) Option

WithGlobalTimeout is the option that adds global timeout to the client.

Example:

WithGlobalTimeout(time.Second * 5)

func WithRateLimit added in v0.0.2

func WithRateLimit(url string, rate int, opt ...ratelimit.Option) Option

WithRateLimit is the option that adds rate limit to the client.

Example:

WithRateLimit(1000)

type Request added in v0.0.2

type Request struct {
	*client.Request
}

func NewRequest added in v0.0.2

func NewRequest(ctx context.Context) *Request

Jump to

Keyboard shortcuts

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