20
20
)
21
21
22
22
// Hook a hook is a web hook when one repository changed
23
+ // swagger:response Hook
23
24
type Hook struct {
24
25
ID int64 `json:"id"`
25
26
Type string `json:"type"`
@@ -31,14 +32,18 @@ type Hook struct {
31
32
Created time.Time `json:"created_at"`
32
33
}
33
34
35
+ // HookList represents a list of API hook.
36
+ // swagger:response HookList
37
+ type HookList []* Hook
38
+
34
39
// 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 ) {
36
41
hooks := make ([]* Hook , 0 , 10 )
37
42
return hooks , c .getParsedResponse ("GET" , fmt .Sprintf ("/orgs/%s/hooks" , org ), nil , nil , & hooks )
38
43
}
39
44
40
45
// 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 ) {
42
47
hooks := make ([]* Hook , 0 , 10 )
43
48
return hooks , c .getParsedResponse ("GET" , fmt .Sprintf ("/repos/%s/%s/hooks" , user , repo ), nil , nil , & hooks )
44
49
}
@@ -56,11 +61,16 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, error) {
56
61
}
57
62
58
63
// CreateHookOption options when create a hook
64
+ // swagger:parameters orgCreateHook repoCreateHook
59
65
type CreateHookOption struct {
60
- Type string `json:"type" binding:"Required"`
66
+ // in: body
67
+ Type string `json:"type" binding:"Required"`
68
+ // in: body
61
69
Config 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"`
64
74
}
65
75
66
76
// CreateOrgHook create one hook for an organization, with options
@@ -84,10 +94,14 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook,
84
94
}
85
95
86
96
// EditHookOption options when modify one hook
97
+ // swagger:parameters orgEditHook repoEditHook
87
98
type EditHookOption struct {
99
+ // in: body
88
100
Config 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"`
91
105
}
92
106
93
107
// EditOrgHook modify one hook of an organization, with hook id and options
0 commit comments