Documentation ¶
Overview ¶
Package protocols contains message structures used to implement protocols.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // InternalServerError is an error response InternalServerError = &ErrorResponse{Code: "internal_server_error", Message: "Internal Server Error, please try again.", Status: http.StatusInternalServerError} // InvalidParameterError is an error response InvalidParameterError = &ErrorResponse{Code: "invalid_parameter", Message: "Invalid parameter.", Status: http.StatusBadRequest} // MissingParameterError is an error response MissingParameterError = &ErrorResponse{Code: "missing_parameter", Message: "Required parameter is missing.", Status: http.StatusBadRequest} )
Functions ¶
func IsValidAccountID ¶
IsValidAccountID returns true if account ID is valid
func IsValidAmount ¶
IsValidAmount returns true if amount is valid
func IsValidAssetCode ¶
IsValidAssetCode returns true if asset code is valid
func IsValidSecret ¶
IsValidSecret returns true if secret is valid
Types ¶
type Asset ¶
type Asset struct { Code string `name:"asset_code" json:"code"` Issuer string `name:"asset_issuer" json:"issuer"` }
Asset represents native or credit asset
func (Asset) ToBaseAsset ¶
ToBaseAsset transforms Asset to github.com/stellar/go-stellar-base/build.Asset
type ErrorResponse ¶
type ErrorResponse struct { // HTTP status code Status int `json:"-"` // Error status code Code string `json:"code"` // Error message that will be returned to API consumer Message string `json:"message"` // Additional information returned to API consumer MoreInfo string `json:"more_info,omitempty"` // Error data that will be returned to API consumer Data map[string]interface{} `json:"data,omitempty"` // Error message that will be logged. LogMessage string `json:"-"` // Error data that will be logged. LogData map[string]interface{} `json:"-"` }
ErrorResponse represents error response and implements server.Response and error interfaces
func NewInternalServerError ¶
func NewInternalServerError(logMessage string, logData map[string]interface{}) *ErrorResponse
NewInternalServerError creates and returns a new InternalServerError
func NewInvalidParameterError ¶
func NewInvalidParameterError(name, value, moreInfo string, additionalLogData ...map[string]interface{}) *ErrorResponse
NewInvalidParameterError creates and returns a new InvalidParameterError
func NewMissingParameter ¶
func NewMissingParameter(name string) *ErrorResponse
NewMissingParameter creates and returns a new MissingParameterError
func (*ErrorResponse) Error ¶
func (error *ErrorResponse) Error() string
Error returns Message or LogMessage if set
func (*ErrorResponse) HTTPStatus ¶
func (error *ErrorResponse) HTTPStatus() int
HTTPStatus returns ErrorResponse.Status
func (*ErrorResponse) Marshal ¶
func (error *ErrorResponse) Marshal() []byte
Marshal marshals ErrorResponse
type FormRequest ¶
FormRequest allows transforming http.Request url.Values from/to request structs
func (*FormRequest) CheckRequired ¶
func (request *FormRequest) CheckRequired(destination interface{}) error
CheckRequired checks whether all fields marked as required have value
func (*FormRequest) FromRequest ¶
func (request *FormRequest) FromRequest(r *http.Request, destination interface{}) error
FromRequest transforms http.Request to request struct object
func (*FormRequest) ToValues ¶
func (request *FormRequest) ToValues(object interface{}) (values url.Values)
ToValues transforms request object to url.Values
type ForwardDestination ¶
ForwardDestination contains fields required to create forward federation request
type SuccessResponse ¶
type SuccessResponse struct{}
SuccessResponse is embedded in all success responses and implements server.Response interface
func (*SuccessResponse) HTTPStatus ¶
func (response *SuccessResponse) HTTPStatus() int
HTTPStatus returns http.StatusOK
Directories ¶
Path | Synopsis |
---|---|
Package compliance contains message structures required to implement compliance protocol.
|
Package compliance contains message structures required to implement compliance protocol. |