connectors

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connector

type Connector interface {
	Request() (io.ReadCloser, error)
}

type HttpAuthenticator

type HttpAuthenticator interface {
	Authenticate(connector *HttpConnector, req *http.Request) error
}

type HttpBodyBuilder

type HttpBodyBuilder func() (any, error)

type HttpConnector

type HttpConnector struct {
	Method        string
	Url           string
	Headers       map[string]string
	Body          any
	Authenticator HttpAuthenticator
	Timeout       time.Duration
}

func NewHttpGetConnector

func NewHttpGetConnector(url string) *HttpConnector

Build and Connector for HTTP GET requests.

func NewHttpPostConnector

func NewHttpPostConnector(
	url string,
	body any,
) *HttpConnector

Build and Connector for HTTP POST requests.

func (*HttpConnector) Request

func (c *HttpConnector) Request() (io.ReadCloser, error)

func (*HttpConnector) RequestBytes

func (c *HttpConnector) RequestBytes() ([]byte, error)

func (*HttpConnector) RequestString

func (c *HttpConnector) RequestString() (string, error)

func (*HttpConnector) SetAuthenticator

func (c *HttpConnector) SetAuthenticator(authenticator HttpAuthenticator)

func (*HttpConnector) SetBody

func (c *HttpConnector) SetBody(body any)

func (*HttpConnector) SetHeaders

func (c *HttpConnector) SetHeaders(headers map[string]string)

func (*HttpConnector) SetMethod

func (c *HttpConnector) SetMethod(method string)

func (*HttpConnector) SetTimeout

func (c *HttpConnector) SetTimeout(timeout time.Duration)

func (*HttpConnector) SetUrl

func (c *HttpConnector) SetUrl(url string)

Jump to

Keyboard shortcuts

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