Documentation
¶
Index ¶
- Variables
- type BadRequestError
- type Client
- func (c *Client) Request(ctx context.Context, method, path string, body io.Reader, v interface{}) (err error)
- func (c *Client) RequestData(ctx context.Context, method, path string, body io.Reader) (resp io.ReadCloser, err error)
- func (c *Client) RequestJSON(ctx context.Context, method, path string, body, v interface{}) (err error)
- func (c *Client) RequestWithHeader(ctx context.Context, method, path string, header http.Header, body io.Reader, ...) (err error)
- func (c *Client) RequestWithResponseHeader(ctx context.Context, method, path string, body io.Reader) (*http.Response, error)
- type ClientOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrForbidden = errors.New("forbidden") ErrNotFound = errors.New("not found") ErrMethodNotAllowed = errors.New("method not allowed") ErrTooManyRequests = errors.New("too many requests") ErrInternalServerError = errors.New("internal server error") ErrRecoveryInitiated = errors.New("try again later") )
Errors that are returned by the API.
Functions ¶
This section is empty.
Types ¶
type BadRequestError ¶
type BadRequestError struct {
// contains filtered or unexported fields
}
BadRequestError holds list of errors from http response that represent invalid data submitted by the user.
func NewBadRequestError ¶
func NewBadRequestError(errors ...string) (err *BadRequestError)
NewBadRequestError constructs a new BadRequestError with provided errors.
func (*BadRequestError) Error ¶
func (e *BadRequestError) Error() (s string)
func (*BadRequestError) Errors ¶
func (e *BadRequestError) Errors() (errs []string)
Errors returns a list of error messages.
type Client ¶
func (*Client) Request ¶
func (c *Client) Request(ctx context.Context, method, path string, body io.Reader, v interface{}) (err error)
request handles the HTTP request response cycle.
func (*Client) RequestData ¶
func (c *Client) RequestData(ctx context.Context, method, path string, body io.Reader) (resp io.ReadCloser, err error)
requestData handles the HTTP request response cycle.
func (*Client) RequestJSON ¶
func (c *Client) RequestJSON(ctx context.Context, method, path string, body, v interface{}) (err error)
requestJSON handles the HTTP request response cycle. It JSON encodes the request body, creates an HTTP request with provided method on a path with required headers and decodes request body if the v argument is not nil and content type is application/json.
type ClientOptions ¶
Click to show internal directories.
Click to hide internal directories.