more hook fields

This commit is contained in:
Unknwon 2015-08-29 11:49:06 +08:00
parent c190da77d7
commit 519eee0af0
1 changed files with 11 additions and 5 deletions

View File

@ -11,6 +11,7 @@ import (
"fmt" "fmt"
"net/http" "net/http"
"strings" "strings"
"time"
) )
var ( var (
@ -18,11 +19,14 @@ var (
) )
type Hook struct { type Hook struct {
ID int64 `json:"id"` ID int64 `json:"id"`
Type string `json:"type"` Type string `json:"type"`
Events []string `json:"events"` URL string `json:"-"`
Active bool `json:"active"` Config map[string]string `json:"config"`
Config map[string]string `json:"config"` Events []string `json:"events"`
Active bool `json:"active"`
Updated time.Time `json:"updated_at"`
Created time.Time `json:"created_at"`
} }
func (c *Client) ListRepoHooks(user, repo string) ([]*Hook, error) { func (c *Client) ListRepoHooks(user, repo string) ([]*Hook, error) {
@ -33,6 +37,7 @@ func (c *Client) ListRepoHooks(user, repo string) ([]*Hook, error) {
type CreateHookOption struct { type CreateHookOption struct {
Type string `json:"type" binding:"Required"` Type string `json:"type" binding:"Required"`
Config map[string]string `json:"config" binding:"Required"` Config map[string]string `json:"config" binding:"Required"`
Events []string `json:"events"`
Active bool `json:"active"` Active bool `json:"active"`
} }
@ -48,6 +53,7 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook,
type EditHookOption struct { type EditHookOption struct {
Config map[string]string `json:"config"` Config map[string]string `json:"config"`
Events []string `json:"events"`
Active *bool `json:"active"` Active *bool `json:"active"`
} }