summaryrefslogtreecommitdiffstats
path: root/vendor/code.gitea.io/sdk/gitea/hook.go
diff options
context:
space:
mode:
authorAntoine GIRARD <sapk@users.noreply.github.com>2017-08-21 13:13:47 +0200
committerLauris BH <lauris@nix.lv>2017-08-21 14:13:47 +0300
commitfd8e8a421ae21f8c68eaad195bdd4881e1d34b21 (patch)
tree2c651e0f39a0360496d1fbbd1f4d0fd03ec9a95f /vendor/code.gitea.io/sdk/gitea/hook.go
parent951c909a67bb6f1f8577fb1e61f22dca2bc3c07f (diff)
downloadgitea-fd8e8a421ae21f8c68eaad195bdd4881e1d34b21.tar.gz
gitea-fd8e8a421ae21f8c68eaad195bdd4881e1d34b21.zip
Improve swagger doc (#2274)
* Add swagger comment for adminCreateOrg * Add swagger comment for admin route * add hook swagger doc * Add tags * Add auth * Fix name of responses * Edit name method * Update vendor * make generate-swagger
Diffstat (limited to 'vendor/code.gitea.io/sdk/gitea/hook.go')
-rw-r--r--vendor/code.gitea.io/sdk/gitea/hook.go28
1 files changed, 21 insertions, 7 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/hook.go b/vendor/code.gitea.io/sdk/gitea/hook.go
index f93a8ba460..c0beb271bd 100644
--- a/vendor/code.gitea.io/sdk/gitea/hook.go
+++ b/vendor/code.gitea.io/sdk/gitea/hook.go
@@ -20,6 +20,7 @@ var (
)
// Hook a hook is a web hook when one repository changed
+// swagger:response Hook
type Hook struct {
ID int64 `json:"id"`
Type string `json:"type"`
@@ -31,14 +32,18 @@ type Hook struct {
Created time.Time `json:"created_at"`
}
+// HookList represents a list of API hook.
+// swagger:response HookList
+type HookList []*Hook
+
// ListOrgHooks list all the hooks of one organization
-func (c *Client) ListOrgHooks(org string) ([]*Hook, error) {
+func (c *Client) ListOrgHooks(org string) (HookList, error) {
hooks := make([]*Hook, 0, 10)
return hooks, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s/hooks", org), nil, nil, &hooks)
}
// ListRepoHooks list all the hooks of one repository
-func (c *Client) ListRepoHooks(user, repo string) ([]*Hook, error) {
+func (c *Client) ListRepoHooks(user, repo string) (HookList, error) {
hooks := make([]*Hook, 0, 10)
return hooks, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/hooks", user, repo), nil, nil, &hooks)
}
@@ -56,11 +61,16 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, error) {
}
// CreateHookOption options when create a hook
+// swagger:parameters orgCreateHook repoCreateHook
type CreateHookOption struct {
- Type string `json:"type" binding:"Required"`
+ // in: body
+ Type string `json:"type" binding:"Required"`
+ // in: body
Config map[string]string `json:"config" binding:"Required"`
- Events []string `json:"events"`
- Active bool `json:"active"`
+ // in: body
+ Events []string `json:"events"`
+ // in: body
+ Active bool `json:"active"`
}
// CreateOrgHook create one hook for an organization, with options
@@ -84,10 +94,14 @@ func (c *Client) CreateRepoHook(user, repo string, opt CreateHookOption) (*Hook,
}
// EditHookOption options when modify one hook
+// swagger:parameters orgEditHook repoEditHook
type EditHookOption struct {
+ // in: body
Config map[string]string `json:"config"`
- Events []string `json:"events"`
- Active *bool `json:"active"`
+ // in: body
+ Events []string `json:"events"`
+ // in: body
+ Active *bool `json:"active"`
}
// EditOrgHook modify one hook of an organization, with hook id and options