web

package
v11.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelTrace = slog.Level(-8)
	LevelFatal = slog.Level(12)
)

Variables

View Source
var ErrResponseMalformed = errors.New("malformed response")

Functions

func ContextGetClient

func ContextGetClient(ctx context.Context) (*resty.Client, bool)

func ContextSetClient

func ContextSetClient(ctx context.Context, client *resty.Client) context.Context

func ExecuteRequest

func ExecuteRequest(ctx context.Context, request, response any) error

func NewAPIClient

func NewAPIClient() *resty.Client

Types

type GenericResponse

type GenericResponse interface {
	Unmarshal(data []byte) error
}

type GetRequest

type GetRequest interface {
	URL() string
}

GetRequest is a HTTP GET request.

type JSONResponse

type JSONResponse interface {
	json.Unmarshaler
}

type PostRequest

type PostRequest interface {
	GetRequest
	RequestBody() json.RawMessage
}

PostRequest is a HTTP POST request with the request body provided by Body().

Jump to

Keyboard shortcuts

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