client

package
v0.1.6-rc.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module

func Module() *module.Module

func SetErrorFilter

func SetErrorFilter(ctx context.Context, filter func(error) (bool, error)) context.Context

func SetFallbackFunc

func SetFallbackFunc(ctx context.Context, fb func(context.Context, error) (interface{}, error)) context.Context

Types

type Base

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

func (*Base) Request

func (b *Base) Request(ctx context.Context) *resty.Request

func (*Base) RequestWithCommand

func (b *Base) RequestWithCommand(ctx context.Context, command string) *resty.Request

type CircuitRoundTripper

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

func (*CircuitRoundTripper) RoundTrip

func (c *CircuitRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type DelayType

type DelayType string
const (
	ConstantDelay    DelayType = "constant"
	ExponentialDelay DelayType = "exponential"
)

type DriverWrapper

type DriverWrapper wrapper.Wrapper[*resty.Client]

func WithTransport

func WithTransport(tr http.RoundTripper) DriverWrapper

type ErrDecoder

type ErrDecoder func(context.Context, *resty.Response) error

func DefaultErrDecoder

func DefaultErrDecoder(name string) ErrDecoder

type Factory

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

func NewFactory

func NewFactory(cfg *config.Config, wrappers []DriverWrapper) *Factory

func (*Factory) Get

func (f *Factory) Get(name string, opts ...Option) *Base

type GenericClientError added in v0.1.4

type GenericClientError struct {
	ClientName string
	StatusCode int
	RawBody    []byte
	ParsedBody interface{}
}

func (GenericClientError) Error added in v0.1.4

func (e GenericClientError) Error() string

func (GenericClientError) Status

func (e GenericClientError) Status() int

type Option added in v0.1.4

type Option interface {
	Apply(*options)
}

func WithDriverWrappers added in v0.1.4

func WithDriverWrappers(wrappers ...DriverWrapper) Option

func WithErrDecoder added in v0.1.4

func WithErrDecoder(ed ErrDecoder) Option

type RetryRoundTripper

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

func (*RetryRoundTripper) RoundTrip

func (r *RetryRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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