Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) Delete(ctx context.Context, request *HTTPRequest) (HTTPResult, error)
- func (c *Client) Get(ctx context.Context, request *HTTPRequest) (HTTPResult, error)
- func (c *Client) Patch(ctx context.Context, request *HTTPRequest) (rst HTTPResult, err error)
- func (c *Client) Post(ctx context.Context, request *HTTPRequest) (HTTPResult, error)
- func (c *Client) PostForm(ctx context.Context, request *HTTPRequest) (HTTPResult, error)
- func (c *Client) Put(ctx context.Context, request *HTTPRequest) (rst HTTPResult, err error)
- type HTTPHeaders
- type HTTPPathParams
- type HTTPQueryParams
- type HTTPRequest
- type HTTPResult
- type Option
Constants ¶
This section is empty.
Variables ¶
var ErrMetricInitialization = func(metric string) error { return errors.New("could not initialize metric: %s", metric). WithCode("ERR_METRIC_INITIALIZATION"). WithKind(errors.KindUnexpected). WithStack(). Retryable(false) }
ErrMetricInitialization occurs when a metric initialization fails.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods for making REST requests.
func (*Client) Delete ¶
func (c *Client) Delete(ctx context.Context, request *HTTPRequest) (HTTPResult, error)
Delete execute a http DELETE method with application/json headers.
func (*Client) Get ¶
func (c *Client) Get(ctx context.Context, request *HTTPRequest) (HTTPResult, error)
Get execute a http GET method.
func (*Client) Patch ¶
func (c *Client) Patch(ctx context.Context, request *HTTPRequest) (rst HTTPResult, err error)
Patch execute a http PATCH method with application/json headers.
func (*Client) Post ¶
func (c *Client) Post(ctx context.Context, request *HTTPRequest) (HTTPResult, error)
Post execute a http POST method with application/json headers.
func (*Client) PostForm ¶
func (c *Client) PostForm(ctx context.Context, request *HTTPRequest) (HTTPResult, error)
PostForm execute a http POST method with x-www-form-urlencoded headers.
func (*Client) Put ¶
func (c *Client) Put(ctx context.Context, request *HTTPRequest) (rst HTTPResult, err error)
Put execute a http PUT method with application/json headers.
type HTTPHeaders ¶
HTTPHeaders is a map containing the relation key=value of the headers used on the http rest request.
type HTTPPathParams ¶
HTTPPathParams is a map containing the relation key=value of the path params used on the http rest request. It will be used to replace values given in Path parameter.
type HTTPQueryParams ¶
HTTPQueryParams is a map containing the relation key=value of the query params used on the http rest request.
type HTTPRequest ¶
type HTTPRequest struct {
Host string
Path string
Body []byte
Headers HTTPHeaders
QueryParams HTTPQueryParams
PathParams HTTPPathParams
}
HTTPRequest are the params used to build a new http rest request.
type HTTPResult ¶
HTTPResult are the params returned from the client HTTP request.