summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--modules/context/api.go4
-rw-r--r--public/swagger.v1.json1451
-rw-r--r--routers/api/v1/admin/org.go15
-rw-r--r--routers/api/v1/admin/repo.go15
-rw-r--r--routers/api/v1/admin/user.go57
-rw-r--r--routers/api/v1/api.go22
-rw-r--r--routers/api/v1/misc/markdown.go4
-rw-r--r--routers/api/v1/misc/version.go2
-rw-r--r--routers/api/v1/org/hook.go56
-rw-r--r--routers/api/v1/org/member.go66
-rw-r--r--routers/api/v1/repo/fork.go4
-rw-r--r--routers/api/v1/repo/hook.go14
-rw-r--r--routers/api/v1/repo/repo.go29
-rw-r--r--routers/api/v1/user/app.go4
-rw-r--r--routers/api/v1/user/follower.go16
-rw-r--r--routers/api/v1/user/gpg_key.go10
-rw-r--r--routers/api/v1/user/key.go10
-rw-r--r--routers/api/v1/user/repo.go6
-rw-r--r--routers/api/v1/user/star.go10
-rw-r--r--routers/api/v1/user/user.go6
-rw-r--r--routers/api/v1/user/watch.go10
-rw-r--r--vendor/code.gitea.io/sdk/gitea/admin_user.go59
-rw-r--r--vendor/code.gitea.io/sdk/gitea/fork.go2
-rw-r--r--vendor/code.gitea.io/sdk/gitea/hook.go28
-rw-r--r--vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go69
-rw-r--r--vendor/code.gitea.io/sdk/gitea/org.go15
-rw-r--r--vendor/code.gitea.io/sdk/gitea/repo.go23
-rw-r--r--vendor/code.gitea.io/sdk/gitea/repo_key.go2
-rw-r--r--vendor/code.gitea.io/sdk/gitea/status.go2
-rw-r--r--vendor/code.gitea.io/sdk/gitea/user_app.go2
-rw-r--r--vendor/code.gitea.io/sdk/gitea/user_gpgkey.go2
-rw-r--r--vendor/vendor.json6
32 files changed, 1911 insertions, 110 deletions
diff --git a/modules/context/api.go b/modules/context/api.go
index 7264214f37..0bf4307726 100644
--- a/modules/context/api.go
+++ b/modules/context/api.go
@@ -51,6 +51,10 @@ type APIForbiddenError struct {
// swagger:response notFound
type APINotFound struct{}
+//APIRedirect is a redirect response
+// swagger:response redirect
+type APIRedirect struct{}
+
// Error responses error message to client with given message.
// If status is 500, also it prints error to log.
func (ctx *APIContext) Error(status int, title string, obj interface{}) {
diff --git a/public/swagger.v1.json b/public/swagger.v1.json
index 3ce534d44f..25ff9fc6be 100644
--- a/public/swagger.v1.json
+++ b/public/swagger.v1.json
@@ -24,6 +24,460 @@
},
"basePath": "/api/v1",
"paths": {
+ "/admin/users": {
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "operationId": "adminCreateUser",
+ "parameters": [
+ {
+ "x-go-name": "SourceID",
+ "name": "source_id",
+ "in": "body",
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ {
+ "x-go-name": "LoginName",
+ "name": "login_name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Username",
+ "name": "username",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "FullName",
+ "name": "full_name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Email",
+ "name": "email",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Password",
+ "name": "password",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "SendNotify",
+ "name": "send_notify",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/User"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/admin/users/{username}": {
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "operationId": "adminDeleteUser",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ },
+ "patch": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "operationId": "adminEditUser",
+ "parameters": [
+ {
+ "x-go-name": "SourceID",
+ "name": "source_id",
+ "in": "body",
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ {
+ "x-go-name": "LoginName",
+ "name": "login_name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "FullName",
+ "name": "full_name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Email",
+ "name": "email",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Password",
+ "name": "password",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Website",
+ "name": "website",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Location",
+ "name": "location",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Active",
+ "name": "active",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "Admin",
+ "name": "admin",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "AllowGitHook",
+ "name": "allow_git_hook",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "AllowImportLocal",
+ "name": "allow_import_local",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "MaxRepoCreation",
+ "name": "max_repo_creation",
+ "in": "body",
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/User"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/admin/users/{username}/keys": {
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "operationId": "adminCreatePublicKey",
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "x-go-name": "Title",
+ "description": "Title of the key to add",
+ "name": "title",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "uniqueItems": true,
+ "x-go-name": "Key",
+ "description": "An armored SSH key to add",
+ "name": "key",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/PublicKey"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/admin/users/{username}/orgs": {
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "operationId": "adminCreateOrg",
+ "parameters": [
+ {
+ "x-go-name": "UserName",
+ "name": "username",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "FullName",
+ "name": "full_name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Description",
+ "name": "description",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Website",
+ "name": "website",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Location",
+ "name": "location",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/Organization"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/admin/users/{username}/repos": {
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "admin"
+ ],
+ "operationId": "adminCreateRepo",
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "x-go-name": "Name",
+ "description": "Name of the repository to create",
+ "name": "name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Description",
+ "description": "Description of the repository to create",
+ "name": "description",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Private",
+ "description": "Is the repository to create private ?",
+ "name": "private",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "AutoInit",
+ "description": "Init the repository to create ?",
+ "name": "auto_init",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "Gitignores",
+ "description": "Gitignores to use",
+ "name": "gitignores",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "License",
+ "description": "License to use",
+ "name": "license",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Readme",
+ "description": "Readme of the repository to create",
+ "name": "readme",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/Repository"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
"/markdown": {
"post": {
"consumes": [
@@ -32,6 +486,9 @@
"produces": [
"text/html"
],
+ "tags": [
+ "miscellaneous"
+ ],
"operationId": "renderMarkdown",
"parameters": [
{
@@ -85,6 +542,9 @@
"produces": [
"text/html"
],
+ "tags": [
+ "miscellaneous"
+ ],
"operationId": "renderMarkdownRaw",
"responses": {
"200": {
@@ -104,6 +564,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "organization"
+ ],
"operationId": "createOrgRepo",
"parameters": [
{
@@ -187,11 +650,334 @@
}
}
},
- "/orgs/{org}/repos": {
+ "/orgs/{orgname}/hooks": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgListHooks",
+ "responses": {
+ "200": {
+ "$ref": "#/responses/HookList"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/orgs/{orgname}/hooks/": {
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgCreateHook",
+ "parameters": [
+ {
+ "x-go-name": "Type",
+ "name": "type",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Config",
+ "name": "config",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "x-go-name": "Events",
+ "name": "events",
+ "in": "body",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "x-go-name": "Active",
+ "name": "active",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/Hook"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/orgs/{orgname}/hooks/{id}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgGetHook",
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Hook"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ },
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgDeleteHook",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ },
+ "patch": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgEditHook",
+ "parameters": [
+ {
+ "x-go-name": "Config",
+ "name": "config",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "x-go-name": "Events",
+ "name": "events",
+ "in": "body",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "x-go-name": "Active",
+ "name": "active",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Hook"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/orgs/{orgname}/members": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgListMembers",
+ "responses": {
+ "200": {
+ "$ref": "#/responses/UserList"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/orgs/{orgname}/members/{username}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgIsMember",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "302": {
+ "$ref": "#/responses/redirect"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgDeleteMember",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/orgs/{orgname}/public_members": {
"get": {
"produces": [
"application/json"
],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgListPublicMembers",
+ "responses": {
+ "200": {
+ "$ref": "#/responses/UserList"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/orgs/{orgname}/public_members/{username}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgIsPublicMember",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "put": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgPublicizeMember",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ },
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
+ "operationId": "orgConcealMember",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/orgs/{orgname}/repos": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "organization"
+ ],
"operationId": "orgListRepos",
"responses": {
"200": {
@@ -203,11 +989,106 @@
}
}
},
+ "/repos/migrate": {
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "operationId": "repoMigrate",
+ "parameters": [
+ {
+ "x-go-name": "CloneAddr",
+ "name": "clone_addr",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "AuthUsername",
+ "name": "auth_username",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "AuthPassword",
+ "name": "auth_password",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "UID",
+ "name": "uid",
+ "in": "body",
+ "schema": {
+ "type": "integer",
+ "format": "int64"
+ }
+ },
+ {
+ "x-go-name": "RepoName",
+ "name": "repo_name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Mirror",
+ "name": "mirror",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "Private",
+ "name": "private",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "Description",
+ "name": "description",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/Repository"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
"/repos/search": {
"get": {
"produces": [
"application/json"
],
+ "tags": [
+ "repository"
+ ],
"operationId": "repoSearch",
"parameters": [
{
@@ -249,6 +1130,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "repository"
+ ],
"operationId": "listForks",
"responses": {
"200": {
@@ -263,7 +1147,20 @@
"produces": [
"application/json"
],
+ "tags": [
+ "repository"
+ ],
"operationId": "createFork",
+ "parameters": [
+ {
+ "x-go-name": "Organization",
+ "name": "organization",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
"responses": {
"202": {
"$ref": "#/responses/Repository"
@@ -280,11 +1177,209 @@
}
}
},
+ "/repos/{username}/{reponame}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "operationId": "repoGet",
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Repository"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ },
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "operationId": "repoDelete",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/repos/{username}/{reponame}/hooks": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "operationId": "repoListHooks",
+ "responses": {
+ "200": {
+ "$ref": "#/responses/HookList"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ },
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "operationId": "repoCreateHook",
+ "parameters": [
+ {
+ "x-go-name": "Type",
+ "name": "type",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Config",
+ "name": "config",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "x-go-name": "Events",
+ "name": "events",
+ "in": "body",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "x-go-name": "Active",
+ "name": "active",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Hook"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
+ "/repos/{username}/{reponame}/hooks/{id}": {
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "operationId": "repoDeleteHook",
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ },
+ "patch": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "operationId": "repoEditHook",
+ "parameters": [
+ {
+ "x-go-name": "Config",
+ "name": "config",
+ "in": "body",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "x-go-name": "Events",
+ "name": "events",
+ "in": "body",
+ "schema": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ {
+ "x-go-name": "Active",
+ "name": "active",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Hook"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
"/repos/{username}/{reponame}/mirror-sync": {
"post": {
"produces": [
"application/json"
],
+ "tags": [
+ "repository"
+ ],
"operationId": "repoMirrorSync",
"responses": {
"200": {
@@ -298,6 +1393,9 @@
},
"/repos/{username}/{reponame}/subscription": {
"get": {
+ "tags": [
+ "repository"
+ ],
"operationId": "userCurrentCheckSubscription",
"responses": {
"200": {
@@ -309,6 +1407,9 @@
}
},
"put": {
+ "tags": [
+ "repository"
+ ],
"operationId": "userCurrentPutSubscription",
"responses": {
"200": {
@@ -320,6 +1421,9 @@
}
},
"delete": {
+ "tags": [
+ "repository"
+ ],
"operationId": "userCurrentDeleteSubscription",
"responses": {
"204": {
@@ -331,11 +1435,33 @@
}
}
},
+ "/repositories/{id}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "operationId": "repoGetByID",
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Repository"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
+ }
+ },
"/user": {
"get": {
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userGetCurrent",
"responses": {
"200": {
@@ -349,6 +1475,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentListFollowers",
"responses": {
"200": {
@@ -365,6 +1494,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentListFollowing",
"responses": {
"200": {
@@ -378,6 +1510,9 @@
},
"/user/following/{username}": {
"get": {
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentCheckFollowing",
"responses": {
"204": {
@@ -389,6 +1524,9 @@
}
},
"put": {
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentPutFollow",
"responses": {
"204": {
@@ -400,6 +1538,9 @@
}
},
"delete": {
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentDeleteFollow",
"responses": {
"204": {
@@ -416,6 +1557,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentListGPGKeys",
"responses": {
"200": {
@@ -433,6 +1577,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentPostGPGKey",
"parameters": [
{
@@ -465,6 +1612,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentGetGPGKey",
"responses": {
"200": {
@@ -482,6 +1632,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentDeleteGPGKey",
"responses": {
"204": {
@@ -501,6 +1654,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentListKeys",
"responses": {
"200": {
@@ -518,6 +1674,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentPostKey",
"parameters": [
{
@@ -561,6 +1720,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentGetKey",
"responses": {
"200": {
@@ -578,6 +1740,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentDeleteKey",
"responses": {
"204": {
@@ -597,6 +1762,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentListRepos",
"responses": {
"200": {
@@ -606,6 +1774,99 @@
"$ref": "#/responses/error"
}
}
+ },
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository",
+ "user"
+ ],
+ "operationId": "createCurrentUserRepo",
+ "parameters": [
+ {
+ "uniqueItems": true,
+ "x-go-name": "Name",
+ "description": "Name of the repository to create",
+ "name": "name",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Description",
+ "description": "Description of the repository to create",
+ "name": "description",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Private",
+ "description": "Is the repository to create private ?",
+ "name": "private",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "AutoInit",
+ "description": "Init the repository to create ?",
+ "name": "auto_init",
+ "in": "body",
+ "schema": {
+ "type": "boolean"
+ }
+ },
+ {
+ "x-go-name": "Gitignores",
+ "description": "Gitignores to use",
+ "name": "gitignores",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "License",
+ "description": "License to use",
+ "name": "license",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ },
+ {
+ "x-go-name": "Readme",
+ "description": "Readme of the repository to create",
+ "name": "readme",
+ "in": "body",
+ "schema": {
+ "type": "string"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/Repository"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "500": {
+ "$ref": "#/responses/error"
+ }
+ }
}
},
"/user/starred": {
@@ -613,6 +1874,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentListStarred",
"responses": {
"200": {
@@ -626,6 +1890,9 @@
},
"/user/starred/{username}/{reponame}": {
"get": {
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentCheckStarring",
"responses": {
"204": {
@@ -637,6 +1904,9 @@
}
},
"put": {
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentPutStar",
"responses": {
"204": {
@@ -648,6 +1918,9 @@
}
},
"delete": {
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentDeleteStar",
"responses": {
"204": {
@@ -664,6 +1937,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userCurrentListSubscriptions",
"responses": {
"200": {
@@ -680,6 +1956,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userListFollowers",
"responses": {
"200": {
@@ -696,6 +1975,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userSearch",
"responses": {
"200": {
@@ -712,6 +1994,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userGet",
"responses": {
"200": {
@@ -731,6 +2016,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userListFollowing",
"responses": {
"200": {
@@ -744,6 +2032,9 @@
},
"/users/{username}/following/:target": {
"get": {
+ "tags": [
+ "user"
+ ],
"operationId": "userCheckFollowing",
"responses": {
"204": {
@@ -760,6 +2051,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userListGPGKeys",
"responses": {
"200": {
@@ -776,6 +2070,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userListKeys",
"responses": {
"200": {
@@ -792,6 +2089,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userListRepos",
"responses": {
"200": {
@@ -808,6 +2108,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userListStarred",
"responses": {
"200": {
@@ -824,6 +2127,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userListSubscriptions",
"responses": {
"200": {
@@ -840,6 +2146,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "user"
+ ],
"operationId": "userGetTokens",
"responses": {
"200": {
@@ -857,6 +2166,9 @@
"produces": [
"application/json"
],
+ "tags": [
+ "miscellaneous"
+ ],
"summary": "Return Gitea running version.",
"operationId": "getVersion",
"responses": {
@@ -929,7 +2241,7 @@
"x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
},
"GPGKeyEmail": {
- "description": "GPGKeyEmail a email attache to a GPGKey",
+ "description": "GPGKeyEmail an email attached to a GPGKey",
"type": "object",
"properties": {
"email": {
@@ -1153,9 +2465,69 @@
"GPGKeyList": {
"description": "GPGKeyList represents a list of GPGKey"
},
+ "Hook": {
+ "description": "Hook a hook is a web hook when one repository changed",
+ "schema": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "headers": {
+ "active": {
+ "type": "boolean"
+ },
+ "config": {},
+ "created_at": {},
+ "events": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "type": {
+ "type": "string"
+ },
+ "updated_at": {}
+ }
+ },
+ "HookList": {
+ "description": "HookList represents a list of API hook."
+ },
"MarkdownRender": {
"description": "MarkdownRender is a rendered markdown document"
},
+ "Organization": {
+ "description": "Organization a group of some repositories, users and teams",
+ "headers": {
+ "avatar_url": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "full_name": {
+ "type": "string"
+ },
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "location": {
+ "type": "string"
+ },
+ "username": {
+ "type": "string"
+ },
+ "website": {
+ "type": "string"
+ }
+ }
+ },
"PublicKey": {
"description": "PublicKey publickey is a user key to push code to repository",
"headers": {
@@ -1287,6 +2659,32 @@
}
}
},
+ "TrackedTime": {
+ "description": "TrackedTime worked time for an issue / pr",
+ "headers": {
+ "created": {},
+ "id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "issue_id": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "time": {
+ "type": "integer",
+ "format": "int64",
+ "description": "Time in seconds"
+ },
+ "user_id": {
+ "type": "integer",
+ "format": "int64"
+ }
+ }
+ },
+ "TrackedTimes": {
+ "description": "TrackedTimes represent a list of tracked times"
+ },
"User": {
"description": "User represents a API user.",
"headers": {
@@ -1361,6 +2759,9 @@
"notFound": {
"description": "APINotFound is a not found empty response"
},
+ "redirect": {
+ "description": "APIRedirect is a redirect response"
+ },
"validationError": {
"description": "APIValidationError is error format response related to input validation",
"headers": {
@@ -1372,5 +2773,47 @@
}
}
}
- }
-}
+ },
+ "securityDefinitions": {
+ "AccessToken": {
+ "type": "apiKey",
+ "name": "access_token",
+ "in": "query"
+ },
+ "AuthorizationHeaderToken": {
+ "type": "apiKey",
+ "name": "Authorization",
+ "in": "header"
+ },
+ "BasicAuth": {
+ "type": "basic"
+ },
+ "Token": {
+ "type": "apiKey",
+ "name": "token",
+ "in": "query"
+ }
+ },
+ "security": [
+ {
+ "BasicAuth": [
+ "[]"
+ ]
+ },
+ {
+ "Token": [
+ "[]"
+ ]
+ },
+ {
+ "AccessToken": [
+ "[]"
+ ]
+ },
+ {
+ "AuthorizationHeaderToken": [
+ "[]"
+ ]
+ }
+ ]
+} \ No newline at end of file
diff --git a/routers/api/v1/admin/org.go b/routers/api/v1/admin/org.go
index 706e2cedeb..99c9cf0b95 100644
--- a/routers/api/v1/admin/org.go
+++ b/routers/api/v1/admin/org.go
@@ -14,8 +14,21 @@ import (
)
// CreateOrg api for create organization
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Organizations#create-a-new-organization
func CreateOrg(ctx *context.APIContext, form api.CreateOrgOption) {
+ // swagger:route POST /admin/users/{username}/orgs admin adminCreateOrg
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: Organization
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := user.GetUserByParams(ctx)
if ctx.Written() {
return
diff --git a/routers/api/v1/admin/repo.go b/routers/api/v1/admin/repo.go
index a52d462137..232fb988c8 100644
--- a/routers/api/v1/admin/repo.go
+++ b/routers/api/v1/admin/repo.go
@@ -13,8 +13,21 @@ import (
)
// CreateRepo api for creating a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Repositories#create-a-new-repository
func CreateRepo(ctx *context.APIContext, form api.CreateRepoOption) {
+ // swagger:route POST /admin/users/{username}/repos admin adminCreateRepo
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: Repository
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
owner := user.GetUserByParams(ctx)
if ctx.Written() {
return
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index 36fea14f11..74cbba8cde 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -35,8 +35,21 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
}
// CreateUser api for creating a user
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-new-user
func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
+ // swagger:route POST /admin/users admin adminCreateUser
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: User
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := &models.User{
Name: form.Username,
FullName: form.FullName,
@@ -73,8 +86,21 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
}
// EditUser api for modifying a user's information
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#edit-an-existing-user
func EditUser(ctx *context.APIContext, form api.EditUserOption) {
+ // swagger:route PATCH /admin/users/{username} admin adminEditUser
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: User
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := user.GetUserByParams(ctx)
if ctx.Written() {
return
@@ -130,8 +156,18 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
}
// DeleteUser api for deleting a user
-// https://github.com/gogits/go-gogs-client/wiki/Administration-Users#delete-a-user
func DeleteUser(ctx *context.APIContext) {
+ // swagger:route DELETE /admin/users/{username} admin adminDeleteUser
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 204: empty
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := user.GetUserByParams(ctx)
if ctx.Written() {
return
@@ -152,8 +188,21 @@ func DeleteUser(ctx *context.APIContext) {
}
// CreatePublicKey api for creating a public key to a user
-// see https://github.com/gogits/go-gogs-client/wiki/Administration-Users#create-a-public-key-for-user
func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
+ // swagger:route POST /admin/users/{username}/keys admin adminCreatePublicKey
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: PublicKey
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
u := user.GetUserByParams(ctx)
if ctx.Written() {
return
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 23c7c7c305..b658c972f1 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -23,6 +23,28 @@
// - application/json
// - text/html
//
+// Security:
+// - BasicAuth: []
+// - Token: []
+// - AccessToken: []
+// - AuthorizationHeaderToken: []
+//
+// SecurityDefinitions:
+// BasicAuth:
+// type: basic
+// Token:
+// type: apiKey
+// name: token
+// in: query
+// AccessToken:
+// type: apiKey
+// name: access_token
+// in: query
+// AuthorizationHeaderToken:
+// type: apiKey
+// name: Authorization
+// in: header
+//
// swagger:meta
package v1
diff --git a/routers/api/v1/misc/markdown.go b/routers/api/v1/misc/markdown.go
index 0d346a9270..933488301b 100644
--- a/routers/api/v1/misc/markdown.go
+++ b/routers/api/v1/misc/markdown.go
@@ -14,7 +14,7 @@ import (
// Markdown render markdown document to HTML
func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
- // swagger:route POST /markdown renderMarkdown
+ // swagger:route POST /markdown miscellaneous renderMarkdown
//
// Consumes:
// - application/json
@@ -52,7 +52,7 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
// MarkdownRaw render raw markdown HTML
func MarkdownRaw(ctx *context.APIContext) {
- // swagger:route POST /markdown/raw renderMarkdownRaw
+ // swagger:route POST /markdown/raw miscellaneous renderMarkdownRaw
//
// Consumes:
// - text/plain
diff --git a/routers/api/v1/misc/version.go b/routers/api/v1/misc/version.go
index 873326a2cc..1780398bf9 100644
--- a/routers/api/v1/misc/version.go
+++ b/routers/api/v1/misc/version.go
@@ -12,7 +12,7 @@ import (
// Version shows the version of the Gitea server
func Version(ctx *context.APIContext) {
- // swagger:route GET /version getVersion
+ // swagger:route GET /version miscellaneous getVersion
//
// Return Gitea running version.
//
diff --git a/routers/api/v1/org/hook.go b/routers/api/v1/org/hook.go
index 3a0b74ac21..d8a4c45fc8 100644
--- a/routers/api/v1/org/hook.go
+++ b/routers/api/v1/org/hook.go
@@ -15,6 +15,15 @@ import (
// ListHooks list an organziation's webhooks
func ListHooks(ctx *context.APIContext) {
+ // swagger:route GET /orgs/{orgname}/hooks organization orgListHooks
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: HookList
+ // 500: error
+
org := ctx.Org.Organization
orgHooks, err := models.GetWebhooksByOrgID(org.ID)
if err != nil {
@@ -30,6 +39,16 @@ func ListHooks(ctx *context.APIContext) {
// GetHook get an organization's hook by id
func GetHook(ctx *context.APIContext) {
+ // swagger:route GET /orgs/{orgname}/hooks/{id} organization orgGetHook
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: Hook
+ // 404: notFound
+ // 500: error
+
org := ctx.Org.Organization
hookID := ctx.ParamsInt64(":id")
hook, err := utils.GetOrgHook(ctx, org.ID, hookID)
@@ -41,6 +60,19 @@ func GetHook(ctx *context.APIContext) {
// CreateHook create a hook for an organization
func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
+ // swagger:route POST /orgs/{orgname}/hooks/ organization orgCreateHook
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: Hook
+ // 422: validationError
+ // 500: error
+
if !utils.CheckCreateHookOption(ctx, &form) {
return
}
@@ -49,12 +81,36 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
// EditHook modify a hook of a repository
func EditHook(ctx *context.APIContext, form api.EditHookOption) {
+ // swagger:route PATCH /orgs/{orgname}/hooks/{id} organization orgEditHook
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: Hook
+ // 422: validationError
+ // 404: notFound
+ // 500: error
+
hookID := ctx.ParamsInt64(":id")
utils.EditOrgHook(ctx, &form, hookID)
}
// DeleteHook delete a hook of an organization
func DeleteHook(ctx *context.APIContext) {
+ // swagger:route DELETE /orgs/{orgname}/hooks/{id} organization orgDeleteHook
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 204: empty
+ // 404: notFound
+ // 500: error
+
org := ctx.Org.Organization
hookID := ctx.ParamsInt64(":id")
if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil {
diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go
index 476025e644..3495370556 100644
--- a/routers/api/v1/org/member.go
+++ b/routers/api/v1/org/member.go
@@ -53,17 +53,45 @@ func listMembers(ctx *context.APIContext, publicOnly bool) {
// ListMembers list an organization's members
func ListMembers(ctx *context.APIContext) {
+ // swagger:route GET /orgs/{orgname}/members organization orgListMembers
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: UserList
+ // 500: error
+
publicOnly := ctx.User == nil || !ctx.Org.Organization.IsOrgMember(ctx.User.ID)
listMembers(ctx, publicOnly)
}
// ListPublicMembers list an organization's public members
func ListPublicMembers(ctx *context.APIContext) {
+ // swagger:route GET /orgs/{orgname}/public_members organization orgListPublicMembers
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 200: UserList
+ // 500: error
+
listMembers(ctx, true)
}
// IsMember check if a user is a member of an organization
func IsMember(ctx *context.APIContext) {
+ // swagger:route GET /orgs/{orgname}/members/{username} organization orgIsMember
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 204: empty
+ // 302: redirect
+ // 404: notFound
+
userToCheck := user.GetUserByParams(ctx)
if ctx.Written() {
return
@@ -85,6 +113,15 @@ func IsMember(ctx *context.APIContext) {
// IsPublicMember check if a user is a public member of an organization
func IsPublicMember(ctx *context.APIContext) {
+ // swagger:route GET /orgs/{orgname}/public_members/{username} organization orgIsPublicMember
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 204: empty
+ // 404: notFound
+
userToCheck := user.GetUserByParams(ctx)
if ctx.Written() {
return
@@ -98,6 +135,16 @@ func IsPublicMember(ctx *context.APIContext) {
// PublicizeMember make a member's membership public
func PublicizeMember(ctx *context.APIContext) {
+ // swagger:route PUT /orgs/{orgname}/public_members/{username} organization orgPublicizeMember
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 204: empty
+ // 403: forbidden
+ // 500: error
+
userToPublicize := user.GetUserByParams(ctx)
if ctx.Written() {
return
@@ -116,6 +163,16 @@ func PublicizeMember(ctx *context.APIContext) {
// ConcealMember make a member's membership not public
func ConcealMember(ctx *context.APIContext) {
+ // swagger:route DELETE /orgs/{orgname}/public_members/{username} organization orgConcealMember
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 204: empty
+ // 403: forbidden
+ // 500: error
+
userToConceal := user.GetUserByParams(ctx)
if ctx.Written() {
return
@@ -134,6 +191,15 @@ func ConcealMember(ctx *context.APIContext) {
// DeleteMember remove a member from an organization
func DeleteMember(ctx *context.APIContext) {
+ // swagger:route DELETE /orgs/{orgname}/members/{username} organization orgDeleteMember
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 204: empty
+ // 500: error
+
member := user.GetUserByParams(ctx)
if ctx.Written() {
return
diff --git a/routers/api/v1/repo/fork.go b/routers/api/v1/repo/fork.go
index 25464dbd78..e4f45004de 100644
--- a/routers/api/v1/repo/fork.go
+++ b/routers/api/v1/repo/fork.go
@@ -14,7 +14,7 @@ import (
// ListForks list a repository's forks
func ListForks(ctx *context.APIContext) {
- // swagger:route GET /repos/{owner}/{repo}/forks listForks
+ // swagger:route GET /repos/{owner}/{repo}/forks repository listForks
//
// Produces:
// - application/json
@@ -42,7 +42,7 @@ func ListForks(ctx *context.APIContext) {
// CreateFork create a fork of a repo
func CreateFork(ctx *context.APIContext, form api.CreateForkOption) {
- // swagger:route POST /repos/{owner}/{repo}/forks createFork
+ // swagger:route POST /repos/{owner}/{repo}/forks repository createFork
//
// Produces:
// - application/json
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index 93dcd081d7..72dfeff3d0 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -15,13 +15,13 @@ import (
// ListHooks list all hooks of a repository
func ListHooks(ctx *context.APIContext) {
- // swagger:route GET /repos/{username}/{reponame}/hooks
+ // swagger:route GET /repos/{username}/{reponame}/hooks repository repoListHooks
//
// Produces:
// - application/json
//
// Responses:
- // 200: apiHooks
+ // 200: HookList
// 500: error
hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID)
@@ -50,7 +50,7 @@ func GetHook(ctx *context.APIContext) {
// CreateHook create a hook for a repository
func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
- // swagger:route POST /repos/{username}/{reponame}/hooks
+ // swagger:route POST /repos/{username}/{reponame}/hooks repository repoCreateHook
//
// Consumes:
// - application/json
@@ -59,7 +59,7 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
// - application/json
//
// Responses:
- // 200: apiHook
+ // 200: Hook
// 422: validationError
// 500: error
@@ -71,13 +71,13 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
// EditHook modify a hook of a repository
func EditHook(ctx *context.APIContext, form api.EditHookOption) {
- // swagger:route PATCH /repos/{username}/{reponame}/hooks/{id}
+ // swagger:route PATCH /repos/{username}/{reponame}/hooks/{id} repository repoEditHook
//
// Produces:
// - application/json
//
// Responses:
- // 200: apiHook //TODO
+ // 200: Hook
// 422: validationError
// 500: error
@@ -87,7 +87,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
// DeleteHook delete a hook of a repository
func DeleteHook(ctx *context.APIContext) {
- // swagger:route DELETE /repos/{username}/{reponame}/hooks/{id}
+ // swagger:route DELETE /repos/{username}/{reponame}/hooks/{id} repository repoDeleteHook
//
// Produces:
// - application/json
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index e44159817e..e8bf026511 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -20,7 +20,7 @@ import (
// Search repositories via options
func Search(ctx *context.APIContext) {
- // swagger:route GET /repos/search repoSearch
+ // swagger:route GET /repos/search repository repoSearch
//
// Produces:
// - application/json
@@ -130,8 +130,21 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
}
// Create one repository of mine
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create
func Create(ctx *context.APIContext, opt api.CreateRepoOption) {
+ // swagger:route POST /user/repos repository user createCurrentUserRepo
+ //
+ // Consumes:
+ // - application/json
+ //
+ // Produces:
+ // - application/json
+ //
+ // Responses:
+ // 201: Repository
+ // 403: forbidden
+ // 422: validationError
+ // 500: error
+
// Shouldn't reach this condition, but just in case.
if ctx.User.IsOrganization() {
ctx.Error(422, "", "not allowed creating repository for organization")
@@ -142,7 +155,7 @@ func Create(ctx *context.APIContext, opt api.CreateRepoOption) {
// CreateOrgRepo create one repository of the organization
func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
- // swagger:route POST /org/{org}/repos createOrgRepo
+ // swagger:route POST /org/{org}/repos organization createOrgRepo
//
// Consumes:
// - application/json
@@ -175,7 +188,7 @@ func CreateOrgRepo(ctx *context.APIContext, opt api.CreateRepoOption) {
// Migrate migrate remote git repository to gitea
func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
- // swagger:route POST /repos/migrate
+ // swagger:route POST /repos/migrate repository repoMigrate
//
// Consumes:
// - application/json
@@ -260,7 +273,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
// Get one repository
func Get(ctx *context.APIContext) {
- // swagger:route GET /repos/{username}/{reponame}
+ // swagger:route GET /repos/{username}/{reponame} repository repoGet
//
// Produces:
// - application/json
@@ -274,7 +287,7 @@ func Get(ctx *context.APIContext) {
// GetByID returns a single Repository
func GetByID(ctx *context.APIContext) {
- // swagger:route GET /repositories/{id}
+ // swagger:route GET /repositories/{id} repository repoGetByID
//
// Produces:
// - application/json
@@ -306,7 +319,7 @@ func GetByID(ctx *context.APIContext) {
// Delete one repository
func Delete(ctx *context.APIContext) {
- // swagger:route DELETE /repos/{username}/{reponame}
+ // swagger:route DELETE /repos/{username}/{reponame} repository repoDelete
//
// Produces:
// - application/json
@@ -339,7 +352,7 @@ func Delete(ctx *context.APIContext) {
// MirrorSync adds a mirrored repository to the sync queue
func MirrorSync(ctx *context.APIContext) {
- // swagger:route POST /repos/{username}/{reponame}/mirror-sync repoMirrorSync
+ // swagger:route POST /repos/{username}/{reponame}/mirror-sync repository repoMirrorSync
//
// Produces:
// - application/json
diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go
index 88837a71a2..1d722e36e4 100644
--- a/routers/api/v1/user/app.go
+++ b/routers/api/v1/user/app.go
@@ -13,7 +13,7 @@ import (
// ListAccessTokens list all the access tokens
func ListAccessTokens(ctx *context.APIContext) {
- // swagger:route GET /users/{username}/tokens userGetTokens
+ // swagger:route GET /users/{username}/tokens user userGetTokens
//
// Produces:
// - application/json
@@ -40,7 +40,7 @@ func ListAccessTokens(ctx *context.APIContext) {
// CreateAccessToken create access tokens
func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) {
- // swagger:route POST /users/{username} /tokens userCreateToken
+ // swagger:route POST /users/{username} /tokens user userCreateToken
//
// Consumes:
// - application/json
diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go
index 84240c7957..55a0b032db 100644
--- a/routers/api/v1/user/follower.go
+++ b/routers/api/v1/user/follower.go
@@ -30,7 +30,7 @@ func listUserFollowers(ctx *context.APIContext, u *models.User) {
// ListMyFollowers list all my followers
func ListMyFollowers(ctx *context.APIContext) {
- // swagger:route GET /user/followers userCurrentListFollowers
+ // swagger:route GET /user/followers user userCurrentListFollowers
//
// Produces:
// - application/json
@@ -44,7 +44,7 @@ func ListMyFollowers(ctx *context.APIContext) {
// ListFollowers list user's followers
func ListFollowers(ctx *context.APIContext) {
- // swagger:route GET /users/:username/followers userListFollowers
+ // swagger:route GET /users/:username/followers user userListFollowers
//
// Produces:
// - application/json
@@ -71,7 +71,7 @@ func listUserFollowing(ctx *context.APIContext, u *models.User) {
// ListMyFollowing list all my followings
func ListMyFollowing(ctx *context.APIContext) {
- // swagger:route GET /user/following userCurrentListFollowing
+ // swagger:route GET /user/following user userCurrentListFollowing
//
// Produces:
// - application/json
@@ -85,7 +85,7 @@ func ListMyFollowing(ctx *context.APIContext) {
// ListFollowing list user's followings
func ListFollowing(ctx *context.APIContext) {
- // swagger:route GET /users/{username}/following userListFollowing
+ // swagger:route GET /users/{username}/following user userListFollowing
//
// Produces:
// - application/json
@@ -111,7 +111,7 @@ func checkUserFollowing(ctx *context.APIContext, u *models.User, followID int64)
// CheckMyFollowing check if the repo is followed by me
func CheckMyFollowing(ctx *context.APIContext) {
- // swagger:route GET /user/following/{username} userCurrentCheckFollowing
+ // swagger:route GET /user/following/{username} user userCurrentCheckFollowing
//
// Responses:
// 204: empty
@@ -126,7 +126,7 @@ func CheckMyFollowing(ctx *context.APIContext) {
// CheckFollowing check if the repo is followed by user
func CheckFollowing(ctx *context.APIContext) {
- // swagger:route GET /users/{username}/following/:target userCheckFollowing
+ // swagger:route GET /users/{username}/following/:target user userCheckFollowing
//
// Responses:
// 204: empty
@@ -145,7 +145,7 @@ func CheckFollowing(ctx *context.APIContext) {
// Follow follow one repository
func Follow(ctx *context.APIContext) {
- // swagger:route PUT /user/following/{username} userCurrentPutFollow
+ // swagger:route PUT /user/following/{username} user userCurrentPutFollow
//
// Responses:
// 204: empty
@@ -164,7 +164,7 @@ func Follow(ctx *context.APIContext) {
// Unfollow unfollow one repository
func Unfollow(ctx *context.APIContext) {
- // swagger:route DELETE /user/following/{username} userCurrentDeleteFollow
+ // swagger:route DELETE /user/following/{username} user userCurrentDeleteFollow
//
// Responses:
// 204: empty
diff --git a/routers/api/v1/user/gpg_key.go b/routers/api/v1/user/gpg_key.go
index 8c5e171b7f..96ff6e88ba 100644
--- a/routers/api/v1/user/gpg_key.go
+++ b/routers/api/v1/user/gpg_key.go
@@ -34,7 +34,7 @@ func listGPGKeys(ctx *context.APIContext, uid int64) {
//ListGPGKeys get the GPG key list of a user
func ListGPGKeys(ctx *context.APIContext) {
- // swagger:route GET /users/{username}/gpg_keys userListGPGKeys
+ // swagger:route GET /users/{username}/gpg_keys user userListGPGKeys
//
// Produces:
// - application/json
@@ -52,7 +52,7 @@ func ListGPGKeys(ctx *context.APIContext) {
//ListMyGPGKeys get the GPG key list of the logged user
func ListMyGPGKeys(ctx *context.APIContext) {
- // swagger:route GET /user/gpg_keys userCurrentListGPGKeys
+ // swagger:route GET /user/gpg_keys user userCurrentListGPGKeys
//
// Produces:
// - application/json
@@ -66,7 +66,7 @@ func ListMyGPGKeys(ctx *context.APIContext) {
//GetGPGKey get the GPG key based on a id
func GetGPGKey(ctx *context.APIContext) {
- // swagger:route GET /user/gpg_keys/{id} userCurrentGetGPGKey
+ // swagger:route GET /user/gpg_keys/{id} user userCurrentGetGPGKey
//
// Produces:
// - application/json
@@ -100,7 +100,7 @@ func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid
//CreateGPGKey associate a GPG key to the current user
func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
- // swagger:route POST /user/gpg_keys userCurrentPostGPGKey
+ // swagger:route POST /user/gpg_keys user userCurrentPostGPGKey
//
// Consumes:
// - application/json
@@ -118,7 +118,7 @@ func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
//DeleteGPGKey remove a GPG key associated to the current user
func DeleteGPGKey(ctx *context.APIContext) {
- // swagger:route DELETE /user/gpg_keys/{id} userCurrentDeleteGPGKey
+ // swagger:route DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey
//
// Produces:
// - application/json
diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go
index a53ed2f8c9..1772ef4d25 100644
--- a/routers/api/v1/user/key.go
+++ b/routers/api/v1/user/key.go
@@ -55,7 +55,7 @@ func listPublicKeys(ctx *context.APIContext, uid int64) {
// ListMyPublicKeys list all my public keys
func ListMyPublicKeys(ctx *context.APIContext) {
- // swagger:route GET /user/keys userCurrentListKeys
+ // swagger:route GET /user/keys user userCurrentListKeys
//
// Produces:
// - application/json
@@ -69,7 +69,7 @@ func ListMyPublicKeys(ctx *context.APIContext) {
// ListPublicKeys list all user's public keys
func ListPublicKeys(ctx *context.APIContext) {
- // swagger:route GET /users/{username}/keys userListKeys
+ // swagger:route GET /users/{username}/keys user userListKeys
//
// Produces:
// - application/json
@@ -87,7 +87,7 @@ func ListPublicKeys(ctx *context.APIContext) {
// GetPublicKey get one public key
func GetPublicKey(ctx *context.APIContext) {
- // swagger:route GET /user/keys/{id} userCurrentGetKey
+ // swagger:route GET /user/keys/{id} user userCurrentGetKey
//
// Produces:
// - application/json
@@ -130,7 +130,7 @@ func CreateUserPublicKey(ctx *context.APIContext, form api.CreateKeyOption, uid
// CreatePublicKey create one public key for me
func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
- // swagger:route POST /user/keys userCurrentPostKey
+ // swagger:route POST /user/keys user userCurrentPostKey
//
// Consumes:
// - application/json
@@ -148,7 +148,7 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
// DeletePublicKey delete one public key of mine
func DeletePublicKey(ctx *context.APIContext) {
- // swagger:route DELETE /user/keys/{id} userCurrentDeleteKey
+ // swagger:route DELETE /user/keys/{id} user userCurrentDeleteKey
//
// Produces:
// - application/json
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go
index b4a4653faa..f119632e39 100644
--- a/routers/api/v1/user/repo.go
+++ b/routers/api/v1/user/repo.go
@@ -36,7 +36,7 @@ func listUserRepos(ctx *context.APIContext, u *models.User) {
// ListUserRepos - list the repos owned by the given user.
func ListUserRepos(ctx *context.APIContext) {
- // swagger:route GET /users/{username}/repos userListRepos
+ // swagger:route GET /users/{username}/repos user userListRepos
//
// Produces:
// - application/json
@@ -54,7 +54,7 @@ func ListUserRepos(ctx *context.APIContext) {
// ListMyRepos - list the repositories you own or have access to.
func ListMyRepos(ctx *context.APIContext) {
- // swagger:route GET /user/repos userCurrentListRepos
+ // swagger:route GET /user/repos user userCurrentListRepos
//
// Produces:
// - application/json
@@ -87,7 +87,7 @@ func ListMyRepos(ctx *context.APIContext) {
// ListOrgRepos - list the repositories of an organization.
func ListOrgRepos(ctx *context.APIContext) {
- // swagger:route GET /orgs/{org}/repos orgListRepos
+ // swagger:route GET /orgs/{orgname}/repos organization orgListRepos
//
// Produces:
// - application/json
diff --git a/routers/api/v1/user/star.go b/routers/api/v1/user/star.go
index 49d704cb2e..6f943a2712 100644
--- a/routers/api/v1/user/star.go
+++ b/routers/api/v1/user/star.go
@@ -33,7 +33,7 @@ func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) {
// GetStarredRepos returns the repos that the user specified by the APIContext
// has starred
func GetStarredRepos(ctx *context.APIContext) {
- // swagger:route GET /users/{username}/starred userListStarred
+ // swagger:route GET /users/{username}/starred user userListStarred
//
// Produces:
// - application/json
@@ -53,7 +53,7 @@ func GetStarredRepos(ctx *context.APIContext) {
// GetMyStarredRepos returns the repos that the authenticated user has starred
func GetMyStarredRepos(ctx *context.APIContext) {
- // swagger:route GET /user/starred userCurrentListStarred
+ // swagger:route GET /user/starred user userCurrentListStarred
//
// Produces:
// - application/json
@@ -71,7 +71,7 @@ func GetMyStarredRepos(ctx *context.APIContext) {
// IsStarring returns whether the authenticated is starring the repo
func IsStarring(ctx *context.APIContext) {
- // swagger:route GET /user/starred/{username}/{reponame} userCurrentCheckStarring
+ // swagger:route GET /user/starred/{username}/{reponame} user userCurrentCheckStarring
//
// Responses:
// 204: empty
@@ -86,7 +86,7 @@ func IsStarring(ctx *context.APIContext) {
// Star the repo specified in the APIContext, as the authenticated user
func Star(ctx *context.APIContext) {
- // swagger:route PUT /user/starred/{username}/{reponame} userCurrentPutStar
+ // swagger:route PUT /user/starred/{username}/{reponame} user userCurrentPutStar
//
// Responses:
// 204: empty
@@ -102,7 +102,7 @@ func Star(ctx *context.APIContext) {
// Unstar the repo specified in the APIContext, as the authenticated user
func Unstar(ctx *context.APIContext) {
- // swagger:route DELETE /user/starred/{username}/{reponame} userCurrentDeleteStar
+ // swagger:route DELETE /user/starred/{username}/{reponame} user userCurrentDeleteStar
//
// Responses:
// 204: empty
diff --git a/routers/api/v1/user/user.go b/routers/api/v1/user/user.go
index cdb55c0d81..0ab6eaf44c 100644
--- a/routers/api/v1/user/user.go
+++ b/routers/api/v1/user/user.go
@@ -17,7 +17,7 @@ import (
// Search search users
func Search(ctx *context.APIContext) {
- // swagger:route GET /users/search userSearch
+ // swagger:route GET /users/search user userSearch
//
// Produces:
// - application/json
@@ -65,7 +65,7 @@ func Search(ctx *context.APIContext) {
// GetInfo get user's information
func GetInfo(ctx *context.APIContext) {
- // swagger:route GET /users/{username} userGet
+ // swagger:route GET /users/{username} user userGet
//
// Produces:
// - application/json
@@ -94,7 +94,7 @@ func GetInfo(ctx *context.APIContext) {
// GetAuthenticatedUser get curent user's information
func GetAuthenticatedUser(ctx *context.APIContext) {
- // swagger:route GET /user userGetCurrent
+ // swagger:route GET /user user userGetCurrent
//
// Produces:
// - application/json
diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go
index 230c819202..18628c91d1 100644
--- a/routers/api/v1/user/watch.go
+++ b/routers/api/v1/user/watch.go
@@ -33,7 +33,7 @@ func getWatchedRepos(userID int64, private bool) ([]*api.Repository, error) {
// GetWatchedRepos returns the repos that the user specified in ctx is watching
func GetWatchedRepos(ctx *context.APIContext) {
- // swagger:route GET /users/{username}/subscriptions userListSubscriptions
+ // swagger:route GET /users/{username}/subscriptions user userListSubscriptions
//
// Produces:
// - application/json
@@ -53,7 +53,7 @@ func GetWatchedRepos(ctx *context.APIContext) {
// GetMyWatchedRepos returns the repos that the authenticated user is watching
func GetMyWatchedRepos(ctx *context.APIContext) {
- // swagger:route GET /user/subscriptions userCurrentListSubscriptions
+ // swagger:route GET /user/subscriptions user userCurrentListSubscriptions
//
// Produces:
// - application/json
@@ -72,7 +72,7 @@ func GetMyWatchedRepos(ctx *context.APIContext) {
// IsWatching returns whether the authenticated user is watching the repo
// specified in ctx
func IsWatching(ctx *context.APIContext) {
- // swagger:route GET /repos/{username}/{reponame}/subscription userCurrentCheckSubscription
+ // swagger:route GET /repos/{username}/{reponame}/subscription repository userCurrentCheckSubscription
//
// Responses:
// 200: WatchInfo
@@ -94,7 +94,7 @@ func IsWatching(ctx *context.APIContext) {
// Watch the repo specified in ctx, as the authenticated user
func Watch(ctx *context.APIContext) {
- // swagger:route PUT /repos/{username}/{reponame}/subscription userCurrentPutSubscription
+ // swagger:route PUT /repos/{username}/{reponame}/subscription repository userCurrentPutSubscription
//
// Responses:
// 200: WatchInfo
@@ -118,7 +118,7 @@ func Watch(ctx *context.APIContext) {
// Unwatch the repo specified in ctx, as the authenticated user
func Unwatch(ctx *context.APIContext) {
- // swagger:route DELETE /repos/{username}/{reponame}/subscription userCurrentDeleteSubscription
+ // swagger:route DELETE /repos/{username}/{reponame}/subscription repository userCurrentDeleteSubscription
//
// Responses:
// 204: empty
diff --git a/vendor/code.gitea.io/sdk/gitea/admin_user.go b/vendor/code.gitea.io/sdk/gitea/admin_user.go
index 6ccad7e1c3..74f166a4f4 100644
--- a/vendor/code.gitea.io/sdk/gitea/admin_user.go
+++ b/vendor/code.gitea.io/sdk/gitea/admin_user.go
@@ -11,14 +11,22 @@ import (
)
// CreateUserOption create user options
+// swagger:parameters adminCreateUser
type CreateUserOption struct {
- SourceID int64 `json:"source_id"`
- LoginName string `json:"login_name"`
- Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
- FullName string `json:"full_name" binding:"MaxSize(100)"`
- Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
- Password string `json:"password" binding:"MaxSize(255)"`
- SendNotify bool `json:"send_notify"`
+ // in: body
+ SourceID int64 `json:"source_id"`
+ // in: body
+ LoginName string `json:"login_name"`
+ // in: body
+ Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
+ // in: body
+ FullName string `json:"full_name" binding:"MaxSize(100)"`
+ // in: body
+ Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
+ // in: body
+ Password string `json:"password" binding:"MaxSize(255)"`
+ // in: body
+ SendNotify bool `json:"send_notify"`
}
// AdminCreateUser create a user
@@ -32,19 +40,32 @@ func (c *Client) AdminCreateUser(opt CreateUserOption) (*User, error) {
}
// EditUserOption edit user options
+// swagger:parameters adminEditUser
type EditUserOption struct {
- SourceID int64 `json:"source_id"`
- LoginName string `json:"login_name"`
- FullName string `json:"full_name" binding:"MaxSize(100)"`
- Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
- Password string `json:"password" binding:"MaxSize(255)"`
- Website string `json:"website" binding:"MaxSize(50)"`
- Location string `json:"location" binding:"MaxSize(50)"`
- Active *bool `json:"active"`
- Admin *bool `json:"admin"`
- AllowGitHook *bool `json:"allow_git_hook"`
- AllowImportLocal *bool `json:"allow_import_local"`
- MaxRepoCreation *int `json:"max_repo_creation"`
+ // in: body
+ SourceID int64 `json:"source_id"`
+ // in: body
+ LoginName string `json:"login_name"`
+ // in: body
+ FullName string `json:"full_name" binding:"MaxSize(100)"`
+ // in: body
+ Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
+ // in: body
+ Password string `json:"password" binding:"MaxSize(255)"`
+ // in: body
+ Website string `json:"website" binding:"MaxSize(50)"`
+ // in: body
+ Location string `json:"location" binding:"MaxSize(50)"`
+ // in: body
+ Active *bool `json:"active"`
+ // in: body
+ Admin *bool `json:"admin"`
+ // in: body
+ AllowGitHook *bool `json:"allow_git_hook"`
+ // in: body
+ AllowImportLocal *bool `json:"allow_import_local"`
+ // in: body
+ MaxRepoCreation *int `json:"max_repo_creation"`
}
// AdminEditUser modify user informations
diff --git a/vendor/code.gitea.io/sdk/gitea/fork.go b/vendor/code.gitea.io/sdk/gitea/fork.go
index e2158e1a16..aa523ab174 100644
--- a/vendor/code.gitea.io/sdk/gitea/fork.go
+++ b/vendor/code.gitea.io/sdk/gitea/fork.go
@@ -20,7 +20,9 @@ func (c *Client) ListForks(user, repo string) ([]*Repository, error) {
}
// CreateForkOption options for creating a fork
+// swagger:parameters createFork
type CreateForkOption struct {
+ // in: body
Organization *string `json:"organization"`
}
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
diff --git a/vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go b/vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go
new file mode 100644
index 0000000000..67b8a9b613
--- /dev/null
+++ b/vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go
@@ -0,0 +1,69 @@
+// Copyright 2017 The Gitea Authors. All rights reserved.
+// Use of this source code is governed by a MIT-style
+// license that can be found in the LICENSE file.
+
+package gitea
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "time"
+)
+
+// TrackedTime worked time for an issue / pr
+// swagger:response TrackedTime
+type TrackedTime struct {
+ ID int64 `json:"id"`
+ Created time.Time `json:"created"`
+ // Time in seconds
+ Time int64 `json:"time"`
+ UserID int64 `json:"user_id"`
+ IssueID int64 `json:"issue_id"`
+}
+
+// TrackedTimes represent a list of tracked times
+// swagger:response TrackedTimes
+type TrackedTimes []*TrackedTime
+
+// GetUserTrackedTimes list tracked times of a user
+func (c *Client) GetUserTrackedTimes(owner, repo, user string) (TrackedTimes, error) {
+ times := make(TrackedTimes, 0, 10)
+ return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/times/%s", owner, repo, user), nil, nil, &times)
+}
+
+// GetRepoTrackedTimes list tracked times of a repository
+func (c *Client) GetRepoTrackedTimes(owner, repo string) (TrackedTimes, error) {
+ times := make(TrackedTimes, 0, 10)
+ return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/times", owner, repo), nil, nil, &times)
+}
+
+// GetMyTrackedTimes list tracked times of the current user
+func (c *Client) GetMyTrackedTimes() (TrackedTimes, error) {
+ times := make(TrackedTimes, 0, 10)
+ return times, c.getParsedResponse("GET", "/user/times", nil, nil, &times)
+}
+
+// AddTimeOption adds time manually to an issue
+// swagger:parameters addTime
+type AddTimeOption struct {
+ // in: body
+ Time int64 `json:"time" binding:"Required"`
+}
+
+// AddTime adds time to issue with the given index
+func (c *Client) AddTime(owner, repo string, index int64, opt AddTimeOption) (*TrackedTime, error) {
+ body, err := json.Marshal(&opt)
+ if err != nil {
+ return nil, err
+ }
+ t := new(TrackedTime)
+ return t, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/times", owner, repo, index),
+ jsonHeader, bytes.NewReader(body), t)
+}
+
+// ListTrackedTimes get tracked times of one issue via issue id
+func (c *Client) ListTrackedTimes(owner, repo string, index int64) (TrackedTimes, error) {
+ times := make(TrackedTimes, 0, 5)
+ return times, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/%d/times", owner, repo, index), nil, nil, &times)
+}
diff --git a/vendor/code.gitea.io/sdk/gitea/org.go b/vendor/code.gitea.io/sdk/gitea/org.go
index 103674a701..ffdc2ffbea 100644
--- a/vendor/code.gitea.io/sdk/gitea/org.go
+++ b/vendor/code.gitea.io/sdk/gitea/org.go
@@ -11,6 +11,7 @@ import (
)
// Organization a group of some repositories, users and teams
+// swagger:response Organization
type Organization struct {
ID int64 `json:"id"`
UserName string `json:"username"`
@@ -40,12 +41,18 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) {
}
// CreateOrgOption create one organization options
+// swagger:parameters adminCreateOrg
type CreateOrgOption struct {
- UserName string `json:"username" binding:"Required"`
- FullName string `json:"full_name"`
+ // in: body
+ UserName string `json:"username" binding:"Required"`
+ // in: body
+ FullName string `json:"full_name"`
+ // in: body
Description string `json:"description"`
- Website string `json:"website"`
- Location string `json:"location"`
+ // in: body
+ Website string `json:"website"`
+ // in: body
+ Location string `json:"location"`
}
// EditOrgOption edit one organization options
diff --git a/vendor/code.gitea.io/sdk/gitea/repo.go b/vendor/code.gitea.io/sdk/gitea/repo.go
index 7e997cd5d7..5b4673d034 100644
--- a/vendor/code.gitea.io/sdk/gitea/repo.go
+++ b/vendor/code.gitea.io/sdk/gitea/repo.go
@@ -69,7 +69,7 @@ func (c *Client) ListOrgRepos(org string) ([]*Repository, error) {
}
// CreateRepoOption options when creating repository
-//swagger:parameters createOrgRepo
+//swagger:parameters createOrgRepo adminCreateRepo createCurrentUserRepo
type CreateRepoOption struct {
// Name of the repository to create
//
@@ -135,15 +135,24 @@ func (c *Client) DeleteRepo(owner, repo string) error {
}
// MigrateRepoOption options when migrate repository from an external place
+// swagger:parameters repoMigrate
type MigrateRepoOption struct {
- CloneAddr string `json:"clone_addr" binding:"Required"`
+ // in: body
+ CloneAddr string `json:"clone_addr" binding:"Required"`
+ // in: body
AuthUsername string `json:"auth_username"`
+ // in: body
AuthPassword string `json:"auth_password"`
- UID int `json:"uid" binding:"Required"`
- RepoName string `json:"repo_name" binding:"Required"`
- Mirror bool `json:"mirror"`
- Private bool `json:"private"`
- Description string `json:"description"`
+ // in: body
+ UID int `json:"uid" binding:"Required"`
+ // in: body
+ RepoName string `json:"repo_name" binding:"Required"`
+ // in: body
+ Mirror bool `json:"mirror"`
+ // in: body
+ Private bool `json:"private"`
+ // in: body
+ Description string `json:"description"`
}
// MigrateRepo migrates a repository from other Git hosting sources for the
diff --git a/vendor/code.gitea.io/sdk/gitea/repo_key.go b/vendor/code.gitea.io/sdk/gitea/repo_key.go
index 24d29a2095..f5f88cd051 100644
--- a/vendor/code.gitea.io/sdk/gitea/repo_key.go
+++ b/vendor/code.gitea.io/sdk/gitea/repo_key.go
@@ -34,7 +34,7 @@ func (c *Client) GetDeployKey(user, repo string, keyID int64) (*DeployKey, error
}
// CreateKeyOption options when create deploy key
-// swagger:parameters userCurrentPostKey
+// swagger:parameters userCurrentPostKey adminCreatePublicKey
type CreateKeyOption struct {
// Title of the key to add
//
diff --git a/vendor/code.gitea.io/sdk/gitea/status.go b/vendor/code.gitea.io/sdk/gitea/status.go
index e694add1c3..d5cdcd57b7 100644
--- a/vendor/code.gitea.io/sdk/gitea/status.go
+++ b/vendor/code.gitea.io/sdk/gitea/status.go
@@ -21,7 +21,7 @@ const (
// StatusSuccess is for when the Status is Success
StatusSuccess StatusState = "success"
// StatusError is for when the Status is Error
- StatusError StatusState = "error"
+ StatusError StatusState = "error"
// StatusFailure is for when the Status is Failure
StatusFailure StatusState = "failure"
// StatusWarning is for when the Status is Warning
diff --git a/vendor/code.gitea.io/sdk/gitea/user_app.go b/vendor/code.gitea.io/sdk/gitea/user_app.go
index 82d2a40462..08e98513ee 100644
--- a/vendor/code.gitea.io/sdk/gitea/user_app.go
+++ b/vendor/code.gitea.io/sdk/gitea/user_app.go
@@ -26,7 +26,7 @@ type AccessToken struct {
// AccessTokenList represents a list of API access token.
// swagger:response AccessTokenList
-type AccessTokenList []*AccessToken
+type AccessTokenList []*AccessToken
// ListAccessTokens lista all the access tokens of user
func (c *Client) ListAccessTokens(user, pass string) ([]*AccessToken, error) {
diff --git a/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go b/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
index 942478b9f1..87dd749e6c 100644
--- a/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
+++ b/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
@@ -32,7 +32,7 @@ type GPGKey struct {
Expires time.Time `json:"expires_at,omitempty"`
}
-// GPGKeyEmail a email attache to a GPGKey
+// GPGKeyEmail an email attached to a GPGKey
// swagger:model GPGKeyEmail
type GPGKeyEmail struct {
Email string `json:"email"`
diff --git a/vendor/vendor.json b/vendor/vendor.json
index 9777d63a6d..2d7eb74660 100644
--- a/vendor/vendor.json
+++ b/vendor/vendor.json
@@ -9,10 +9,10 @@
"revisionTime": "2017-08-03T00:53:29Z"
},
{
- "checksumSHA1": "nLhT+bLMj8uLICP+EZbrdoQe6mM=",
+ "checksumSHA1": "Zgp5RqU+20L2p9TNl1rSsUIWEEE=",
"path": "code.gitea.io/sdk/gitea",
- "revision": "8cff72208aa458f4efa8fdfbad29b03aee485b8c",
- "revisionTime": "2017-05-06T01:37:21Z"
+ "revision": "bc243ad6c268d60658c71185452334b300c268cf",
+ "revisionTime": "2017-08-21T08:23:17Z"
},
{
"checksumSHA1": "bOODD4Gbw3GfcuQPU2dI40crxxk=",