Documentation ¶
Overview ¶
Package rest provides REST clients.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // WithBaseURL configures the client with a base URL; returns modified self. WithBaseURL(baseURL string) Client // Get makes a GET request. Get(url string, body interface{}, result interface{}) (*http.Response, error) // Head makes a HEAD request. Head(url string, body interface{}, result interface{}) (*http.Response, error) // Post makes a POST request. Post(url string, body interface{}, result interface{}) (*http.Response, error) // Put makes a PUT request. Put(url string, body interface{}, result interface{}) (*http.Response, error) // Patch makes a PATCH request. Patch(url string, body interface{}, result interface{}) (*http.Response, error) // Delete makes a DELETE request. Delete(url string, body interface{}, result interface{}) (*http.Response, error) // Do makes a REST request using JSON for input and output. Do(method string, url string, body interface{}, result interface{}) (*http.Response, error) }
Client represts a web client to use with REST APIs.
func NewJSONClient ¶
NewJSONClient creates a new REST client that uses JSON to encode requests and decode responses.
func NewJSONRequestNoopResponseClient ¶
NewJSONRequestNoopResponseClient creates a new REST client that uses JSON to encode requests and does not decode the response (it leaves the decoding to the caller, which has access to the response object).
func NewURLEncodedRequestJSONResponseClient ¶
NewURLEncodedRequestJSONResponseClient creates a new REST client that URL-encodes requests and uses JSON to decode responses. The body parameter for this client's methods must be a map[string]string instance.
Click to show internal directories.
Click to hide internal directories.