Documentation ¶
Overview ¶
Package api provides low-level primitives for HTTP APIs.
Index ¶
- func Get(endpoint *url.URL, apiKey string, body []byte) (res string, statusCode int, err error)
- func GetJSON(endpoint *url.URL, apiKey string, body []byte, v interface{}) (statusCode int, err error)
- func MakeAPIRequest(method string, endpoint *url.URL, APIKey string, body []byte) (res []byte, statusCode int, err error)
- func Post(endpoint *url.URL, apiKey string, body []byte) (res string, statusCode int, err error)
- func PostJSON(endpoint *url.URL, apiKey string, body []byte, v interface{}) (statusCode int, err error)
- type TimeoutError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetJSON ¶
func GetJSON(endpoint *url.URL, apiKey string, body []byte, v interface{}) (statusCode int, err error)
GetJSON is a convenience method for MakeAPIRequest.
func MakeAPIRequest ¶
func MakeAPIRequest(method string, endpoint *url.URL, APIKey string, body []byte) (res []byte, statusCode int, err error)
MakeAPIRequest runs and logs a request backed by a default `http.Client`.
Types ¶
type TimeoutError ¶
type TimeoutError error
TimeoutError is an error caused by an HTTP request timeout.
Click to show internal directories.
Click to hide internal directories.