Documentation ¶
Index ¶
- Constants
- func CheckResponse(res *http.Response, expected ...int) error
- func DecodeJSONBody(res *http.Response, j interface{}) error
- func ExtractLocation(res *http.Response, base string) (string, error)
- func ResolveReference(baseURI, referenceURI string) (string, error)
- type Client
- type ProblemError
Constants ¶
View Source
const ( PollPeriod = 1 * time.Second MaxAttempts = 2 )
TODO(tho) make these two configurable
View Source
const ( APIStatusFailed = "failed" APIStatusSuccess = "success" APIStatusProcessing = "processing" APIStatusComplete = "complete" )
Variables ¶
This section is empty.
Functions ¶
func DecodeJSONBody ¶
func ExtractLocation ¶
Extract Location header and resolve it to the supplied base (if non-empty)
func ResolveReference ¶
Types ¶
type Client ¶
type Client struct { HTTPClient http.Client Auth auth.IAuthenticator }
Client holds configuration data associated with the HTTP(s) session, and a reference to an IAuthenticator that is used to provide Authorization headers for requests.
func NewClient ¶
func NewClient(a auth.IAuthenticator) *Client
NewClient instantiates a new Client with a fixed 5s timeout. The client will use the provided IAuthenticator for requests, if it is not nil
func NewTestingHTTPClient ¶
NewTestingHTTPClient creates an HTTP test server (with a configurable request handler), an API Client and connects them together. The API client and the server's shutdown switch are returned.
func (Client) DeleteResource ¶
func (Client) GetResource ¶ added in v0.1.0
func (Client) PostEmptyResource ¶ added in v0.1.0
type ProblemError ¶ added in v0.1.0
type ProblemError struct {
problems.DefaultProblem
}
func (*ProblemError) Error ¶ added in v0.1.0
func (o *ProblemError) Error() string
Click to show internal directories.
Click to hide internal directories.