Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RespondWith ¶ added in v1.0.147
func RespondWith(c *gin.Context, status int, dataField interface{}, error string, code ReturnCode)
RespondWith will respond with the generic API response
func RespondWithInvalidAppContext ¶ added in v1.0.147
RespondWithInvalidAppContext will be called when the application's context is invalid
func RespondWithValidationError ¶ added in v1.0.147
RespondWithValidationError will be called when the application's context is invalid
Types ¶
type GenericAPIResponse ¶
type GenericAPIResponse struct { Data interface{} `json:"data"` Error string `json:"error"` Code ReturnCode `json:"code"` }
GenericAPIResponse defines the structure of all responses on API endpoints
type ReturnCode ¶
type ReturnCode string
ReturnCode defines the type defines to identify return codes
const ReturnCodeInternalError ReturnCode = "internal_issue"
ReturnCodeInternalError defines a request which hasn't been executed successfully due to an internal error
const ReturnCodeRequestError ReturnCode = "bad_request"
ReturnCodeRequestError defines a request which hasn't been executed successfully due to a bad request received
const ReturnCodeSuccess ReturnCode = "successful"
ReturnCodeSuccess defines a successful request
const ReturnCodeSystemBusy ReturnCode = "system_busy"
ReturnCodeSystemBusy defines a request which hasn't been executed successfully due to too many requests