7 "github.com/go-kit/kit/endpoint"
9 "github.com/go-kit/kit/examples/shipping/cargo"
10 "github.com/go-kit/kit/examples/shipping/location"
11 "github.com/go-kit/kit/examples/shipping/voyage"
14 type registerIncidentRequest struct {
16 Location location.UNLocode
18 EventType cargo.HandlingEventType
19 CompletionTime time.Time
22 type registerIncidentResponse struct {
23 Err error `json:"error,omitempty"`
26 func (r registerIncidentResponse) error() error { return r.Err }
28 func makeRegisterIncidentEndpoint(hs Service) endpoint.Endpoint {
29 return func(ctx context.Context, request interface{}) (interface{}, error) {
30 req := request.(registerIncidentRequest)
31 err := hs.RegisterHandlingEvent(req.CompletionTime, req.ID, req.Voyage, req.Location, req.EventType)
32 return registerIncidentResponse{Err: err}, nil