rapi

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2023 License: BSD-3-Clause Imports: 15 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, header http.Header, in interface{}) (result *Response, err error)

type Client

type Client struct {
	Client              *http.Client
	URL                 *url.URL
	Header              http.Header
	MaxResponseBodySize int64
}

func (*Client) Caller

func (c *Client) Caller(method string, endpoint string, header http.Header, out interface{}, errOut error) *Caller

func (*Client) Clone

func (c *Client) Clone() *Client

type DoFunc

type DoFunc func(req *Request, respHeader http.Header, send SendFunc)

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 WithMaxRequestBodySize

func WithMaxRequestBodySize(maxRequestBodySize int64) HandlerOption

func WithMiddleware

func WithMiddleware(middleware ...DoFunc) HandlerOption

func WithOnError

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

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)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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