Documentation
¶
Index ¶
- type Error
- type HTTPErrorCallback
- type InternalErrorCallback
- type JSONAPI
- func (jsonAPI *JSONAPI) Delete(url string, parameters url.Values, responseBody interface{}, ...) (response *http.Response, err error)
- func (jsonAPI *JSONAPI) Get(url string, parameters url.Values, responseBody interface{}, ...) (response *http.Response, err error)
- func (jsonAPI *JSONAPI) Post(url string, parameters url.Values, requestBody interface{}, ...) (response *http.Response, err error)
- func (jsonAPI *JSONAPI) Put(url string, parameters url.Values, requestBody interface{}, ...) (response *http.Response, err error)
- func (jsonAPI *JSONAPI) R() *Request
- func (jsonAPI *JSONAPI) Use(mw ...MiddlewareFunction)
- type MiddlewareFunction
- type Request
- func (r *Request) Delete(url string, parameters url.Values, responseBody interface{}, ...) (response *http.Response, err error)
- func (r *Request) Get(url string, parameters url.Values, responseBody interface{}, ...) (response *http.Response, err error)
- func (r *Request) Post(url string, parameters url.Values, responseBody interface{}, ...) (response *http.Response, err error)
- func (r *Request) Put(url string, parameters url.Values, responseBody interface{}, ...) (response *http.Response, err error)
- func (r *Request) SetBody(v *bytes.Reader)
- func (r *Request) SetHeader(key, value string) *Request
- type SuccessCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
type Error struct {
Error string `json:"error"`
Status int `json:"status"`
Message string `json:"message"`
}
Error struct
type HTTPErrorCallback ¶
HTTPErrorCallback runs on a errored HTTP request
type InternalErrorCallback ¶
type InternalErrorCallback func(error)
InternalErrorCallback runs on an internal error
type JSONAPI ¶
type JSONAPI struct {
BaseURL string
Headers map[string]string
// contains filtered or unexported fields
}
JSONAPI struct
func (*JSONAPI) Delete ¶
func (jsonAPI *JSONAPI) Delete(url string, parameters url.Values, responseBody interface{}, onSuccess SuccessCallback, onHTTPError HTTPErrorCallback, onInternalError InternalErrorCallback) (response *http.Response, err error)
Delete request
func (*JSONAPI) Get ¶
func (jsonAPI *JSONAPI) Get(url string, parameters url.Values, responseBody interface{}, onSuccess SuccessCallback, onHTTPError HTTPErrorCallback, onInternalError InternalErrorCallback) (response *http.Response, err error)
Get request
func (*JSONAPI) Post ¶
func (jsonAPI *JSONAPI) Post(url string, parameters url.Values, requestBody interface{}, responseBody interface{}, onSuccess SuccessCallback, onHTTPError HTTPErrorCallback, onInternalError InternalErrorCallback) (response *http.Response, err error)
Post request
func (*JSONAPI) Put ¶
func (jsonAPI *JSONAPI) Put(url string, parameters url.Values, requestBody interface{}, responseBody interface{}, onSuccess SuccessCallback, onHTTPError HTTPErrorCallback, onInternalError InternalErrorCallback) (response *http.Response, err error)
Put request
func (*JSONAPI) Use ¶
func (jsonAPI *JSONAPI) Use(mw ...MiddlewareFunction)
type MiddlewareFunction ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) Delete ¶
func (r *Request) Delete(url string, parameters url.Values, responseBody interface{}, onSuccess SuccessCallback, onHTTPError HTTPErrorCallback, onInternalError InternalErrorCallback) (response *http.Response, err error)
Delete request
func (*Request) Get ¶
func (r *Request) Get(url string, parameters url.Values, responseBody interface{}, onSuccess SuccessCallback, onHTTPError HTTPErrorCallback, onInternalError InternalErrorCallback) (response *http.Response, err error)
Get request
func (*Request) Post ¶
func (r *Request) Post(url string, parameters url.Values, responseBody interface{}, requestBody interface{}, onSuccess SuccessCallback, onHTTPError HTTPErrorCallback, onInternalError InternalErrorCallback) (response *http.Response, err error)
Post request
func (*Request) Put ¶
func (r *Request) Put(url string, parameters url.Values, responseBody interface{}, requestBody interface{}, onSuccess SuccessCallback, onHTTPError HTTPErrorCallback, onInternalError InternalErrorCallback) (response *http.Response, err error)
Put request
type SuccessCallback ¶
type SuccessCallback func()
SuccessCallback runs on a successfull request and parse