# Functions
A Wrapper HTTP Rest API Response Builder Initiator.
A Wrapper HTTP Rest API Response Builder Initiator With Interceptor, i.e:
// Interceptor type SomeInterceptHandler struct{}
func NewSomeInterceptHandler() SomeInterceptHandler { return SomeInterceptHandler{} }
func (SomeInterceptHandler) Handler(req *http.Request, res RestResponseValue[dto.SomeResDTO, dto.SomeResErrorDTO]) { // do something on here }
// Controller / Handler type SomeHandler struct{}
func NewSomeHandler() SomeHandler { return SomeHandler{} }
func (SomeHandler) SomeAction(rw http.ResponseWriter, r *http.Request) { ctx := r.Context() res := xresponse.NewRestResponseWithInterceptor(r, rw, interceptor.NewSomeInterceptHandler())
req := xhttputil.LoadInput[dto.SomeReqDTO](ctx) if err := req.ValidateWithContext(ctx); err != nil { return res.StatusCode(http.StatusUnprocessableEntity).Code(restkey.INVALID_ARGUMENT).Msg("invalid request data").JSON() }
// continue your bussines logic ..
# Structs
A Standard Response For API.
# Interfaces
A Async Function For Interceptor HTTP REST API.
A Wrapper Standard Response For HTTP REST API
HTTP Rest API Response Builder.
A Wrapper Standard Response For HTTP REST API
HTTP Rest API Response Getter For Interceptor.