rapi

package module
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: BSD-3-Clause Imports: 19 Imported by: 0

README

rapi

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caller

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

func (*Caller) Call

func (c *Caller) Call(ctx context.Context, in interface{}, opts ...CallerOption) (result *Response, err error)

type CallerError added in v0.4.0

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

type CallerOption added in v0.2.0

type CallerOption interface {
	// contains filtered or unexported methods
}

func WithAdditionalRequestHeader added in v0.2.0

func WithAdditionalRequestHeader(header ...http.Header) CallerOption

func WithErrOut added in v0.3.0

func WithErrOut(errOut error) CallerOption

func WithForceBody added in v0.5.0

func WithForceBody(forceBody bool) CallerOption

func WithMaxResponseBodySize added in v0.2.0

func WithMaxResponseBodySize(maxResponseBodySize int64) CallerOption

func WithRequestHeader added in v0.2.0

func WithRequestHeader(header ...http.Header) CallerOption

type DoFunc

type DoFunc func(req *Request, send SendFunc)

type Factory added in v0.2.0

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

func NewFactory added in v0.2.0

func NewFactory(client *http.Client, u *url.URL, opts ...CallerOption) (f *Factory)

func (*Factory) Caller added in v0.2.0

func (f *Factory) Caller(endpoint string, method string, out interface{}, opts ...CallerOption) *Caller

type Handler

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

func NewHandler

func NewHandler(opts ...HandlerOption) (h *Handler)

func (*Handler) Handle

func (h *Handler) Handle(pattern string, opts ...HandlerOption) *PatternHandler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerOption

type HandlerOption interface {
	// contains filtered or unexported methods
}

func WithAllowEncoding added in v0.2.0

func WithAllowEncoding(allowEncoding bool) HandlerOption

func WithMaxRequestBodySize

func WithMaxRequestBodySize(maxRequestBodySize int64) HandlerOption

func WithMiddleware

func WithMiddleware(middleware ...MiddlewareFunc) HandlerOption

func WithOnError

func WithOnError(onError func(error, *http.Request)) HandlerOption

func WithRequestTimeout added in v0.2.0

func WithRequestTimeout(requestTimeout time.Duration) HandlerOption

func WithResponseTimeout added in v0.5.0

func WithResponseTimeout(responseTimeout time.Duration) HandlerOption

type HeaderOption added in v0.2.0

type HeaderOption struct {
	KeyVals []HeaderOptionKeyVal
	Map     map[string]string
}

func ParseHeaderOptions added in v0.2.0

func ParseHeaderOptions(directive string) (options []HeaderOption)

type HeaderOptionKeyVal added in v0.2.0

type HeaderOptionKeyVal struct {
	Key string
	Val string
}

type MiddlewareFunc added in v0.2.0

type MiddlewareFunc func(req *Request, send SendFunc, do DoFunc)

type PatternHandler

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

func (*PatternHandler) Register

func (h *PatternHandler) Register(method string, in interface{}, do DoFunc, opts ...HandlerOption) *PatternHandler

func (*PatternHandler) ServeHTTP

func (h *PatternHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Request

type Request struct {
	*http.Request
	In interface{}
}

type Response

type Response struct {
	*http.Response
	Data []byte
	Out  interface{}
}

type SendFunc

type SendFunc func(out interface{}, code int, header ...http.Header)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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