Documentation ¶
Index ¶
- Constants
- Variables
- func Error(err error, c echo.Context)
- type API
- func (a *API) DeleteReverse() echo.HandlerFunc
- func (a *API) GetReverse() echo.HandlerFunc
- func (a *API) GetReversesBy() echo.HandlerFunc
- func (a *API) GetTracking() echo.HandlerFunc
- func (a *API) PostReverse() echo.HandlerFunc
- func (a *API) PutReverse() echo.HandlerFunc
- func (a *API) ValidatePutJSON(s *strut.Request) map[string]string
- func (a *API) ValidateSearchJSON(s *strut.Search) map[string]string
- func (a *API) ValidateTrackingJSON(s *strut.Tracking) map[string]string
- type ErrContent
- type ErrResponse
- type ErrResponseValidation
- type ErrValidation
Constants ¶
const DateRegex = "" /* 230-byte string literal not displayed */
Regex to validate date formats
Variables ¶
var ( //OperatorValues Values that can be used in the operators OperatorValues = map[string]bool{"LIKE": true, "=": true, ">=": true, "<=": true, "<>": true, "!=": true, "IN": true, "NOT IN": true} //RequestNotFound request not found message RequestNotFound = "Request with ID: %d not found" //ErrorNotSet field not set message ErrorNotSet = "%s not set" //ErrorIsEmpty field empty message ErrorIsEmpty = "is empty" //ErrorValidValues field with invalid values message ErrorValidValues = "valid values are: %s" )
Functions ¶
Types ¶
type API ¶
type API struct { Repo repo.Definition Conf *cnf.CorreiosConfig Hand *hand.Handler }
API struct
func New ¶
func New(r repo.Definition, c *cnf.CorreiosConfig) *API
New method to create a new API struct
func (*API) DeleteReverse ¶
func (a *API) DeleteReverse() echo.HandlerFunc
DeleteReverse Handler to DELETE a Correios Reverse request
func (*API) GetReverse ¶
func (a *API) GetReverse() echo.HandlerFunc
GetReverse Handler to GET Reverse information of a request
func (*API) GetReversesBy ¶
func (a *API) GetReversesBy() echo.HandlerFunc
GetReversesBy Handler to GET Reverse information for N Requests
func (*API) GetTracking ¶
func (a *API) GetTracking() echo.HandlerFunc
GetTracking Handler to retrieve Tracking information
func (*API) PostReverse ¶
func (a *API) PostReverse() echo.HandlerFunc
PostReverse Handler to POST a Correios Reverse request
func (*API) PutReverse ¶
func (a *API) PutReverse() echo.HandlerFunc
PutReverse Handler to PUT a Correios Reverse request
func (*API) ValidatePutJSON ¶
ValidatePutJSON Validates the consistency of the Request struct
func (*API) ValidateSearchJSON ¶
ValidateSearchJSON Validates the consistency of the Search struct
type ErrContent ¶
ErrContent contains the code and message of the Error
type ErrResponse ¶
type ErrResponse struct {
Error ErrContent `json:"error"`
}
ErrResponse main struct for error handling
type ErrResponseValidation ¶
type ErrResponseValidation struct { Type string `json:"error_type"` Errors []*ErrValidation `json:"errors"` }
ErrResponseValidation contains the type of error found and its fields and correspondent messages
type ErrValidation ¶
ErrValidation contains the field and correspondent error message