summaryrefslogtreecommitdiffstats
path: root/routers/api/v1/repo/collaborators.go
diff options
context:
space:
mode:
authorEthan Koenig <ethantkoenig@gmail.com>2017-11-12 23:02:25 -0800
committerLauris BH <lauris@nix.lv>2017-11-13 09:02:25 +0200
commitf26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f (patch)
tree39c2fc0abc5a10f80f8fa31b3bd57ec3604bf7fd /routers/api/v1/repo/collaborators.go
parent4287d100b39ff89e297ba8945e54fb5911226974 (diff)
downloadgitea-f26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f.tar.gz
gitea-f26f4a7e01f9c380c261fa5bc21bd7e48f2f2f9f.zip
Update swagger documentation (#2899)
* Update swagger documentation Add docs for missing endpoints Add documentation for request parameters Make parameter naming consistent Fix response documentation * Restore delete comments
Diffstat (limited to 'routers/api/v1/repo/collaborators.go')
-rw-r--r--routers/api/v1/repo/collaborators.go99
1 files changed, 98 insertions, 1 deletions
diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go
index 31cb9c6b21..f35de08e50 100644
--- a/routers/api/v1/repo/collaborators.go
+++ b/routers/api/v1/repo/collaborators.go
@@ -13,6 +13,25 @@ import (
// ListCollaborators list a repository's collaborators
func ListCollaborators(ctx *context.APIContext) {
+ // swagger:operation GET /repos/{owner}/{repo}/collaborators repository repoListCollaborators
+ // ---
+ // summary: List a repository's collaborators
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: owner
+ // in: path
+ // description: owner of the repo
+ // type: string
+ // required: true
+ // - name: repo
+ // in: path
+ // description: name of the repo
+ // type: string
+ // required: true
+ // responses:
+ // "200":
+ // "$ref": "#/responses/UserList"
if !ctx.Repo.IsWriter() {
ctx.Error(403, "", "User does not have push access")
return
@@ -31,6 +50,32 @@ func ListCollaborators(ctx *context.APIContext) {
// IsCollaborator check if a user is a collaborator of a repository
func IsCollaborator(ctx *context.APIContext) {
+ // swagger:operation GET /repos/{owner}/{repo}/collaborators/{collaborator} repository repoCheckCollaborator
+ // ---
+ // summary: Check if a user is a collaborator of a repository
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: owner
+ // in: path
+ // description: owner of the repo
+ // type: string
+ // required: true
+ // - name: repo
+ // in: path
+ // description: name of the repo
+ // type: string
+ // required: true
+ // - name: collaborator
+ // in: path
+ // description: username of the collaborator
+ // type: string
+ // required: true
+ // responses:
+ // "204":
+ // "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/empty"
if !ctx.Repo.IsWriter() {
ctx.Error(403, "", "User does not have push access")
return
@@ -56,8 +101,36 @@ func IsCollaborator(ctx *context.APIContext) {
}
}
-// AddCollaborator add a collaborator of a repository
+// AddCollaborator add a collaborator to a repository
func AddCollaborator(ctx *context.APIContext, form api.AddCollaboratorOption) {
+ // swagger:operation PUT /repos/{owner}/{repo}/collaborators/{collaborator} repository repoAddCollaborator
+ // ---
+ // summary: Add a collaborator to a repository
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: owner
+ // in: path
+ // description: owner of the repo
+ // type: string
+ // required: true
+ // - name: repo
+ // in: path
+ // description: name of the repo
+ // type: string
+ // required: true
+ // - name: collaborator
+ // in: path
+ // description: username of the collaborator to add
+ // type: string
+ // required: true
+ // - name: body
+ // in: body
+ // schema:
+ // "$ref": "#/definitions/AddCollaboratorOption"
+ // responses:
+ // "204":
+ // "$ref": "#/responses/empty"
if !ctx.Repo.IsWriter() {
ctx.Error(403, "", "User does not have push access")
return
@@ -89,6 +162,30 @@ func AddCollaborator(ctx *context.APIContext, form api.AddCollaboratorOption) {
// DeleteCollaborator delete a collaborator from a repository
func DeleteCollaborator(ctx *context.APIContext) {
+ // swagger:operation DELETE /repos/{owner}/{repo}/collaborators/{collaborator} repository repoDeleteCollaborator
+ // ---
+ // summary: Delete a collaborator from a repository
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: owner
+ // in: path
+ // description: owner of the repo
+ // type: string
+ // required: true
+ // - name: repo
+ // in: path
+ // description: name of the repo
+ // type: string
+ // required: true
+ // - name: collaborator
+ // in: path
+ // description: username of the collaborator to delete
+ // type: string
+ // required: true
+ // responses:
+ // "204":
+ // "$ref": "#/responses/empty"
if !ctx.Repo.IsWriter() {
ctx.Error(403, "", "User does not have push access")
return