Documentation ¶
Index ¶
- type Client
- func (c Client) Do(request *Request, v interface{}) (*Response, error)
- func (c Client) Get(url string, response interface{}) (*Response, error)
- func (c Client) Patch(url string, body map[string]interface{}, response interface{}) (*Response, error)
- func (c Client) Put(url string, body map[string]interface{}, response interface{}) (*Response, error)
- type Request
- type Requester
- type Response
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { // Base is the base URL used for relative requests Base string // ValidateStatus is a function that validates the status code of the HTTP response ValidateStatus func(int) bool // Envelope is the name of the data field in the response Envelope string }
func (Client) Do ¶
Do performs the HTTP request. Relative URLs will have the base URL prepended. An error will be thrown if the response does not have a JSON content-type or if the status code is not valid. The entire response will be returned but the JSON will be unmarshalled into the second argument.
type Requester ¶
type Requester interface { Do(request *Request, resultData interface{}) (*Response, error) Get(url string, response interface{}) (*Response, error) Put(url string, body map[string]interface{}, response interface{}) (*Response, error) Patch(url string, body map[string]interface{}, response interface{}) (*Response, error) }
Requester is an interface for making HTTP requests
var DefaultClient Requester
Click to show internal directories.
Click to hide internal directories.