sdk

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseURLClient

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

BaseURLClient amends the http.Request.URL with the configured scheme, host, and path. This comes in handy when calling an onsite installation of the us-street-api.

func NewBaseURLClient

func NewBaseURLClient(inner HTTPClient, baseURL *url.URL) *BaseURLClient

func (*BaseURLClient) Do

func (c *BaseURLClient) Do(request *http.Request) (*http.Response, error)

type CustomHeadersClient

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

func NewCustomHeadersClient

func NewCustomHeadersClient(inner HTTPClient, headers http.Header) *CustomHeadersClient

func (*CustomHeadersClient) Do

func (this *CustomHeadersClient) Do(request *http.Request) (*http.Response, error)

type DebugOutputClient

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

DebugOutputClient makes use of functions from net/http/httputil to log http request/response details.

func (*DebugOutputClient) Do

func (d *DebugOutputClient) Do(request *http.Request) (*http.Response, error)

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient matches http.Client and allows us to define custom clients that wrap over http.Client.

func NewDebugOutputClient

func NewDebugOutputClient(inner HTTPClient, dump bool) HTTPClient

func NewKeepAliveCloseClient

func NewKeepAliveCloseClient(client HTTPClient, close bool) HTTPClient

func NewRetryClient

func NewRetryClient(inner HTTPClient, maxRetries int, rand *rand.Rand, sleeper func(time.Duration)) HTTPClient

func NewTracingClient

func NewTracingClient(inner HTTPClient, trace bool) HTTPClient

type HTTPSender

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

HTTPSender translates *http.Request into ([]byte, error) by - calling the provided HTTPClient, - reading the response body, and - interpreting the content (or error) received.

func NewHTTPSender

func NewHTTPSender(client HTTPClient) *HTTPSender

func (*HTTPSender) Send

func (s *HTTPSender) Send(request *http.Request) ([]byte, error)

type HTTPTraceLogger

type HTTPTraceLogger struct {
	*bytes.Buffer
	// contains filtered or unexported fields
}

func NewHTTPTraceLogger

func NewHTTPTraceLogger() *HTTPTraceLogger

func (*HTTPTraceLogger) AttachToRequest

func (t *HTTPTraceLogger) AttachToRequest(request *http.Request) *http.Request

func (*HTTPTraceLogger) ConnectDone

func (t *HTTPTraceLogger) ConnectDone(network, address string, err error)

func (*HTTPTraceLogger) ConnectStart

func (t *HTTPTraceLogger) ConnectStart(network, address string)

func (*HTTPTraceLogger) DNSDone

func (t *HTTPTraceLogger) DNSDone(info httptrace.DNSDoneInfo)

func (*HTTPTraceLogger) DNSStart

func (t *HTTPTraceLogger) DNSStart(info httptrace.DNSStartInfo)

func (*HTTPTraceLogger) DumpResponse

func (t *HTTPTraceLogger) DumpResponse(response *http.Response, err error)

func (*HTTPTraceLogger) GetConn

func (t *HTTPTraceLogger) GetConn(hostPort string)

func (*HTTPTraceLogger) Got100Continue

func (t *HTTPTraceLogger) Got100Continue()

func (*HTTPTraceLogger) GotConn

func (t *HTTPTraceLogger) GotConn(info httptrace.GotConnInfo)

func (*HTTPTraceLogger) GotFirstResponseByte

func (t *HTTPTraceLogger) GotFirstResponseByte()

func (*HTTPTraceLogger) PutIdleConn

func (t *HTTPTraceLogger) PutIdleConn(err error)

func (*HTTPTraceLogger) Wait100Continue

func (t *HTTPTraceLogger) Wait100Continue()

func (*HTTPTraceLogger) WroteHeaders

func (t *HTTPTraceLogger) WroteHeaders()

func (*HTTPTraceLogger) WroteRequest

func (t *HTTPTraceLogger) WroteRequest(info httptrace.WroteRequestInfo)

type KeepAliveCloseClient

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

func (*KeepAliveCloseClient) Do

func (c *KeepAliveCloseClient) Do(request *http.Request) (*http.Response, error)

type LicenseClient added in v1.6.0

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

func NewLicenseClient added in v1.6.0

func NewLicenseClient(inner HTTPClient, licenses ...string) *LicenseClient

func (*LicenseClient) Do added in v1.6.0

func (this *LicenseClient) Do(request *http.Request) (*http.Response, error)

type NopCredential

type NopCredential struct{}

NopCredential - See https://en.wikipedia.org/wiki/Null_Object_pattern

func (NopCredential) Sign

func (c NopCredential) Sign(request *http.Request) error

type RetryClient

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

RetryClient sends failed requests multiple times depending on the parameters passed to NewRetryClient.

func (*RetryClient) Do

func (r *RetryClient) Do(request *http.Request) (*http.Response, error)

type SigningClient

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

Signing client signs each request it receives using the credential provided and forwards the request to the inner client.

func NewSigningClient

func NewSigningClient(inner HTTPClient, credential sdk.Credential) *SigningClient

func (*SigningClient) Do

func (c *SigningClient) Do(request *http.Request) (*http.Response, error)

type TracingClient

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

func (*TracingClient) Do

func (d *TracingClient) Do(request *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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