From b9a6da4a57698020d9e361e0b32acbf1b6de4f8c Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Mon, 1 Feb 2016 19:26:30 -0500 Subject: [PATCH] api: implement delete notification --- api/v1/routes.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/api/v1/routes.go b/api/v1/routes.go index 55bdb001b6..e74b7a0bec 100644 --- a/api/v1/routes.go +++ b/api/v1/routes.go @@ -264,8 +264,16 @@ func getNotification(w http.ResponseWriter, r *http.Request, p httprouter.Params } func deleteNotification(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int { - // ez - return 0 + err := ctx.Store.DeleteNotification(p.ByName("notificationName")) + if err == cerrors.ErrNotFound { + writeResponse(w, NotificationEnvelope{Error: &Error{err.Error()}}) + return writeHeader(w, http.StatusNotFound) + } else if err != nil { + writeResponse(w, NotificationEnvelope{Error: &Error{err.Error()}}) + return writeHeader(w, http.StatusInternalServerError) + } + + return writeHeader(w, http.StatusOK) } func getMetrics(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int {