rest

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 4 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fetch added in v1.1.2

func Fetch(host string, path string, req any, resp any) (code int, err error)

Fetch get

func Service added in v1.1.2

func Service(host string, path string, req any, resp any) (code int, err error)

Service post

Types

type Handler

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

func (*Handler) Get

func (r *Handler) Get(uri string) (code int, result string, err error)

func (*Handler) GetJson

func (r *Handler) GetJson(uri string, req interface{}, resultPtr interface{}, headers ...Header) (code int, err error)

func (*Handler) Post

func (r *Handler) Post(uri string) (code int, body string, err error)

func (*Handler) PostJson

func (r *Handler) PostJson(uri string, req interface{}, result interface{}, headers ...Header) (code int, err error)
type Header struct {
	Name  string
	Value string
}

type ReqOption

type ReqOption func()

type Rest

type Rest interface {
	Get(uri string) (code int, body string, err error)
	GetJson(uri string, body interface{}, resultPrt interface{}, headers ...Header) (code int, err error)
	Post(uri string) (code int, result string, err error)
	PostJson(uri string, req interface{}, resultPrt interface{}, headers ...Header) (code int, err error)
}

func New

func New() (r Rest)

Jump to

Keyboard shortcuts

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