diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2016-11-24 15:04:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-24 15:04:31 +0800 |
commit | 3917ed45de063b4e8868610c82d8172020d572fd (patch) | |
tree | 052b7651cbb64ae30f92efe87441ad1d4fa2d922 /routers/api/v1/repo/hook.go | |
parent | 3a3782bb7fed768c1e832ff4c0a77f2f5281ed05 (diff) | |
download | gitea-3917ed45de063b4e8868610c82d8172020d572fd.tar.gz gitea-3917ed45de063b4e8868610c82d8172020d572fd.zip |
golint fixed for routers (#208)
Diffstat (limited to 'routers/api/v1/repo/hook.go')
-rw-r--r-- | routers/api/v1/repo/hook.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index 226b50db9f..30e1fad363 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -16,7 +16,8 @@ import ( "code.gitea.io/gitea/routers/api/v1/convert" ) -// https://github.com/gogits/go-gogs-client/wiki/Repositories#list-hooks +// ListHooks list all hooks of a repository +// see https://github.com/gogits/go-gogs-client/wiki/Repositories#list-hooks func ListHooks(ctx *context.APIContext) { hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID) if err != nil { @@ -31,7 +32,8 @@ func ListHooks(ctx *context.APIContext) { ctx.JSON(200, &apiHooks) } -// https://github.com/gogits/go-gogs-client/wiki/Repositories#create-a-hook +// CreateHook create a hook for a repository +// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create-a-hook func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { if !models.IsValidHookTaskType(form.Type) { ctx.Error(422, "", "Invalid hook type") @@ -97,7 +99,8 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) { ctx.JSON(201, convert.ToHook(ctx.Repo.RepoLink, w)) } -// https://github.com/gogits/go-gogs-client/wiki/Repositories#edit-a-hook +// EditHook modify a hook of a repository +// see 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")) if err != nil { @@ -165,6 +168,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) { ctx.JSON(200, convert.ToHook(ctx.Repo.RepoLink, w)) } +// DeleteHook delete a hook of a repository func DeleteHook(ctx *context.APIContext) { if err := models.DeleteWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil { ctx.Error(500, "DeleteWebhookByRepoID", err) |