summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/hook.go
diff options
context:
space:
mode:
authorDennis Chen <barracks510@gmail.com>2016-07-16 19:08:38 -0500
committer无闻 <u@gogs.io>2016-07-17 08:08:38 +0800
commit5ff2dfb23eb4f5c436d69cc86945192eb4b3d279 (patch)
treeed98b252b5046253489a52f1faf54e913c361c05 /routers/api/v1/repo/hook.go
parenteac32419fcc68fc2e49497ee2f81beb4b6f6178f (diff)
downloadgitea-5ff2dfb23eb4f5c436d69cc86945192eb4b3d279.tar.gz
gitea-5ff2dfb23eb4f5c436d69cc86945192eb4b3d279.zip
api: delete repository webhooks (#3275)
Allows the deletion of a webhook from a repository at the /:user/:repo/hooks/:id endpoint. Solves drone/drone issue #1603. Signed-off-by: Dennis Chen <barracks510@gmail.com>
Diffstat (limited to 'routers/api/v1/repo/hook.go')
-rw-r--r--routers/api/v1/repo/hook.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index 0bf46977d9..4cda05c8b8 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -96,6 +96,15 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
ctx.JSON(201, convert.ToHook(ctx.Repo.RepoLink, w))
}
+func DeleteHook(ctx *context.APIContext) {
+ if err := models.DeleteWebhook(ctx.ParamsInt64(":id")); err != nil {
+ ctx.Error(500, "DeleteWebhook", err)
+ return
+ }
+
+ ctx.Status(204)
+}
+
// https://github.com/gogits/go-gogs-client/wiki/Repositories#edit-a-hook
func EditHook(ctx *context.APIContext, form api.EditHookOption) {
w, err := models.GetWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))