2020)
2121
2222// Hook a hook is a web hook when one repository changed
23+ // swagger:response Hook
2324type Hook struct {
2425ID int64 `json:"id"`
2526Type string `json:"type"`
@@ -31,14 +32,18 @@ type Hook struct {
3132Created time.Time `json:"created_at"`
3233}
3334
35+ // HookList represents a list of API hook.
36+ // swagger:response HookList
37+ type HookList []* Hook
38+
3439// ListOrgHooks list all the hooks of one organization
35- func (c * Client ) ListOrgHooks (org string ) ([] * Hook , error ) {
40+ func (c * Client ) ListOrgHooks (org string ) (HookList , error ) {
3641hooks := make ([]* Hook , 0 , 10 )
3742return hooks , c .getParsedResponse ("GET" , fmt .Sprintf ("/orgs/%s/hooks" , org ), nil , nil , & hooks )
3843}
3944
4045// ListRepoHooks list all the hooks of one repository
41- func (c * Client ) ListRepoHooks (user , repo string ) ([] * Hook , error ) {
46+ func (c * Client ) ListRepoHooks (user , repo string ) (HookList , error ) {
4247hooks := make ([]* Hook , 0 , 10 )
4348return hooks , c .getParsedResponse ("GET" , fmt .Sprintf ("/repos/%s/%s/hooks" , user , repo ), nil , nil , & hooks )
4449}
@@ -56,11 +61,16 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, error) {
5661}
5762
5863// CreateHookOption options when create a hook
64+ // swagger:parameters orgCreateHook repoCreateHook
5965type CreateHookOption struct {
60- Type string `json:"type" binding:"Required"`
66+ // in: body
67+ Type string `json:"type" binding:"Required"`
68+ // in: body
6169Config map [string ]string `json:"config" binding:"Required"`
62- Events []string `json:"events"`
63- Active bool `json:"active"`
70+ // in: body
71+ Events []string `json:"events"`
72+ // in: body
73+ Active bool `json:"active"`
6474}
6575
6676// CreateOrgHook create one hook for an organization, with options
@@ -84,10 +94,14 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook,
8494}
8595
8696// EditHookOption options when modify one hook
97+ // swagger:parameters orgEditHook repoEditHook
8798type EditHookOption struct {
99+ // in: body
88100Config map [string ]string `json:"config"`
89- Events []string `json:"events"`
90- Active * bool `json:"active"`
101+ // in: body
102+ Events []string `json:"events"`
103+ // in: body
104+ Active * bool `json:"active"`
91105}
92106
93107// EditOrgHook modify one hook of an organization, with hook id and options
0 commit comments