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
This commit is contained in:
parent
951c909a67
commit
fd8e8a421a
32 changed files with 1911 additions and 110 deletions
28
vendor/code.gitea.io/sdk/gitea/hook.go
generated
vendored
28
vendor/code.gitea.io/sdk/gitea/hook.go
generated
vendored
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue