2023-01-04 09:52:15 +00:00
|
|
|
package handlers
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2023-04-21 06:49:17 +00:00
|
|
|
. "github.com/reiver/greatape/components/api/protobuf"
|
|
|
|
. "github.com/reiver/greatape/components/contracts"
|
2023-01-04 09:52:15 +00:00
|
|
|
. "github.com/xeronith/diamante/contracts/network/http"
|
|
|
|
pipeline "github.com/xeronith/diamante/network/http"
|
|
|
|
)
|
|
|
|
|
|
|
|
type getInboxHandler struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func GetInboxHandler() IHttpHandler {
|
|
|
|
return &getInboxHandler{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (handler *getInboxHandler) Method() string {
|
|
|
|
return http.MethodGet
|
|
|
|
}
|
|
|
|
|
|
|
|
func (handler *getInboxHandler) Path() string {
|
2023-07-17 13:41:21 +00:00
|
|
|
return "/users/:username/inbox"
|
2023-01-04 09:52:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (handler *getInboxHandler) HandlerFunc() HttpHandlerFunc {
|
|
|
|
return func(x IServerDispatcher) error {
|
|
|
|
request := &GetInboxRequest{}
|
|
|
|
result := &GetInboxResult{}
|
|
|
|
|
|
|
|
onRequestUnmarshalled := func(request *GetInboxRequest) {
|
|
|
|
request.Username = x.Param("username")
|
|
|
|
}
|
|
|
|
|
|
|
|
return pipeline.Handle(x,
|
|
|
|
GET_INBOX_REQUEST,
|
|
|
|
GET_INBOX_RESULT,
|
|
|
|
request, result,
|
|
|
|
onRequestUnmarshalled,
|
2023-05-02 17:43:35 +00:00
|
|
|
nil,
|
2023-01-04 09:52:15 +00:00
|
|
|
false,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|