Documentation
¶
Index ¶
- func CheckResponse(r *http.Response) error
- type Client
- func (c *Client) Do(req *http.Request, responseBody interface{}) (*http.Response, error)
- func (c *Client) GetEndpoint(path string) *url.URL
- func (c *Client) NewRequest(ctx context.Context, method, path string, body interface{}) (*http.Request, error)
- func (c *Client) SetBaseURL(baseURL *url.URL)
- func (c *Client) SetDebug(debug bool)
- func (c *Client) SetDisallowUnknownFields(disallowUnknownFields bool)
- func (c *Client) SetDivisionID(divisionID int)
- func (c *Client) SetUserAgent(userAgent string)
- func (c *Client) SubPath(path string) string
- func (c *Client) SubPathWithID(path string, id string) string
- type ErrorMessage
- type ErrorResponse
- type RequestCompletionCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckResponse ¶
CheckResponse checks the API response for errors, and returns them if present. A response is considered an error if it has a status code outside the 200 range. API error responses are expected to have either no response body, or a XML response body that maps to ErrorResponse. Any other response body will be silently ignored.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is XML decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response will be written to v, without attempting to decode it.
func (*Client) NewRequest ¶
func (*Client) SetBaseURL ¶
func (*Client) SetDisallowUnknownFields ¶
func (*Client) SetDivisionID ¶
func (*Client) SetUserAgent ¶
type ErrorMessage ¶
type ErrorResponse ¶
type ErrorResponse struct { // HTTP response that caused this error Response *http.Response // HTTP status code Code string // Fault message Message ErrorMessage `json:"message"` }
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
Click to show internal directories.
Click to hide internal directories.