rest

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAPIError = errors.New("api error")
	ErrClient   = fmt.Errorf("%w: client error", ErrAPIError)
	ErrServer   = fmt.Errorf("%w: server error", ErrAPIError)
)
View Source
var (
	ErrBadRequest = fmt.Errorf("%w: validation failed", ErrClient)
	ErrConflict   = fmt.Errorf("%w: conflict", ErrClient)
)

Functions

func IsAPIError added in v1.7.0

func IsAPIError(err error) bool

func IsBadRequest added in v1.7.0

func IsBadRequest(err error) bool

func IsClientError added in v1.7.0

func IsClientError(err error) bool

func IsConflict added in v1.7.0

func IsConflict(err error) bool

func IsServerError added in v1.7.0

func IsServerError(err error) bool

Types

type Client

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

func NewClient

func NewClient(config Config) *Client

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, headers map[string]string, payload, response any) error

type Config

type Config struct {
	Client  *http.Client // Optional HTTP Client, defaults to `http.DefaultClient`
	BaseURL string       // Optional base URL
}

Jump to

Keyboard shortcuts

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