Documentation
¶
Index ¶
- func FromJson(body io.ReadCloser, status int) (interface{}, error)
- func ToJson(object interface{}) (string, error)
- type ErrorResponse
- type FailureResponse
- type InputErrorResponse
- type NetworkFailureResponse
- type NoAccessResponse
- type NotFoundResponse
- type PayloadResponse
- type PaymentDeclinedResponse
- type PreconditionalResponse
- type Response
- type SuccessResponse
- type TimeoutResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromJson ¶
func FromJson(body io.ReadCloser, status int) (interface{}, error)
This function maps and casts an HTTP response to an interface.
The `body` parameter is an io.ReadCloser object that represents the HTTP response body. The `status` parameter is an integer that represents the HTTP status code.
This function returns the mapped and casted HTTP response as an interface.
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
ErrorResponse provides a specific structure for an error response coming from a transaction.
type FailureResponse ¶
type FailureResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
FailureResponse provides a specific structure for a failure response coming from a transaction.
type InputErrorResponse ¶
type InputErrorResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
InputErrorResponse provides a specific structure for an input error response coming from a transaction.
type NetworkFailureResponse ¶
type NetworkFailureResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
NetworkFailureResponse provides a specific structure for a network failure response coming from a transaction.
type NoAccessResponse ¶
type NoAccessResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
NoAccessResponse provides a specific structure for a no access response coming from a transaction.
type NotFoundResponse ¶
type NotFoundResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
NotFoundResponse provides a specific structure for a not found response coming from a transaction.
type PayloadResponse ¶
type PayloadResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
PayloadResponse provides a specific structure for a payload response coming from a transaction.
type PaymentDeclinedResponse ¶
type PaymentDeclinedResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
PaymentDeclinedResponse provides a specific structure for a payment declined response coming from a transaction.
type PreconditionalResponse ¶
type PreconditionalResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
PreconditionalResponse provides a specific structure for a preconditional response coming from a transaction.
type Response ¶
type Response struct {
// Response status success
Success bool `json:"success,omitempty"`
// Response friendly messag
Message string `json:"message,omitempty"`
// Response 'action to' format
Action string `json:"action,omitempty"`
// Response data payload
Data map[string]interface{} `json:"data,omitempty"`
// Response input validation felds errors
Errors map[string][]string `json:"errors,omitempty"`
// contains filtered or unexported fields
}
Response provides a specific structure for a base response coming from a transaction.
func (*Response) GetData ¶
Checks if the given key has data in the response object.
The `key` parameter represents the key to check.
This function returns the data if it exists, otherwise it will return nil.
func (*Response) GetStatus ¶
This function retrieves the HTTP status code from a response.
Returns the HTTP status as an int value.
func (*Response) InputHasError ¶
Checks if the given key has an error in the response object.
The `key` parameter represents the key to check.
This function returns a boolean value indicating whether there is an error or not.
type SuccessResponse ¶
type SuccessResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
SuccessResponse provides a specific structure for a success response coming from a transaction.
type TimeoutResponse ¶
type TimeoutResponse struct {
// Anonymous field, to embed the Response struct (composition)
Response
}
TimeoutResponse provides a specific structure for a timeout response coming from a transaction.