app

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyErrorMessage           = ErrorMessage("")
	InputValidationErrorMessage = ErrorMessage("One or more input values are invalid. Please re-renter valid values")
)

Defaut application error messages

Variables

View Source
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

func RetrieveCustomerID(r *http.Request) string

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 ErrorCode

type ErrorCode string

ErrorCode is a machine friendly description of the error

type ErrorMessage

type ErrorMessage string

ErrorMessage is a human friendly description of the error

type ErrorParams

type ErrorParams map[string]string

ErrorParams captures an additional key value pairs of information about an error

type HTTPRequestLoggingFilter

type HTTPRequestLoggingFilter func() http.Handler

HTTPRequestLoggingFilter intercepts and logs data about incoming requests

func (HTTPRequestLoggingFilter) ServeHTTP

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL