aboutsummaryrefslogtreecommitdiff
path: root/routers/api/v1/repo_hooks.go
diff options
context:
space:
mode:
authorUnknwon <joe2010xtmf@163.com>2014-12-12 20:30:32 -0500
committerUnknwon <joe2010xtmf@163.com>2014-12-12 20:30:32 -0500
commitac4a10456ea4515091c3c90a83a82c1e59cdf428 (patch)
treedb68f1f7a8f290322bd4da9892487cca5a1a5843 /routers/api/v1/repo_hooks.go
parent2f3a7e53cb58e922055baf3cf14138100a1f05ac (diff)
api: able to create repo and fix #726
- POST /user/repos - POST /org/:org/repos
Diffstat (limited to 'routers/api/v1/repo_hooks.go')
-rw-r--r--routers/api/v1/repo_hooks.go15
1 files changed, 2 insertions, 13 deletions
diff --git a/routers/api/v1/repo_hooks.go b/routers/api/v1/repo_hooks.go
index 5dddbc5a..afe18a00 100644
--- a/routers/api/v1/repo_hooks.go
+++ b/routers/api/v1/repo_hooks.go
@@ -48,15 +48,9 @@ func ListRepoHooks(ctx *middleware.Context) {
ctx.JSON(200, &apiHooks)
}
-type CreateRepoHookForm struct {
- Type string `json:"type" binding:"Required"`
- Config map[string]string `json:"config" binding:"Required"`
- Active bool `json:"active"`
-}
-
// POST /repos/:username/:reponame/hooks
// https://developer.github.com/v3/repos/hooks/#create-a-hook
-func CreateRepoHook(ctx *middleware.Context, form CreateRepoHookForm) {
+func CreateRepoHook(ctx *middleware.Context, form api.CreateHookOption) {
if !models.IsValidHookTaskType(form.Type) {
ctx.JSON(422, &base.ApiJsonErr{"invalid hook type", base.DOC_URL})
return
@@ -124,14 +118,9 @@ func CreateRepoHook(ctx *middleware.Context, form CreateRepoHookForm) {
ctx.JSON(201, apiHook)
}
-type EditRepoHookForm struct {
- Config map[string]string `json:"config"`
- Active *bool `json:"active"`
-}
-
// PATCH /repos/:username/:reponame/hooks/:id
// https://developer.github.com/v3/repos/hooks/#edit-a-hook
-func EditRepoHook(ctx *middleware.Context, form EditRepoHookForm) {
+func EditRepoHook(ctx *middleware.Context, form api.EditHookOption) {
w, err := models.GetWebhookById(ctx.ParamsInt64(":id"))
if err != nil {
ctx.JSON(500, &base.ApiJsonErr{"GetWebhookById: " + err.Error(), base.DOC_URL})