Documentation ¶
Index ¶
- type Client
- type HTTPClient
- func (h *HTTPClient) DeleteFrom(path string) (*http.Response, error)
- func (h *HTTPClient) DeleteFromWithContext(ctx context.Context, path string) (*http.Response, error)
- func (h *HTTPClient) DeleteRequest(path string) (*http.Request, error)
- func (h *HTTPClient) GetFrom(path string) (*http.Response, error)
- func (h *HTTPClient) GetFromWithContext(ctx context.Context, path string) (*http.Response, error)
- func (h *HTTPClient) GetRequest(path string) (*http.Request, error)
- func (h *HTTPClient) PostRequest(path string, body io.Reader) (*http.Request, error)
- func (h *HTTPClient) PostTo(path string, body io.Reader) (*http.Response, error)
- func (h *HTTPClient) PostToWithContext(ctx context.Context, path string, body io.Reader) (*http.Response, error)
- func (h *HTTPClient) PutRequest(path string, body io.Reader) (*http.Request, error)
- func (h *HTTPClient) PutTo(path string, body io.Reader) (*http.Response, error)
- func (h *HTTPClient) PutToWithContext(ctx context.Context, path string, body io.Reader) (*http.Response, error)
- type HTTPConfig
- type HttpError
- type NotFoundError
- type RemoteError
- type UnauthorizedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { GetFrom(path string) (*http.Response, error) PostTo(path string, body io.Reader) (*http.Response, error) PutTo(path string, body io.Reader) (*http.Response, error) DeleteFrom(path string) (*http.Response, error) GetRequest(path string) (*http.Request, error) PostRequest(path string, body io.Reader) (*http.Request, error) PutRequest(path string, body io.Reader) (*http.Request, error) DeleteRequest(path string) (*http.Request, error) GetFromWithContext(ctx context.Context, path string) (*http.Response, error) PostToWithContext(ctx context.Context, path string, body io.Reader) (*http.Response, error) PutToWithContext(ctx context.Context, path string, body io.Reader) (*http.Response, error) DeleteFromWithContext(ctx context.Context, path string) (*http.Response, error) }
Client provides a high-level API for working with HTTP requests and constructing them.
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient wraps the underlying http.Client and it's HTTPConfig.
func NewDefaultHTTPClient ¶
func NewDefaultHTTPClient(baseURL string) *HTTPClient
func NewHTTPClient ¶
func NewHTTPClient(config *HTTPConfig) *HTTPClient
*
- Create a new HTTPClient with a custom transport for clean resource usage
func (*HTTPClient) DeleteFrom ¶
func (h *HTTPClient) DeleteFrom(path string) (*http.Response, error)
func (*HTTPClient) DeleteFromWithContext ¶
func (*HTTPClient) DeleteRequest ¶
func (h *HTTPClient) DeleteRequest(path string) (*http.Request, error)
func (*HTTPClient) GetFrom ¶
func (h *HTTPClient) GetFrom(path string) (*http.Response, error)
Interface implementations
func (*HTTPClient) GetFromWithContext ¶
func (*HTTPClient) GetRequest ¶
func (h *HTTPClient) GetRequest(path string) (*http.Request, error)
func (*HTTPClient) PostRequest ¶
func (*HTTPClient) PostToWithContext ¶
func (*HTTPClient) PutRequest ¶
type HTTPConfig ¶
type HTTPConfig struct {
// contains filtered or unexported fields
}
HTTPConfig holds the base configuration for the HTTPClient.
func DefaultHTTPConfig ¶
func DefaultHTTPConfig(baseURL string) *HTTPConfig
func NewHTTPConfig ¶
func NewHTTPConfig(baseURL string, username string, password string, accept string) *HTTPConfig
type NotFoundError ¶
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
type RemoteError ¶
type RemoteError struct { Host string // contains filtered or unexported fields }
func (RemoteError) Error ¶
func (e RemoteError) Error() string
type UnauthorizedError ¶
type UnauthorizedError struct {}
func (UnauthorizedError) Error ¶
func (e UnauthorizedError) Error() string
Click to show internal directories.
Click to hide internal directories.