Documentation
¶
Index ¶
- Variables
- func DecodeJSON(request *wedeploy.WeDeploy, data interface{}) error
- func EncodeJSON(data interface{}) (*bytes.Reader, error)
- func ParamsFromJSON(request *wedeploy.WeDeploy, data interface{})
- func SetBody(request *wedeploy.WeDeploy, data interface{}) error
- func Validate(request *wedeploy.WeDeploy, err error) error
- type APIFault
- type APIFaultError
- type APIFaultErrorContext
- type APIFaultErrors
- type Client
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidContentType is used when the content-type is not application/json ErrInvalidContentType = errors.New("Can only decode data for application/json") // ErrExtractingParams is used when query string params fail due to unrecognized type ErrExtractingParams = errors.New("Can only extract query string params from flat objects") )
Functions ¶
func DecodeJSON ¶
DecodeJSON decodes a JSON response
func EncodeJSON ¶
EncodeJSON encodes a object using its JSON annotations map and creates a reader that can be used as body for requests, for example
func ParamsFromJSON ¶
ParamsFromJSON creates query string params from a flat object with JSON tags
Types ¶
type APIFault ¶
type APIFault struct {
Method string
URL string
Status int `json:"status"`
Message string `json:"message"`
Errors APIFaultErrors `json:"errors"`
}
APIFault is sent by the server when errors happen Method and URL MUST NOT have JSON tags
type APIFaultError ¶
type APIFaultError struct {
Reason string `json:"reason"`
Context APIFaultErrorContext `json:"context"`
}
APIFaultError is the error structure for the errors described by a fault
type APIFaultErrorContext ¶
type APIFaultErrorContext map[string]interface{}
APIFaultErrorContext map
func (APIFaultErrorContext) Message ¶
func (c APIFaultErrorContext) Message() string
Message for a given APIFaultError
type APIFaultErrors ¶
type APIFaultErrors []APIFaultError
APIFaultErrors is the array of APIFaultError
Click to show internal directories.
Click to hide internal directories.