restclient

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const TokenTypeBearer = "Bearer"

Variables

This section is empty.

Functions

func ClearObject

func ClearObject(obj interface{})

Types

type AuditLogData

type AuditLogData struct {
	Method          string
	Url             *url.URL
	ReqContentType  string
	ReqHeader       http.Header
	ReqBody         []byte
	Status          int
	RespContentType string
	RespHeader      http.Header
	RespBody        []byte
	Err             error
	Start           time.Time
	End             time.Time
}

func (*AuditLogData) GetEventTags

func (s *AuditLogData) GetEventTags() map[string]string

type Client

type Client struct {
	SkipVerify bool
	Debug      bool
	TokenType  string
	// To allow testing of midstream failures, we need to wait until
	// some stream messages have been received before signaling to the
	// sender that it's ok to generate an error.
	MidstreamFailChs map[string]chan bool
	// Test transport for mocking unit tests
	TestTransport http.RoundTripper
	// Print input data transformations
	PrintTransformations bool
	Timeout              time.Duration
	AuditLogFunc         func(data *AuditLogData)
	ParseErrorFunc       func(resBody []byte) error
}

func (*Client) DisableMidstreamFailure

func (s *Client) DisableMidstreamFailure(uri string)

func (*Client) EnableMidstreamFailure

func (s *Client) EnableMidstreamFailure(uri string, syncCh chan bool)

func (*Client) EnablePrintTransformations

func (s *Client) EnablePrintTransformations()

func (*Client) HandleWebsocketStreamOut

func (s *Client) HandleWebsocketStreamOut(uri, token string, reader *bufio.Reader, reqData, replyData interface{}, queryParams map[string]string, replyReady func()) (int, error)

func (*Client) HttpJsonSend

func (s *Client) HttpJsonSend(method, uri, token string, reqData interface{}, replyData interface{}, headerVals http.Header, queryParams map[string]string, okStatuses map[int]struct{}) (int, http.Header, error)

func (*Client) HttpJsonSendReq

func (s *Client) HttpJsonSendReq(method, uri, token string, reqData interface{}, headerVals http.Header, queryParams map[string]string) (*http.Response, error)

func (*Client) PostJson

func (s *Client) PostJson(uri, token string, reqData interface{}, replyData interface{}, queryParams map[string]string) (int, error)

func (*Client) PostJsonSend

func (s *Client) PostJsonSend(uri, token string, reqData interface{}, queryParams map[string]string) (*http.Response, error)

func (*Client) PostJsonStreamOut

func (s *Client) PostJsonStreamOut(uri, token string, reqData, replyData interface{}, queryParams map[string]string, replyReady func()) (int, error)

func (*Client) WebsocketConn

func (s *Client) WebsocketConn(uri, token string, reqData interface{}) (*websocket.Conn, error)

type MultiPartFormData

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

func NewMultiPartFormData

func NewMultiPartFormData() *MultiPartFormData

func (*MultiPartFormData) AddField

func (s *MultiPartFormData) AddField(key string, val interface{})

func (*MultiPartFormData) AddFile

func (s *MultiPartFormData) AddFile(key string, val *os.File)

func (*MultiPartFormData) Write

func (s *MultiPartFormData) Write(buf *bytes.Buffer) (string, error)

Jump to

Keyboard shortcuts

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