pdnshttp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

Types

type APIKeyAuthenticator

type APIKeyAuthenticator struct {
	APIKey string
}

func (*APIKeyAuthenticator) OnConnect

func (a *APIKeyAuthenticator) OnConnect(*http.Client) error

func (*APIKeyAuthenticator) OnRequest

func (a *APIKeyAuthenticator) OnRequest(r *http.Request) error

type Client

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

func NewClient

func NewClient(baseURL string, hc *http.Client, auth ClientAuthenticator, debugOutput io.Writer) *Client

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, path string, out interface{}) error

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, out interface{}) error

func (*Client) NewRequest

func (c *Client) NewRequest(method string, path string, body io.Reader) (*http.Request, error)

func (*Client) Patch

func (c *Client) Patch(ctx context.Context, path string, in interface{}, out interface{}) error

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, in interface{}, out interface{}) error

type ClientAuthenticator

type ClientAuthenticator interface {
	OnRequest(*http.Request) error
	OnConnect(*http.Client) error
}

type ErrNotFound

type ErrNotFound struct {
	URL string
}

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type ErrUnexpectedStatus

type ErrUnexpectedStatus struct {
	URL        string
	StatusCode int
}

func (ErrUnexpectedStatus) Error

func (e ErrUnexpectedStatus) Error() string

type TLSClientCertificateAuthenticator

type TLSClientCertificateAuthenticator struct {
	CACerts    []*x509.Certificate
	ClientCert tls.Certificate
	ClientKey  crypto.PrivateKey
}

func (*TLSClientCertificateAuthenticator) OnConnect

func (*TLSClientCertificateAuthenticator) OnRequest

Jump to

Keyboard shortcuts

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