rest

package
v1.0.2-0...-b10ef10 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseTemplate

type BaseTemplate interface {
	GetForObject(url string, response interface{}, uriVariables ...string) error
	PostForObject(url string, body, response interface{}, uriVariables ...string) error
	PutForObject(url string, body, response interface{}, uriVariables ...string) error
	DeleteForObject(url string, response interface{}, uriVariables ...string)
	HeadForObject(url string, header http.Header, response interface{}, uriVariables ...string) error
	ExecuteForJsonString(url, method string, header http.Header, body string, response interface{}, uriVariables ...string) error
	ExecuteForObject(url, method string, header http.Header, body, response interface{}, uriVariables ...string) error
	Execute(url, method string, header http.Header, body, response interface{}, uriVariables ...string) error
}

type ClientConfig

type ClientConfig struct {
	MaxIdleConns       int
	IdleConnTimeout    time.Duration
	DisableCompression bool
	SocketTimeout      time.Duration
	Authorization      string
	ReplyCount         int
	Proxy              string
}

type RestTemplate

type RestTemplate struct {
	Template
	ClientConfig *ClientConfig
}

func Config

func Config(cfg ClientConfig) *RestTemplate

func Default

func Default() *RestTemplate

func DefaultProxy

func DefaultProxy(proxy string) *RestTemplate

func (*RestTemplate) DeleteForObject

func (rest *RestTemplate) DeleteForObject(url string, response interface{}, uriVariables ...string) error

func (*RestTemplate) Execute

func (rest *RestTemplate) Execute(url, method string, header http.Header, body, response interface{}, uriVariables ...string) error

func (*RestTemplate) ExecuteForJsonString

func (rest *RestTemplate) ExecuteForJsonString(url, method string, header http.Header, body string, response interface{}, uriVariables ...string) error

func (*RestTemplate) ExecuteForObject

func (rest *RestTemplate) ExecuteForObject(url, method string, header http.Header, body, response interface{}, uriVariables ...string) error

func (*RestTemplate) GetForObject

func (rest *RestTemplate) GetForObject(url string, response interface{}, uriVariables ...string) error

func (*RestTemplate) HeadForObject

func (rest *RestTemplate) HeadForObject(url string, header http.Header, response interface{}, uriVariables ...string) error

func (*RestTemplate) PostForObject

func (rest *RestTemplate) PostForObject(url string, body, response interface{}, uriVariables ...string) error

func (*RestTemplate) PutForObject

func (rest *RestTemplate) PutForObject(url string, body, response interface{}, uriVariables ...string) error

type Template

type Template struct {
	Client      *http.Client
	EnableReply bool
	ReplyCount  int
}

Jump to

Keyboard shortcuts

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