Documentation ¶
Index ¶
- Constants
- Variables
- func HandleCreate(wf workflow.CreateFunc) http.HandlerFunc
- func HandleRemove(wf workflow.RemoveFunc) http.HandlerFunc
- func HandleRetrieveMulti(wf workflow.RetrieveMultiFunc) http.HandlerFunc
- func HandleRetrieveOne(wf workflow.RetrieveSingleFunc) http.HandlerFunc
- func HandleUpdate(wf workflow.UpdateFunc) http.HandlerFunc
- func Handler(app StandAlone) http.Handler
- func RetrieveCustomerID(r *http.Request) string
- type CreateHandlerFunc
- type CreateRequestDTO
- type CreateResponseDTO
- type CustomerRetrieveErrorDTO
- type CustomerRetrieveResponseDTO
- type Error
- type ErrorCode
- type ErrorMessage
- type ErrorParams
- type HTTPRequestLoggingFilter
- type HandlerFunc
- type RemoveHandlerFunc
- type RetriveMultiHandlerFunc
- type RetriveOneHandlerFunc
- type StandAlone
- type StandAloneFunc
- type UpdateHandlerFunc
- type UpdateRequestDTO
- type UpdateResponseDTO
Constants ¶
const ( EmptyErrorMessage = ErrorMessage("") InputValidationErrorMessage = ErrorMessage("One or more input values are invalid. Please re-renter valid values") )
Defaut application error messages
Variables ¶
var InvalidRequestBody = ErrorCode("invalid_request_body")
InvalidRequestBody is a constant for an invalid request body error
Functions ¶
func HandleCreate ¶
func HandleCreate(wf workflow.CreateFunc) http.HandlerFunc
HandleCreate returns an http handler for the customer create API call
func HandleRemove ¶
func HandleRemove(wf workflow.RemoveFunc) http.HandlerFunc
HandleRemove returns an http handler for a customer remove API call
func HandleRetrieveMulti ¶
func HandleRetrieveMulti(wf workflow.RetrieveMultiFunc) http.HandlerFunc
HandleRetrieveMulti returns an http handler for a customer retrieve multi API call
func HandleRetrieveOne ¶
func HandleRetrieveOne(wf workflow.RetrieveSingleFunc) http.HandlerFunc
HandleRetrieveOne returns an http handler for a customer retrieve API call
func HandleUpdate ¶
func HandleUpdate(wf workflow.UpdateFunc) http.HandlerFunc
HandleUpdate returns an http handler for a customer update API call
func Handler ¶
func Handler(app StandAlone) http.Handler
Handler is the default http handler for the application
func RetrieveCustomerID ¶
RetrieveCustomerID retrieves the customerID from an http request
Types ¶
type CreateHandlerFunc ¶
type CreateHandlerFunc func(wf workflow.CreateFunc) http.HandlerFunc
CreateHandlerFunc returns an http handler for a customer create API call
type CreateRequestDTO ¶
type CreateRequestDTO struct { FirstName string `json:"firstName"` LastName string `json:"lastName"` NationalID string `json:"nationalId"` PhoneNumber string `json:"phoneNumber"` AccountID string `json:"accountId"` }
CreateRequestDTO represents the json structure for a customer create request
type CreateResponseDTO ¶
type CreateResponseDTO struct { CustomerID string `json:"customerId"` FirstName string `json:"firstName"` LastName string `json:"lastName"` NationalID string `json:"nationalId"` PhoneNumber string `json:"phoneNumber"` AccountID string `json:"accountId"` }
CreateResponseDTO represents the json structure for a customer create response
type CustomerRetrieveErrorDTO ¶
type CustomerRetrieveErrorDTO struct {
Message string `json:"message"`
}
CustomerRetrieveErrorDTO is the error body returned to the API caller when an error occurs
type CustomerRetrieveResponseDTO ¶
type CustomerRetrieveResponseDTO struct { CustomerID string `json:"customerId"` FirstName string `json:"firstName"` LastName string `json:"lastName"` NationalID string `json:"nationalId"` PhoneNumber string `json:"phoneNumber"` AccountID string `json:"accountId"` LastModifiedTime string `json:"lastModifiedTime"` CreatedTime string `json:"createdTime"` Version int `json:"version"` }
CustomerRetrieveResponseDTO represents the json structure for a customer retrieve response
type Error ¶
type Error struct { Code ErrorCode `json:"code"` Message ErrorMessage `json:"message"` Params ErrorParams `json:"params"` }
An Error is a representation of an api error Errors include but not limited to domain errors, validation, authentication error etc
type ErrorMessage ¶
type ErrorMessage string
ErrorMessage is a human friendly description of the error
type ErrorParams ¶
ErrorParams captures an additional key value pairs of information about an error
type HTTPRequestLoggingFilter ¶
HTTPRequestLoggingFilter intercepts and logs data about incoming requests
func (HTTPRequestLoggingFilter) ServeHTTP ¶
func (h HTTPRequestLoggingFilter) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HandlerFunc ¶
type HandlerFunc func(app StandAlone) http.Handler
HandlerFunc returns an entry point http handler for the entire application
type RemoveHandlerFunc ¶
type RemoveHandlerFunc func(wf workflow.RemoveFunc) http.HandlerFunc
RemoveHandlerFunc returns an http handler for a customer remove http call
type RetriveMultiHandlerFunc ¶
type RetriveMultiHandlerFunc func(wf workflow.RetrieveMultiFunc) http.HandlerFunc
RetriveMultiHandlerFunc returns an http handler for a customer retrieve multi API call
type RetriveOneHandlerFunc ¶
type RetriveOneHandlerFunc func(wf workflow.RetrieveSingleFunc) http.HandlerFunc
RetriveOneHandlerFunc returns an http handler for a customer retrieve API call
type StandAlone ¶
type StandAlone struct { CreateHandler http.HandlerFunc RetrieveOneHandler http.HandlerFunc RetrieveMultiHandler http.HandlerFunc UpdateHandler http.HandlerFunc RemoveHandler http.HandlerFunc }
StandAlone encapsulates all the apps as a single standalone app
type StandAloneFunc ¶
type StandAloneFunc func() StandAlone
StandAloneFunc creates a new instance of the stand alone application
type UpdateHandlerFunc ¶
type UpdateHandlerFunc func(wf workflow.UpdateFunc) http.HandlerFunc
UpdateHandlerFunc returns an http handler for a customer update API call
type UpdateRequestDTO ¶
type UpdateRequestDTO struct { FirstName string `json:"firstName"` LastName string `json:"lastName"` NationalID string `json:"nationalId"` PhoneNumber string `json:"phoneNumber"` }
UpdateRequestDTO represents the json structure for a customer update request
type UpdateResponseDTO ¶
type UpdateResponseDTO struct { CustomerID string `json:"customerId"` FirstName string `json:"firstName"` LastName string `json:"lastName"` NationalID string `json:"nationalId"` PhoneNumber string `json:"phoneNumber"` AccountID string `json:"accountId"` LastModifiedTime string `json:"lastModifiedTime"` CreatedTime string `json:"createdTime"` Version int `json:"version"` }
UpdateResponseDTO represents the json structure for a customer update response