]> source.dussan.org Git - gitea.git/commitdiff
Update swagger documentation (#2899)
authorEthan Koenig <ethantkoenig@gmail.com>
Mon, 13 Nov 2017 07:02:25 +0000 (23:02 -0800)
committerLauris BH <lauris@nix.lv>
Mon, 13 Nov 2017 07:02:25 +0000 (09:02 +0200)
* Update swagger documentation

Add docs for missing endpoints
Add documentation for request parameters
Make parameter naming consistent
Fix response documentation

* Restore delete comments

72 files changed:
Makefile
modules/auth/repo_form.go
public/swagger.v1.json
routers/api/v1/admin/org.go
routers/api/v1/admin/repo.go
routers/api/v1/admin/user.go
routers/api/v1/api.go
routers/api/v1/misc/markdown.go
routers/api/v1/misc/version.go
routers/api/v1/org/hook.go
routers/api/v1/org/member.go
routers/api/v1/org/org.go
routers/api/v1/org/team.go
routers/api/v1/repo/branch.go
routers/api/v1/repo/collaborators.go
routers/api/v1/repo/file.go
routers/api/v1/repo/fork.go
routers/api/v1/repo/hook.go
routers/api/v1/repo/issue.go
routers/api/v1/repo/issue_comment.go
routers/api/v1/repo/issue_label.go
routers/api/v1/repo/issue_tracked_time.go
routers/api/v1/repo/key.go
routers/api/v1/repo/label.go
routers/api/v1/repo/milestone.go
routers/api/v1/repo/pull.go
routers/api/v1/repo/release.go
routers/api/v1/repo/repo.go
routers/api/v1/repo/star.go
routers/api/v1/repo/status.go
routers/api/v1/repo/subscriber.go
routers/api/v1/swagger/issue.go [new file with mode: 0644]
routers/api/v1/swagger/key.go [new file with mode: 0644]
routers/api/v1/swagger/misc.go [new file with mode: 0644]
routers/api/v1/swagger/options.go [new file with mode: 0644]
routers/api/v1/swagger/org.go [new file with mode: 0644]
routers/api/v1/swagger/repo.go [new file with mode: 0644]
routers/api/v1/swagger/user.go [new file with mode: 0644]
routers/api/v1/user/app.go
routers/api/v1/user/email.go
routers/api/v1/user/follower.go
routers/api/v1/user/gpg_key.go
routers/api/v1/user/key.go
routers/api/v1/user/repo.go
routers/api/v1/user/star.go
routers/api/v1/user/user.go
routers/api/v1/user/watch.go
vendor/code.gitea.io/sdk/gitea/admin_user.go
vendor/code.gitea.io/sdk/gitea/attachment.go [new file with mode: 0644]
vendor/code.gitea.io/sdk/gitea/fork.go
vendor/code.gitea.io/sdk/gitea/hook.go
vendor/code.gitea.io/sdk/gitea/issue.go
vendor/code.gitea.io/sdk/gitea/issue_comment.go
vendor/code.gitea.io/sdk/gitea/issue_label.go
vendor/code.gitea.io/sdk/gitea/issue_milestone.go
vendor/code.gitea.io/sdk/gitea/issue_tracked_time.go
vendor/code.gitea.io/sdk/gitea/miscellaneous.go
vendor/code.gitea.io/sdk/gitea/org.go
vendor/code.gitea.io/sdk/gitea/org_team.go
vendor/code.gitea.io/sdk/gitea/pull.go
vendor/code.gitea.io/sdk/gitea/release.go
vendor/code.gitea.io/sdk/gitea/repo.go
vendor/code.gitea.io/sdk/gitea/repo_branch.go
vendor/code.gitea.io/sdk/gitea/repo_collaborator.go
vendor/code.gitea.io/sdk/gitea/repo_key.go
vendor/code.gitea.io/sdk/gitea/repo_watch.go
vendor/code.gitea.io/sdk/gitea/status.go
vendor/code.gitea.io/sdk/gitea/user.go
vendor/code.gitea.io/sdk/gitea/user_email.go
vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
vendor/code.gitea.io/sdk/gitea/user_key.go
vendor/vendor.json

index 8ac3940b8588694fd31d46ec40bf0074e0d081f7..4485986ffd8ae3022595fffcdfe64258c90f99aa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -89,8 +89,6 @@ generate-swagger:
                $(GO) get -u github.com/go-swagger/go-swagger/cmd/swagger; \
        fi
        swagger generate spec -o ./public/swagger.v1.json
-       $(SED_INPLACE) "s;\".ref\": \"#/definitions/GPGKey\";\"type\": \"object\";g" ./public/swagger.v1.json
-       $(SED_INPLACE) "s;^          \".ref\": \"#/definitions/Repository\";          \"type\": \"object\";g" ./public/swagger.v1.json
 
 .PHONY: errcheck
 errcheck:
index a6454655f7a937aa79e5d5eff02a2d967220f644..6fe826f5742db2911874bf157fb77aab192a42f5 100644 (file)
@@ -41,14 +41,17 @@ func (f *CreateRepoForm) Validate(ctx *macaron.Context, errs binding.Errors) bin
 
 // MigrateRepoForm form for migrating repository
 type MigrateRepoForm struct {
+       // required: true
        CloneAddr    string `json:"clone_addr" binding:"Required"`
        AuthUsername string `json:"auth_username"`
        AuthPassword string `json:"auth_password"`
-       UID          int64  `json:"uid" binding:"Required"`
-       RepoName     string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
-       Mirror       bool   `json:"mirror"`
-       Private      bool   `json:"private"`
-       Description  string `json:"description" binding:"MaxSize(255)"`
+       // required: true
+       UID int64 `json:"uid" binding:"Required"`
+       // required: true
+       RepoName    string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
+       Mirror      bool   `json:"mirror"`
+       Private     bool   `json:"private"`
+       Description string `json:"description" binding:"MaxSize(255)"`
 }
 
 // Validate validates the fields
index c269fcb8640122cfb88a8f96189be141439d2c68..4f4505b4a1898ba9f70b440b0fc4e2ca736d7368 100644 (file)
@@ -13,9 +13,8 @@
   ],
   "swagger": "2.0",
   "info": {
-    "description": "This provide API interface to communicate with this Gitea instance.",
+    "description": "This documentation describes the Gitea API.",
     "title": "Gitea API.",
-    "termsOfService": "there are no TOS at this moment, use at your own risk we take no responsibility",
     "license": {
       "name": "MIT",
       "url": "http://opensource.org/licenses/MIT"
         "tags": [
           "admin"
         ],
+        "summary": "Create a user",
         "operationId": "adminCreateUser",
         "parameters": [
           {
-            "x-go-name": "SourceID",
-            "name": "source_id",
+            "name": "body",
             "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"
+              "$ref": "#/definitions/CreateUserOption"
             }
           }
         ],
           },
           "422": {
             "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
         "tags": [
           "admin"
         ],
+        "summary": "Delete a user",
         "operationId": "adminDeleteUser",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user to delete",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "204": {
             "$ref": "#/responses/empty"
           },
           "422": {
             "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       },
         "tags": [
           "admin"
         ],
+        "summary": "Edit an existing user",
         "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"
-            }
+            "type": "string",
+            "description": "username of user to edit",
+            "name": "username",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "MaxRepoCreation",
-            "name": "max_repo_creation",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "integer",
-              "format": "int64"
+              "$ref": "#/definitions/EditUserOption"
             }
           }
         ],
           },
           "422": {
             "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
         "tags": [
           "admin"
         ],
+        "summary": "Add a public key on behalf of a user",
         "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"
-            }
+            "type": "string",
+            "description": "username of the user",
+            "name": "username",
+            "in": "path",
+            "required": true
           }
         ],
         "responses": {
           },
           "422": {
             "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
         "tags": [
           "admin"
         ],
+        "summary": "Create an organization",
         "operationId": "adminCreateOrg",
         "parameters": [
           {
-            "x-go-name": "UserName",
+            "type": "string",
+            "description": "username of the user that will own the created organization",
             "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"
-            }
+            "in": "path",
+            "required": true
           }
         ],
         "responses": {
           },
           "422": {
             "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
         "tags": [
           "admin"
         ],
+        "summary": "Create a repository on behalf a user",
         "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"
-            }
+            "type": "string",
+            "description": "username of the user. This user will own the created repository",
+            "name": "username",
+            "in": "path",
+            "required": true
           }
         ],
         "responses": {
           },
           "422": {
             "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
         "tags": [
           "miscellaneous"
         ],
+        "summary": "Render a markdown document as HTML",
         "operationId": "renderMarkdown",
         "parameters": [
           {
-            "description": "Text markdown to render",
-            "name": "Text",
-            "in": "body",
-            "schema": {
-              "type": "string"
-            }
-          },
-          {
-            "description": "Mode to render",
-            "name": "Mode",
-            "in": "body",
-            "schema": {
-              "type": "string"
-            }
-          },
-          {
-            "description": "Context to render",
-            "name": "Context",
-            "in": "body",
-            "schema": {
-              "type": "string"
-            }
-          },
-          {
-            "description": "Is it a wiki page ?",
-            "name": "Wiki",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "boolean"
+              "$ref": "#/definitions/MarkdownOption"
             }
           }
         ],
         "tags": [
           "miscellaneous"
         ],
+        "summary": "Render raw markdown as HTML",
         "operationId": "renderMarkdownRaw",
+        "parameters": [
+          {
+            "type": "string",
+            "name": "body",
+            "in": "body"
+          }
+        ],
         "responses": {
           "200": {
             "$ref": "#/responses/MarkdownRender"
         "tags": [
           "organization"
         ],
+        "summary": "Create a repository in an organization",
         "operationId": "createOrgRepo",
         "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"
-            }
+            "type": "string",
+            "description": "name of organization",
+            "name": "org",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Readme",
-            "description": "Readme of the repository to create",
-            "name": "readme",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "string"
+              "$ref": "#/definitions/CreateRepoOption"
             }
           }
         ],
           },
           "422": {
             "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/orgs/{orgname}/hooks": {
+    "/orgs/{org}": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "organization"
         ],
-        "operationId": "orgListHooks",
+        "summary": "Get an organization",
+        "operationId": "orgGet",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization to get",
+            "name": "org",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
-            "$ref": "#/responses/HookList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Organization"
           }
         }
-      }
-    },
-    "/orgs/{orgname}/hooks/": {
-      "post": {
+      },
+      "patch": {
         "consumes": [
           "application/json"
         ],
         "tags": [
           "organization"
         ],
-        "operationId": "orgCreateHook",
+        "summary": "Edit an organization",
+        "operationId": "orgEdit",
         "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"
-              }
-            }
+            "type": "string",
+            "description": "name of the organization to edit",
+            "name": "org",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Events",
-            "name": "events",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "array",
-              "items": {
-                "type": "string"
-              }
-            }
-          },
-          {
-            "x-go-name": "Active",
-            "name": "active",
-            "in": "body",
-            "schema": {
-              "type": "boolean"
+              "$ref": "#/definitions/EditOrgOption"
             }
           }
         ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/Organization"
+          }
+        }
+      }
+    },
+    "/orgs/{org}/hooks": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "List an organization's webhooks",
+        "operationId": "orgListHooks",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/HookList"
+          }
+        }
+      }
+    },
+    "/orgs/{org}/hooks/": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "Create a hook",
+        "operationId": "orgCreateHook",
         "responses": {
           "201": {
             "$ref": "#/responses/Hook"
-          },
-          "422": {
-            "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/orgs/{orgname}/hooks/{id}": {
+    "/orgs/{org}/hooks/{id}": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "organization"
         ],
+        "summary": "Get a hook",
         "operationId": "orgGetHook",
         "responses": {
           "200": {
             "$ref": "#/responses/Hook"
-          },
-          "404": {
-            "$ref": "#/responses/notFound"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       },
         "tags": [
           "organization"
         ],
+        "summary": "Delete a hook",
         "operationId": "orgDeleteHook",
         "responses": {
           "204": {
             "$ref": "#/responses/empty"
-          },
-          "404": {
-            "$ref": "#/responses/notFound"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       },
         "tags": [
           "organization"
         ],
+        "summary": "Update a hook",
         "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": {
+    "/orgs/{org}/members": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "organization"
         ],
+        "summary": "List an organization's members",
         "operationId": "orgListMembers",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
             "$ref": "#/responses/UserList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/orgs/{orgname}/members/{username}": {
+    "/orgs/{org}/members/{username}": {
       "get": {
-        "produces": [
-          "application/json"
-        ],
         "tags": [
           "organization"
         ],
+        "summary": "Check if a user is a member of an organization",
         "operationId": "orgIsMember",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "204": {
-            "$ref": "#/responses/empty"
-          },
-          "302": {
-            "$ref": "#/responses/redirect"
+            "description": "user is a member",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
           },
           "404": {
-            "$ref": "#/responses/notFound"
+            "description": "user is not a member",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
           }
         }
       },
         "tags": [
           "organization"
         ],
+        "summary": "Remove a member from an organization",
         "operationId": "orgDeleteMember",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "204": {
-            "$ref": "#/responses/empty"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "description": "member removed",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
           }
         }
       }
     },
-    "/orgs/{orgname}/public_members": {
+    "/orgs/{org}/public_members": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "organization"
         ],
+        "summary": "List an organization's public members",
         "operationId": "orgListPublicMembers",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
             "$ref": "#/responses/UserList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/orgs/{orgname}/public_members/{username}": {
+    "/orgs/{org}/public_members/{username}": {
       "get": {
-        "produces": [
-          "application/json"
-        ],
         "tags": [
           "organization"
         ],
+        "summary": "Check if a user is a public member of an organization",
         "operationId": "orgIsPublicMember",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "204": {
-            "$ref": "#/responses/empty"
+            "description": "user is a public member",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
           },
           "404": {
-            "$ref": "#/responses/notFound"
+            "description": "user is not a public member",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
           }
         }
       },
         "tags": [
           "organization"
         ],
+        "summary": "Publicize a user's membership",
         "operationId": "orgPublicizeMember",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "204": {
-            "$ref": "#/responses/empty"
-          },
-          "403": {
-            "$ref": "#/responses/forbidden"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "description": "membership publicized",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
           }
         }
       },
         "tags": [
           "organization"
         ],
+        "summary": "Conceal a user's membership",
         "operationId": "orgConcealMember",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "204": {
             "$ref": "#/responses/empty"
-          },
-          "403": {
-            "$ref": "#/responses/forbidden"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/orgs/{orgname}/repos": {
+    "/orgs/{org}/repos": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "organization"
         ],
+        "summary": "List an organization's repos",
         "operationId": "orgListRepos",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
             "$ref": "#/responses/RepositoryList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/repos/migrate": {
+    "/orgs/{org}/teams": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "List an organization's teams",
+        "operationId": "orgListTeams",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/TeamList"
+          }
+        }
+      },
       "post": {
         "consumes": [
           "application/json"
           "application/json"
         ],
         "tags": [
-          "repository"
+          "organization"
         ],
-        "operationId": "repoMigrate",
+        "summary": "Create a team",
+        "operationId": "orgCreateTeam",
         "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"
-            }
+            "type": "string",
+            "description": "name of the organization",
+            "name": "org",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Private",
-            "name": "private",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "boolean"
+              "$ref": "#/definitions/CreateTeamOption"
             }
-          },
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/Team"
+          }
+        }
+      }
+    },
+    "/repos/migrate": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Migrate a remote git repository",
+        "operationId": "repoMigrate",
+        "parameters": [
           {
-            "x-go-name": "Description",
-            "name": "description",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "string"
+              "$ref": "#/definitions/MigrateRepoForm"
             }
           }
         ],
         "responses": {
           "201": {
             "$ref": "#/responses/Repository"
-          },
-          "422": {
-            "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
         "tags": [
           "repository"
         ],
+        "summary": "Search for repositories",
         "operationId": "repoSearch",
         "parameters": [
           {
             "type": "string",
-            "x-go-name": "Keyword",
-            "description": "Keyword to search",
+            "description": "keyword",
             "name": "q",
             "in": "query"
           },
           {
             "type": "integer",
-            "format": "int64",
-            "x-go-name": "OwnerID",
-            "description": "Repository owner to search",
+            "description": "if provided, will return only repos owned by the user with the given id",
             "name": "uid",
             "in": "query"
           },
           {
             "type": "integer",
-            "format": "int64",
-            "x-go-name": "PageSize",
-            "description": "Limit of result\n\nmaximum: setting.ExplorePagingNum",
+            "description": "maximum number of repos to return",
             "name": "limit",
             "in": "query"
           },
           {
             "type": "string",
-            "x-go-name": "SearchMode",
-            "description": "Type of repository to search, related to owner",
+            "description": "type of repository to search for. Supported values are \"fork\", \"source\", \"mirror\" and \"collaborative\"",
             "name": "mode",
             "in": "query"
           },
           {
             "type": "boolean",
-            "x-go-name": "OwnerExclusive",
-            "description": "Search only owners repositories\nHas effect only if owner is provided and mode is not \"collaborative\"",
+            "description": "only search for repositories owned by the authenticated user",
             "name": "exclusive",
             "in": "query"
           }
           },
           "422": {
             "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/SearchError"
           }
         }
       }
     },
-    "/repos/{owner}/{repo}/forks": {
+    "/repos/{owner}/{repo}": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "repository"
         ],
-        "operationId": "listForks",
+        "summary": "Get a repository",
+        "operationId": "repoGet",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
-            "$ref": "#/responses/RepositoryList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Repository"
           }
         }
       },
-      "post": {
+      "delete": {
         "produces": [
           "application/json"
         ],
         "tags": [
           "repository"
         ],
-        "operationId": "createFork",
+        "summary": "Delete a repository",
+        "operationId": "repoDelete",
         "parameters": [
           {
-            "x-go-name": "Organization",
-            "name": "organization",
-            "in": "body",
-            "schema": {
-              "type": "string"
-            }
+            "type": "string",
+            "description": "owner of the repo to delete",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo to delete",
+            "name": "repo",
+            "in": "path",
+            "required": true
           }
         ],
         "responses": {
-          "202": {
-            "$ref": "#/responses/Repository"
+          "204": {
+            "$ref": "#/responses/empty"
           },
           "403": {
             "$ref": "#/responses/forbidden"
-          },
-          "422": {
-            "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/repos/{username}/{reponame}": {
+    "/repos/{owner}/{repo}/archive/{filepath}": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "repository"
         ],
-        "operationId": "repoGet",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/Repository"
+        "summary": "Get an archive of a repository",
+        "operationId": "repoGetArchive",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "archive to download, consisting of a git reference and archive",
+            "name": "archive",
+            "in": "path",
+            "required": true
           }
+        ],
+        "responses": {
+          "200": {}
         }
-      },
-      "delete": {
+      }
+    },
+    "/repos/{owner}/{repo}/branches": {
+      "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
           "repository"
         ],
-        "operationId": "repoDelete",
-        "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
-          },
-          "403": {
-            "$ref": "#/responses/forbidden"
+        "summary": "List a repository's branches",
+        "operationId": "repoListBranches",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/BranchList"
           }
         }
       }
     },
-    "/repos/{username}/{reponame}/hooks": {
+    "/repos/{owner}/{repo}/branches/{branch}": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "repository"
         ],
-        "operationId": "repoListHooks",
+        "summary": "List a repository's branches",
+        "operationId": "repoGetBranch",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "branch to get",
+            "name": "branch",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
-            "$ref": "#/responses/HookList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Branch"
           }
         }
-      },
-      "post": {
-        "consumes": [
-          "application/json"
-        ],
+      }
+    },
+    "/repos/{owner}/{repo}/collaborators": {
+      "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
           "repository"
         ],
-        "operationId": "repoCreateHook",
+        "summary": "List a repository's collaborators",
+        "operationId": "repoListCollaborators",
         "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"
-              }
-            }
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Active",
-            "name": "active",
-            "in": "body",
-            "schema": {
-              "type": "boolean"
-            }
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           }
         ],
         "responses": {
           "200": {
-            "$ref": "#/responses/Hook"
-          },
-          "422": {
-            "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/UserList"
           }
         }
       }
     },
-    "/repos/{username}/{reponame}/hooks/{id}": {
-      "delete": {
+    "/repos/{owner}/{repo}/collaborators/{collaborator}": {
+      "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
           "repository"
         ],
-        "operationId": "repoDeleteHook",
+        "summary": "Check if a user is a collaborator of a repository",
+        "operationId": "repoCheckCollaborator",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the collaborator",
+            "name": "collaborator",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "204": {
             "$ref": "#/responses/empty"
           },
           "404": {
-            "$ref": "#/responses/notFound"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/empty"
           }
         }
       },
-      "patch": {
+      "put": {
         "produces": [
           "application/json"
         ],
         "tags": [
           "repository"
         ],
-        "operationId": "repoEditHook",
+        "summary": "Add a collaborator to a repository",
+        "operationId": "repoAddCollaborator",
         "parameters": [
           {
-            "x-go-name": "Config",
-            "name": "config",
-            "in": "body",
-            "schema": {
-              "type": "object",
-              "additionalProperties": {
-                "type": "string"
-              }
-            }
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Events",
-            "name": "events",
-            "in": "body",
-            "schema": {
-              "type": "array",
-              "items": {
-                "type": "string"
-              }
-            }
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the collaborator to add",
+            "name": "collaborator",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Active",
-            "name": "active",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "boolean"
+              "$ref": "#/definitions/AddCollaboratorOption"
             }
           }
         ],
         "responses": {
-          "200": {
-            "$ref": "#/responses/Hook"
-          },
-          "422": {
-            "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+          "204": {
+            "$ref": "#/responses/empty"
           }
         }
-      }
-    },
-    "/repos/{username}/{reponame}/issues/{issue}/times": {
-      "get": {
+      },
+      "delete": {
         "produces": [
           "application/json"
         ],
         "tags": [
           "repository"
         ],
-        "operationId": "issueTrackedTimes",
+        "summary": "Delete a collaborator from a repository",
+        "operationId": "repoDeleteCollaborator",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the collaborator to delete",
+            "name": "collaborator",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
-          "200": {
-            "$ref": "#/responses/TrackedTimes"
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/comments/{id}": {
+      "delete": {
+        "tags": [
+          "issue"
+        ],
+        "summary": "Delete a comment",
+        "operationId": "issueDeleteComment",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "404": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "integer",
+            "description": "id of comment to delete",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
           }
         }
       },
-      "post": {
+      "patch": {
+        "consumes": [
+          "application/json"
+        ],
         "produces": [
           "application/json"
         ],
         "tags": [
-          "repository"
+          "issue"
         ],
-        "operationId": "addTime",
+        "summary": "Edit a comment",
+        "operationId": "issueEditComment",
         "parameters": [
           {
-            "x-go-name": "Time",
-            "name": "time",
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the comment to edit",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "integer",
-              "format": "int64"
+              "$ref": "#/definitions/EditIssueCommentOption"
             }
           }
         ],
         "responses": {
           "200": {
-            "$ref": "#/responses/TrackedTime"
-          },
-          "400": {
-            "$ref": "#/responses/error"
-          },
-          "403": {
-            "$ref": "#/responses/error"
-          },
-          "404": {
-            "$ref": "#/responses/error"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Comment"
           }
         }
       }
     },
-    "/repos/{username}/{reponame}/mirror-sync": {
-      "post": {
+    "/repos/{owner}/{repo}/commits/{ref}/statuses": {
+      "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
           "repository"
         ],
-        "operationId": "repoMirrorSync",
+        "summary": "Get a commit's combined status, by branch/tag/commit reference",
+        "operationId": "repoGetCombinedStatusByRef",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of branch/tag/commit",
+            "name": "ref",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
-            "$ref": "#/responses/empty"
-          },
-          "403": {
-            "$ref": "#/responses/forbidden"
+            "$ref": "#/responses/Status"
           }
         }
       }
     },
-    "/repos/{username}/{reponame}/subscription": {
+    "/repos/{owner}/{repo}/editorconfig/{filepath}": {
       "get": {
+        "produces": [
+          "application/json"
+        ],
         "tags": [
           "repository"
         ],
-        "operationId": "userCurrentCheckSubscription",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/WatchInfo"
+        "summary": "Get the EditorConfig definitions of a file in a repository",
+        "operationId": "repoGetEditorConfig",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "404": {
-            "$ref": "#/responses/notFound"
-          }
-        }
-      },
-      "put": {
-        "tags": [
-          "repository"
-        ],
-        "operationId": "userCurrentPutSubscription",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/WatchInfo"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "filepath of file to get",
+            "name": "filepath",
+            "in": "path",
+            "required": true
           }
-        }
-      },
-      "delete": {
-        "tags": [
-          "repository"
         ],
-        "operationId": "userCurrentDeleteSubscription",
         "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
-          },
-          "500": {
-            "$ref": "#/responses/error"
-          }
+          "200": {}
         }
       }
     },
-    "/repos/{username}/{reponame}/times": {
+    "/repos/{owner}/{repo}/forks": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "repository"
         ],
-        "operationId": "repoTrackedTimes",
+        "summary": "List a repository's forks",
+        "operationId": "listForks",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
-            "$ref": "#/responses/TrackedTimes"
-          },
-          "400": {
-            "$ref": "#/responses/error"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/RepositoryList"
           }
         }
-      }
-    },
-    "/repos/{username}/{reponame}/times/{timetrackingusername}": {
-      "get": {
+      },
+      "post": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
         ],
-        "operationId": "userTrackedTimes",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/TrackedTimes"
-          },
-          "400": {
-            "$ref": "#/responses/error"
+        "summary": "Fork a repository",
+        "operationId": "createFork",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo to fork",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "404": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo to fork",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateForkOption"
+            }
+          }
+        ],
+        "responses": {
+          "202": {
+            "$ref": "#/responses/Repository"
           }
         }
       }
     },
-    "/repositories/{id}": {
+    "/repos/{owner}/{repo}/hooks": {
       "get": {
         "produces": [
           "application/json"
         "tags": [
           "repository"
         ],
-        "operationId": "repoGetByID",
+        "summary": "List the hooks in a repository",
+        "operationId": "repoListHooks",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
         "responses": {
           "200": {
-            "$ref": "#/responses/Repository"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/HookList"
           }
         }
-      }
-    },
-    "/user": {
-      "get": {
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
+        ],
+        "summary": "Create a hook",
+        "operationId": "repoCreateHook",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateHookOption"
+            }
+          }
         ],
-        "operationId": "userGetCurrent",
         "responses": {
           "200": {
-            "$ref": "#/responses/User"
+            "$ref": "#/responses/Hook"
           }
         }
       }
     },
-    "/user/followers": {
+    "/repos/{owner}/{repo}/hooks/{id}": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
+        ],
+        "summary": "Get a hook",
+        "operationId": "repoGetHook",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the hook to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userCurrentListFollowers",
         "responses": {
           "200": {
-            "$ref": "#/responses/UserList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Hook"
           }
         }
-      }
-    },
-    "/user/following": {
-      "get": {
+      },
+      "patch": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
+        ],
+        "summary": "Edit a hook in a repository",
+        "operationId": "repoEditHook",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/EditHookOption"
+            }
+          }
         ],
-        "operationId": "userCurrentListFollowing",
         "responses": {
           "200": {
-            "$ref": "#/responses/UserList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Hook"
           }
         }
       }
     },
-    "/user/following/{username}": {
+    "/repos/{owner}/{repo}/issue/{index}/comments": {
       "get": {
-        "tags": [
-          "user"
+        "produces": [
+          "application/json"
         ],
-        "operationId": "userCurrentCheckFollowing",
-        "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
-          },
-          "404": {
-            "$ref": "#/responses/notFound"
-          }
-        }
-      },
-      "put": {
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userCurrentPutFollow",
-        "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
+        "summary": "List all comments on an issue",
+        "operationId": "issueGetComments",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the issue",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "if provided, only comments updated since the specified time are returned.",
+            "name": "string",
+            "in": "query"
           }
-        }
-      },
-      "delete": {
-        "tags": [
-          "user"
         ],
-        "operationId": "userCurrentDeleteFollow",
         "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+          "200": {
+            "$ref": "#/responses/CommentList"
           }
         }
       }
     },
-    "/user/gpg_keys": {
-      "get": {
+    "/repos/{owner}/{repo}/issue/{index}/labels": {
+      "put": {
+        "consumes": [
+          "application/json"
+        ],
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Replace an issue's labels",
+        "operationId": "issueReplaceLabels",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the issue",
+            "name": "index",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/IssueLabelsOption"
+            }
+          }
         ],
-        "operationId": "userCurrentListGPGKeys",
         "responses": {
           "200": {
-            "$ref": "#/responses/GPGKeyList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/LabelList"
           }
         }
       },
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userCurrentPostGPGKey",
+        "summary": "Add a label to an issue",
+        "operationId": "issueAddLabel",
         "parameters": [
           {
-            "uniqueItems": true,
-            "x-go-name": "ArmoredKey",
-            "description": "An armored GPG key to add",
-            "name": "armored_public_key",
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the issue",
+            "name": "index",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
             "in": "body",
-            "required": true,
             "schema": {
-              "type": "string"
+              "$ref": "#/definitions/IssueLabelsOption"
             }
           }
         ],
         "responses": {
-          "201": {
-            "$ref": "#/responses/GPGKey"
-          },
-          "422": {
-            "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+          "200": {
+            "$ref": "#/responses/LabelList"
           }
         }
-      }
-    },
-    "/user/gpg_keys/{id}": {
-      "get": {
+      },
+      "delete": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userCurrentGetGPGKey",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/GPGKey"
+        "summary": "Remove all labels from an issue",
+        "operationId": "issueClearLabels",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "404": {
-            "$ref": "#/responses/notFound"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "integer",
+            "description": "index of the issue",
+            "name": "index",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
           }
         }
-      },
+      }
+    },
+    "/repos/{owner}/{repo}/issue/{index}/labels/{id}": {
       "delete": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Remove a label from an issue",
+        "operationId": "issueRemoveLabel",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the issue",
+            "name": "index",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the label to remove",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userCurrentDeleteGPGKey",
         "responses": {
           "204": {
             "$ref": "#/responses/empty"
-          },
-          "403": {
-            "$ref": "#/responses/forbidden"
-          },
-          "500": {
-            "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/user/keys": {
+    "/repos/{owner}/{repo}/issues": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "List a repository's issues",
+        "operationId": "issueListIssues",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "whether issue is open or closed",
+            "name": "state",
+            "in": "query"
+          },
+          {
+            "type": "integer",
+            "description": "page number of requested issues",
+            "name": "page",
+            "in": "query"
+          }
         ],
-        "operationId": "userCurrentListKeys",
         "responses": {
           "200": {
-            "$ref": "#/responses/PublicKeyList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/IssueList"
           }
         }
       },
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userCurrentPostKey",
+        "summary": "Create an issue",
+        "operationId": "issueCreateIssue",
         "parameters": [
           {
-            "uniqueItems": true,
-            "x-go-name": "Title",
-            "description": "Title of the key to add",
-            "name": "title",
-            "in": "body",
-            "required": true,
-            "schema": {
-              "type": "string"
-            }
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
           {
-            "uniqueItems": true,
-            "x-go-name": "Key",
-            "description": "An armored SSH key to add",
-            "name": "key",
+            "name": "body",
             "in": "body",
-            "required": true,
             "schema": {
-              "type": "string"
+              "$ref": "#/definitions/CreateIssueOption"
             }
           }
         ],
         "responses": {
           "201": {
-            "$ref": "#/responses/PublicKey"
-          },
-          "422": {
-            "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Issue"
           }
         }
       }
     },
-    "/user/keys/{id}": {
+    "/repos/{owner}/{repo}/issues/comments": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userCurrentGetKey",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/PublicKey"
+        "summary": "List all comments in a repository",
+        "operationId": "issueGetRepoComments",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "404": {
-            "$ref": "#/responses/notFound"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "if provided, only comments updated since the provided time are returned.",
+            "name": "string",
+            "in": "query"
           }
-        }
-      },
-      "delete": {
-        "produces": [
-          "application/json"
-        ],
-        "tags": [
-          "user"
         ],
-        "operationId": "userCurrentDeleteKey",
         "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
-          },
-          "403": {
-            "$ref": "#/responses/forbidden"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+          "200": {
+            "$ref": "#/responses/CommentList"
           }
         }
       }
     },
-    "/user/repos": {
+    "/repos/{owner}/{repo}/issues/{id}": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Get an issue by id",
+        "operationId": "issueGetIssue",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the issue to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userCurrentListRepos",
         "responses": {
           "200": {
-            "$ref": "#/responses/RepositoryList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Issue"
           }
         }
       },
-      "post": {
+      "patch": {
         "consumes": [
           "application/json"
         ],
           "application/json"
         ],
         "tags": [
-          "repository",
-          "user"
+          "issue"
         ],
-        "operationId": "createCurrentUserRepo",
+        "summary": "Edit an issue",
+        "operationId": "issueEditIssue",
         "parameters": [
           {
-            "uniqueItems": true,
-            "x-go-name": "Name",
-            "description": "Name of the repository to create",
-            "name": "name",
-            "in": "body",
-            "schema": {
-              "type": "string"
-            }
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Description",
-            "description": "Description of the repository to create",
-            "name": "description",
-            "in": "body",
-            "schema": {
-              "type": "string"
-            }
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Private",
-            "description": "Is the repository to create private ?",
-            "name": "private",
-            "in": "body",
-            "schema": {
-              "type": "boolean"
-            }
+            "type": "integer",
+            "description": "id of the issue to edit",
+            "name": "id",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "AutoInit",
-            "description": "Init the repository to create ?",
-            "name": "auto_init",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "boolean"
+              "$ref": "#/definitions/EditIssueOption"
             }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/Issue"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/issues/{index}/comments": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "issue"
+        ],
+        "summary": "Add a comment to an issue",
+        "operationId": "issueCreateComment",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Gitignores",
-            "description": "Gitignores to use",
-            "name": "gitignores",
-            "in": "body",
-            "schema": {
-              "type": "string"
-            }
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "License",
-            "description": "License to use",
-            "name": "license",
-            "in": "body",
-            "schema": {
-              "type": "string"
-            }
+            "type": "integer",
+            "description": "index of the issue",
+            "name": "id",
+            "in": "path",
+            "required": true
           },
           {
-            "x-go-name": "Readme",
-            "description": "Readme of the repository to create",
-            "name": "readme",
+            "name": "body",
             "in": "body",
             "schema": {
-              "type": "string"
+              "$ref": "#/definitions/CreateIssueOption"
             }
           }
         ],
         "responses": {
           "201": {
-            "$ref": "#/responses/Repository"
-          },
-          "403": {
-            "$ref": "#/responses/forbidden"
-          },
-          "422": {
-            "$ref": "#/responses/validationError"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Comment"
           }
         }
       }
     },
-    "/user/starred": {
+    "/repos/{owner}/{repo}/issues/{index}/labels": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Get an issue's labels",
+        "operationId": "issueGetLabels",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the issue",
+            "name": "index",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userCurrentListStarred",
         "responses": {
           "200": {
-            "$ref": "#/responses/RepositoryList"
+            "$ref": "#/responses/LabelList"
           },
-          "500": {
-            "$ref": "#/responses/error"
+          "404": {
+            "$ref": "#/responses/notFound"
           }
         }
       }
     },
-    "/user/starred/{username}/{reponame}": {
+    "/repos/{owner}/{repo}/issues/{index}/times": {
       "get": {
+        "produces": [
+          "application/json"
+        ],
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userCurrentCheckStarring",
-        "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
+        "summary": "List an issue's tracked times",
+        "operationId": "issueTrackedTimes",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "404": {
-            "$ref": "#/responses/notFound"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the issue",
+            "name": "repo",
+            "in": "path",
+            "required": true
           }
-        }
-      },
-      "put": {
-        "tags": [
-          "user"
         ],
-        "operationId": "userCurrentPutStar",
         "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+          "200": {
+            "$ref": "#/responses/TrackedTimeList"
           }
         }
       },
-      "delete": {
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Add a tracked time to a issue",
+        "operationId": "issueAddTime",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the issue to add tracked time to",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/AddTimeOption"
+            }
+          }
         ],
-        "operationId": "userCurrentDeleteStar",
         "responses": {
-          "204": {
-            "$ref": "#/responses/empty"
+          "200": {
+            "$ref": "#/responses/TrackedTime"
+          },
+          "400": {
+            "$ref": "#/responses/error"
           },
-          "500": {
+          "403": {
             "$ref": "#/responses/error"
           }
         }
       }
     },
-    "/user/subscriptions": {
+    "/repos/{owner}/{repo}/keys": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
+        ],
+        "summary": "List a repository's keys",
+        "operationId": "repoListKeys",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userCurrentListSubscriptions",
         "responses": {
           "200": {
-            "$ref": "#/responses/RepositoryList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/DeployKeyList"
           }
         }
-      }
-    },
-    "/user/times": {
-      "get": {
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
         ],
-        "operationId": "userTrackedTimes",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/TrackedTimes"
+        "summary": "Add a key to a repository",
+        "operationId": "repoCreateKey",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateKeyOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/DeployKey"
           }
         }
       }
     },
-    "/users/:username/followers": {
+    "/repos/{owner}/{repo}/keys/{id}": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
+        ],
+        "summary": "Get a repository's key by id",
+        "operationId": "repoGetKey",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the key to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userListFollowers",
         "responses": {
           "200": {
-            "$ref": "#/responses/UserList"
+            "$ref": "#/responses/DeployKey"
+          }
+        }
+      },
+      "delete": {
+        "tags": [
+          "repository"
+        ],
+        "summary": "Delete a key from a repository",
+        "operationId": "repoDeleteKey",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the key to delete",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
           }
         }
       }
     },
-    "/users/search": {
+    "/repos/{owner}/{repo}/labels": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Get all of a repository's labels",
+        "operationId": "issueListLabels",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userSearch",
         "responses": {
           "200": {
-            "$ref": "#/responses/UserList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/LabelList"
           }
         }
-      }
-    },
-    "/users/{username}": {
-      "get": {
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userGet",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/User"
+        "summary": "Create a label",
+        "operationId": "issueCreateLabel",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "404": {
-            "$ref": "#/responses/notFound"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateLabelOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/Label"
           }
         }
       }
     },
-    "/users/{username}/following": {
+    "/repos/{owner}/{repo}/labels/{id}": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Get a single label",
+        "operationId": "issueGetLabel",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the label to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userListFollowing",
         "responses": {
           "200": {
-            "$ref": "#/responses/UserList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Label"
           }
         }
-      }
-    },
-    "/users/{username}/following/:target": {
-      "get": {
+      },
+      "delete": {
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Delete a label",
+        "operationId": "issueDeleteLabel",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the label to delete",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userCheckFollowing",
         "responses": {
           "204": {
             "$ref": "#/responses/empty"
-          },
-          "404": {
-            "$ref": "#/responses/notFound"
           }
         }
-      }
-    },
-    "/users/{username}/gpg_keys": {
-      "get": {
+      },
+      "patch": {
+        "consumes": [
+          "application/json"
+        ],
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userListGPGKeys",
-        "responses": {
-          "200": {
-            "$ref": "#/responses/GPGKeyList"
+        "summary": "Update a label",
+        "operationId": "issueEditLabel",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the label to edit",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/EditLabelOption"
+            }
           }
-        }
-      }
-    },
-    "/users/{username}/keys": {
-      "get": {
-        "produces": [
-          "application/json"
-        ],
-        "tags": [
-          "user"
         ],
-        "operationId": "userListKeys",
         "responses": {
           "200": {
-            "$ref": "#/responses/PublicKeyList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/Label"
           }
         }
       }
     },
-    "/users/{username}/repos": {
+    "/repos/{owner}/{repo}/milestones": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
+        ],
+        "summary": "Get all of a repository's milestones",
+        "operationId": "issueGetMilestones",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the milestone to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userListRepos",
         "responses": {
           "200": {
-            "$ref": "#/responses/RepositoryList"
-          },
-          "500": {
-            "$ref": "#/responses/error"
+            "$ref": "#/responses/MilestoneList"
           }
         }
-      }
-    },
-    "/users/{username}/starred": {
-      "get": {
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "issue"
         ],
-        "operationId": "userListStarred",
+        "summary": "Create a milestone",
+        "operationId": "issueCreateMilestone",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateMilestoneOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/Milestone"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/milestones/{id}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "issue"
+        ],
+        "summary": "Get a milestone",
+        "operationId": "issueGetMilestone",
         "responses": {
           "200": {
-            "$ref": "#/responses/RepositoryList"
+            "$ref": "#/responses/Milestone"
+          }
+        }
+      },
+      "delete": {
+        "tags": [
+          "issue"
+        ],
+        "summary": "Delete a milestone",
+        "operationId": "issueDeleteMilestone",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the milestone to delete",
+            "name": "body",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      },
+      "patch": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "issue"
+        ],
+        "summary": "Update a milestone",
+        "operationId": "issueEditMilestone",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/EditMilestoneOption"
+            }
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/Milestone"
           }
         }
       }
     },
-    "/users/{username}/subscriptions": {
+    "/repos/{owner}/{repo}/mirror-sync": {
+      "post": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Sync a mirrored repository",
+        "operationId": "repoMirrorSync",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo to sync",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo to sync",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/pulls": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
+        ],
+        "summary": "List a repo's pull requests",
+        "operationId": "repoListPullRequests",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userListSubscriptions",
         "responses": {
           "200": {
-            "$ref": "#/responses/RepositoryList"
+            "$ref": "#/responses/PullRequestList"
+          }
+        }
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Create a pull request",
+        "operationId": "repoCreatePullRequest",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreatePullRequestOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/PullRequest"
           }
         }
       }
     },
-    "/users/{username}/tokens": {
+    "/repos/{owner}/{repo}/pulls/{index}": {
       "get": {
         "produces": [
           "application/json"
         ],
         "tags": [
-          "user"
+          "repository"
+        ],
+        "summary": "Get a pull request",
+        "operationId": "repoGetPullRequest",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the pull request to get",
+            "name": "index",
+            "in": "path",
+            "required": true
+          }
         ],
-        "operationId": "userGetTokens",
         "responses": {
           "200": {
-            "$ref": "#/responses/AccessTokenList"
+            "$ref": "#/responses/PullRequest"
+          }
+        }
+      },
+      "patch": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Update a pull request",
+        "operationId": "repoEditPullRequest",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
           },
-          "500": {
-            "$ref": "#/responses/error"
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the pull request to edit",
+            "name": "index",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/EditPullRequestOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/PullRequest"
           }
         }
       }
     },
-    "/version": {
+    "/repos/{owner}/{repo}/pulls/{index}/merge": {
       "get": {
-        "description": "This show current running Gitea application version.",
         "produces": [
           "application/json"
         ],
         "tags": [
-          "miscellaneous"
+          "repository"
+        ],
+        "summary": "Check if a pull request has been merged",
+        "operationId": "repoPullRequestIsMerged",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the pull request",
+            "name": "index",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "description": "pull request has been merged",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
+          },
+          "404": {
+            "description": "pull request has not been merged",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
+          }
+        }
+      },
+      "post": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Merge a pull request",
+        "operationId": "repoMergePullRequest",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "index of the pull request to merge",
+            "name": "index",
+            "in": "path",
+            "required": true
+          }
         ],
-        "summary": "Return Gitea running version.",
-        "operationId": "getVersion",
         "responses": {
           "200": {
-            "$ref": "#/responses/ServerVersion"
+            "$ref": "#/responses/empty"
+          },
+          "405": {
+            "$ref": "#/responses/empty"
           }
         }
       }
-    }
-  },
-  "definitions": {
-    "GPGKey": {
-      "description": "GPGKey a user GPG key to sign commit and tag in repository",
-      "type": "object",
-      "properties": {
-        "can_certify": {
-          "type": "boolean",
-          "x-go-name": "CanCertify"
-        },
-        "can_encrypt_comms": {
-          "type": "boolean",
-          "x-go-name": "CanEncryptComms"
-        },
-        "can_encrypt_storage": {
-          "type": "boolean",
-          "x-go-name": "CanEncryptStorage"
-        },
-        "can_sign": {
-          "type": "boolean",
-          "x-go-name": "CanSign"
-        },
+    },
+    "/repos/{owner}/{repo}/raw/{filepath}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Get a file from a repository",
+        "operationId": "repoGetRawFile",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "filepath of the file to get",
+            "name": "filepath",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {}
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/releases": {
+      "get": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Create a release",
+        "operationId": "repoCreateRelease",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateReleaseOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/Release"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/releases/{id}": {
+      "delete": {
+        "tags": [
+          "repository"
+        ],
+        "summary": "Delete a release",
+        "operationId": "repoDeleteRelease",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the release to delete",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      },
+      "patch": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Update a release",
+        "operationId": "repoEditRelease",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the release to edit",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/EditReleaseOption"
+            }
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/Release"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/stargazers": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "List a repo's stargazers",
+        "operationId": "repoListStargazers",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/UserList"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/statuses/{sha}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Get a commit's statuses",
+        "operationId": "repoListStatuses",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "sha of the commit",
+            "name": "sha",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/StatusList"
+          }
+        }
+      },
+      "post": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Create a commit status",
+        "operationId": "repoCreateStatus",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "sha of the commit",
+            "name": "sha",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateStatusOption"
+            }
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/StatusList"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/subscribers": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "List a repo's watchers",
+        "operationId": "repoListSubscribers",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/UserList"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/subscription": {
+      "get": {
+        "tags": [
+          "repository"
+        ],
+        "summary": "Check if the current user is watching a repo",
+        "operationId": "userCurrentCheckSubscription",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/WatchInfo"
+          }
+        }
+      },
+      "put": {
+        "tags": [
+          "repository"
+        ],
+        "summary": "Watch a repo",
+        "operationId": "userCurrentPutSubscription",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/WatchInfo"
+          }
+        }
+      },
+      "delete": {
+        "tags": [
+          "repository"
+        ],
+        "summary": "Unwatch a repo",
+        "operationId": "userCurrentDeleteSubscription",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/times": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "List a repo's tracked times",
+        "operationId": "repoTrackedTimes",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/TrackedTimeList"
+          }
+        }
+      }
+    },
+    "/repos/{owner}/{repo}/times/{tracker}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List a user's tracked times in a repo",
+        "operationId": "userTrackedTimes",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of user",
+            "name": "user",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/TrackedTimeList"
+          }
+        }
+      }
+    },
+    "/repos/{user}/{repo}/hooks/{id}": {
+      "delete": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Delete a hook in a repository",
+        "operationId": "repoDeleteHook",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "integer",
+            "description": "id of the hook to delete",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          },
+          "404": {
+            "$ref": "#/responses/notFound"
+          }
+        }
+      }
+    },
+    "/repositories/{id}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository"
+        ],
+        "summary": "Get a repository by id",
+        "operationId": "repoGetByID",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the repo to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/Repository"
+          }
+        }
+      }
+    },
+    "/teams/{id}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "Get a team",
+        "operationId": "orgGetTeam",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/Team"
+          }
+        }
+      },
+      "delete": {
+        "tags": [
+          "organization"
+        ],
+        "summary": "Delete a team",
+        "operationId": "orgDeleteTeam",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team to delete",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "description": "team deleted",
+            "schema": {
+              "$ref": "#/responses/empty"
+            }
+          }
+        }
+      },
+      "patch": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "Edit a team",
+        "operationId": "orgEditTeam",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team to edit",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/EditTeamOption"
+            }
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/Team"
+          }
+        }
+      }
+    },
+    "/teams/{id}/members": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "List a team's members",
+        "operationId": "orgListTeamMembers",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/UserList"
+          }
+        }
+      }
+    },
+    "/teams/{id}/members/{username}": {
+      "put": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "Add a team member",
+        "operationId": "orgAddTeamMember",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the user to add",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      },
+      "delete": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "Remove a team member",
+        "operationId": "orgAddTeamMember",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of the user to remove",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      }
+    },
+    "/teams/{id}/repos": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "List a team's repos",
+        "operationId": "orgListTeamRepos",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/RepositoryList"
+          }
+        }
+      }
+    },
+    "/teams/{id}/repos/{org}/{repo}": {
+      "put": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "Add a repository to a team",
+        "operationId": "orgAddTeamMember",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "organization that owns the repo to add",
+            "name": "org",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo to add",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      },
+      "delete": {
+        "description": "This does not delete the repository, it only removes the repository from the team.",
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "Remove a repository from a team",
+        "operationId": "orgAddTeamMember",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of the team",
+            "name": "id",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "organization that owns the repo to remove",
+            "name": "org",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo to remove",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      }
+    },
+    "/user": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Get the authenticated user",
+        "operationId": "userGetCurrent",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/User"
+          }
+        }
+      }
+    },
+    "/user/emails": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the authenticated user's email addresses",
+        "operationId": "userListEmails",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/EmailList"
+          }
+        }
+      },
+      "post": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Add email addresses",
+        "operationId": "userAddEmail",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateEmailOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/EmailList"
+          }
+        }
+      },
+      "delete": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Delete email addresses",
+        "operationId": "userDeleteEmail",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/DeleteEmailOption"
+            }
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      }
+    },
+    "/user/followers": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the authenticated user's followers",
+        "operationId": "userCurrentListFollowers",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/UserList"
+          }
+        }
+      }
+    },
+    "/user/following": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the users that the authenticated user is following",
+        "operationId": "userCurrentListFollowing",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/UserList"
+          }
+        }
+      }
+    },
+    "/user/following/{followee}": {
+      "get": {
+        "tags": [
+          "user"
+        ],
+        "summary": "Check whether a user is followed by the authenticated user",
+        "operationId": "userCurrentCheckFollowing",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of followed user",
+            "name": "followee",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          },
+          "404": {
+            "$ref": "#/responses/notFound"
+          }
+        }
+      }
+    },
+    "/user/following/{username}": {
+      "put": {
+        "tags": [
+          "user"
+        ],
+        "summary": "Follow a user",
+        "operationId": "userCurrentPutFollow",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user to follow",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      },
+      "delete": {
+        "tags": [
+          "user"
+        ],
+        "summary": "Unfollow a user",
+        "operationId": "userCurrentDeleteFollow",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user to unfollow",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      }
+    },
+    "/user/gpg_keys": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the authenticated user's GPG keys",
+        "operationId": "userCurrentListGPGKeys",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/GPGKeyList"
+          }
+        }
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Create a GPG key",
+        "operationId": "userCurrentPostGPGKey",
+        "parameters": [
+          {
+            "name": "Form",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateGPGKeyOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/GPGKey"
+          },
+          "422": {
+            "$ref": "#/responses/validationError"
+          }
+        }
+      }
+    },
+    "/user/gpg_keys/{id}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Get a GPG key",
+        "operationId": "userCurrentGetGPGKey",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of key to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/GPGKey"
+          },
+          "404": {
+            "$ref": "#/responses/notFound"
+          }
+        }
+      },
+      "delete": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Remove a GPG key",
+        "operationId": "userCurrentDeleteGPGKey",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of key to delete",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          },
+          "403": {
+            "$ref": "#/responses/forbidden"
+          }
+        }
+      }
+    },
+    "/user/keys": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the authenticated user's public keys",
+        "operationId": "userCurrentListKeys",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/PublicKeyList"
+          }
+        }
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Create a public key",
+        "operationId": "userCurrentPostKey",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateKeyOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/PublicKey"
+          },
+          "422": {
+            "$ref": "#/responses/validationError"
+          }
+        }
+      }
+    },
+    "/user/keys/{id}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Get a public key",
+        "operationId": "userCurrentGetKey",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of key to get",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/PublicKey"
+          },
+          "404": {
+            "$ref": "#/responses/notFound"
+          }
+        }
+      },
+      "delete": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Delete a public key",
+        "operationId": "userCurrentDeleteKey",
+        "parameters": [
+          {
+            "type": "integer",
+            "description": "id of key to delete",
+            "name": "id",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          },
+          "403": {
+            "$ref": "#/responses/forbidden"
+          }
+        }
+      }
+    },
+    "/user/orgs": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "List the current user's organizations",
+        "operationId": "orgListCurrentUserOrgs",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/OrganizationList"
+          }
+        }
+      }
+    },
+    "/user/repos": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the repos that the authenticated user owns or has access to",
+        "operationId": "userCurrentListRepos",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/RepositoryList"
+          }
+        }
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "repository",
+          "user"
+        ],
+        "summary": "Create a repository",
+        "operationId": "createCurrentUserRepo",
+        "parameters": [
+          {
+            "name": "body",
+            "in": "body",
+            "schema": {
+              "$ref": "#/definitions/CreateRepoOption"
+            }
+          }
+        ],
+        "responses": {
+          "201": {
+            "$ref": "#/responses/Repository"
+          }
+        }
+      }
+    },
+    "/user/starred": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "The repos that the authenticated user has starred",
+        "operationId": "userCurrentListStarred",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/RepositoryList"
+          }
+        }
+      }
+    },
+    "/user/starred/{owner}/{repo}": {
+      "get": {
+        "tags": [
+          "user"
+        ],
+        "summary": "Whether the authenticated is starring the repo",
+        "operationId": "userCurrentCheckStarring",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          },
+          "404": {
+            "$ref": "#/responses/notFound"
+          }
+        }
+      },
+      "put": {
+        "tags": [
+          "user"
+        ],
+        "summary": "Star the given repo",
+        "operationId": "userCurrentPutStar",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo to star",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo to star",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      },
+      "delete": {
+        "tags": [
+          "user"
+        ],
+        "summary": "Unstar the given repo",
+        "operationId": "userCurrentDeleteStar",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "owner of the repo to unstar",
+            "name": "owner",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "name of the repo to unstar",
+            "name": "repo",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          }
+        }
+      }
+    },
+    "/user/subscriptions": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List repositories watched by the authenticated user",
+        "operationId": "userCurrentListSubscriptions",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/RepositoryList"
+          }
+        }
+      }
+    },
+    "/user/times": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the current user's tracked times",
+        "operationId": "userCurrentTrackedTimes",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/TrackedTimeList"
+          }
+        }
+      }
+    },
+    "/user/{username}/orgs": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "organization"
+        ],
+        "summary": "List a user's organizations",
+        "operationId": "orgListUserOrgs",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user",
+            "name": "username",
+            "in": "path"
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/OrganizationList"
+          }
+        }
+      }
+    },
+    "/users/search": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Search for users",
+        "operationId": "userSearch",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "keyword",
+            "name": "q",
+            "in": "query"
+          },
+          {
+            "type": "integer",
+            "description": "maximum number of users to return",
+            "name": "limit",
+            "in": "query"
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/UserList"
+          }
+        }
+      }
+    },
+    "/users/{follower}/following/{followee}": {
+      "get": {
+        "tags": [
+          "user"
+        ],
+        "summary": "Check if one user is following another user",
+        "operationId": "userCheckFollowing",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of following user",
+            "name": "follower",
+            "in": "path",
+            "required": true
+          },
+          {
+            "type": "string",
+            "description": "username of followed user",
+            "name": "followee",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "204": {
+            "$ref": "#/responses/empty"
+          },
+          "404": {
+            "$ref": "#/responses/notFound"
+          }
+        }
+      }
+    },
+    "/users/{username}": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Get a user",
+        "operationId": "userGet",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user to get",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/User"
+          },
+          "404": {
+            "$ref": "#/responses/notFound"
+          }
+        }
+      }
+    },
+    "/users/{username}/followers": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the given user's followers",
+        "operationId": "userListFollowers",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/UserList"
+          }
+        }
+      }
+    },
+    "/users/{username}/following": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the users that the given user is following",
+        "operationId": "userListFollowing",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/UserList"
+          }
+        }
+      }
+    },
+    "/users/{username}/gpg_keys": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the given user's GPG keys",
+        "operationId": "userListGPGKeys",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/GPGKeyList"
+          }
+        }
+      }
+    },
+    "/users/{username}/keys": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the given user's public keys",
+        "operationId": "userListKeys",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/PublicKeyList"
+          }
+        }
+      }
+    },
+    "/users/{username}/repos": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the repos owned by the given user",
+        "operationId": "userListRepos",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/RepositoryList"
+          }
+        }
+      }
+    },
+    "/users/{username}/starred": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "The repos that the given user has starred",
+        "operationId": "userListStarred",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of user",
+            "name": "username",
+            "in": "path",
+            "required": true
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/RepositoryList"
+          }
+        }
+      }
+    },
+    "/users/{username}/subscriptions": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the repositories watched by a user",
+        "operationId": "userListSubscriptions",
+        "parameters": [
+          {
+            "type": "string",
+            "description": "username of the user",
+            "name": "username",
+            "in": "path"
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/RepositoryList"
+          }
+        }
+      }
+    },
+    "/users/{username}/tokens": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "List the authenticated user's access tokens",
+        "operationId": "userGetTokens",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/AccessTokenList"
+          }
+        }
+      },
+      "post": {
+        "consumes": [
+          "application/json"
+        ],
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "user"
+        ],
+        "summary": "Create an access token",
+        "operationId": "userCreateToken",
+        "parameters": [
+          {
+            "type": "string",
+            "x-go-name": "Name",
+            "name": "name",
+            "in": "query"
+          }
+        ],
+        "responses": {
+          "200": {
+            "$ref": "#/responses/AccessToken"
+          }
+        }
+      }
+    },
+    "/version": {
+      "get": {
+        "produces": [
+          "application/json"
+        ],
+        "tags": [
+          "miscellaneous"
+        ],
+        "summary": "Returns the version of the Gitea application",
+        "operationId": "getVersion",
+        "responses": {
+          "200": {
+            "$ref": "#/responses/ServerVersion"
+          }
+        }
+      }
+    }
+  },
+  "definitions": {
+    "AddCollaboratorOption": {
+      "description": "AddCollaboratorOption options when adding a user as a collaborator of a repository",
+      "type": "object",
+      "properties": {
+        "permission": {
+          "type": "string",
+          "x-go-name": "Permission"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "AddTimeOption": {
+      "description": "AddTimeOption options for adding time to an issue",
+      "type": "object",
+      "required": [
+        "time"
+      ],
+      "properties": {
+        "time": {
+          "description": "time in seconds",
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Time"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Branch": {
+      "description": "Branch represents a repository branch",
+      "type": "object",
+      "properties": {
+        "commit": {
+          "$ref": "#/definitions/PayloadCommit"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Name"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Comment": {
+      "description": "Comment represents a comment on a commit or issue",
+      "type": "object",
+      "properties": {
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        },
+        "created_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Created"
+        },
+        "html_url": {
+          "type": "string",
+          "x-go-name": "HTMLURL"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "issue_url": {
+          "type": "string",
+          "x-go-name": "IssueURL"
+        },
+        "pull_request_url": {
+          "type": "string",
+          "x-go-name": "PRURL"
+        },
+        "updated_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Updated"
+        },
+        "user": {
+          "$ref": "#/definitions/User"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateEmailOption": {
+      "description": "CreateEmailOption options when creating email addresses",
+      "type": "object",
+      "properties": {
+        "emails": {
+          "description": "email addresses to add",
+          "type": "array",
+          "items": {
+            "type": "string"
+          },
+          "x-go-name": "Emails"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateForkOption": {
+      "description": "CreateForkOption options for creating a fork",
+      "type": "object",
+      "properties": {
+        "organization": {
+          "description": "organization name, if forking into an organization",
+          "type": "string",
+          "x-go-name": "Organization"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateGPGKeyOption": {
+      "description": "CreateGPGKeyOption options create user GPG key",
+      "type": "object",
+      "required": [
+        "armored_public_key"
+      ],
+      "properties": {
+        "armored_public_key": {
+          "description": "An armored GPG key to add",
+          "type": "string",
+          "uniqueItems": true,
+          "x-go-name": "ArmoredKey"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateHookOption": {
+      "description": "CreateHookOption options when create a hook",
+      "type": "object",
+      "required": [
+        "type",
+        "config"
+      ],
+      "properties": {
+        "active": {
+          "type": "boolean",
+          "default": false,
+          "x-go-name": "Active"
+        },
+        "config": {
+          "type": "object",
+          "additionalProperties": {
+            "type": "string"
+          },
+          "x-go-name": "Config"
+        },
+        "events": {
+          "type": "array",
+          "items": {
+            "type": "string"
+          },
+          "x-go-name": "Events"
+        },
+        "type": {
+          "type": "string",
+          "enum": [
+            "gitea",
+            "gogs",
+            "slack",
+            "discord"
+          ],
+          "x-go-name": "Type"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateIssueCommentOption": {
+      "description": "CreateIssueCommentOption options for creating a comment on an issue",
+      "type": "object",
+      "required": [
+        "body"
+      ],
+      "properties": {
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateIssueOption": {
+      "description": "CreateIssueOption options to create one issue",
+      "type": "object",
+      "required": [
+        "title"
+      ],
+      "properties": {
+        "assignee": {
+          "description": "username of assignee",
+          "type": "string",
+          "x-go-name": "Assignee"
+        },
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        },
+        "closed": {
+          "type": "boolean",
+          "x-go-name": "Closed"
+        },
+        "labels": {
+          "description": "list of label ids",
+          "type": "array",
+          "items": {
+            "type": "integer",
+            "format": "int64"
+          },
+          "x-go-name": "Labels"
+        },
+        "milestone": {
+          "description": "milestone id",
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Milestone"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateKeyOption": {
+      "description": "CreateKeyOption options when creating a key",
+      "type": "object",
+      "required": [
+        "title",
+        "key"
+      ],
+      "properties": {
+        "key": {
+          "description": "An armored SSH key to add",
+          "type": "string",
+          "uniqueItems": true,
+          "x-go-name": "Key"
+        },
+        "title": {
+          "description": "Title of the key to add",
+          "type": "string",
+          "uniqueItems": true,
+          "x-go-name": "Title"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateLabelOption": {
+      "description": "CreateLabelOption options for creating a label",
+      "type": "object",
+      "required": [
+        "name",
+        "color"
+      ],
+      "properties": {
+        "color": {
+          "type": "string",
+          "x-go-name": "Color",
+          "example": "#00aabb"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Name"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateMilestoneOption": {
+      "description": "CreateMilestoneOption options for creating a milestone",
+      "type": "object",
+      "properties": {
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "due_on": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Deadline"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateOrgOption": {
+      "description": "CreateOrgOption options for creating an organization",
+      "type": "object",
+      "required": [
+        "username"
+      ],
+      "properties": {
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "full_name": {
+          "type": "string",
+          "x-go-name": "FullName"
+        },
+        "location": {
+          "type": "string",
+          "x-go-name": "Location"
+        },
+        "username": {
+          "type": "string",
+          "x-go-name": "UserName"
+        },
+        "website": {
+          "type": "string",
+          "x-go-name": "Website"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreatePullRequestOption": {
+      "description": "CreatePullRequestOption options when creating a pull request",
+      "type": "object",
+      "properties": {
+        "assignee": {
+          "type": "string",
+          "x-go-name": "Assignee"
+        },
+        "base": {
+          "type": "string",
+          "x-go-name": "Base"
+        },
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        },
+        "head": {
+          "type": "string",
+          "x-go-name": "Head"
+        },
+        "labels": {
+          "type": "array",
+          "items": {
+            "type": "integer",
+            "format": "int64"
+          },
+          "x-go-name": "Labels"
+        },
+        "milestone": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Milestone"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateReleaseOption": {
+      "description": "CreateReleaseOption options when creating a release",
+      "type": "object",
+      "required": [
+        "tag_name"
+      ],
+      "properties": {
+        "body": {
+          "type": "string",
+          "x-go-name": "Note"
+        },
+        "draft": {
+          "type": "boolean",
+          "x-go-name": "IsDraft"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Title"
+        },
+        "prerelease": {
+          "type": "boolean",
+          "x-go-name": "IsPrerelease"
+        },
+        "tag_name": {
+          "type": "string",
+          "x-go-name": "TagName"
+        },
+        "target_commitish": {
+          "type": "string",
+          "x-go-name": "Target"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateRepoOption": {
+      "description": "CreateRepoOption options when creating repository",
+      "type": "object",
+      "required": [
+        "name"
+      ],
+      "properties": {
+        "auto_init": {
+          "description": "Whether the repository should be auto-intialized?",
+          "type": "boolean",
+          "x-go-name": "AutoInit"
+        },
+        "description": {
+          "description": "Description of the repository to create",
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "gitignores": {
+          "description": "Gitignores to use",
+          "type": "string",
+          "x-go-name": "Gitignores"
+        },
+        "license": {
+          "description": "License to use",
+          "type": "string",
+          "x-go-name": "License"
+        },
+        "name": {
+          "description": "Name of the repository to create",
+          "type": "string",
+          "uniqueItems": true,
+          "x-go-name": "Name"
+        },
+        "private": {
+          "description": "Whether the repository is private",
+          "type": "boolean",
+          "x-go-name": "Private"
+        },
+        "readme": {
+          "description": "Readme of the repository to create",
+          "type": "string",
+          "x-go-name": "Readme"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateStatusOption": {
+      "description": "CreateStatusOption holds the information needed to create a new Status for a Commit",
+      "type": "object",
+      "properties": {
+        "context": {
+          "type": "string",
+          "x-go-name": "Context"
+        },
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "state": {
+          "$ref": "#/definitions/StatusState"
+        },
+        "target_url": {
+          "type": "string",
+          "x-go-name": "TargetURL"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateTeamOption": {
+      "description": "CreateTeamOption options for creating a team",
+      "type": "object",
+      "required": [
+        "name"
+      ],
+      "properties": {
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Name"
+        },
+        "permission": {
+          "type": "string",
+          "enum": [
+            "read",
+            "write",
+            "admin"
+          ],
+          "x-go-name": "Permission"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "CreateUserOption": {
+      "description": "CreateUserOption create user options",
+      "type": "object",
+      "required": [
+        "username",
+        "email",
+        "password"
+      ],
+      "properties": {
+        "email": {
+          "type": "string",
+          "format": "email",
+          "x-go-name": "Email"
+        },
+        "full_name": {
+          "type": "string",
+          "x-go-name": "FullName"
+        },
+        "login_name": {
+          "type": "string",
+          "x-go-name": "LoginName"
+        },
+        "password": {
+          "type": "string",
+          "x-go-name": "Password"
+        },
+        "send_notify": {
+          "type": "boolean",
+          "x-go-name": "SendNotify"
+        },
+        "source_id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "SourceID"
+        },
+        "username": {
+          "type": "string",
+          "x-go-name": "Username"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "DeleteEmailOption": {
+      "description": "DeleteEmailOption options when deleting email addresses",
+      "type": "object",
+      "properties": {
+        "emails": {
+          "description": "email addresses to delete",
+          "type": "array",
+          "items": {
+            "type": "string"
+          },
+          "x-go-name": "Emails"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "DeployKey": {
+      "description": "DeployKey a deploy key",
+      "type": "object",
+      "properties": {
+        "created_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Created"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "key": {
+          "type": "string",
+          "x-go-name": "Key"
+        },
+        "read_only": {
+          "type": "boolean",
+          "x-go-name": "ReadOnly"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        },
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditHookOption": {
+      "description": "EditHookOption options when modify one hook",
+      "type": "object",
+      "properties": {
+        "active": {
+          "type": "boolean",
+          "x-go-name": "Active"
+        },
+        "config": {
+          "type": "object",
+          "additionalProperties": {
+            "type": "string"
+          },
+          "x-go-name": "Config"
+        },
+        "events": {
+          "type": "array",
+          "items": {
+            "type": "string"
+          },
+          "x-go-name": "Events"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditIssueCommentOption": {
+      "description": "EditIssueCommentOption options for editing a comment",
+      "type": "object",
+      "required": [
+        "body"
+      ],
+      "properties": {
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditIssueOption": {
+      "description": "EditIssueOption options for editing an issue",
+      "type": "object",
+      "properties": {
+        "assignee": {
+          "type": "string",
+          "x-go-name": "Assignee"
+        },
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        },
+        "milestone": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Milestone"
+        },
+        "state": {
+          "type": "string",
+          "x-go-name": "State"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditLabelOption": {
+      "description": "EditLabelOption options for editing a label",
+      "type": "object",
+      "properties": {
+        "color": {
+          "type": "string",
+          "x-go-name": "Color"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Name"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditMilestoneOption": {
+      "description": "EditMilestoneOption options for editing a milestone",
+      "type": "object",
+      "properties": {
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "due_on": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Deadline"
+        },
+        "state": {
+          "type": "string",
+          "x-go-name": "State"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditOrgOption": {
+      "description": "EditOrgOption options for editing an organization",
+      "type": "object",
+      "properties": {
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "full_name": {
+          "type": "string",
+          "x-go-name": "FullName"
+        },
+        "location": {
+          "type": "string",
+          "x-go-name": "Location"
+        },
+        "website": {
+          "type": "string",
+          "x-go-name": "Website"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditPullRequestOption": {
+      "description": "EditPullRequestOption options when modify pull request",
+      "type": "object",
+      "properties": {
+        "assignee": {
+          "type": "string",
+          "x-go-name": "Assignee"
+        },
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        },
+        "labels": {
+          "type": "array",
+          "items": {
+            "type": "integer",
+            "format": "int64"
+          },
+          "x-go-name": "Labels"
+        },
+        "milestone": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Milestone"
+        },
+        "state": {
+          "type": "string",
+          "x-go-name": "State"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditReleaseOption": {
+      "description": "EditReleaseOption options when editing a release",
+      "type": "object",
+      "properties": {
+        "body": {
+          "type": "string",
+          "x-go-name": "Note"
+        },
+        "draft": {
+          "type": "boolean",
+          "x-go-name": "IsDraft"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Title"
+        },
+        "prerelease": {
+          "type": "boolean",
+          "x-go-name": "IsPrerelease"
+        },
+        "tag_name": {
+          "type": "string",
+          "x-go-name": "TagName"
+        },
+        "target_commitish": {
+          "type": "string",
+          "x-go-name": "Target"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditTeamOption": {
+      "description": "EditTeamOption options for editing a team",
+      "type": "object",
+      "required": [
+        "name"
+      ],
+      "properties": {
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Name"
+        },
+        "permission": {
+          "type": "string",
+          "enum": [
+            "read",
+            "write",
+            "admin"
+          ],
+          "x-go-name": "Permission"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "EditUserOption": {
+      "description": "EditUserOption edit user options",
+      "type": "object",
+      "required": [
+        "email"
+      ],
+      "properties": {
+        "active": {
+          "type": "boolean",
+          "x-go-name": "Active"
+        },
+        "admin": {
+          "type": "boolean",
+          "x-go-name": "Admin"
+        },
+        "allow_git_hook": {
+          "type": "boolean",
+          "x-go-name": "AllowGitHook"
+        },
+        "allow_import_local": {
+          "type": "boolean",
+          "x-go-name": "AllowImportLocal"
+        },
+        "email": {
+          "type": "string",
+          "format": "email",
+          "x-go-name": "Email"
+        },
+        "full_name": {
+          "type": "string",
+          "x-go-name": "FullName"
+        },
+        "location": {
+          "type": "string",
+          "x-go-name": "Location"
+        },
+        "login_name": {
+          "type": "string",
+          "x-go-name": "LoginName"
+        },
+        "max_repo_creation": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "MaxRepoCreation"
+        },
+        "password": {
+          "type": "string",
+          "x-go-name": "Password"
+        },
+        "source_id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "SourceID"
+        },
+        "website": {
+          "type": "string",
+          "x-go-name": "Website"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Email": {
+      "description": "Email an email address belonging to a user",
+      "type": "object",
+      "properties": {
+        "email": {
+          "type": "string",
+          "format": "email",
+          "x-go-name": "Email"
+        },
+        "primary": {
+          "type": "boolean",
+          "x-go-name": "Primary"
+        },
+        "verified": {
+          "type": "boolean",
+          "x-go-name": "Verified"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "GPGKey": {
+      "description": "GPGKey a user GPG key to sign commit and tag in repository",
+      "type": "object",
+      "properties": {
+        "can_certify": {
+          "type": "boolean",
+          "x-go-name": "CanCertify"
+        },
+        "can_encrypt_comms": {
+          "type": "boolean",
+          "x-go-name": "CanEncryptComms"
+        },
+        "can_encrypt_storage": {
+          "type": "boolean",
+          "x-go-name": "CanEncryptStorage"
+        },
+        "can_sign": {
+          "type": "boolean",
+          "x-go-name": "CanSign"
+        },
+        "created_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Created"
+        },
+        "emails": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/GPGKeyEmail"
+          },
+          "x-go-name": "Emails"
+        },
+        "expires_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Expires"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "key_id": {
+          "type": "string",
+          "x-go-name": "KeyID"
+        },
+        "primary_key_id": {
+          "type": "string",
+          "x-go-name": "PrimaryKeyID"
+        },
+        "public_key": {
+          "type": "string",
+          "x-go-name": "PublicKey"
+        },
+        "subkeys": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/GPGKey"
+          },
+          "x-go-name": "SubsKey"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "GPGKeyEmail": {
+      "description": "GPGKeyEmail an email attached to a GPGKey",
+      "type": "object",
+      "properties": {
+        "email": {
+          "type": "string",
+          "x-go-name": "Email"
+        },
+        "verified": {
+          "type": "boolean",
+          "x-go-name": "Verified"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Issue": {
+      "description": "Issue represents an issue in a repository",
+      "type": "object",
+      "properties": {
+        "assignee": {
+          "$ref": "#/definitions/User"
+        },
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        },
+        "comments": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Comments"
+        },
+        "created_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Created"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "labels": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/Label"
+          },
+          "x-go-name": "Labels"
+        },
+        "milestone": {
+          "$ref": "#/definitions/Milestone"
+        },
+        "number": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Index"
+        },
+        "pull_request": {
+          "$ref": "#/definitions/PullRequestMeta"
+        },
+        "state": {
+          "$ref": "#/definitions/StateType"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        },
+        "updated_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Updated"
+        },
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        },
+        "user": {
+          "$ref": "#/definitions/User"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "IssueLabelsOption": {
+      "description": "IssueLabelsOption a collection of labels",
+      "type": "object",
+      "properties": {
+        "labels": {
+          "description": "list of label IDs",
+          "type": "array",
+          "items": {
+            "type": "integer",
+            "format": "int64"
+          },
+          "x-go-name": "Labels"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Label": {
+      "description": "Label a label to an issue or a pr",
+      "type": "object",
+      "properties": {
+        "color": {
+          "type": "string",
+          "x-go-name": "Color",
+          "example": "00aabb"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Name"
+        },
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "MarkdownOption": {
+      "description": "MarkdownOption markdown options",
+      "type": "object",
+      "properties": {
+        "Context": {
+          "description": "Context to render\n\nin: body",
+          "type": "string"
+        },
+        "Mode": {
+          "description": "Mode to render\n\nin: body",
+          "type": "string"
+        },
+        "Text": {
+          "description": "Text markdown to render\n\nin: body",
+          "type": "string"
+        },
+        "Wiki": {
+          "description": "Is it a wiki page ?\n\nin: body",
+          "type": "boolean"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "MigrateRepoForm": {
+      "description": "MigrateRepoForm form for migrating repository",
+      "type": "object",
+      "required": [
+        "clone_addr",
+        "uid",
+        "repo_name"
+      ],
+      "properties": {
+        "auth_password": {
+          "type": "string",
+          "x-go-name": "AuthPassword"
+        },
+        "auth_username": {
+          "type": "string",
+          "x-go-name": "AuthUsername"
+        },
+        "clone_addr": {
+          "type": "string",
+          "x-go-name": "CloneAddr"
+        },
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "mirror": {
+          "type": "boolean",
+          "x-go-name": "Mirror"
+        },
+        "private": {
+          "type": "boolean",
+          "x-go-name": "Private"
+        },
+        "repo_name": {
+          "type": "string",
+          "x-go-name": "RepoName"
+        },
+        "uid": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "UID"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/modules/auth"
+    },
+    "Milestone": {
+      "description": "Milestone milestone is a collection of issues on one repository",
+      "type": "object",
+      "properties": {
+        "closed_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Closed"
+        },
+        "closed_issues": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ClosedIssues"
+        },
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "due_on": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Deadline"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "open_issues": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "OpenIssues"
+        },
+        "state": {
+          "$ref": "#/definitions/StateType"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Organization": {
+      "description": "Organization represents an organization",
+      "type": "object",
+      "properties": {
+        "avatar_url": {
+          "type": "string",
+          "x-go-name": "AvatarURL"
+        },
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "full_name": {
+          "type": "string",
+          "x-go-name": "FullName"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "location": {
+          "type": "string",
+          "x-go-name": "Location"
+        },
+        "username": {
+          "type": "string",
+          "x-go-name": "UserName"
+        },
+        "website": {
+          "type": "string",
+          "x-go-name": "Website"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "PRBranchInfo": {
+      "description": "PRBranchInfo information about a branch",
+      "type": "object",
+      "properties": {
+        "label": {
+          "type": "string",
+          "x-go-name": "Name"
+        },
+        "ref": {
+          "type": "string",
+          "x-go-name": "Ref"
+        },
+        "repo": {
+          "$ref": "#/definitions/Repository"
+        },
+        "repo_id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "RepoID"
+        },
+        "sha": {
+          "type": "string",
+          "x-go-name": "Sha"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "PayloadCommit": {
+      "description": "PayloadCommit represents a commit",
+      "type": "object",
+      "properties": {
+        "author": {
+          "$ref": "#/definitions/PayloadUser"
+        },
+        "committer": {
+          "$ref": "#/definitions/PayloadUser"
+        },
+        "id": {
+          "description": "sha1 hash of the commit",
+          "type": "string",
+          "x-go-name": "ID"
+        },
+        "message": {
+          "type": "string",
+          "x-go-name": "Message"
+        },
+        "timestamp": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Timestamp"
+        },
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        },
+        "verification": {
+          "$ref": "#/definitions/PayloadCommitVerification"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "PayloadCommitVerification": {
+      "description": "PayloadCommitVerification represents the GPG verification of a commit",
+      "type": "object",
+      "properties": {
+        "payload": {
+          "type": "string",
+          "x-go-name": "Payload"
+        },
+        "reason": {
+          "type": "string",
+          "x-go-name": "Reason"
+        },
+        "signature": {
+          "type": "string",
+          "x-go-name": "Signature"
+        },
+        "verified": {
+          "type": "boolean",
+          "x-go-name": "Verified"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "PayloadUser": {
+      "description": "PayloadUser represents the author or committer of a commit",
+      "type": "object",
+      "properties": {
+        "email": {
+          "type": "string",
+          "format": "email",
+          "x-go-name": "Email"
+        },
+        "name": {
+          "description": "Full name of the commit author",
+          "type": "string",
+          "x-go-name": "Name"
+        },
+        "username": {
+          "type": "string",
+          "x-go-name": "UserName"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Permission": {
+      "description": "Permission represents a set of permissions",
+      "type": "object",
+      "properties": {
+        "admin": {
+          "type": "boolean",
+          "x-go-name": "Admin"
+        },
+        "pull": {
+          "type": "boolean",
+          "x-go-name": "Pull"
+        },
+        "push": {
+          "type": "boolean",
+          "x-go-name": "Push"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "PublicKey": {
+      "description": "PublicKey publickey is a user key to push code to repository",
+      "type": "object",
+      "properties": {
         "created_at": {
+          "type": "string",
+          "format": "date-time",
           "x-go-name": "Created"
         },
-        "emails": {
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "key": {
+          "type": "string",
+          "x-go-name": "Key"
+        },
+        "title": {
+          "type": "string",
+          "x-go-name": "Title"
+        },
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "PullRequest": {
+      "description": "PullRequest represents a pull request",
+      "type": "object",
+      "properties": {
+        "assignee": {
+          "$ref": "#/definitions/User"
+        },
+        "base": {
+          "$ref": "#/definitions/PRBranchInfo"
+        },
+        "body": {
+          "type": "string",
+          "x-go-name": "Body"
+        },
+        "comments": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Comments"
+        },
+        "created_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Created"
+        },
+        "diff_url": {
+          "type": "string",
+          "x-go-name": "DiffURL"
+        },
+        "head": {
+          "$ref": "#/definitions/PRBranchInfo"
+        },
+        "html_url": {
+          "type": "string",
+          "x-go-name": "HTMLURL"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "labels": {
           "type": "array",
           "items": {
-            "$ref": "#/definitions/GPGKeyEmail"
+            "$ref": "#/definitions/Label"
           },
-          "x-go-name": "Emails"
+          "x-go-name": "Labels"
         },
-        "expires_at": {
-          "x-go-name": "Expires"
+        "merge_base": {
+          "type": "string",
+          "x-go-name": "MergeBase"
+        },
+        "merge_commit_sha": {
+          "type": "string",
+          "x-go-name": "MergedCommitID"
+        },
+        "mergeable": {
+          "type": "boolean",
+          "x-go-name": "Mergeable"
+        },
+        "merged": {
+          "type": "boolean",
+          "x-go-name": "HasMerged"
+        },
+        "merged_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Merged"
+        },
+        "merged_by": {
+          "$ref": "#/definitions/User"
+        },
+        "milestone": {
+          "$ref": "#/definitions/Milestone"
         },
-        "id": {
+        "number": {
           "type": "integer",
           "format": "int64",
-          "x-go-name": "ID"
+          "x-go-name": "Index"
         },
-        "key_id": {
+        "patch_url": {
           "type": "string",
-          "x-go-name": "KeyID"
+          "x-go-name": "PatchURL"
         },
-        "primary_key_id": {
+        "state": {
+          "$ref": "#/definitions/StateType"
+        },
+        "title": {
           "type": "string",
-          "x-go-name": "PrimaryKeyID"
+          "x-go-name": "Title"
         },
-        "public_key": {
+        "updated_at": {
           "type": "string",
-          "x-go-name": "PublicKey"
+          "format": "date-time",
+          "x-go-name": "Updated"
         },
-        "subkeys": {
-          "type": "array",
-          "items": {
-            "type": "object"
-          },
-          "x-go-name": "SubsKey"
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        },
+        "user": {
+          "$ref": "#/definitions/User"
         }
       },
       "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
     },
-    "GPGKeyEmail": {
-      "description": "GPGKeyEmail an email attached to a GPGKey",
+    "PullRequestMeta": {
+      "description": "PullRequestMeta PR info if an issue is a PR",
       "type": "object",
       "properties": {
-        "email": {
-          "type": "string",
-          "x-go-name": "Email"
-        },
-        "verified": {
+        "merged": {
           "type": "boolean",
-          "x-go-name": "Verified"
+          "x-go-name": "HasMerged"
+        },
+        "merged_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Merged"
         }
       },
       "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
     },
-    "Permission": {
+    "Release": {
+      "description": "Release represents a repository release",
       "type": "object",
-      "title": "Permission represents a API permission.",
       "properties": {
-        "admin": {
-          "type": "boolean",
-          "x-go-name": "Admin"
+        "author": {
+          "$ref": "#/definitions/User"
         },
-        "pull": {
+        "body": {
+          "type": "string",
+          "x-go-name": "Note"
+        },
+        "created_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "CreatedAt"
+        },
+        "draft": {
           "type": "boolean",
-          "x-go-name": "Pull"
+          "x-go-name": "IsDraft"
         },
-        "push": {
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Title"
+        },
+        "prerelease": {
           "type": "boolean",
-          "x-go-name": "Push"
+          "x-go-name": "IsPrerelease"
+        },
+        "published_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "PublishedAt"
+        },
+        "tag_name": {
+          "type": "string",
+          "x-go-name": "TagName"
+        },
+        "tarball_url": {
+          "type": "string",
+          "x-go-name": "TarURL"
+        },
+        "target_commitish": {
+          "type": "string",
+          "x-go-name": "Target"
+        },
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        },
+        "zipball_url": {
+          "type": "string",
+          "x-go-name": "ZipURL"
         }
       },
       "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
     },
     "Repository": {
+      "description": "Repository represents a repository",
       "type": "object",
-      "title": "Repository represents a API repository.",
       "properties": {
         "clone_url": {
           "type": "string",
           "x-go-name": "CloneURL"
         },
         "created_at": {
+          "type": "string",
+          "format": "date-time",
           "x-go-name": "Created"
         },
         "default_branch": {
           "$ref": "#/definitions/User"
         },
         "parent": {
-          "type": "object"
+          "$ref": "#/definitions/Repository"
         },
         "permissions": {
           "$ref": "#/definitions/Permission"
           "x-go-name": "Stars"
         },
         "updated_at": {
+          "type": "string",
+          "format": "date-time",
           "x-go-name": "Updated"
         },
         "watchers_count": {
       },
       "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
     },
+    "SearchResults": {
+      "description": "SearchResults results of a successful search",
+      "type": "object",
+      "properties": {
+        "data": {
+          "type": "array",
+          "items": {
+            "$ref": "#/definitions/Repository"
+          },
+          "x-go-name": "Data"
+        },
+        "ok": {
+          "type": "boolean",
+          "x-go-name": "OK"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "ServerVersion": {
+      "description": "ServerVersion wraps the version of the server",
+      "type": "object",
+      "properties": {
+        "version": {
+          "type": "string",
+          "x-go-name": "Version"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "StateType": {
+      "description": "StateType issue state type",
+      "type": "string",
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Status": {
+      "description": "Status holds a single Status of a single Commit",
+      "type": "object",
+      "properties": {
+        "context": {
+          "type": "string",
+          "x-go-name": "Context"
+        },
+        "created_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Created"
+        },
+        "creator": {
+          "$ref": "#/definitions/User"
+        },
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "status": {
+          "$ref": "#/definitions/StatusState"
+        },
+        "target_url": {
+          "type": "string",
+          "x-go-name": "TargetURL"
+        },
+        "updated_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Updated"
+        },
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "StatusState": {
+      "description": "StatusState holds the state of a Status\nIt can be \"pending\", \"success\", \"error\", \"failure\", and \"warning\"",
+      "type": "string",
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "Team": {
+      "description": "Team represents a team in an organization",
+      "type": "object",
+      "properties": {
+        "description": {
+          "type": "string",
+          "x-go-name": "Description"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "name": {
+          "type": "string",
+          "x-go-name": "Name"
+        },
+        "permission": {
+          "type": "string",
+          "enum": [
+            "none",
+            "read",
+            "write",
+            "admin",
+            "owner"
+          ],
+          "x-go-name": "Permission"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "TrackedTime": {
+      "description": "TrackedTime worked time for an issue / pr",
+      "type": "object",
+      "properties": {
+        "created": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "Created"
+        },
+        "id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "ID"
+        },
+        "issue_id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "IssueID"
+        },
+        "time": {
+          "description": "Time in seconds",
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "Time"
+        },
+        "user_id": {
+          "type": "integer",
+          "format": "int64",
+          "x-go-name": "UserID"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
     "User": {
+      "description": "User represents a user",
       "type": "object",
-      "title": "User represents a API user.",
       "properties": {
         "avatar_url": {
+          "description": "URL to the user's avatar",
           "type": "string",
           "x-go-name": "AvatarURL"
         },
         "email": {
           "type": "string",
+          "format": "email",
           "x-go-name": "Email"
         },
         "full_name": {
+          "description": "the user's full name",
           "type": "string",
           "x-go-name": "FullName"
         },
         "id": {
+          "description": "the user's id",
           "type": "integer",
           "format": "int64",
           "x-go-name": "ID"
         },
         "login": {
+          "description": "the user's username",
           "type": "string",
           "x-go-name": "UserName"
         }
       },
       "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
+    },
+    "WatchInfo": {
+      "description": "WatchInfo represents an API watch status of one repository",
+      "type": "object",
+      "properties": {
+        "created_at": {
+          "type": "string",
+          "format": "date-time",
+          "x-go-name": "CreatedAt"
+        },
+        "ignored": {
+          "type": "boolean",
+          "x-go-name": "Ignored"
+        },
+        "reason": {
+          "type": "object",
+          "x-go-name": "Reason"
+        },
+        "repository_url": {
+          "type": "string",
+          "x-go-name": "RepositoryURL"
+        },
+        "subscribed": {
+          "type": "boolean",
+          "x-go-name": "Subscribed"
+        },
+        "url": {
+          "type": "string",
+          "x-go-name": "URL"
+        }
+      },
+      "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
     }
   },
   "responses": {
     "AccessTokenList": {
       "description": "AccessTokenList represents a list of API access token."
     },
-    "GPGKey": {
-      "description": "GPGKey a user GPG key to sign commit and tag in repository",
-      "headers": {
-        "can_certify": {
-          "type": "boolean"
-        },
-        "can_encrypt_comms": {
-          "type": "boolean"
-        },
-        "can_encrypt_storage": {
-          "type": "boolean"
-        },
-        "can_sign": {
-          "type": "boolean"
-        },
-        "created_at": {},
-        "emails": {
-          "type": "array",
-          "items": {
-            "$ref": "#/definitions/GPGKeyEmail"
-          }
-        },
-        "expires_at": {},
-        "id": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "key_id": {
-          "type": "string"
-        },
-        "primary_key_id": {
-          "type": "string"
-        },
-        "public_key": {
-          "type": "string"
-        },
-        "subkeys": {
-          "type": "array",
-          "items": {
-            "type": "object"
-          }
+    "Branch": {
+      "schema": {
+        "$ref": "#/definitions/Branch"
+      }
+    },
+    "BranchList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Branch"
+        }
+      }
+    },
+    "Comment": {
+      "schema": {
+        "$ref": "#/definitions/Comment"
+      }
+    },
+    "CommentList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Comment"
+        }
+      }
+    },
+    "DeployKey": {
+      "schema": {
+        "$ref": "#/definitions/DeployKey"
+      }
+    },
+    "DeployKeyList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/DeployKey"
+        }
+      }
+    },
+    "EmailList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Email"
         }
       }
     },
+    "GPGKey": {
+      "schema": {
+        "$ref": "#/definitions/GPGKey"
+      }
+    },
     "GPGKeyList": {
-      "description": "GPGKeyList represents a list of GPGKey"
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/GPGKey"
+        }
+      }
     },
     "Hook": {
-      "description": "Hook a hook is a web hook when one repository changed",
       "schema": {
-        "type": "object",
-        "additionalProperties": {
-          "type": "string"
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Branch"
         }
-      },
-      "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."
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Branch"
+        }
+      }
+    },
+    "Issue": {
+      "schema": {
+        "$ref": "#/definitions/Issue"
+      }
+    },
+    "IssueList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Issue"
+        }
+      }
+    },
+    "Label": {
+      "schema": {
+        "$ref": "#/definitions/Label"
+      }
+    },
+    "LabelList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Label"
+        }
+      }
     },
     "MarkdownRender": {
       "description": "MarkdownRender is a rendered markdown document"
     },
+    "Milestone": {
+      "schema": {
+        "$ref": "#/definitions/Milestone"
+      }
+    },
+    "MilestoneList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Milestone"
+        }
+      }
+    },
     "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"
+      "schema": {
+        "$ref": "#/definitions/Organization"
+      }
+    },
+    "OrganizationList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Organization"
         }
       }
     },
     "PublicKey": {
-      "description": "PublicKey publickey is a user key to push code to repository",
-      "headers": {
-        "created_at": {},
-        "id": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "key": {
-          "type": "string"
-        },
-        "title": {
-          "type": "string"
-        },
-        "url": {
-          "type": "string"
-        }
+      "schema": {
+        "$ref": "#/definitions/PublicKey"
       }
     },
     "PublicKeyList": {
-      "description": "PublicKeyList represents a list of PublicKey"
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/PublicKey"
+        }
+      }
     },
-    "Repository": {
-      "description": "Repository represents a API repository.",
+    "PullRequest": {
       "schema": {
-        "$ref": "#/definitions/Permission"
-      },
-      "headers": {
-        "clone_url": {
-          "type": "string"
-        },
-        "created_at": {},
-        "default_branch": {
-          "type": "string"
-        },
-        "description": {
-          "type": "string"
-        },
-        "empty": {
-          "type": "boolean"
-        },
-        "fork": {
-          "type": "boolean"
-        },
-        "forks_count": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "full_name": {
-          "type": "string"
-        },
-        "html_url": {
-          "type": "string"
-        },
-        "id": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "mirror": {
-          "type": "boolean"
-        },
-        "name": {
-          "type": "string"
-        },
-        "open_issues_count": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "owner": {},
-        "parent": {},
-        "permissions": {},
-        "private": {
-          "type": "boolean"
-        },
-        "size": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "ssh_url": {
-          "type": "string"
-        },
-        "stars_count": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "updated_at": {},
-        "watchers_count": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "website": {
-          "type": "string"
+        "$ref": "#/definitions/PullRequest"
+      }
+    },
+    "PullRequestList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/PullRequest"
         }
       }
     },
-    "RepositoryList": {
-      "description": "RepositoryList represents a list of API repository."
+    "Release": {
+      "schema": {
+        "$ref": "#/definitions/Release"
+      }
     },
-    "SearchError": {
-      "description": "SearchError error of failing search",
-      "headers": {
-        "error": {
-          "type": "string"
-        },
-        "ok": {
-          "type": "boolean"
+    "ReleaseList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Release"
+        }
+      }
+    },
+    "Repository": {
+      "schema": {
+        "$ref": "#/definitions/Repository"
+      }
+    },
+    "RepositoryList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Repository"
         }
       }
     },
     "SearchResults": {
-      "description": "SearchResults results of search",
+      "schema": {
+        "$ref": "#/definitions/SearchResults"
+      },
       "headers": {
-        "data": {
-          "type": "array",
-          "items": {
-            "$ref": "#/definitions/Repository"
-          }
-        },
-        "ok": {
-          "type": "boolean"
-        }
+        "body": {}
       }
     },
     "ServerVersion": {
-      "description": "ServerVersion wraps the version of the server",
-      "headers": {
-        "Version": {
-          "type": "string"
+      "schema": {
+        "$ref": "#/definitions/ServerVersion"
+      }
+    },
+    "Status": {
+      "schema": {
+        "$ref": "#/definitions/Status"
+      }
+    },
+    "StatusList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Status"
         }
       }
     },
-    "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"
+    "Team": {
+      "schema": {
+        "$ref": "#/definitions/Team"
+      }
+    },
+    "TeamList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/Team"
         }
       }
     },
-    "TrackedTimes": {
-      "description": "TrackedTimes represent a list of tracked times"
+    "TrackedTime": {
+      "schema": {
+        "$ref": "#/definitions/TrackedTime"
+      }
     },
-    "User": {
-      "description": "User represents a API user.",
-      "headers": {
-        "avatar_url": {
-          "type": "string"
-        },
-        "email": {
-          "type": "string"
-        },
-        "full_name": {
-          "type": "string"
-        },
-        "id": {
-          "type": "integer",
-          "format": "int64"
-        },
-        "login": {
-          "type": "string"
+    "TrackedTimeList": {
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/TrackedTime"
         }
       }
     },
+    "User": {
+      "schema": {
+        "$ref": "#/definitions/User"
+      }
+    },
     "UserList": {
-      "description": "UserList represents a list of API user."
+      "schema": {
+        "type": "array",
+        "items": {
+          "$ref": "#/definitions/User"
+        }
+      }
     },
     "WatchInfo": {
-      "description": "WatchInfo represents a API watch status of one repository",
       "schema": {
-        "type": "object"
-      },
-      "headers": {
-        "created_at": {},
-        "ignored": {
-          "type": "boolean"
-        },
-        "reason": {},
-        "repository_url": {
-          "type": "string"
-        },
-        "subscribed": {
-          "type": "boolean"
-        },
-        "url": {
-          "type": "string"
-        }
+        "$ref": "#/definitions/WatchInfo"
       }
     },
     "empty": {
     "notFound": {
       "description": "APINotFound is a not found empty response"
     },
+    "parameterBodies": {
+      "schema": {
+        "$ref": "#/definitions/MigrateRepoForm"
+      },
+      "headers": {
+        "AddCollaboratorOption": {},
+        "AddTimeOption": {},
+        "CreateEmailOption": {},
+        "CreateForkOption": {},
+        "CreateHookOption": {},
+        "CreateIssueCommentOption": {},
+        "CreateIssueOption": {},
+        "CreateKeyOption": {},
+        "CreateLabelOption": {},
+        "CreateMilestoneOption": {},
+        "CreateOrgOption": {},
+        "CreatePullRequestOption": {},
+        "CreateReleaseOption": {},
+        "CreateRepoOption": {},
+        "CreateStatusOption": {},
+        "CreateTeamOption": {},
+        "CreateUserOption": {},
+        "DeleteEmailOption": {},
+        "EditHookOption": {},
+        "EditIssueCommentOption": {},
+        "EditIssueOption": {},
+        "EditLabelOption": {},
+        "EditMilestoneOption": {},
+        "EditOrgOption": {},
+        "EditPullRequestOption": {},
+        "EditReleaseOption": {},
+        "EditTeamOption": {},
+        "EditUserOption": {},
+        "IssueLabelsOption": {},
+        "MarkdownOption": {},
+        "MigrateRepoForm": {}
+      }
+    },
     "redirect": {
       "description": "APIRedirect is a redirect response"
     },
index 99c9cf0b9567517bd90d5402cd91a3dfaf4aa1b7..d247b51c726e600e1278bd042e872ec86610d278 100644 (file)
@@ -15,20 +15,26 @@ import (
 
 // CreateOrg api for create 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
-
+       // swagger:operation POST /admin/users/{username}/orgs admin adminCreateOrg
+       // ---
+       // summary: Create an organization
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of the user that will own the created organization
+       //   type: string
+       //   required: true
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Organization"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        u := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
index 232fb988c8fdbef09acefc673887e64a78c7e7fd..70765557fb58e68396d47baf5b601f004ca617a3 100644 (file)
@@ -14,20 +14,26 @@ import (
 
 // CreateRepo api for creating a 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
-
+       // swagger:operation POST /admin/users/{username}/repos admin adminCreateRepo
+       // ---
+       // summary: Create a repository on behalf a user
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of the user. This user will own the created repository
+       //   type: string
+       //   required: true
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Repository"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        owner := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
index 74cbba8cde9af2bb744f4504d745432c652cc198..19f24aed8f876eed27a1d0e710541b1faf0e0bd4 100644 (file)
@@ -5,13 +5,12 @@
 package admin
 
 import (
-       api "code.gitea.io/sdk/gitea"
-
        "code.gitea.io/gitea/models"
        "code.gitea.io/gitea/modules/context"
        "code.gitea.io/gitea/modules/log"
        "code.gitea.io/gitea/modules/setting"
        "code.gitea.io/gitea/routers/api/v1/user"
+       api "code.gitea.io/sdk/gitea"
 )
 
 func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, loginName string) {
@@ -34,22 +33,27 @@ func parseLoginSource(ctx *context.APIContext, u *models.User, sourceID int64, l
        u.LoginName = loginName
 }
 
-// CreateUser api for creating a user
+// CreateUser create a 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
-
+       // swagger:operation POST /admin/users admin adminCreateUser
+       // ---
+       // summary: Create a user
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateUserOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/User"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        u := &models.User{
                Name:      form.Username,
                FullName:  form.FullName,
@@ -87,20 +91,30 @@ func CreateUser(ctx *context.APIContext, form api.CreateUserOption) {
 
 // EditUser api for modifying a user's information
 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
-
+       // swagger:operation PATCH /admin/users/{username} admin adminEditUser
+       // ---
+       // summary: Edit an existing user
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user to edit
+       //   type: string
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditUserOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/User"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        u := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -157,17 +171,24 @@ func EditUser(ctx *context.APIContext, form api.EditUserOption) {
 
 // DeleteUser api for deleting 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
-
+       // swagger:operation DELETE /admin/users/{username} admin adminDeleteUser
+       // ---
+       // summary: Delete a user
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user to delete
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        u := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -189,20 +210,26 @@ func DeleteUser(ctx *context.APIContext) {
 
 // CreatePublicKey api for creating a public key to a 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
-
+       // swagger:operation POST /admin/users/{username}/keys admin adminCreatePublicKey
+       // ---
+       // summary: Add a public key on behalf of a user
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of the user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/PublicKey"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        u := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
index 4331929614600b3fd586ce35cc59c634445d55c6..b6e7df12154ba7d58e697ec243873ef9643be3ee 100644 (file)
@@ -4,11 +4,7 @@
 
 // Package v1 Gitea API.
 //
-// This provide API interface to communicate with this Gitea instance.
-//
-// Terms Of Service:
-//
-// there are no TOS at this moment, use at your own risk we take no responsibility
+// This documentation describes the Gitea API.
 //
 //     Schemes: http, https
 //     BasePath: /api/v1
@@ -51,11 +47,6 @@ package v1
 import (
        "strings"
 
-       "github.com/go-macaron/binding"
-       "gopkg.in/macaron.v1"
-
-       api "code.gitea.io/sdk/gitea"
-
        "code.gitea.io/gitea/models"
        "code.gitea.io/gitea/modules/auth"
        "code.gitea.io/gitea/modules/context"
@@ -63,8 +54,13 @@ import (
        "code.gitea.io/gitea/routers/api/v1/misc"
        "code.gitea.io/gitea/routers/api/v1/org"
        "code.gitea.io/gitea/routers/api/v1/repo"
+       _ "code.gitea.io/gitea/routers/api/v1/swagger" // for swagger generation
        "code.gitea.io/gitea/routers/api/v1/user"
        "code.gitea.io/gitea/routers/api/v1/utils"
+       api "code.gitea.io/sdk/gitea"
+
+       "github.com/go-macaron/binding"
+       "gopkg.in/macaron.v1"
 )
 
 func repoAssignment() macaron.Handler {
@@ -320,7 +316,7 @@ func RegisterRoutes(m *macaron.Macaron) {
                        m.Get("", user.GetAuthenticatedUser)
                        m.Combo("/emails").Get(user.ListEmails).
                                Post(bind(api.CreateEmailOption{}), user.AddEmail).
-                               Delete(bind(api.CreateEmailOption{}), user.DeleteEmail)
+                               Delete(bind(api.DeleteEmailOption{}), user.DeleteEmail)
 
                        m.Get("/followers", user.ListMyFollowers)
                        m.Group("/following", func() {
@@ -435,7 +431,6 @@ func RegisterRoutes(m *macaron.Macaron) {
                                                        m.Combo("").Get(repo.ListTrackedTimes).
                                                                Post(reqToken(), bind(api.AddTimeOption{}), repo.AddTime)
                                                })
-
                                        })
                                }, mustEnableIssues)
                                m.Group("/labels", func() {
@@ -484,8 +479,8 @@ func RegisterRoutes(m *macaron.Macaron) {
                                                Post(reqToken(), reqRepoWriter(), bind(api.CreateStatusOption{}), repo.NewCommitStatus)
                                })
                                m.Group("/commits/:ref", func() {
-                                       m.Get("/status", repo.GetCombinedCommitStatus)
-                                       m.Get("/statuses", repo.GetCommitStatuses)
+                                       m.Get("/status", repo.GetCombinedCommitStatusByRef)
+                                       m.Get("/statuses", repo.GetCommitStatusesByRef)
                                })
                        }, repoAssignment())
                })
index 8e3c66841f8f828b4fb2f75e80befab5efedbe80..ed50c1c05b5e5c36ecc7dc376d7de03f767acc1c 100644 (file)
@@ -15,18 +15,23 @@ import (
 
 // Markdown render markdown document to HTML
 func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
-       // swagger:route POST /markdown miscellaneous renderMarkdown
-       //
-       //     Consumes:
-       //     - application/json
-       //
-       //     Produces:
+       // swagger:operation POST /markdown miscellaneous renderMarkdown
+       // ---
+       // summary: Render a markdown document as HTML
+       // parameters:
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/MarkdownOption"
+       // consumes:
+       // - application/json
+       // produces:
        //     - text/html
-       //
-       //     Responses:
-       //       200: MarkdownRender
-       //       422: validationError
-
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/MarkdownRender"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        if ctx.HasAPIError() {
                ctx.Error(422, "", ctx.GetErrMsg())
                return
@@ -53,17 +58,22 @@ func Markdown(ctx *context.APIContext, form api.MarkdownOption) {
 
 // MarkdownRaw render raw markdown HTML
 func MarkdownRaw(ctx *context.APIContext) {
-       // swagger:route POST /markdown/raw miscellaneous renderMarkdownRaw
-       //
-       //     Consumes:
+       // swagger:operation POST /markdown/raw miscellaneous renderMarkdownRaw
+       // ---
+       // summary: Render raw markdown as HTML
+       // parameters:
+       // - name: body
+       //   in: body
+       //   type: string
+       // consumes:
        //     - text/plain
-       //
-       //     Produces:
+       // produces:
        //     - text/html
-       //
-       //     Responses:
-       //       200: MarkdownRender
-       //       422: validationError
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/MarkdownRender"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        body, err := ctx.Req.Body().Bytes()
        if err != nil {
                ctx.Error(422, "", err)
index 1780398bf9e55dd8ceaea4f36a43211a7d6fe918..20e0a60c720868960aa557d1bf34c79993a00d35 100644 (file)
@@ -12,17 +12,13 @@ import (
 
 // Version shows the version of the Gitea server
 func Version(ctx *context.APIContext) {
-       // swagger:route GET /version miscellaneous getVersion
-       //
-       // Return Gitea running version.
-       //
-       // This show current running Gitea application version.
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: ServerVersion
-
+       // swagger:operation GET /version miscellaneous getVersion
+       // ---
+       // summary: Returns the version of the Gitea application
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/ServerVersion"
        ctx.JSON(200, &gitea.ServerVersion{Version: setting.AppVer})
 }
index d8a4c45fc8ec9938e6deb0322c4efc7382b46ea6..0a77d795e6386a36d6d613d93106be1be21009cc 100644 (file)
@@ -15,15 +15,14 @@ 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
-
+       // swagger:operation GET /orgs/{org}/hooks organization orgListHooks
+       // ---
+       // summary: List an organization's webhooks
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/HookList"
        org := ctx.Org.Organization
        orgHooks, err := models.GetWebhooksByOrgID(org.ID)
        if err != nil {
@@ -39,16 +38,14 @@ 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
-
+       // swagger:operation GET /orgs/{org}/hooks/{id} organization orgGetHook
+       // ---
+       // summary: Get a hook
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Hook"
        org := ctx.Org.Organization
        hookID := ctx.ParamsInt64(":id")
        hook, err := utils.GetOrgHook(ctx, org.ID, hookID)
@@ -60,19 +57,16 @@ 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
-
+       // swagger:operation POST /orgs/{org}/hooks/ organization orgCreateHook
+       // ---
+       // summary: Create a hook
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Hook"
        if !utils.CheckCreateHookOption(ctx, &form) {
                return
        }
@@ -81,36 +75,30 @@ 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
-
+       // swagger:operation PATCH /orgs/{org}/hooks/{id} organization orgEditHook
+       // ---
+       // summary: Update a hook
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Hook"
        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
-
+       // swagger:operation DELETE /orgs/{org}/hooks/{id} organization orgDeleteHook
+       // ---
+       // summary: Delete a hook
+       // produces:
+       // - application/json
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        org := ctx.Org.Organization
        hookID := ctx.ParamsInt64(":id")
        if err := models.DeleteWebhookByOrgID(org.ID, hookID); err != nil {
index 34953705567ad2540d971904df395f8b44f7b14b..7cae7c19fab9d1e0d940cbdd05466fe623bc8599 100644 (file)
@@ -53,45 +53,68 @@ 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
-
+       // swagger:operation GET /orgs/{org}/members organization orgListMembers
+       // ---
+       // summary: List an organization's members
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/UserList"
        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
-
+       // swagger:operation GET /orgs/{org}/public_members organization orgListPublicMembers
+       // ---
+       // summary: List an organization's public members
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/UserList"
        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
-
+       // swagger:operation GET /orgs/{org}/members/{username} organization orgIsMember
+       // ---
+       // summary: Check if a user is a member of an organization
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // - name: username
+       //   in: path
+       //   description: username of the user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     description: user is a member
+       //     schema:
+       //       "$ref": "#/responses/empty"
+       //   "404":
+       //     description: user is not a member
+       //     schema:
+       //       "$ref": "#/responses/empty"
        userToCheck := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -113,15 +136,29 @@ 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
-
+       // swagger:operation GET /orgs/{org}/public_members/{username} organization orgIsPublicMember
+       // ---
+       // summary: Check if a user is a public member of an organization
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // - name: username
+       //   in: path
+       //   description: username of the user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     description: user is a public member
+       //     schema:
+       //       "$ref": "#/responses/empty"
+       //   "404":
+       //     description: user is not a public member
+       //     schema:
+       //       "$ref": "#/responses/empty"
        userToCheck := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -135,16 +172,27 @@ 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
-
+       // swagger:operation PUT /orgs/{org}/public_members/{username} organization orgPublicizeMember
+       // ---
+       // summary: Publicize a user's membership
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // - name: username
+       //   in: path
+       //   description: username of the user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     description: membership publicized
+       //     schema:
+       //       "$ref": "#/responses/empty"
        userToPublicize := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -163,16 +211,25 @@ 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
-
+       // swagger:operation DELETE /orgs/{org}/public_members/{username} organization orgConcealMember
+       // ---
+       // summary: Conceal a user's membership
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // - name: username
+       //   in: path
+       //   description: username of the user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        userToConceal := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -191,15 +248,27 @@ 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
-
+       // swagger:operation DELETE /orgs/{org}/members/{username} organization orgDeleteMember
+       // ---
+       // summary: Remove a member from an organization
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // - name: username
+       //   in: path
+       //   description: username of the user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     description: member removed
+       //     schema:
+       //       "$ref": "#/responses/empty"
        member := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
index ec55b9ebe469c17282b71eb165bad8a6c55ed803..c24a4aeb10d1e7524e841ff2e28898e5726f3f55 100644 (file)
@@ -27,14 +27,33 @@ func listUserOrgs(ctx *context.APIContext, u *models.User, all bool) {
 }
 
 // ListMyOrgs list all my orgs
-// see https://github.com/gogits/go-gogs-client/wiki/Organizations#list-your-organizations
 func ListMyOrgs(ctx *context.APIContext) {
+       // swagger:operation GET /user/orgs organization orgListCurrentUserOrgs
+       // ---
+       // summary: List the current user's organizations
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/OrganizationList"
        listUserOrgs(ctx, ctx.User, true)
 }
 
 // ListUserOrgs list user's orgs
-// see https://github.com/gogits/go-gogs-client/wiki/Organizations#list-user-organizations
 func ListUserOrgs(ctx *context.APIContext) {
+       // swagger:operation GET /user/{username}/orgs organization orgListUserOrgs
+       // ---
+       // summary: List a user's organizations
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user
+       //   type: string
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/OrganizationList"
        u := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -43,14 +62,46 @@ func ListUserOrgs(ctx *context.APIContext) {
 }
 
 // Get get an organization
-// see https://github.com/gogits/go-gogs-client/wiki/Organizations#get-an-organization
 func Get(ctx *context.APIContext) {
+       // swagger:operation GET /orgs/{org} organization orgGet
+       // ---
+       // summary: Get an organization
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization to get
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Organization"
        ctx.JSON(200, convert.ToOrganization(ctx.Org.Organization))
 }
 
 // Edit change an organization's information
-// see https://github.com/gogits/go-gogs-client/wiki/Organizations#edit-an-organization
 func Edit(ctx *context.APIContext, form api.EditOrgOption) {
+       // swagger:operation PATCH /orgs/{org} organization orgEdit
+       // ---
+       // summary: Edit an organization
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization to edit
+       //   type: string
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditOrgOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Organization"
        org := ctx.Org.Organization
        org.FullName = form.FullName
        org.Description = form.Description
index dbd6ccc460c76b129aa204fabf04a4c45c358111..eead7dd8fd52606382986a342c6186e5de13483f 100644 (file)
@@ -15,6 +15,20 @@ import (
 
 // ListTeams list all the teams of an organization
 func ListTeams(ctx *context.APIContext) {
+       // swagger:operation GET /orgs/{org}/teams organization orgListTeams
+       // ---
+       // summary: List an organization's teams
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/TeamList"
        org := ctx.Org.Organization
        if err := org.GetTeams(); err != nil {
                ctx.Error(500, "GetTeams", err)
@@ -30,11 +44,45 @@ func ListTeams(ctx *context.APIContext) {
 
 // GetTeam api for get a team
 func GetTeam(ctx *context.APIContext) {
+       // swagger:operation GET /teams/{id} organization orgGetTeam
+       // ---
+       // summary: Get a team
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Team"
        ctx.JSON(200, convert.ToTeam(ctx.Org.Team))
 }
 
 // CreateTeam api for create a team
 func CreateTeam(ctx *context.APIContext, form api.CreateTeamOption) {
+       // swagger:operation POST /orgs/{org}/teams organization orgCreateTeam
+       // ---
+       // summary: Create a team
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateTeamOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Team"
        team := &models.Team{
                OrgID:       ctx.Org.Organization.ID,
                Name:        form.Name,
@@ -55,6 +103,26 @@ func CreateTeam(ctx *context.APIContext, form api.CreateTeamOption) {
 
 // EditTeam api for edit a team
 func EditTeam(ctx *context.APIContext, form api.EditTeamOption) {
+       // swagger:operation PATCH /teams/{id} organization orgEditTeam
+       // ---
+       // summary: Edit a team
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team to edit
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditTeamOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Team"
        team := &models.Team{
                ID:          ctx.Org.Team.ID,
                OrgID:       ctx.Org.Team.OrgID,
@@ -71,6 +139,20 @@ func EditTeam(ctx *context.APIContext, form api.EditTeamOption) {
 
 // DeleteTeam api for delete a team
 func DeleteTeam(ctx *context.APIContext) {
+       // swagger:operation DELETE /teams/{id} organization orgDeleteTeam
+       // ---
+       // summary: Delete a team
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     description: team deleted
+       //     schema:
+       //       "$ref": "#/responses/empty"
        if err := models.DeleteTeam(ctx.Org.Team); err != nil {
                ctx.Error(500, "DeleteTeam", err)
                return
@@ -80,6 +162,20 @@ func DeleteTeam(ctx *context.APIContext) {
 
 // GetTeamMembers api for get a team's members
 func GetTeamMembers(ctx *context.APIContext) {
+       // swagger:operation GET /teams/{id}/members organization orgListTeamMembers
+       // ---
+       // summary: List a team's members
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/UserList"
        if !models.IsOrganizationMember(ctx.Org.Team.OrgID, ctx.User.ID) {
                ctx.Status(404)
                return
@@ -98,6 +194,25 @@ func GetTeamMembers(ctx *context.APIContext) {
 
 // AddTeamMember api for add a member to a team
 func AddTeamMember(ctx *context.APIContext) {
+       // swagger:operation PUT /teams/{id}/members/{username} organization orgAddTeamMember
+       // ---
+       // summary: Add a team member
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team
+       //   type: integer
+       //   required: true
+       // - name: username
+       //   in: path
+       //   description: username of the user to add
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        u := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -111,6 +226,25 @@ func AddTeamMember(ctx *context.APIContext) {
 
 // RemoveTeamMember api for remove one member from a team
 func RemoveTeamMember(ctx *context.APIContext) {
+       // swagger:operation DELETE /teams/{id}/members/{username} organization orgAddTeamMember
+       // ---
+       // summary: Remove a team member
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team
+       //   type: integer
+       //   required: true
+       // - name: username
+       //   in: path
+       //   description: username of the user to remove
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        u := user.GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -125,6 +259,20 @@ func RemoveTeamMember(ctx *context.APIContext) {
 
 // GetTeamRepos api for get a team's repos
 func GetTeamRepos(ctx *context.APIContext) {
+       // swagger:operation GET /teams/{id}/repos organization orgListTeamRepos
+       // ---
+       // summary: List a team's repos
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/RepositoryList"
        team := ctx.Org.Team
        if err := team.GetRepositories(); err != nil {
                ctx.Error(500, "GetTeamRepos", err)
@@ -157,6 +305,30 @@ func getRepositoryByParams(ctx *context.APIContext) *models.Repository {
 
 // AddTeamRepository api for adding a repository to a team
 func AddTeamRepository(ctx *context.APIContext) {
+       // swagger:operation PUT /teams/{id}/repos/{org}/{repo} organization orgAddTeamMember
+       // ---
+       // summary: Add a repository to a team
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team
+       //   type: integer
+       //   required: true
+       // - name: org
+       //   in: path
+       //   description: organization that owns the repo to add
+       //   type: string
+       //   required: true
+       // - name: repo
+       //   in: path
+       //   description: name of the repo to add
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        repo := getRepositoryByParams(ctx)
        if ctx.Written() {
                return
@@ -177,6 +349,32 @@ func AddTeamRepository(ctx *context.APIContext) {
 
 // RemoveTeamRepository api for removing a repository from a team
 func RemoveTeamRepository(ctx *context.APIContext) {
+       // swagger:operation DELETE /teams/{id}/repos/{org}/{repo} organization orgAddTeamMember
+       // ---
+       // summary: Remove a repository from a team
+       // description: This does not delete the repository, it only removes the
+       //              repository from the team.
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the team
+       //   type: integer
+       //   required: true
+       // - name: org
+       //   in: path
+       //   description: organization that owns the repo to remove
+       //   type: string
+       //   required: true
+       // - name: repo
+       //   in: path
+       //   description: name of the repo to remove
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        repo := getRepositoryByParams(ctx)
        if ctx.Written() {
                return
index aed630f558830a2b3e7466d54f84e63c1021a96a..a82527e6a7b87a162eb217fe8e231f20a197a9e0 100644 (file)
@@ -13,8 +13,31 @@ import (
 )
 
 // GetBranch get a branch of a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories#get-branch
 func GetBranch(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/branches/{branch} repository repoGetBranch
+       // ---
+       // summary: List a repository's branches
+       // 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: branch
+       //   in: path
+       //   description: branch to get
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Branch"
        if ctx.Repo.TreePath != "" {
                // if TreePath != "", then URL contained extra slashes
                // (i.e. "master/subbranch" instead of "master"), so branch does
@@ -42,8 +65,26 @@ func GetBranch(ctx *context.APIContext) {
 }
 
 // ListBranches list all the branches of a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories#list-branches
 func ListBranches(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/branches repository repoListBranches
+       // ---
+       // summary: List a repository's branches
+       // 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/BranchList"
        branches, err := ctx.Repo.Repository.GetBranches()
        if err != nil {
                ctx.Error(500, "GetBranches", err)
index 31cb9c6b21fd5510d55cba65d2bf1d1a115852a3..f35de08e50cff15e250970ae108bdbeaa66c5201 100644 (file)
@@ -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
index 9d12a6e136c48ca5334e2c20e8dc39f4b9091029..4ea81255afbc0ca34943bb09bcc235e10487b85a 100644 (file)
@@ -13,8 +13,30 @@ import (
 )
 
 // GetRawFile get a file by path on a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories-Contents#download-raw-content
 func GetRawFile(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/raw/{filepath} repository repoGetRawFile
+       // ---
+       // summary: Get a file 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: filepath
+       //   in: path
+       //   description: filepath of the file to get
+       //   type: string
+       //   required: true
+       // responses:
+       //       200:
        if !ctx.Repo.HasAccess() {
                ctx.Status(404)
                return
@@ -40,8 +62,30 @@ func GetRawFile(ctx *context.APIContext) {
 }
 
 // GetArchive get archive of a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories-Contents#download-archive
 func GetArchive(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/archive/{filepath} repository repoGetArchive
+       // ---
+       // summary: Get an archive 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: archive
+       //   in: path
+       //   description: archive to download, consisting of a git reference and archive
+       //   type: string
+       //   required: true
+       // responses:
+       //       200:
        repoPath := models.RepoPath(ctx.Params(":username"), ctx.Params(":reponame"))
        gitRepo, err := git.OpenRepository(repoPath)
        if err != nil {
@@ -55,6 +99,29 @@ func GetArchive(ctx *context.APIContext) {
 
 // GetEditorconfig get editor config of a repository
 func GetEditorconfig(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/editorconfig/{filepath} repository repoGetEditorConfig
+       // ---
+       // summary: Get the EditorConfig definitions of a file in 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: filepath
+       //   in: path
+       //   description: filepath of file to get
+       //   type: string
+       //   required: true
+       // responses:
+       //       200:
        ec, err := ctx.Repo.GetEditorconfig()
        if err != nil {
                if git.IsErrNotExist(err) {
index 2f3addf69220c95b07775aff50d2d23fe1287581..90301cc35e1017d10e21961a228685bd5ef90a01 100644 (file)
@@ -14,15 +14,25 @@ import (
 
 // ListForks list a repository's forks
 func ListForks(ctx *context.APIContext) {
-       // swagger:route GET /repos/{owner}/{repo}/forks repository listForks
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: RepositoryList
-       //       500: error
-
+       // swagger:operation GET /repos/{owner}/{repo}/forks repository listForks
+       // ---
+       // summary: List a repository's forks
+       // 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/RepositoryList"
        forks, err := ctx.Repo.Repository.GetForks()
        if err != nil {
                ctx.Error(500, "GetForks", err)
@@ -42,17 +52,29 @@ 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 repository createFork
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       202: Repository
-       //       403: forbidden
-       //       422: validationError
-       //       500: error
-
+       // swagger:operation POST /repos/{owner}/{repo}/forks repository createFork
+       // ---
+       // summary: Fork a repository
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: owner
+       //   in: path
+       //   description: owner of the repo to fork
+       //   type: string
+       //   required: true
+       // - name: repo
+       //   in: path
+       //   description: name of the repo to fork
+       //   type: string
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateForkOption"
+       // responses:
+       //   "202":
+       //     "$ref": "#/responses/Repository"
        repo := ctx.Repo.Repository
        var forker *models.User // user/org that will own the fork
        if form.Organization == nil {
index 72dfeff3d071171c33de09ec71036b8362286a44..2464cc7bd768311d89ae9a70dcd35fd307110ece 100644 (file)
@@ -15,15 +15,25 @@ import (
 
 // ListHooks list all hooks of a repository
 func ListHooks(ctx *context.APIContext) {
-       // swagger:route GET /repos/{username}/{reponame}/hooks repository repoListHooks
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: HookList
-       //       500: error
-
+       // swagger:operation GET /repos/{owner}/{repo}/hooks repository repoListHooks
+       // ---
+       // summary: List the hooks in 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
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/HookList"
        hooks, err := models.GetWebhooksByRepoID(ctx.Repo.Repository.ID)
        if err != nil {
                ctx.Error(500, "GetWebhooksByRepoID", err)
@@ -39,6 +49,30 @@ func ListHooks(ctx *context.APIContext) {
 
 // GetHook get a repo's hook by id
 func GetHook(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/hooks/{id} repository repoGetHook
+       // ---
+       // summary: Get a hook
+       // 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: id
+       //   in: path
+       //   description: id of the hook to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Hook"
        repo := ctx.Repo
        hookID := ctx.ParamsInt64(":id")
        hook, err := utils.GetRepoHook(ctx, repo.Repository.ID, hookID)
@@ -50,19 +84,31 @@ 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 repository repoCreateHook
-       //
-       //     Consumes:
-       //     - application/json
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: Hook
-       //       422: validationError
-       //       500: error
-
+       // swagger:operation POST /repos/{owner}/{repo}/hooks repository repoCreateHook
+       // ---
+       // summary: Create a hook
+       // consumes:
+       // - application/json
+       // 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateHookOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Hook"
        if !utils.CheckCreateHookOption(ctx, &form) {
                return
        }
@@ -71,32 +117,61 @@ 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} repository repoEditHook
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: Hook
-       //       422: validationError
-       //       500: error
-
+       // swagger:operation PATCH /repos/{owner}/{repo}/hooks/{id} repository repoEditHook
+       // ---
+       // summary: Edit a hook in 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditHookOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Hook"
        hookID := ctx.ParamsInt64(":id")
        utils.EditRepoHook(ctx, &form, hookID)
 }
 
 // DeleteHook delete a hook of a repository
 func DeleteHook(ctx *context.APIContext) {
-       // swagger:route DELETE /repos/{username}/{reponame}/hooks/{id} repository repoDeleteHook
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       204: empty
-       //       404: notFound
-       //       500: error
-
+       // swagger:operation DELETE /repos/{user}/{repo}/hooks/{id} repository repoDeleteHook
+       // ---
+       // summary: Delete a hook in 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: id
+       //   in: path
+       //   description: id of the hook to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
+       //   "404":
+       //     "$ref": "#/responses/notFound"
        if err := models.DeleteWebhookByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil {
                if models.IsErrWebhookNotExist(err) {
                        ctx.Status(404)
index 2debe67c3b67c016a091f1deb095012ed6c024cf..08815ee07458119c1cb19fa0679ba658f2d4506e 100644 (file)
@@ -18,6 +18,33 @@ import (
 
 // ListIssues list the issues of a repository
 func ListIssues(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/issues issue issueListIssues
+       // ---
+       // summary: List a repository's issues
+       // 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: state
+       //   in: query
+       //   description: whether issue is open or closed
+       //   type: string
+       // - name: page
+       //   in: query
+       //   description: page number of requested issues
+       //   type: integer
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/IssueList"
        var isClosed util.OptionalBool
        switch ctx.Query("state") {
        case "closed":
@@ -50,6 +77,30 @@ func ListIssues(ctx *context.APIContext) {
 
 // GetIssue get an issue of a repository
 func GetIssue(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/issues/{id} issue issueGetIssue
+       // ---
+       // summary: Get an issue by id
+       // 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: id
+       //   in: path
+       //   description: id of the issue to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Issue"
        issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                if models.IsErrIssueNotExist(err) {
@@ -64,6 +115,31 @@ func GetIssue(ctx *context.APIContext) {
 
 // CreateIssue create an issue of a repository
 func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
+       // swagger:operation POST /repos/{owner}/{repo}/issues issue issueCreateIssue
+       // ---
+       // summary: Create an issue
+       // consumes:
+       // - application/json
+       // 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateIssueOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Issue"
        issue := &models.Issue{
                RepoID:   ctx.Repo.Repository.ID,
                Title:    form.Title,
@@ -114,6 +190,36 @@ func CreateIssue(ctx *context.APIContext, form api.CreateIssueOption) {
 
 // EditIssue modify an issue of a repository
 func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
+       // swagger:operation PATCH /repos/{owner}/{repo}/issues/{id} issue issueEditIssue
+       // ---
+       // summary: Edit an issue
+       // consumes:
+       // - application/json
+       // 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: id
+       //   in: path
+       //   description: id of the issue to edit
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditIssueOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Issue"
        issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                if models.IsErrIssueNotExist(err) {
index b57511a2deffa6d867b7e36716eaffcfdab19cb9..f0b0353d1b4c643e872f0c93aec66c2d099f0f1c 100644 (file)
@@ -15,6 +15,34 @@ import (
 
 // ListIssueComments list all the comments of an issue
 func ListIssueComments(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/issue/{index}/comments issue issueGetComments
+       // ---
+       // summary: List all comments on an issue
+       // 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: id
+       //   in: path
+       //   description: index of the issue
+       //   type: integer
+       //   required: true
+       // - name: string
+       //   in: query
+       //   description: if provided, only comments updated since the specified time are returned.
+       //   type: string
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/CommentList"
        var since time.Time
        if len(ctx.Query("since")) > 0 {
                since, _ = time.Parse(time.RFC3339, ctx.Query("since"))
@@ -44,8 +72,31 @@ func ListIssueComments(ctx *context.APIContext) {
        ctx.JSON(200, &apiComments)
 }
 
-// ListRepoIssueComments returns all issue-comments for an issue
+// ListRepoIssueComments returns all issue-comments for a repo
 func ListRepoIssueComments(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/issues/comments issue issueGetRepoComments
+       // ---
+       // summary: List all comments in 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: string
+       //   in: query
+       //   description: if provided, only comments updated since the provided time are returned.
+       //   type: string
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/CommentList"
        var since time.Time
        if len(ctx.Query("since")) > 0 {
                since, _ = time.Parse(time.RFC3339, ctx.Query("since"))
@@ -70,6 +121,36 @@ func ListRepoIssueComments(ctx *context.APIContext) {
 
 // CreateIssueComment create a comment for an issue
 func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOption) {
+       // swagger:operation POST /repos/{owner}/{repo}/issues/{index}/comments issue issueCreateComment
+       // ---
+       // summary: Add a comment to an issue
+       // consumes:
+       // - application/json
+       // 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: id
+       //   in: path
+       //   description: index of the issue
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateIssueOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Comment"
        issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                ctx.Error(500, "GetIssueByIndex", err)
@@ -87,6 +168,36 @@ func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOpti
 
 // EditIssueComment modify a comment of an issue
 func EditIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption) {
+       // swagger:operation PATCH /repos/{owner}/{repo}/comments/{id} issue issueEditComment
+       // ---
+       // summary: Edit a comment
+       // consumes:
+       // - application/json
+       // 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: id
+       //   in: path
+       //   description: id of the comment to edit
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditIssueCommentOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Comment"
        comment, err := models.GetCommentByID(ctx.ParamsInt64(":id"))
        if err != nil {
                if models.IsErrCommentNotExist(err) {
@@ -115,6 +226,28 @@ func EditIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
 
 // DeleteIssueComment delete a comment from an issue
 func DeleteIssueComment(ctx *context.APIContext) {
+       // swagger:operation DELETE /repos/{owner}/{repo}/comments/{id} issue issueDeleteComment
+       // ---
+       // summary: Delete a comment
+       // 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: id
+       //   in: path
+       //   description: id of comment to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        comment, err := models.GetCommentByID(ctx.ParamsInt64(":id"))
        if err != nil {
                if models.IsErrCommentNotExist(err) {
index 2eec743e7029a29c9f0cd5119156e799869591fb..fde919e506d57641a17bdf3f48ec182360bb0780 100644 (file)
@@ -13,6 +13,32 @@ import (
 
 // ListIssueLabels list all the labels of an issue
 func ListIssueLabels(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/issues/{index}/labels issue issueGetLabels
+       // ---
+       // summary: Get an issue's labels
+       // 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: index
+       //   in: path
+       //   description: index of the issue
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/LabelList"
+       //   "404":
+       //     "$ref": "#/responses/notFound"
        issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                if models.IsErrIssueNotExist(err) {
@@ -32,6 +58,36 @@ func ListIssueLabels(ctx *context.APIContext) {
 
 // AddIssueLabels add labels for an issue
 func AddIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
+       // swagger:operation POST /repos/{owner}/{repo}/issue/{index}/labels issue issueAddLabel
+       // ---
+       // summary: Add a label to an issue
+       // consumes:
+       // - application/json
+       // 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: index
+       //   in: path
+       //   description: index of the issue
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/IssueLabelsOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/LabelList"
        if !ctx.Repo.IsWriter() {
                ctx.Status(403)
                return
@@ -73,6 +129,35 @@ func AddIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
 
 // DeleteIssueLabel delete a label for an issue
 func DeleteIssueLabel(ctx *context.APIContext) {
+       // swagger:operation DELETE /repos/{owner}/{repo}/issue/{index}/labels/{id} issue issueRemoveLabel
+       // ---
+       // summary: Remove a label from an issue
+       // 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: index
+       //   in: path
+       //   description: index of the issue
+       //   type: integer
+       //   required: true
+       // - name: id
+       //   in: path
+       //   description: id of the label to remove
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        if !ctx.Repo.IsWriter() {
                ctx.Status(403)
                return
@@ -108,6 +193,36 @@ func DeleteIssueLabel(ctx *context.APIContext) {
 
 // ReplaceIssueLabels replace labels for an issue
 func ReplaceIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
+       // swagger:operation PUT /repos/{owner}/{repo}/issue/{index}/labels issue issueReplaceLabels
+       // ---
+       // summary: Replace an issue's labels
+       // consumes:
+       // - application/json
+       // 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: index
+       //   in: path
+       //   description: index of the issue
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/IssueLabelsOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/LabelList"
        if !ctx.Repo.IsWriter() {
                ctx.Status(403)
                return
@@ -149,6 +264,30 @@ func ReplaceIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
 
 // ClearIssueLabels delete all the labels for an issue
 func ClearIssueLabels(ctx *context.APIContext) {
+       // swagger:operation DELETE /repos/{owner}/{repo}/issue/{index}/labels issue issueClearLabels
+       // ---
+       // summary: Remove all labels from an issue
+       // 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: index
+       //   in: path
+       //   description: index of the issue
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        if !ctx.Repo.IsWriter() {
                ctx.Status(403)
                return
index 3962a7b0e281b5525bd6882bbc4127f364c8edf6..15d898d5d54e1c3d8e2c5700fdeab79804c17de6 100644 (file)
@@ -20,15 +20,30 @@ func trackedTimesToAPIFormat(trackedTimes []*models.TrackedTime) []*api.TrackedT
 
 // ListTrackedTimes list all the tracked times of an issue
 func ListTrackedTimes(ctx *context.APIContext) {
-       // swagger:route GET /repos/{username}/{reponame}/issues/{issue}/times repository issueTrackedTimes
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: TrackedTimes
-       //       404: error
-       //       500: error
+       // swagger:operation GET /repos/{owner}/{repo}/issues/{index}/times issue issueTrackedTimes
+       // ---
+       // summary: List an issue's tracked times
+       // 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: repo
+       //   in: path
+       //   description: index of the issue
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/TrackedTimeList"
        if !ctx.Repo.Repository.IsTimetrackerEnabled() {
                ctx.Error(404, "IsTimetrackerEnabled", "Timetracker is diabled")
                return
@@ -54,17 +69,40 @@ func ListTrackedTimes(ctx *context.APIContext) {
 
 // AddTime adds time manual to the given issue
 func AddTime(ctx *context.APIContext, form api.AddTimeOption) {
-       // swagger:route Post /repos/{username}/{reponame}/issues/{issue}/times repository addTime
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: TrackedTime
-       //       400: error
-       //       403: error
-       //       404: error
-       //       500: error
+       // swagger:operation Post /repos/{owner}/{repo}/issues/{index}/times issue issueAddTime
+       // ---
+       // summary: Add a tracked time to a issue
+       // consumes:
+       // - application/json
+       // 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: id
+       //   in: path
+       //   description: index of the issue to add tracked time to
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/AddTimeOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/TrackedTime"
+       //   "400":
+       //     "$ref": "#/responses/error"
+       //   "403":
+       //     "$ref": "#/responses/error"
        issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                if models.IsErrIssueNotExist(err) {
@@ -93,16 +131,30 @@ func AddTime(ctx *context.APIContext, form api.AddTimeOption) {
 
 // ListTrackedTimesByUser  lists all tracked times of the user
 func ListTrackedTimesByUser(ctx *context.APIContext) {
-       // swagger:route GET /repos/{username}/{reponame}/times/{timetrackingusername} user userTrackedTimes
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: TrackedTimes
-       //       400: error
-       //       404: error
-       //       500: error
+       // swagger:operation GET /repos/{owner}/{repo}/times/{tracker} user userTrackedTimes
+       // ---
+       // summary: List a user's tracked times in a repo
+       // 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: user
+       //   in: path
+       //   description: username of user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/TrackedTimeList"
        if !ctx.Repo.Repository.IsTimetrackerEnabled() {
                ctx.JSON(400, struct{ Message string }{Message: "time tracking disabled"})
                return
@@ -131,17 +183,27 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
        ctx.JSON(200, &apiTrackedTimes)
 }
 
-// ListTrackedTimesByRepository lists all tracked times of the user
+// ListTrackedTimesByRepository lists all tracked times of the repository
 func ListTrackedTimesByRepository(ctx *context.APIContext) {
-       // swagger:route GET /repos/{username}/{reponame}/times repository repoTrackedTimes
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: TrackedTimes
-       //       400: error
-       //       500: error
+       // swagger:operation GET /repos/{owner}/{repo}/times repository repoTrackedTimes
+       // ---
+       // summary: List a repo's tracked times
+       // 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/TrackedTimeList"
        if !ctx.Repo.Repository.IsTimetrackerEnabled() {
                ctx.JSON(400, struct{ Message string }{Message: "time tracking disabled"})
                return
@@ -158,14 +220,14 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
 
 // ListMyTrackedTimes lists all tracked times of the current user
 func ListMyTrackedTimes(ctx *context.APIContext) {
-       // swagger:route GET /user/times user userTrackedTimes
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: TrackedTimes
-       //       500: error
+       // swagger:operation GET /user/times user userCurrentTrackedTimes
+       // ---
+       // summary: List the current user's tracked times
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/TrackedTimeList"
        trackedTimes, err := models.GetTrackedTimes(models.FindTrackedTimesOptions{UserID: ctx.User.ID})
        if err != nil {
                ctx.Error(500, "GetTrackedTimesByUser", err)
index 546cc40e6116f6102e8c70ccf63594879dc46e66..a20f4c829e544ef5c80fe14df368376ca060eb81 100644 (file)
@@ -20,8 +20,26 @@ func composeDeployKeysAPILink(repoPath string) string {
 }
 
 // ListDeployKeys list all the deploy keys of a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#list-deploy-keys
 func ListDeployKeys(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/keys repository repoListKeys
+       // ---
+       // summary: List a repository's keys
+       // 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/DeployKeyList"
        keys, err := models.ListDeployKeys(ctx.Repo.Repository.ID)
        if err != nil {
                ctx.Error(500, "ListDeployKeys", err)
@@ -42,8 +60,31 @@ func ListDeployKeys(ctx *context.APIContext) {
 }
 
 // GetDeployKey get a deploy key by id
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#get-a-deploy-key
 func GetDeployKey(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/keys/{id} repository repoGetKey
+       // ---
+       // summary: Get a repository's key by id
+       // 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: id
+       //   in: path
+       //   description: id of the key to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/DeployKey"
        key, err := models.GetDeployKeyByID(ctx.ParamsInt64(":id"))
        if err != nil {
                if models.IsErrDeployKeyNotExist(err) {
@@ -85,8 +126,32 @@ func HandleAddKeyError(ctx *context.APIContext, err error) {
 }
 
 // CreateDeployKey create deploy key for a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#add-a-new-deploy-key
 func CreateDeployKey(ctx *context.APIContext, form api.CreateKeyOption) {
+       // swagger:operation POST /repos/{owner}/{repo}/keys repository repoCreateKey
+       // ---
+       // summary: Add a key to a repository
+       // consumes:
+       // - application/json
+       // 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateKeyOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/DeployKey"
        content, err := models.CheckPublicKeyString(form.Key)
        if err != nil {
                HandleCheckKeyStringError(ctx, err)
@@ -105,8 +170,29 @@ func CreateDeployKey(ctx *context.APIContext, form api.CreateKeyOption) {
 }
 
 // DeleteDeploykey delete deploy key for a repository
-// see https://github.com/gogits/go-gogs-client/wiki/Repositories-Deploy-Keys#remove-a-deploy-key
 func DeleteDeploykey(ctx *context.APIContext) {
+       // swagger:operation DELETE /repos/{owner}/{repo}/keys/{id} repository repoDeleteKey
+       // ---
+       // summary: Delete a key from a repository
+       // 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: id
+       //   in: path
+       //   description: id of the key to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        if err := models.DeleteDeployKey(ctx.User, ctx.ParamsInt64(":id")); err != nil {
                if models.IsErrKeyAccessDenied(err) {
                        ctx.Error(403, "", "You do not have access to this key")
index c932fb15851e203b92442a05f78ea6eaeae30447..cb724c718223d22309a83af3c4742fe2801338ca 100644 (file)
@@ -15,6 +15,25 @@ import (
 
 // ListLabels list all the labels of a repository
 func ListLabels(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/labels issue issueListLabels
+       // ---
+       // summary: Get all of a repository's labels
+       // 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/LabelList"
        labels, err := models.GetLabelsByRepoID(ctx.Repo.Repository.ID, ctx.Query("sort"))
        if err != nil {
                ctx.Error(500, "GetLabelsByRepoID", err)
@@ -30,6 +49,30 @@ func ListLabels(ctx *context.APIContext) {
 
 // GetLabel get label by repository and label id
 func GetLabel(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/labels/{id} issue issueGetLabel
+       // ---
+       // summary: Get a single label
+       // 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: id
+       //   in: path
+       //   description: id of the label to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Label"
        var (
                label *models.Label
                err   error
@@ -54,6 +97,31 @@ func GetLabel(ctx *context.APIContext) {
 
 // CreateLabel create a label for a repository
 func CreateLabel(ctx *context.APIContext, form api.CreateLabelOption) {
+       // swagger:operation POST /repos/{owner}/{repo}/labels issue issueCreateLabel
+       // ---
+       // summary: Create a label
+       // consumes:
+       // - application/json
+       // 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateLabelOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Label"
        if !ctx.Repo.IsWriter() {
                ctx.Status(403)
                return
@@ -73,6 +141,36 @@ func CreateLabel(ctx *context.APIContext, form api.CreateLabelOption) {
 
 // EditLabel modify a label for a repository
 func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
+       // swagger:operation PATCH /repos/{owner}/{repo}/labels/{id} issue issueEditLabel
+       // ---
+       // summary: Update a label
+       // consumes:
+       // - application/json
+       // 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: id
+       //   in: path
+       //   description: id of the label to edit
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditLabelOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Label"
        if !ctx.Repo.IsWriter() {
                ctx.Status(403)
                return
@@ -103,6 +201,28 @@ func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
 
 // DeleteLabel delete a label for a repository
 func DeleteLabel(ctx *context.APIContext) {
+       // swagger:operation DELETE /repos/{owner}/{repo}/labels/{id} issue issueDeleteLabel
+       // ---
+       // summary: Delete a label
+       // 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: id
+       //   in: path
+       //   description: id of the label to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        if !ctx.Repo.IsWriter() {
                ctx.Status(403)
                return
index ef32ed898919b488d80e5392e4e15dc6820456bb..0e597a9db081a02b94fdd167f94399174309c410 100644 (file)
@@ -15,6 +15,14 @@ import (
 
 // ListMilestones list all the milestones for a repository
 func ListMilestones(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/milestones/{id} issue issueGetMilestone
+       // ---
+       // summary: Get a milestone
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Milestone"
        milestones, err := models.GetMilestonesByRepoID(ctx.Repo.Repository.ID)
        if err != nil {
                ctx.Error(500, "GetMilestonesByRepoID", err)
@@ -30,6 +38,41 @@ func ListMilestones(ctx *context.APIContext) {
 
 // GetMilestone get a milestone for a repository
 func GetMilestone(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/milestones issue issueGetMilestones
+       // ---
+       // summary: Get all of a repository's milestones
+       // 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
+       // 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: id
+       //   in: path
+       //   description: id of the milestone to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/MilestoneList"
        milestone, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
        if err != nil {
                if models.IsErrMilestoneNotExist(err) {
@@ -44,6 +87,31 @@ func GetMilestone(ctx *context.APIContext) {
 
 // CreateMilestone create a milestone for a repository
 func CreateMilestone(ctx *context.APIContext, form api.CreateMilestoneOption) {
+       // swagger:operation POST /repos/{owner}/{repo}/milestones issue issueCreateMilestone
+       // ---
+       // summary: Create a milestone
+       // consumes:
+       // - application/json
+       // 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateMilestoneOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Milestone"
        if form.Deadline == nil {
                defaultDeadline, _ := time.ParseInLocation("2006-01-02", "9999-12-31", time.Local)
                form.Deadline = &defaultDeadline
@@ -65,6 +133,31 @@ func CreateMilestone(ctx *context.APIContext, form api.CreateMilestoneOption) {
 
 // EditMilestone modify a milestone for a repository
 func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) {
+       // swagger:operation PATCH /repos/{owner}/{repo}/milestones/{id} issue issueEditMilestone
+       // ---
+       // summary: Update a milestone
+       // consumes:
+       // - application/json
+       // 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditMilestoneOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Milestone"
        milestone, err := models.GetMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id"))
        if err != nil {
                if models.IsErrMilestoneNotExist(err) {
@@ -94,6 +187,28 @@ func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) {
 
 // DeleteMilestone delete a milestone for a repository
 func DeleteMilestone(ctx *context.APIContext) {
+       // swagger:operation DELETE /repos/{owner}/{repo}/milestones/{id} issue issueDeleteMilestone
+       // ---
+       // summary: Delete a milestone
+       // 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: body
+       //   in: path
+       //   description: id of the milestone to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        if err := models.DeleteMilestoneByRepoID(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil {
                ctx.Error(500, "DeleteMilestoneByRepoID", err)
                return
index d1b73c6cf72be5f721e57a556307c922f536613f..50b864e32348a219bbe3e653ef5079a09a0dbff1 100644 (file)
@@ -18,6 +18,25 @@ import (
 
 // ListPullRequests returns a list of all PRs
 func ListPullRequests(ctx *context.APIContext, form api.ListPullRequestsOptions) {
+       // swagger:operation GET /repos/{owner}/{repo}/pulls repository repoListPullRequests
+       // ---
+       // summary: List a repo's pull requests
+       // 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/PullRequestList"
        prs, maxResults, err := models.PullRequests(ctx.Repo.Repository.ID, &models.PullRequestsOptions{
                Page:        ctx.QueryInt("page"),
                State:       ctx.QueryTrim("state"),
@@ -58,6 +77,30 @@ func ListPullRequests(ctx *context.APIContext, form api.ListPullRequestsOptions)
 
 // GetPullRequest returns a single PR based on index
 func GetPullRequest(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/pulls/{index} repository repoGetPullRequest
+       // ---
+       // summary: Get a pull request
+       // 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: index
+       //   in: path
+       //   description: index of the pull request to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/PullRequest"
        pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                if models.IsErrPullRequestNotExist(err) {
@@ -81,6 +124,31 @@ func GetPullRequest(ctx *context.APIContext) {
 
 // CreatePullRequest does what it says
 func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption) {
+       // swagger:operation POST /repos/{owner}/{repo}/pulls repository repoCreatePullRequest
+       // ---
+       // summary: Create a pull request
+       // consumes:
+       // - application/json
+       // 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreatePullRequestOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/PullRequest"
        var (
                repo        = ctx.Repo.Repository
                labelIDs    []int64
@@ -204,6 +272,36 @@ func CreatePullRequest(ctx *context.APIContext, form api.CreatePullRequestOption
 
 // EditPullRequest does what it says
 func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
+       // swagger:operation PATCH /repos/{owner}/{repo}/pulls/{index} repository repoEditPullRequest
+       // ---
+       // summary: Update a pull request
+       // consumes:
+       // - application/json
+       // 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: index
+       //   in: path
+       //   description: index of the pull request to edit
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditPullRequestOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/PullRequest"
        pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                if models.IsErrPullRequestNotExist(err) {
@@ -283,13 +381,42 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
                return
        }
 
+       // TODO this should be 200, not 201
        ctx.JSON(201, pr.APIFormat())
 }
 
 // IsPullRequestMerged checks if a PR exists given an index
-//  - Returns 204 if it exists
-//    Otherwise 404
 func IsPullRequestMerged(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/pulls/{index}/merge repository repoPullRequestIsMerged
+       // ---
+       // summary: Check if a pull request has been merged
+       // 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: index
+       //   in: path
+       //   description: index of the pull request
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     description: pull request has been merged
+       //     schema:
+       //       "$ref": "#/responses/empty"
+       //   "404":
+       //     description: pull request has not been merged
+       //     schema:
+       //       "$ref": "#/responses/empty"
        pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                if models.IsErrPullRequestNotExist(err) {
@@ -308,6 +435,32 @@ func IsPullRequestMerged(ctx *context.APIContext) {
 
 // MergePullRequest merges a PR given an index
 func MergePullRequest(ctx *context.APIContext) {
+       // swagger:operation POST /repos/{owner}/{repo}/pulls/{index}/merge repository repoMergePullRequest
+       // ---
+       // summary: Merge a pull request
+       // 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: index
+       //   in: path
+       //   description: index of the pull request to merge
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/empty"
+       //   "405":
+       //     "$ref": "#/responses/empty"
        pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
        if err != nil {
                if models.IsErrPullRequestNotExist(err) {
index 78289a6a2aa4d5fd1dbecd8e14a29b7929a77465..17cddc56522243a79bed6a26ba8e4a9613fc24c6 100644 (file)
@@ -13,6 +13,30 @@ import (
 
 // GetRelease get a single release of a repository
 func GetRelease(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/releases repository repoGetRelease
+       // ---
+       // summary: Get a release
+       // 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: repo
+       //   in: path
+       //   description: id of the release to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Release"
        id := ctx.ParamsInt64(":id")
        release, err := models.GetReleaseByID(id)
        if err != nil {
@@ -32,6 +56,25 @@ func GetRelease(ctx *context.APIContext) {
 
 // ListReleases list a repository's releases
 func ListReleases(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/releases repository repoListReleases
+       // ---
+       // summary: List a repo's releases
+       // 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/ReleaseList"
        releases, err := models.GetReleasesByRepoID(ctx.Repo.Repository.ID, models.FindReleasesOptions{
                IncludeDrafts: ctx.Repo.AccessMode >= models.AccessModeWrite,
                IncludeTags:   false,
@@ -53,6 +96,31 @@ func ListReleases(ctx *context.APIContext) {
 
 // CreateRelease create a release
 func CreateRelease(ctx *context.APIContext, form api.CreateReleaseOption) {
+       // swagger:operation GET /repos/{owner}/{repo}/releases repository repoCreateRelease
+       // ---
+       // summary: Create a release
+       // consumes:
+       // - application/json
+       // 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: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateReleaseOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Release"
        if ctx.Repo.AccessMode < models.AccessModeWrite {
                ctx.Status(403)
                return
@@ -110,6 +178,36 @@ func CreateRelease(ctx *context.APIContext, form api.CreateReleaseOption) {
 
 // EditRelease edit a release
 func EditRelease(ctx *context.APIContext, form api.EditReleaseOption) {
+       // swagger:operation PATCH /repos/{owner}/{repo}/releases/{id} repository repoEditRelease
+       // ---
+       // summary: Update a release
+       // consumes:
+       // - application/json
+       // 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: id
+       //   in: path
+       //   description: id of the release to edit
+       //   type: integer
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/EditReleaseOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Release"
        if ctx.Repo.AccessMode < models.AccessModeWrite {
                ctx.Status(403)
                return
@@ -163,6 +261,28 @@ func EditRelease(ctx *context.APIContext, form api.EditReleaseOption) {
 
 // DeleteRelease delete a release from a repository
 func DeleteRelease(ctx *context.APIContext) {
+       // swagger:operation DELETE /repos/{owner}/{repo}/releases/{id} repository repoDeleteRelease
+       // ---
+       // summary: Delete a release
+       // 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: id
+       //   in: path
+       //   description: id of the release to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        if ctx.Repo.AccessMode < models.AccessModeWrite {
                ctx.Status(403)
                return
index 34f4c5fa161a217a1a9de4fda1298cb49cdd1ca4..36e644373c7ca855108f72f5dfe68072c37bca2b 100644 (file)
@@ -20,45 +20,40 @@ import (
        "code.gitea.io/gitea/routers/api/v1/convert"
 )
 
-// SearchRepoOption options when searching repositories
-// swagger:parameters repoSearch
-type SearchRepoOption struct { // TODO: Move SearchRepoOption to Gitea SDK
-       // Keyword to search
-       //
-       // in: query
-       Keyword string `json:"q"`
-       // Repository owner to search
-       //
-       // in: query
-       OwnerID int64 `json:"uid"`
-       // Limit of result
-       //
-       // maximum: setting.ExplorePagingNum
-       // in: query
-       PageSize int `json:"limit"`
-       // Type of repository to search, related to owner
-       //
-       // in: query
-       SearchMode string `json:"mode"`
-       // Search only owners repositories
-       // Has effect only if owner is provided and mode is not "collaborative"
-       //
-       // in: query
-       OwnerExclusive bool `json:"exclusive"`
-}
-
 // Search repositories via options
 func Search(ctx *context.APIContext) {
-       // swagger:route GET /repos/search repository repoSearch
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: SearchResults
-       //       422: validationError
-       //       500: SearchError
-
+       // swagger:operation GET /repos/search repository repoSearch
+       // ---
+       // summary: Search for repositories
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: q
+       //   in: query
+       //   description: keyword
+       //   type: string
+       // - name: uid
+       //   in: query
+       //   description: if provided, will return only repos owned by the user with the given id
+       //   type: integer
+       // - name: limit
+       //   in: query
+       //   description: maximum number of repos to return
+       //   type: integer
+       // - name: mode
+       //   in: query
+       //   description: type of repository to search for. Supported values are
+       //                "fork", "source", "mirror" and "collaborative"
+       //   type: string
+       // - name: exclusive
+       //   in: query
+       //   description: only search for repositories owned by the authenticated user
+       //   type: boolean
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/SearchResults"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        opts := &models.SearchRepoOptions{
                Keyword:     strings.Trim(ctx.Query("q"), " "),
                OwnerID:     ctx.QueryInt64("uid"),
@@ -187,22 +182,23 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
 
 // Create one repository of mine
 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.
+       // swagger:operation POST /user/repos repository user createCurrentUserRepo
+       // ---
+       // summary: Create a repository
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateRepoOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Repository"
        if ctx.User.IsOrganization() {
+               // Shouldn't reach this condition, but just in case.
                ctx.Error(422, "", "not allowed creating repository for organization")
                return
        }
@@ -211,20 +207,30 @@ 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 organization createOrgRepo
-       //
-       //     Consumes:
-       //     - application/json
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       201: Repository
-       //       422: validationError
-       //       403: forbidden
-       //       500: error
-
+       // swagger:operation POST /org/{org}/repos organization createOrgRepo
+       // ---
+       // summary: Create a repository in an organization
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of organization
+       //   type: string
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateRepoOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Repository"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
        org, err := models.GetOrgByName(ctx.Params(":org"))
        if err != nil {
                if models.IsErrOrgNotExist(err) {
@@ -244,19 +250,21 @@ 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 repository repoMigrate
-       //
-       //     Consumes:
-       //     - application/json
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       201: Repository
-       //       422: validationError
-       //       500: error
-
+       // swagger:operation POST /repos/migrate repository repoMigrate
+       // ---
+       // summary: Migrate a remote git repository
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/MigrateRepoForm"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/Repository"
        ctxUser := ctx.User
        // Not equal means context user is an organization,
        // or is another user/organization if current user is admin.
@@ -329,29 +337,44 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
 
 // Get one repository
 func Get(ctx *context.APIContext) {
-       // swagger:route GET /repos/{username}/{reponame} repository repoGet
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: Repository
-       //       500: error
-
+       // swagger:operation GET /repos/{owner}/{repo} repository repoGet
+       // ---
+       // summary: Get 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
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Repository"
        ctx.JSON(200, ctx.Repo.Repository.APIFormat(ctx.Repo.AccessMode))
 }
 
 // GetByID returns a single Repository
 func GetByID(ctx *context.APIContext) {
-       // swagger:route GET /repositories/{id} repository repoGetByID
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: Repository
-       //       500: error
-
+       // swagger:operation GET /repositories/{id} repository repoGetByID
+       // ---
+       // summary: Get a repository by id
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of the repo to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Repository"
        repo, err := models.GetRepositoryByID(ctx.ParamsInt64(":id"))
        if err != nil {
                if models.IsErrRepoNotExist(err) {
@@ -375,16 +398,27 @@ func GetByID(ctx *context.APIContext) {
 
 // Delete one repository
 func Delete(ctx *context.APIContext) {
-       // swagger:route DELETE /repos/{username}/{reponame} repository repoDelete
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       204: empty
-       //       403: forbidden
-       //       500: error
-
+       // swagger:operation DELETE /repos/{owner}/{repo} repository repoDelete
+       // ---
+       // summary: Delete a repository
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: owner
+       //   in: path
+       //   description: owner of the repo to delete
+       //   type: string
+       //   required: true
+       // - name: repo
+       //   in: path
+       //   description: name of the repo to delete
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
        if !ctx.Repo.IsAdmin() {
                ctx.Error(403, "", "Must have admin rights")
                return
@@ -408,15 +442,25 @@ 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 repository repoMirrorSync
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: empty
-       //       403: forbidden
-
+       // swagger:operation POST /repos/{owner}/{repo}/mirror-sync repository repoMirrorSync
+       // ---
+       // summary: Sync a mirrored repository
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: owner
+       //   in: path
+       //   description: owner of the repo to sync
+       //   type: string
+       //   required: true
+       // - name: repo
+       //   in: path
+       //   description: name of the repo to sync
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/empty"
        repo := ctx.Repo.Repository
 
        if !ctx.Repo.IsWriter() {
index 20e7e4e50879d006c9f3008ee543c41a2ac4f543..3500eaf42170ccb0ab3237476cd63cabb89076a6 100644 (file)
@@ -12,6 +12,25 @@ import (
 
 // ListStargazers list a repository's stargazers
 func ListStargazers(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/stargazers repository repoListStargazers
+       // ---
+       // summary: List a repo's stargazers
+       // 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"
        stargazers, err := ctx.Repo.Repository.GetStargazers(-1)
        if err != nil {
                ctx.Error(500, "GetStargazers", err)
index e4cc20a50b88ad9e5868e33fafb0a5c7a1772ffa..7f7ef1ae3278862ae58520dcc4d4157488be5c28 100644 (file)
@@ -14,6 +14,34 @@ import (
 
 // NewCommitStatus creates a new CommitStatus
 func NewCommitStatus(ctx *context.APIContext, form api.CreateStatusOption) {
+       // swagger:operation POST /repos/{owner}/{repo}/statuses/{sha} repository repoCreateStatus
+       // ---
+       // summary: Create a commit status
+       // 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: sha
+       //   in: path
+       //   description: sha of the commit
+       //   type: string
+       //   required: true
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateStatusOption"
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/StatusList"
        sha := ctx.Params("sha")
        if len(sha) == 0 {
                sha = ctx.Params("ref")
@@ -43,10 +71,63 @@ func NewCommitStatus(ctx *context.APIContext, form api.CreateStatusOption) {
 
 // GetCommitStatuses returns all statuses for any given commit hash
 func GetCommitStatuses(ctx *context.APIContext) {
-       sha := ctx.Params("sha")
-       if len(sha) == 0 {
-               sha = ctx.Params("ref")
-       }
+       // swagger:operation GET /repos/{owner}/{repo}/statuses/{sha} repository repoListStatuses
+       // ---
+       // summary: Get a commit's statuses
+       // 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: sha
+       //   in: path
+       //   description: sha of the commit
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/StatusList"
+       getCommitStatuses(ctx, ctx.Params("sha"))
+}
+
+// GetCommitStatusesByRef returns all statuses for any given commit ref
+func GetCommitStatusesByRef(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses repository repoListStatusesByRef
+       // ---
+       // summary: Get a commit's statuses, by branch/tag/commit reference
+       // 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: ref
+       //   in: path
+       //   description: name of branch/tag/commit
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/StatusList"
+       getCommitStatuses(ctx, ctx.Params("ref"))
+}
+
+func getCommitStatuses(ctx *context.APIContext, sha string) {
        if len(sha) == 0 {
                ctx.Error(400, "ref/sha not given", nil)
                return
@@ -78,12 +159,33 @@ type combinedCommitStatus struct {
        URL        string                   `json:"url"`
 }
 
-// GetCombinedCommitStatus returns the combined status for any given commit hash
-func GetCombinedCommitStatus(ctx *context.APIContext) {
-       sha := ctx.Params("sha")
-       if len(sha) == 0 {
-               sha = ctx.Params("ref")
-       }
+// GetCombinedCommitStatusByRef returns the combined status for any given commit hash
+func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses repository repoGetCombinedStatusByRef
+       // ---
+       // summary: Get a commit's combined status, by branch/tag/commit reference
+       // 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: ref
+       //   in: path
+       //   description: name of branch/tag/commit
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/Status"
+       sha := ctx.Params("ref")
        if len(sha) == 0 {
                ctx.Error(400, "ref/sha not given", nil)
                return
index d9d9a6c96d1a3454e5f828323de27a6bd126bdba..737ae89f01820c89a521323e859a27e948023ad6 100644 (file)
@@ -12,6 +12,25 @@ import (
 
 // ListSubscribers list a repo's subscribers (i.e. watchers)
 func ListSubscribers(ctx *context.APIContext) {
+       // swagger:operation GET /repos/{owner}/{repo}/subscribers repository repoListSubscribers
+       // ---
+       // summary: List a repo's watchers
+       // 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"
        subscribers, err := ctx.Repo.Repository.GetWatchers(0)
        if err != nil {
                ctx.Error(500, "GetWatchers", err)
diff --git a/routers/api/v1/swagger/issue.go b/routers/api/v1/swagger/issue.go
new file mode 100644 (file)
index 0000000..1ebb17b
--- /dev/null
@@ -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 swagger
+
+import (
+       api "code.gitea.io/sdk/gitea"
+)
+
+// swagger:response Issue
+type swaggerResponseIssue struct {
+       // in:body
+       Body api.Issue `json:"body"`
+}
+
+// swagger:response IssueList
+type swaggerResponseIssueList struct {
+       // in:body
+       Body []api.Issue `json:"body"`
+}
+
+// swagger:response Comment
+type swaggerResponseComment struct {
+       // in:body
+       Body api.Comment `json:"body"`
+}
+
+// swagger:response CommentList
+type swaggerResponseCommentList struct {
+       // in:body
+       Body []api.Comment `json:"body"`
+}
+
+// swagger:response Label
+type swaggerResponseLabel struct {
+       // in:body
+       Body api.Label `json:"body"`
+}
+
+// swagger:response LabelList
+type swaggerResponseLabelList struct {
+       // in:body
+       Body []api.Label `json:"body"`
+}
+
+// swagger:response Milestone
+type swaggerResponseMilestone struct {
+       // in:body
+       Body api.Milestone `json:"body"`
+}
+
+// swagger:response MilestoneList
+type swaggerResponseMilestoneList struct {
+       // in:body
+       Body []api.Milestone `json:"body"`
+}
+
+// swagger:response TrackedTime
+type swaggerResponseTrackedTime struct {
+       // in:body
+       Body api.TrackedTime `json:"body"`
+}
+
+// swagger:response TrackedTimeList
+type swaggerResponseTrackedTimeList struct {
+       // in:body
+       Body []api.TrackedTime `json:"body"`
+}
diff --git a/routers/api/v1/swagger/key.go b/routers/api/v1/swagger/key.go
new file mode 100644 (file)
index 0000000..344d54c
--- /dev/null
@@ -0,0 +1,45 @@
+// 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 swagger
+
+import (
+       api "code.gitea.io/sdk/gitea"
+)
+
+// swagger:response PublicKey
+type swaggerResponsePublicKey struct {
+       // in:body
+       Body api.PublicKey `json:"body"`
+}
+
+// swagger:response PublicKeyList
+type swaggerResponsePublicKeyList struct {
+       // in:body
+       Body []api.PublicKey `json:"body"`
+}
+
+// swagger:response GPGKey
+type swaggerResponseGPGKey struct {
+       // in:body
+       Body api.GPGKey `json:"body"`
+}
+
+// swagger:response GPGKeyList
+type swaggerResponseGPGKeyList struct {
+       // in:body
+       Body []api.GPGKey `json:"body"`
+}
+
+// swagger:response DeployKey
+type swaggerResponseDeployKey struct {
+       // in:body
+       Body api.DeployKey `json:"body"`
+}
+
+// swagger:response DeployKeyList
+type swaggerResponseDeployKeyList struct {
+       // in:body
+       Body []api.DeployKey `json:"body"`
+}
diff --git a/routers/api/v1/swagger/misc.go b/routers/api/v1/swagger/misc.go
new file mode 100644 (file)
index 0000000..8ec0d53
--- /dev/null
@@ -0,0 +1,15 @@
+// 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 swagger
+
+import (
+       api "code.gitea.io/sdk/gitea"
+)
+
+// swagger:response ServerVersion
+type swaggerResponseServerVersion struct {
+       // in:body
+       Body api.ServerVersion `json:"body"`
+}
diff --git a/routers/api/v1/swagger/options.go b/routers/api/v1/swagger/options.go
new file mode 100644 (file)
index 0000000..31251eb
--- /dev/null
@@ -0,0 +1,66 @@
+// 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 swagger
+
+import (
+       "code.gitea.io/gitea/modules/auth"
+       api "code.gitea.io/sdk/gitea"
+)
+
+// not actually a response, just a hack to get go-swagger to include definitions
+// of the various XYZOption structs
+
+// swagger:response parameterBodies
+type swaggerParameterBodies struct {
+       AddCollaboratorOption api.AddCollaboratorOption
+
+       CreateEmailOption api.CreateEmailOption
+       DeleteEmailOption api.DeleteEmailOption
+
+       CreateHookOption api.CreateHookOption
+       EditHookOption   api.EditHookOption
+
+       CreateIssueOption api.CreateIssueOption
+       EditIssueOption   api.EditIssueOption
+
+       CreateIssueCommentOption api.CreateIssueCommentOption
+       EditIssueCommentOption   api.EditIssueCommentOption
+
+       IssueLabelsOption api.IssueLabelsOption
+
+       CreateKeyOption api.CreateKeyOption
+
+       CreateLabelOption api.CreateLabelOption
+       EditLabelOption   api.EditLabelOption
+
+       MarkdownOption api.MarkdownOption
+
+       CreateMilestoneOption api.CreateMilestoneOption
+       EditMilestoneOption   api.EditMilestoneOption
+
+       CreateOrgOption api.CreateOrgOption
+       EditOrgOption   api.EditOrgOption
+
+       CreatePullRequestOption api.CreatePullRequestOption
+       EditPullRequestOption   api.EditPullRequestOption
+
+       CreateReleaseOption api.CreateReleaseOption
+       EditReleaseOption   api.EditReleaseOption
+
+       CreateRepoOption api.CreateRepoOption
+       CreateForkOption api.CreateForkOption
+
+       CreateStatusOption api.CreateStatusOption
+
+       CreateTeamOption api.CreateTeamOption
+       EditTeamOption   api.EditTeamOption
+
+       AddTimeOption api.AddTimeOption
+
+       CreateUserOption api.CreateUserOption
+       EditUserOption   api.EditUserOption
+
+       MigrateRepoForm auth.MigrateRepoForm
+}
diff --git a/routers/api/v1/swagger/org.go b/routers/api/v1/swagger/org.go
new file mode 100644 (file)
index 0000000..46bd566
--- /dev/null
@@ -0,0 +1,33 @@
+// 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 swagger
+
+import (
+       api "code.gitea.io/sdk/gitea"
+)
+
+// swagger:response Organization
+type swaggerResponseOrganization struct {
+       // in:body
+       Body api.Organization `json:"body"`
+}
+
+// swagger:response OrganizationList
+type swaggerResponseOrganizationList struct {
+       // in:body
+       Body []api.Organization `json:"body"`
+}
+
+// swagger:response Team
+type swaggerResponseTeam struct {
+       // in:body
+       Body api.Team `json:"body"`
+}
+
+// swagger:response TeamList
+type swaggerResponseTeamList struct {
+       // in:body
+       Body []api.Team `json:"body"`
+}
diff --git a/routers/api/v1/swagger/repo.go b/routers/api/v1/swagger/repo.go
new file mode 100644 (file)
index 0000000..703f7d1
--- /dev/null
@@ -0,0 +1,92 @@
+// 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 swagger
+
+import (
+       api "code.gitea.io/sdk/gitea"
+)
+
+// swagger:response Repository
+type swaggerResponseRepository struct {
+       // in:body
+       Body api.Repository `json:"body"`
+}
+
+// swagger:response RepositoryList
+type swaggerResponseRepositoryList struct {
+       // in:body
+       Body []api.Repository `json:"body"`
+}
+
+// swagger:response Branch
+type swaggerResponseBranch struct {
+       // in:body
+       Body api.Branch `json:"body"`
+}
+
+// swagger:response BranchList
+type swaggerResponseBranchList struct {
+       // in:body
+       Body []api.Branch `json:"body"`
+}
+
+// swagger:response Hook
+type swaggerResponseHook struct {
+       // in:body
+       Body []api.Branch `json:"body"`
+}
+
+// swagger:response HookList
+type swaggerResponseHookList struct {
+       // in:body
+       Body []api.Branch `json:"body"`
+}
+
+// swagger:response Release
+type swaggerResponseRelease struct {
+       // in:body
+       Body api.Release `json:"body"`
+}
+
+// swagger:response ReleaseList
+type swaggerResponseReleaseList struct {
+       // in:body
+       Body []api.Release `json:"body"`
+}
+
+// swagger:response PullRequest
+type swaggerResponsePullRequest struct {
+       // in:body
+       Body api.PullRequest `json:"body"`
+}
+
+// swagger:response PullRequestList
+type swaggerResponsePullRequestList struct {
+       // in:body
+       Body []api.PullRequest `json:"body"`
+}
+
+// swagger:response Status
+type swaggerResponseStatus struct {
+       // in:body
+       Body api.Status `json:"body"`
+}
+
+// swagger:response StatusList
+type swaggerResponseStatusList struct {
+       // in:body
+       Body []api.Status `json:"body"`
+}
+
+// swagger:response WatchInfo
+type swaggerResponseWatchInfo struct {
+       // in:body
+       Body api.WatchInfo `json:"body"`
+}
+
+// swagger:response SearchResults
+type swaggerResponseSearchResults struct {
+       Body api.SearchResults `json:"body"`
+}
diff --git a/routers/api/v1/swagger/user.go b/routers/api/v1/swagger/user.go
new file mode 100644 (file)
index 0000000..2bb8f1b
--- /dev/null
@@ -0,0 +1,33 @@
+// 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 swagger
+
+import (
+       api "code.gitea.io/sdk/gitea"
+)
+
+// swagger:response User
+type swaggerResponseUser struct {
+       // in:body
+       Body api.User `json:"body"`
+}
+
+// swagger:response UserList
+type swaggerResponseUserList struct {
+       // in:body
+       Body []api.User `json:"body"`
+}
+
+// swagger:response EmailList
+type swaggerResponseEmailList struct {
+       // in:body
+       Body []api.Email `json:"body"`
+}
+
+// swagger:model EditUserOption
+type swaggerModelEditUserOption struct {
+       // in:body
+       Options api.EditUserOption
+}
index 1d722e36e401c96d1058ee3f5c650f2000c50316..e1f75de6830376e05eac23d132e86b4f0ee6e3af 100644 (file)
@@ -13,15 +13,14 @@ import (
 
 // ListAccessTokens list all the access tokens
 func ListAccessTokens(ctx *context.APIContext) {
-       // swagger:route GET /users/{username}/tokens user userGetTokens
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: AccessTokenList
-       //       500: error
-
+       // swagger:operation GET /users/{username}/tokens user userGetTokens
+       // ---
+       // summary: List the authenticated user's access tokens
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/AccessTokenList"
        tokens, err := models.ListAccessTokens(ctx.User.ID)
        if err != nil {
                ctx.Error(500, "ListAccessTokens", err)
@@ -40,18 +39,16 @@ func ListAccessTokens(ctx *context.APIContext) {
 
 // CreateAccessToken create access tokens
 func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption) {
-       // swagger:route POST /users/{username} /tokens user userCreateToken
-       //
-       //     Consumes:
-       //     - application/json
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: AccessToken
-       //       500: error
-
+       // swagger:operation POST /users/{username}/tokens user userCreateToken
+       // ---
+       // summary: Create an access token
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/AccessToken"
        t := &models.AccessToken{
                UID:  ctx.User.ID,
                Name: form.Name,
index 0d83aa38c1185cccc18a0f62eb016bc89b3b380c..1d071e697f7249e50c5d06d68ef3517d625b3328 100644 (file)
@@ -13,9 +13,17 @@ import (
        "code.gitea.io/gitea/routers/api/v1/convert"
 )
 
-// ListEmails list all the emails of mine
+// ListEmails list all of the authenticated user's email addresses
 // see https://github.com/gogits/go-gogs-client/wiki/Users-Emails#list-email-addresses-for-a-user
 func ListEmails(ctx *context.APIContext) {
+       // swagger:operation GET /user/emails user userListEmails
+       // ---
+       // summary: List the authenticated user's email addresses
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/EmailList"
        emails, err := models.GetEmailAddresses(ctx.User.ID)
        if err != nil {
                ctx.Error(500, "GetEmailAddresses", err)
@@ -28,9 +36,26 @@ func ListEmails(ctx *context.APIContext) {
        ctx.JSON(200, &apiEmails)
 }
 
-// AddEmail add email for me
-// see https://github.com/gogits/go-gogs-client/wiki/Users-Emails#add-email-addresses
+// AddEmail add an email address
 func AddEmail(ctx *context.APIContext, form api.CreateEmailOption) {
+       // swagger:operation POST /user/emails user userAddEmail
+       // ---
+       // summary: Add email addresses
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: options
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateEmailOption"
+       // parameters:
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateEmailOption"
+       // responses:
+       //   '201':
+       //     "$ref": "#/responses/EmailList"
        if len(form.Emails) == 0 {
                ctx.Status(422)
                return
@@ -62,8 +87,20 @@ func AddEmail(ctx *context.APIContext, form api.CreateEmailOption) {
 }
 
 // DeleteEmail delete email
-// see https://github.com/gogits/go-gogs-client/wiki/Users-Emails#delete-email-addresses
-func DeleteEmail(ctx *context.APIContext, form api.CreateEmailOption) {
+func DeleteEmail(ctx *context.APIContext, form api.DeleteEmailOption) {
+       // swagger:operation DELETE /user/emails user userDeleteEmail
+       // ---
+       // summary: Delete email addresses
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/DeleteEmailOption"
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        if len(form.Emails) == 0 {
                ctx.Status(204)
                return
index 55a0b032db0e243b7450755bf3b4804cc594402c..49d13cc380438e9222a96936e21a91ec37bfc729 100644 (file)
@@ -28,31 +28,35 @@ func listUserFollowers(ctx *context.APIContext, u *models.User) {
        responseAPIUsers(ctx, users)
 }
 
-// ListMyFollowers list all my followers
+// ListMyFollowers list the authenticated user's followers
 func ListMyFollowers(ctx *context.APIContext) {
-       // swagger:route GET /user/followers user userCurrentListFollowers
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: UserList
-       //       500: error
-
+       // swagger:operation GET /user/followers user userCurrentListFollowers
+       // ---
+       // summary: List the authenticated user's followers
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/UserList"
        listUserFollowers(ctx, ctx.User)
 }
 
-// ListFollowers list user's followers
+// ListFollowers list the given user's followers
 func ListFollowers(ctx *context.APIContext) {
-       // swagger:route GET /users/:username/followers user userListFollowers
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: UserList
-       //       500: error
-
+       // swagger:operation GET /users/{username}/followers user userListFollowers
+       // ---
+       // summary: List the given user's followers
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/UserList"
        u := GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -69,31 +73,35 @@ func listUserFollowing(ctx *context.APIContext, u *models.User) {
        responseAPIUsers(ctx, users)
 }
 
-// ListMyFollowing list all my followings
+// ListMyFollowing list the users that the authenticated user is following
 func ListMyFollowing(ctx *context.APIContext) {
-       // swagger:route GET /user/following user userCurrentListFollowing
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: UserList
-       //       500: error
-
+       // swagger:operation GET /user/following user userCurrentListFollowing
+       // ---
+       // summary: List the users that the authenticated user is following
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/UserList"
        listUserFollowing(ctx, ctx.User)
 }
 
-// ListFollowing list user's followings
+// ListFollowing list the users that the given user is following
 func ListFollowing(ctx *context.APIContext) {
-       // swagger:route GET /users/{username}/following user userListFollowing
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: UserList
-       //       500: error
-
+       // swagger:operation GET /users/{username}/following user userListFollowing
+       // ---
+       // summary: List the users that the given user is following
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/UserList"
        u := GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -109,14 +117,22 @@ func checkUserFollowing(ctx *context.APIContext, u *models.User, followID int64)
        }
 }
 
-// CheckMyFollowing check if the repo is followed by me
+// CheckMyFollowing whether the given user is followed by the authenticated user
 func CheckMyFollowing(ctx *context.APIContext) {
-       // swagger:route GET /user/following/{username} user userCurrentCheckFollowing
-       //
-       //     Responses:
-       //       204: empty
-       //       404: notFound
-
+       // swagger:operation GET /user/following/{followee} user userCurrentCheckFollowing
+       // ---
+       // summary: Check whether a user is followed by the authenticated user
+       // parameters:
+       // - name: followee
+       //   in: path
+       //   description: username of followed user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
+       //   "404":
+       //     "$ref": "#/responses/notFound"
        target := GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -124,14 +140,27 @@ func CheckMyFollowing(ctx *context.APIContext) {
        checkUserFollowing(ctx, ctx.User, target.ID)
 }
 
-// CheckFollowing check if the repo is followed by user
+// CheckFollowing check if one user is following another user
 func CheckFollowing(ctx *context.APIContext) {
-       // swagger:route GET /users/{username}/following/:target user userCheckFollowing
-       //
-       //     Responses:
-       //       204: empty
-       //       404: notFound
-
+       // swagger:operation GET /users/{follower}/following/{followee} user userCheckFollowing
+       // ---
+       // summary: Check if one user is following another user
+       // parameters:
+       // - name: follower
+       //   in: path
+       //   description: username of following user
+       //   type: string
+       //   required: true
+       // - name: followee
+       //   in: path
+       //   description: username of followed user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
+       //   "404":
+       //     "$ref": "#/responses/notFound"
        u := GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -143,14 +172,20 @@ func CheckFollowing(ctx *context.APIContext) {
        checkUserFollowing(ctx, u, target.ID)
 }
 
-// Follow follow one repository
+// Follow follow a user
 func Follow(ctx *context.APIContext) {
-       // swagger:route PUT /user/following/{username} user userCurrentPutFollow
-       //
-       //     Responses:
-       //       204: empty
-       //       500: error
-
+       // swagger:operation PUT /user/following/{username} user userCurrentPutFollow
+       // ---
+       // summary: Follow a user
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user to follow
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        target := GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -162,14 +197,20 @@ func Follow(ctx *context.APIContext) {
        ctx.Status(204)
 }
 
-// Unfollow unfollow one repository
+// Unfollow unfollow a user
 func Unfollow(ctx *context.APIContext) {
-       // swagger:route DELETE /user/following/{username} user userCurrentDeleteFollow
-       //
-       //     Responses:
-       //       204: empty
-       //       500: error
-
+       // swagger:operation DELETE /user/following/{username} user userCurrentDeleteFollow
+       // ---
+       // summary: Unfollow a user
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user to unfollow
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        target := GetUserByParams(ctx)
        if ctx.Written() {
                return
index 96ff6e88ba29fe3731e7f343a60a256384d57efb..a955f3ff1480cc4ddeb7d6c9464dbc8b0691cd26 100644 (file)
@@ -34,15 +34,20 @@ 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 user userListGPGKeys
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: GPGKeyList
-       //       500: error
-
+       // swagger:operation GET /users/{username}/gpg_keys user userListGPGKeys
+       // ---
+       // summary: List the given user's GPG keys
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/GPGKeyList"
        user := GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -50,32 +55,37 @@ func ListGPGKeys(ctx *context.APIContext) {
        listGPGKeys(ctx, user.ID)
 }
 
-//ListMyGPGKeys get the GPG key list of the logged user
+//ListMyGPGKeys get the GPG key list of the authenticated user
 func ListMyGPGKeys(ctx *context.APIContext) {
-       // swagger:route GET /user/gpg_keys user userCurrentListGPGKeys
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: GPGKeyList
-       //       500: error
-
+       // swagger:operation GET /user/gpg_keys user userCurrentListGPGKeys
+       // ---
+       // summary: List the authenticated user's GPG keys
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/GPGKeyList"
        listGPGKeys(ctx, ctx.User.ID)
 }
 
 //GetGPGKey get the GPG key based on a id
 func GetGPGKey(ctx *context.APIContext) {
-       // swagger:route GET /user/gpg_keys/{id} user userCurrentGetGPGKey
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: GPGKey
-       //       404: notFound
-       //       500: error
-
+       // swagger:operation GET /user/gpg_keys/{id} user userCurrentGetGPGKey
+       // ---
+       // summary: Get a GPG key
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of key to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/GPGKey"
+       //   "404":
+       //     "$ref": "#/responses/notFound"
        key, err := models.GetGPGKeyByID(ctx.ParamsInt64(":id"))
        if err != nil {
                if models.IsErrGPGKeyNotExist(err) {
@@ -98,36 +108,47 @@ func CreateUserGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption, uid
        ctx.JSON(201, convert.ToGPGKey(key))
 }
 
-//CreateGPGKey associate a GPG key to the current user
-func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
-       // swagger:route POST /user/gpg_keys user userCurrentPostGPGKey
-       //
-       //     Consumes:
-       //     - application/json
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       201: GPGKey
-       //       422: validationError
-       //       500: error
+// swagger:parameters userCurrentPostGPGKey
+type swaggerUserCurrentPostGPGKey struct {
+       // in:body
+       Form api.CreateGPGKeyOption
+}
 
+//CreateGPGKey create a GPG key belonging to the authenticated user
+func CreateGPGKey(ctx *context.APIContext, form api.CreateGPGKeyOption) {
+       // swagger:operation POST /user/gpg_keys user userCurrentPostGPGKey
+       // ---
+       // summary: Create a GPG key
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/GPGKey"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        CreateUserGPGKey(ctx, form, ctx.User.ID)
 }
 
-//DeleteGPGKey remove a GPG key associated to the current user
+//DeleteGPGKey remove a GPG key belonging to the authenticated user
 func DeleteGPGKey(ctx *context.APIContext) {
-       // swagger:route DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       204: empty
-       //       403: forbidden
-       //       500: error
-
+       // swagger:operation DELETE /user/gpg_keys/{id} user userCurrentDeleteGPGKey
+       // ---
+       // summary: Remove a GPG key
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of key to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
        if err := models.DeleteGPGKey(ctx.User, ctx.ParamsInt64(":id")); err != nil {
                if models.IsErrGPGKeyAccessDenied(err) {
                        ctx.Error(403, "", "You do not have access to this key")
@@ -144,9 +165,9 @@ func DeleteGPGKey(ctx *context.APIContext) {
 func HandleAddGPGKeyError(ctx *context.APIContext, err error) {
        switch {
        case models.IsErrGPGKeyAccessDenied(err):
-               ctx.Error(422, "", "You do not have access to this gpg key")
+               ctx.Error(422, "", "You do not have access to this GPG key")
        case models.IsErrGPGKeyIDAlreadyUsed(err):
-               ctx.Error(422, "", "A key with the same keyid is already in database")
+               ctx.Error(422, "", "A key with the same id already exists")
        default:
                ctx.Error(500, "AddGPGKey", err)
        }
index 1772ef4d25285a31cbc1eb66d76e654c9bbf4ff2..3649dac9b96758f03f2b5fcf1f57add48fa4e9a8 100644 (file)
@@ -53,31 +53,35 @@ func listPublicKeys(ctx *context.APIContext, uid int64) {
        ctx.JSON(200, &apiKeys)
 }
 
-// ListMyPublicKeys list all my public keys
+// ListMyPublicKeys list all of the authenticated user's public keys
 func ListMyPublicKeys(ctx *context.APIContext) {
-       // swagger:route GET /user/keys user userCurrentListKeys
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: PublicKeyList
-       //       500: error
-
+       // swagger:operation GET /user/keys user userCurrentListKeys
+       // ---
+       // summary: List the authenticated user's public keys
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/PublicKeyList"
        listPublicKeys(ctx, ctx.User.ID)
 }
 
-// ListPublicKeys list all user's public keys
+// ListPublicKeys list the given user's public keys
 func ListPublicKeys(ctx *context.APIContext) {
-       // swagger:route GET /users/{username}/keys user userListKeys
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: PublicKeyList
-       //       500: error
-
+       // swagger:operation GET /users/{username}/keys user userListKeys
+       // ---
+       // summary: List the given user's public keys
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/PublicKeyList"
        user := GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -85,18 +89,24 @@ func ListPublicKeys(ctx *context.APIContext) {
        listPublicKeys(ctx, user.ID)
 }
 
-// GetPublicKey get one public key
+// GetPublicKey get a public key
 func GetPublicKey(ctx *context.APIContext) {
-       // swagger:route GET /user/keys/{id} user userCurrentGetKey
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: PublicKey
-       //       404: notFound
-       //       500: error
-
+       // swagger:operation GET /user/keys/{id} user userCurrentGetKey
+       // ---
+       // summary: Get a public key
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of key to get
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/PublicKey"
+       //   "404":
+       //     "$ref": "#/responses/notFound"
        key, err := models.GetPublicKeyByID(ctx.ParamsInt64(":id"))
        if err != nil {
                if models.IsErrKeyNotExist(err) {
@@ -130,34 +140,44 @@ 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 user userCurrentPostKey
-       //
-       //     Consumes:
-       //     - application/json
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       201: PublicKey
-       //       422: validationError
-       //       500: error
-
+       // swagger:operation POST /user/keys user userCurrentPostKey
+       // ---
+       // summary: Create a public key
+       // consumes:
+       // - application/json
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: body
+       //   in: body
+       //   schema:
+       //     "$ref": "#/definitions/CreateKeyOption"
+       // responses:
+       //   "201":
+       //     "$ref": "#/responses/PublicKey"
+       //   "422":
+       //     "$ref": "#/responses/validationError"
        CreateUserPublicKey(ctx, form, ctx.User.ID)
 }
 
-// DeletePublicKey delete one public key of mine
+// DeletePublicKey delete one public key
 func DeletePublicKey(ctx *context.APIContext) {
-       // swagger:route DELETE /user/keys/{id} user userCurrentDeleteKey
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       204: empty
-       //       403: forbidden
-       //       500: error
-
+       // swagger:operation DELETE /user/keys/{id} user userCurrentDeleteKey
+       // ---
+       // summary: Delete a public key
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: id
+       //   in: path
+       //   description: id of key to delete
+       //   type: integer
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
+       //   "403":
+       //     "$ref": "#/responses/forbidden"
        if err := models.DeletePublicKey(ctx.User, ctx.ParamsInt64(":id")); err != nil {
                if models.IsErrKeyAccessDenied(err) {
                        ctx.Error(403, "", "You do not have access to this key")
index f119632e394c77a91fb2c292727e7ba5a855adf9..38fe76cad4167f059168953c845ecac3b80218e6 100644 (file)
@@ -36,15 +36,20 @@ 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 user userListRepos
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: RepositoryList
-       //       500: error
-
+       // swagger:operation GET /users/{username}/repos user userListRepos
+       // ---
+       // summary: List the repos owned by the given user
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/RepositoryList"
        user := GetUserByParams(ctx)
        if ctx.Written() {
                return
@@ -54,14 +59,14 @@ 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 user userCurrentListRepos
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: RepositoryList
-       //       500: error
+       // swagger:operation GET /user/repos user userCurrentListRepos
+       // ---
+       // summary: List the repos that the authenticated user owns or has access to
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/RepositoryList"
        ownRepos, err := models.GetUserRepositories(ctx.User.ID, true, 1, ctx.User.NumRepos, "")
        if err != nil {
                ctx.Error(500, "GetUserRepositories", err)
@@ -87,14 +92,19 @@ func ListMyRepos(ctx *context.APIContext) {
 
 // ListOrgRepos - list the repositories of an organization.
 func ListOrgRepos(ctx *context.APIContext) {
-       // swagger:route GET /orgs/{orgname}/repos organization orgListRepos
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: RepositoryList
-       //       500: error
-
+       // swagger:operation GET /orgs/{org}/repos organization orgListRepos
+       // ---
+       // summary: List an organization's repos
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: org
+       //   in: path
+       //   description: name of the organization
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/RepositoryList"
        listUserRepos(ctx, ctx.Org.Organization)
 }
index 6f943a27124286cf68debafd8f2c6f6e2925c8b3..1cf4f5239cc594f6cc610120f42f2dee2e528b45 100644 (file)
@@ -30,18 +30,22 @@ func getStarredRepos(userID int64, private bool) ([]*api.Repository, error) {
        return repos, nil
 }
 
-// GetStarredRepos returns the repos that the user specified by the APIContext
-// has starred
+// GetStarredRepos returns the repos that the given user has starred
 func GetStarredRepos(ctx *context.APIContext) {
-       // swagger:route GET /users/{username}/starred user userListStarred
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: RepositoryList
-       //       500: error
-
+       // swagger:operation GET /users/{username}/starred user userListStarred
+       // ---
+       // summary: The repos that the given user has starred
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/RepositoryList"
        user := GetUserByParams(ctx)
        private := user.ID == ctx.User.ID
        repos, err := getStarredRepos(user.ID, private)
@@ -53,15 +57,14 @@ 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 user userCurrentListStarred
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: RepositoryList
-       //       500: error
-
+       // swagger:operation GET /user/starred user userCurrentListStarred
+       // ---
+       // summary: The repos that the authenticated user has starred
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/RepositoryList"
        repos, err := getStarredRepos(ctx.User.ID, true)
        if err != nil {
                ctx.Error(500, "getStarredRepos", err)
@@ -71,12 +74,25 @@ 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} user userCurrentCheckStarring
-       //
-       //     Responses:
-       //       204: empty
-       //       404: notFound
-
+       // swagger:operation GET /user/starred/{owner}/{repo} user userCurrentCheckStarring
+       // ---
+       // summary: Whether the authenticated is starring the repo
+       // 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:
+       //   "204":
+       //     "$ref": "#/responses/empty"
+       //   "404":
+       //     "$ref": "#/responses/notFound"
        if models.IsStaring(ctx.User.ID, ctx.Repo.Repository.ID) {
                ctx.Status(204)
        } else {
@@ -86,12 +102,23 @@ 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} user userCurrentPutStar
-       //
-       //     Responses:
-       //       204: empty
-       //       500: error
-
+       // swagger:operation PUT /user/starred/{owner}/{repo} user userCurrentPutStar
+       // ---
+       // summary: Star the given repo
+       // parameters:
+       // - name: owner
+       //   in: path
+       //   description: owner of the repo to star
+       //   type: string
+       //   required: true
+       // - name: repo
+       //   in: path
+       //   description: name of the repo to star
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        err := models.StarRepo(ctx.User.ID, ctx.Repo.Repository.ID, true)
        if err != nil {
                ctx.Error(500, "StarRepo", err)
@@ -102,12 +129,23 @@ 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} user userCurrentDeleteStar
-       //
-       //     Responses:
-       //       204: empty
-       //       500: error
-
+       // swagger:operation DELETE /user/starred/{owner}/{repo} user userCurrentDeleteStar
+       // ---
+       // summary: Unstar the given repo
+       // parameters:
+       // - name: owner
+       //   in: path
+       //   description: owner of the repo to unstar
+       //   type: string
+       //   required: true
+       // - name: repo
+       //   in: path
+       //   description: name of the repo to unstar
+       //   type: string
+       //   required: true
+       // responses:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        err := models.StarRepo(ctx.User.ID, ctx.Repo.Repository.ID, false)
        if err != nil {
                ctx.Error(500, "StarRepo", err)
index 799cec0804f0d63c6b7f6bd40493b21329b97d7f..0453a455f4de84f5d599d2f3585410794cdcb3c0 100644 (file)
@@ -17,15 +17,23 @@ import (
 
 // Search search users
 func Search(ctx *context.APIContext) {
-       // swagger:route GET /users/search user userSearch
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: UserList
-       //       500: error
-
+       // swagger:operation GET /users/search user userSearch
+       // ---
+       // summary: Search for users
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: q
+       //   in: query
+       //   description: keyword
+       //   type: string
+       // - name: limit
+       //   in: query
+       //   description: maximum number of users to return
+       //   type: integer
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/UserList"
        opts := &models.SearchUserOptions{
                Keyword:  strings.Trim(ctx.Query("q"), " "),
                Type:     models.UserTypeIndividual,
@@ -65,16 +73,22 @@ func Search(ctx *context.APIContext) {
 
 // GetInfo get user's information
 func GetInfo(ctx *context.APIContext) {
-       // swagger:route GET /users/{username} user userGet
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: User
-       //       404: notFound
-       //       500: error
-
+       // swagger:operation GET /users/{username} user userGet
+       // ---
+       // summary: Get a user
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   in: path
+       //   description: username of user to get
+       //   type: string
+       //   required: true
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/User"
+       //   "404":
+       //     "$ref": "#/responses/notFound"
        u, err := models.GetUserByName(ctx.Params(":username"))
        if err != nil {
                if models.IsErrUserNotExist(err) {
@@ -92,15 +106,15 @@ func GetInfo(ctx *context.APIContext) {
        ctx.JSON(200, u.APIFormat())
 }
 
-// GetAuthenticatedUser get curent user's information
+// GetAuthenticatedUser get current user's information
 func GetAuthenticatedUser(ctx *context.APIContext) {
-       // swagger:route GET /user user userGetCurrent
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: User
-
+       // swagger:operation GET /user user userGetCurrent
+       // ---
+       // summary: Get the authenticated user
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/User"
        ctx.JSON(200, ctx.User.APIFormat())
 }
index 18628c91d18d7e239f8e70e11fa9e52fcc233a7e..b10831f5f2b957229cfb076df00e28fd5a161e10 100644 (file)
@@ -33,15 +33,19 @@ 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 user userListSubscriptions
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: RepositoryList
-       //       500: error
-
+       // swagger:operation GET /users/{username}/subscriptions user userListSubscriptions
+       // ---
+       // summary: List the repositories watched by a user
+       // produces:
+       // - application/json
+       // parameters:
+       // - name: username
+       //   type: string
+       //   in: path
+       //   description: username of the user
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/RepositoryList"
        user := GetUserByParams(ctx)
        private := user.ID == ctx.User.ID
        repos, err := getWatchedRepos(user.ID, private)
@@ -53,15 +57,14 @@ 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 user userCurrentListSubscriptions
-       //
-       //     Produces:
-       //     - application/json
-       //
-       //     Responses:
-       //       200: RepositoryList
-       //       500: error
-
+       // swagger:operation GET /user/subscriptions user userCurrentListSubscriptions
+       // ---
+       // summary: List repositories watched by the authenticated user
+       // produces:
+       // - application/json
+       // responses:
+       //   "200":
+       //     "$ref": "#/responses/RepositoryList"
        repos, err := getWatchedRepos(ctx.User.ID, true)
        if err != nil {
                ctx.Error(500, "getWatchedRepos", err)
@@ -72,12 +75,23 @@ 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 repository userCurrentCheckSubscription
-       //
-       //     Responses:
-       //       200: WatchInfo
-       //       404: notFound
-
+       // swagger:operation GET /repos/{owner}/{repo}/subscription repository userCurrentCheckSubscription
+       // ---
+       // summary: Check if the current user is watching a repo
+       // 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/WatchInfo"
        if models.IsWatching(ctx.User.ID, ctx.Repo.Repository.ID) {
                ctx.JSON(200, api.WatchInfo{
                        Subscribed:    true,
@@ -94,12 +108,23 @@ 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 repository userCurrentPutSubscription
-       //
-       //     Responses:
-       //       200: WatchInfo
-       //       500: error
-
+       // swagger:operation PUT /repos/{owner}/{repo}/subscription repository userCurrentPutSubscription
+       // ---
+       // summary: Watch a repo
+       // 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/WatchInfo"
        err := models.WatchRepo(ctx.User.ID, ctx.Repo.Repository.ID, true)
        if err != nil {
                ctx.Error(500, "WatchRepo", err)
@@ -118,12 +143,23 @@ 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 repository userCurrentDeleteSubscription
-       //
-       //     Responses:
-       //       204: empty
-       //       500: error
-
+       // swagger:operation DELETE /repos/{owner}/{repo}/subscription repository userCurrentDeleteSubscription
+       // ---
+       // summary: Unwatch a repo
+       // 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:
+       //   "204":
+       //     "$ref": "#/responses/empty"
        err := models.WatchRepo(ctx.User.ID, ctx.Repo.Repository.ID, false)
        if err != nil {
                ctx.Error(500, "UnwatchRepo", err)
index 74f166a4f44bc8b07b4482d438bb78f10162c1c0..6d736d3462fc06f95ad0e0ed74cf904ab5efce11 100644 (file)
@@ -11,21 +11,17 @@ import (
 )
 
 // CreateUserOption create user options
-// swagger:parameters adminCreateUser
 type CreateUserOption struct {
-       // in: body
        SourceID int64 `json:"source_id"`
-       // in: body
        LoginName string `json:"login_name"`
-       // in: body
+       // required: true
        Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"`
-       // in: body
        FullName string `json:"full_name" binding:"MaxSize(100)"`
-       // in: body
+       // required: true
+       // swagger:strfmt email
        Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
-       // in: body
-       Password string `json:"password" binding:"MaxSize(255)"`
-       // in: body
+       // required: true
+       Password string `json:"password" binding:"Required;MaxSize(255)"`
        SendNotify bool `json:"send_notify"`
 }
 
@@ -40,31 +36,20 @@ func (c *Client) AdminCreateUser(opt CreateUserOption) (*User, error) {
 }
 
 // EditUserOption edit user options
-// swagger:parameters adminEditUser
 type EditUserOption struct {
-       // 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
+       // required: true
+       // swagger:strfmt email
        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"`
 }
 
diff --git a/vendor/code.gitea.io/sdk/gitea/attachment.go b/vendor/code.gitea.io/sdk/gitea/attachment.go
new file mode 100644 (file)
index 0000000..10e7a1d
--- /dev/null
@@ -0,0 +1,17 @@
+// 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 "code.gitea.io/sdk/gitea"
+import "time"
+
+// Attachment a generic attachment
+type Attachment struct {
+       ID            int64     `json:"id"`
+       Name          string    `json:"name"`
+       Size          int64     `json:"size"`
+       DownloadCount int64     `json:"download_count"`
+       Created       time.Time `json:"created_at"`
+       UUID          string    `json:"uuid"`
+       DownloadURL   string    `json:"browser_download_url"`
+}
index aa523ab174586191d05be3a89fb80ea3f3ecd7d2..57222498ef54cafdcc2995261853f0563073b109 100644 (file)
@@ -20,9 +20,8 @@ func (c *Client) ListForks(user, repo string) ([]*Repository, error) {
 }
 
 // CreateForkOption options for creating a fork
-// swagger:parameters createFork
 type CreateForkOption struct {
-       // in: body
+       // organization name, if forking into an organization
        Organization *string `json:"organization"`
 }
 
index c0beb271bde114dcd09ae15d369696cf3e80271b..b7109482f8cde2e1340d3664211983c54d6d4de9 100644 (file)
@@ -20,7 +20,6 @@ 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"`
@@ -28,12 +27,13 @@ type Hook struct {
        Config  map[string]string `json:"config"`
        Events  []string          `json:"events"`
        Active  bool              `json:"active"`
+       // swagger:strfmt date-time
        Updated time.Time         `json:"updated_at"`
+       // swagger:strfmt date-time
        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
@@ -61,15 +61,14 @@ func (c *Client) GetRepoHook(user, repo string, id int64) (*Hook, error) {
 }
 
 // CreateHookOption options when create a hook
-// swagger:parameters orgCreateHook repoCreateHook
 type CreateHookOption struct {
-       // in: body
+       // required: true
+       // enum: gitea,gogs,slack,discord
        Type string `json:"type" binding:"Required"`
-       // in: body
+       // required: true
        Config map[string]string `json:"config" binding:"Required"`
-       // in: body
        Events []string `json:"events"`
-       // in: body
+       // default: false
        Active bool `json:"active"`
 }
 
@@ -94,13 +93,9 @@ 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"`
-       // in: body
        Events []string `json:"events"`
-       // in: body
        Active *bool `json:"active"`
 }
 
@@ -142,25 +137,32 @@ type Payloader interface {
        JSONPayload() ([]byte, error)
 }
 
-// PayloadUser FIXME
+// PayloadUser represents the author or committer of a commit
 type PayloadUser struct {
+       // Full name of the commit author
        Name     string `json:"name"`
+       // swagger:strfmt email
        Email    string `json:"email"`
        UserName string `json:"username"`
 }
 
-// PayloadCommit FIXME: consider use same format as API when commits API are added.
+// FIXME: consider using same format as API when commits API are added.
+//        applies to PayloadCommit and PayloadCommitVerification
+
+// PayloadCommit represents a commit
 type PayloadCommit struct {
+       // sha1 hash of the commit
        ID           string                     `json:"id"`
        Message      string                     `json:"message"`
        URL          string                     `json:"url"`
        Author       *PayloadUser               `json:"author"`
        Committer    *PayloadUser               `json:"committer"`
        Verification *PayloadCommitVerification `json:"verification"`
+       // swagger:strfmt date-time
        Timestamp    time.Time                  `json:"timestamp"`
 }
 
-// PayloadCommitVerification represent the GPG verification part of a commit. FIXME: like PayloadCommit consider use same format as API when commits API are added.
+// PayloadCommitVerification represents the GPG verification of a commit
 type PayloadCommitVerification struct {
        Verified  bool   `json:"verified"`
        Reason    string `json:"reason"`
index 729e54fe8b27b4e637d2ab2f0cd0391eea73fe62..720f54caae103e861f275f6fa1818b85491dbeb8 100644 (file)
@@ -27,7 +27,8 @@ type PullRequestMeta struct {
        Merged    *time.Time `json:"merged_at"`
 }
 
-// Issue an issue to a repository
+// Issue represents an issue in a repository
+// swagger:model
 type Issue struct {
        ID        int64      `json:"id"`
        URL       string     `json:"url"`
@@ -38,9 +39,15 @@ type Issue struct {
        Labels    []*Label   `json:"labels"`
        Milestone *Milestone `json:"milestone"`
        Assignee  *User      `json:"assignee"`
+       // Whether the issue is open or closed
+       //
+       // type: string
+       // enum: open,closed
        State     StateType  `json:"state"`
        Comments  int        `json:"comments"`
+       // swagger:strfmt date-time
        Created   time.Time  `json:"created_at"`
+       // swagger:strfmt date-time
        Updated   time.Time  `json:"updated_at"`
 
        PullRequest *PullRequestMeta `json:"pull_request"`
@@ -78,10 +85,14 @@ func (c *Client) GetIssue(owner, repo string, index int64) (*Issue, error) {
 
 // CreateIssueOption options to create one issue
 type CreateIssueOption struct {
+       // required:true
        Title     string  `json:"title" binding:"Required"`
        Body      string  `json:"body"`
+       // username of assignee
        Assignee  string  `json:"assignee"`
+       // milestone id
        Milestone int64   `json:"milestone"`
+       // list of label ids
        Labels    []int64 `json:"labels"`
        Closed    bool    `json:"closed"`
 }
@@ -97,7 +108,7 @@ func (c *Client) CreateIssue(owner, repo string, opt CreateIssueOption) (*Issue,
                jsonHeader, bytes.NewReader(body), issue)
 }
 
-// EditIssueOption edit issue options
+// EditIssueOption options for editing an issue
 type EditIssueOption struct {
        Title     string  `json:"title"`
        Body      *string `json:"body"`
index 0977f98a4a99ad19aa18c44188c04490b6480694..f146c1fe2db2ec72bbf5aaa7b67f74e24ed9838b 100644 (file)
@@ -11,7 +11,7 @@ import (
        "time"
 )
 
-// Comment represents a comment in commit and issue page.
+// Comment represents a comment on a commit or issue
 type Comment struct {
        ID       int64     `json:"id"`
        HTMLURL  string    `json:"html_url"`
@@ -19,7 +19,9 @@ type Comment struct {
        IssueURL string    `json:"issue_url"`
        Poster   *User     `json:"user"`
        Body     string    `json:"body"`
+       // swagger:strfmt date-time
        Created  time.Time `json:"created_at"`
+       // swagger:strfmt date-time
        Updated  time.Time `json:"updated_at"`
 }
 
@@ -35,8 +37,9 @@ func (c *Client) ListRepoIssueComments(owner, repo string) ([]*Comment, error) {
        return comments, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/issues/comments", owner, repo), nil, nil, &comments)
 }
 
-// CreateIssueCommentOption is option when creating an issue comment.
+// CreateIssueCommentOption options for creating a comment on an issue
 type CreateIssueCommentOption struct {
+       // required:true
        Body string `json:"body" binding:"Required"`
 }
 
@@ -50,8 +53,9 @@ func (c *Client) CreateIssueComment(owner, repo string, index int64, opt CreateI
        return comment, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/comments", owner, repo, index), jsonHeader, bytes.NewReader(body), comment)
 }
 
-// EditIssueCommentOption is option when editing an issue comment.
+// EditIssueCommentOption options for editing a comment
 type EditIssueCommentOption struct {
+       // required: true
        Body string `json:"body" binding:"Required"`
 }
 
index 20607f2efd8ae1dd0f5521a856af4ea29e7cec47..3acf1440b45fd861852736735289b6287be1400a 100644 (file)
@@ -11,14 +11,16 @@ import (
 )
 
 // Label a label to an issue or a pr
+// swagger:model
 type Label struct {
        ID    int64  `json:"id"`
        Name  string `json:"name"`
+       // example: 00aabb
        Color string `json:"color"`
        URL   string `json:"url"`
 }
 
-// ListRepoLabels list lables of one reppsitory
+// ListRepoLabels list labels of one repository
 func (c *Client) ListRepoLabels(owner, repo string) ([]*Label, error) {
        labels := make([]*Label, 0, 10)
        return labels, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/labels", owner, repo), nil, nil, &labels)
@@ -31,9 +33,12 @@ func (c *Client) GetRepoLabel(owner, repo string, id int64) (*Label, error) {
        return label, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/labels/%d", owner, repo, id), nil, nil, label)
 }
 
-// CreateLabelOption create options when one label of repository
+// CreateLabelOption options for creating a label
 type CreateLabelOption struct {
+       // required:true
        Name  string `json:"name" binding:"Required"`
+       // required:true
+       // example: #00aabb
        Color string `json:"color" binding:"Required;Size(7)"`
 }
 
@@ -48,7 +53,7 @@ func (c *Client) CreateLabel(owner, repo string, opt CreateLabelOption) (*Label,
                jsonHeader, bytes.NewReader(body), label)
 }
 
-// EditLabelOption edit label options
+// EditLabelOption options for editing a label
 type EditLabelOption struct {
        Name  *string `json:"name"`
        Color *string `json:"color"`
@@ -71,8 +76,9 @@ func (c *Client) DeleteLabel(owner, repo string, id int64) error {
        return err
 }
 
-// IssueLabelsOption list one issue's labels options
+// IssueLabelsOption a collection of labels
 type IssueLabelsOption struct {
+       // list of label IDs
        Labels []int64 `json:"labels"`
 }
 
index e35325e8d68865174f1bc8a604596fdf0debfa1e..d82006742244bda5b77b285633fc49f41e0449cd 100644 (file)
@@ -19,7 +19,9 @@ type Milestone struct {
        State        StateType  `json:"state"`
        OpenIssues   int        `json:"open_issues"`
        ClosedIssues int        `json:"closed_issues"`
+       // swagger:strfmt date-time
        Closed       *time.Time `json:"closed_at"`
+       // swagger:strfmt date-time
        Deadline     *time.Time `json:"due_on"`
 }
 
@@ -35,10 +37,11 @@ func (c *Client) GetMilestone(owner, repo string, id int64) (*Milestone, error)
        return milestone, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/milestones/%d", owner, repo, id), nil, nil, milestone)
 }
 
-// CreateMilestoneOption options when creating milestone
+// CreateMilestoneOption options for creating a milestone
 type CreateMilestoneOption struct {
        Title       string     `json:"title"`
        Description string     `json:"description"`
+       // swagger:strfmt date-time
        Deadline    *time.Time `json:"due_on"`
 }
 
@@ -52,7 +55,7 @@ func (c *Client) CreateMilestone(owner, repo string, opt CreateMilestoneOption)
        return milestone, c.getParsedResponse("POST", fmt.Sprintf("/repos/%s/%s/milestones", owner, repo), jsonHeader, bytes.NewReader(body), milestone)
 }
 
-// EditMilestoneOption options when modify milestone
+// EditMilestoneOption options for editing a milestone
 type EditMilestoneOption struct {
        Title       string     `json:"title"`
        Description *string    `json:"description"`
index 67b8a9b61339a5bfa2dd8a759cbc31e0517b6144..dcdecbb2a2b1425aa2bbdc674cddcc9b613e472e 100644 (file)
@@ -12,9 +12,9 @@ import (
 )
 
 // TrackedTime worked time for an issue / pr
-// swagger:response TrackedTime
 type TrackedTime struct {
        ID      int64     `json:"id"`
+       // swagger:strfmt date-time
        Created time.Time `json:"created"`
        // Time in seconds
        Time    int64 `json:"time"`
@@ -23,7 +23,6 @@ type TrackedTime struct {
 }
 
 // TrackedTimes represent a list of tracked times
-// swagger:response TrackedTimes
 type TrackedTimes []*TrackedTime
 
 // GetUserTrackedTimes list tracked times of a user
@@ -44,10 +43,10 @@ func (c *Client) GetMyTrackedTimes() (TrackedTimes, error) {
        return times, c.getParsedResponse("GET", "/user/times", nil, nil, &times)
 }
 
-// AddTimeOption adds time manually to an issue
-// swagger:parameters addTime
+// AddTimeOption options for adding time to an issue
 type AddTimeOption struct {
-       // in: body
+       // time in seconds
+       // required: true
        Time int64 `json:"time" binding:"Required"`
 }
 
index be1aa5e8b0684fde315626d32e33cf4c816fba72..3735047b7f8868eeb4c7e3e53e602086b6b61b94 100644 (file)
@@ -4,22 +4,19 @@
 
 package gitea
 
-// SearchResults results of search
-// swagger:response SearchResults
+// SearchResults results of a successful search
 type SearchResults struct {
        OK   bool          `json:"ok"`
        Data []*Repository `json:"data"`
 }
 
-// SearchError error of failing search
-// swagger:response SearchError
+// SearchError error of a failed search
 type SearchError struct {
        OK    bool   `json:"ok"`
        Error string `json:"error"`
 }
 
 // MarkdownOption markdown options
-// swagger:parameters renderMarkdown
 type MarkdownOption struct {
        // Text markdown to render
        //
@@ -44,9 +41,8 @@ type MarkdownOption struct {
 type MarkdownRender string
 
 // ServerVersion wraps the version of the server
-// swagger:response ServerVersion
 type ServerVersion struct {
-       Version string
+       Version string `json:"version"`
 }
 
 // ServerVersion returns the version of the server
index ffdc2ffbead9a0ebae8c8f526a69e1c3fe79c024..d67d707e7b0e5d0cbcf3e699990f90bb9e74504c 100644 (file)
@@ -10,8 +10,7 @@ import (
        "fmt"
 )
 
-// Organization a group of some repositories, users and teams
-// swagger:response Organization
+// Organization represents an organization
 type Organization struct {
        ID          int64  `json:"id"`
        UserName    string `json:"username"`
@@ -40,22 +39,17 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) {
        return org, c.getParsedResponse("GET", fmt.Sprintf("/orgs/%s", orgname), nil, nil, org)
 }
 
-// CreateOrgOption create one organization options
-// swagger:parameters adminCreateOrg
+// CreateOrgOption options for creating an organization
 type CreateOrgOption struct {
-       // in: body
+       // required: true
        UserName string `json:"username" binding:"Required"`
-       // in: body
        FullName string `json:"full_name"`
-       // in: body
        Description string `json:"description"`
-       // in: body
        Website string `json:"website"`
-       // in: body
        Location string `json:"location"`
 }
 
-// EditOrgOption edit one organization options
+// EditOrgOption options for editing an organization
 type EditOrgOption struct {
        FullName    string `json:"full_name"`
        Description string `json:"description"`
index eddaa2d60e4a0dc6b2f666b57005f240ab66e4f9..0c9a740350fb9a8b74d06c6d179851da66c0077c 100644 (file)
@@ -4,24 +4,29 @@
 
 package gitea
 
-// Team is a sub virtual organization of one Organization
+// Team represents a team in an organization
 type Team struct {
        ID          int64  `json:"id"`
        Name        string `json:"name"`
        Description string `json:"description"`
+       // enum: none,read,write,admin,owner
        Permission  string `json:"permission"`
 }
 
-// CreateTeamOption options when create team
+// CreateTeamOption options for creating a team
 type CreateTeamOption struct {
+       // required: true
        Name        string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
        Description string `json:"description" binding:"MaxSize(255)"`
+       // enum: read,write,admin
        Permission  string `json:"permission"`
 }
 
-// EditTeamOption options when edit team
+// EditTeamOption options for editing a team
 type EditTeamOption struct {
+       // required: true
        Name        string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
        Description string `json:"description" binding:"MaxSize(255)"`
+       // enum: read,write,admin
        Permission  string `json:"permission"`
 }
index a50db96e3e9831b2980e5594aa8862eaa4f326e6..0aa0ea8cc1f275b6c693e784e9aa2f76159c3379 100644 (file)
@@ -11,7 +11,7 @@ import (
        "time"
 )
 
-// PullRequest represents a pull request API object.
+// PullRequest represents a pull request
 type PullRequest struct {
        ID        int64      `json:"id"`
        URL       string     `json:"url"`
@@ -31,6 +31,7 @@ type PullRequest struct {
 
        Mergeable      bool       `json:"mergeable"`
        HasMerged      bool       `json:"merged"`
+       // swagger:strfmt date-time
        Merged         *time.Time `json:"merged_at"`
        MergedCommitID *string    `json:"merge_commit_sha"`
        MergedBy       *User      `json:"merged_by"`
@@ -39,11 +40,13 @@ type PullRequest struct {
        Head      *PRBranchInfo `json:"head"`
        MergeBase string        `json:"merge_base"`
 
+       // swagger:strfmt date-time
        Created *time.Time `json:"created_at"`
+       // swagger:strfmt date-time
        Updated *time.Time `json:"updated_at"`
 }
 
-// PRBranchInfo base branch info when send a PR
+// PRBranchInfo information about a branch
 type PRBranchInfo struct {
        Name       string      `json:"label"`
        Ref        string      `json:"ref"`
@@ -52,7 +55,7 @@ type PRBranchInfo struct {
        Repository *Repository `json:"repo"`
 }
 
-// ListPullRequestsOptions options when list PRs
+// ListPullRequestsOptions options for listing pull requests
 type ListPullRequestsOptions struct {
        Page  int    `json:"page"`
        State string `json:"state"`
index cc841466d8eda0c84f4da731bfa8da1bf696b137..01e41e35a69ab3e8e7016b3ee552c4b1b8b2abf4 100644 (file)
@@ -23,7 +23,9 @@ type Release struct {
        ZipURL       string    `json:"zipball_url"`
        IsDraft      bool      `json:"draft"`
        IsPrerelease bool      `json:"prerelease"`
+       // swagger:strfmt date-time
        CreatedAt    time.Time `json:"created_at"`
+       // swagger:strfmt date-time
        PublishedAt  time.Time `json:"published_at"`
        Publisher    *User     `json:"author"`
 }
@@ -48,6 +50,7 @@ func (c *Client) GetRelease(user, repo string, id int64) (*Release, error) {
 
 // CreateReleaseOption options when creating a release
 type CreateReleaseOption struct {
+       // required: true
        TagName      string `json:"tag_name" binding:"Required"`
        Target       string `json:"target_commitish"`
        Title        string `json:"name"`
index 5b4673d0341e5cd067eafd2431b919bd94881e36..3def6e26ceee975c64fb750f9af8a17bbe4ef2c4 100644 (file)
@@ -11,15 +11,14 @@ import (
        "time"
 )
 
-// Permission represents a API permission.
+// Permission represents a set of permissions
 type Permission struct {
        Admin bool `json:"admin"`
        Push  bool `json:"push"`
        Pull  bool `json:"pull"`
 }
 
-// Repository represents a API repository.
-// swagger:response Repository
+// Repository represents a repository
 type Repository struct {
        ID            int64       `json:"id"`
        Owner         *User       `json:"owner"`
@@ -41,15 +40,13 @@ type Repository struct {
        Watchers      int         `json:"watchers_count"`
        OpenIssues    int         `json:"open_issues_count"`
        DefaultBranch string      `json:"default_branch"`
+       // swagger:strfmt date-time
        Created       time.Time   `json:"created_at"`
+       // swagger:strfmt date-time
        Updated       time.Time   `json:"updated_at"`
        Permissions   *Permission `json:"permissions,omitempty"`
 }
 
-// RepositoryList represents a list of API repository.
-// swagger:response RepositoryList
-type RepositoryList []*Repository
-
 // ListMyRepos lists all repositories for the authenticated user that has access to.
 func (c *Client) ListMyRepos() ([]*Repository, error) {
        repos := make([]*Repository, 0, 10)
@@ -69,36 +66,24 @@ func (c *Client) ListOrgRepos(org string) ([]*Repository, error) {
 }
 
 // CreateRepoOption options when creating repository
-//swagger:parameters createOrgRepo adminCreateRepo createCurrentUserRepo
+// swagger:model
 type CreateRepoOption struct {
        // Name of the repository to create
        //
-       // in: body
+       // required: true
        // unique: true
        Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
        // Description of the repository to create
-       //
-       // in: body
        Description string `json:"description" binding:"MaxSize(255)"`
-       // Is the repository to create private ?
-       //
-       // in: body
+       // Whether the repository is private
        Private bool `json:"private"`
-       // Init the repository to create ?
-       //
-       // in: body
+       // Whether the repository should be auto-intialized?
        AutoInit bool `json:"auto_init"`
        // Gitignores to use
-       //
-       // in: body
        Gitignores string `json:"gitignores"`
        // License to use
-       //
-       // in: body
        License string `json:"license"`
        // Readme of the repository to create
-       //
-       // in: body
        Readme string `json:"readme"`
 }
 
@@ -134,24 +119,18 @@ func (c *Client) DeleteRepo(owner, repo string) error {
        return err
 }
 
-// MigrateRepoOption options when migrate repository from an external place
-// swagger:parameters repoMigrate
+// MigrateRepoOption options for migrating a repository from an external service
 type MigrateRepoOption struct {
-       // in: body
+       // required: true
        CloneAddr string `json:"clone_addr" binding:"Required"`
-       // in: body
        AuthUsername string `json:"auth_username"`
-       // in: body
        AuthPassword string `json:"auth_password"`
-       // in: body
+       // required: true
        UID int `json:"uid" binding:"Required"`
-       // in: body
+       // required: true
        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"`
 }
 
index fadc9e3956047f19dcbb4e8da7ebfa89b99e309d..481fc3386ee76c4e26d81d239ab574f74f938852 100644 (file)
@@ -8,7 +8,7 @@ import (
        "fmt"
 )
 
-// Branch represents a repository branch.
+// Branch represents a repository branch
 type Branch struct {
        Name   string         `json:"name"`
        Commit *PayloadCommit `json:"commit"`
index 546f2476e35e16225deb0757ca27e4a938c0359a..bd61a22cec4f5c697a80ee2df033329cc56d1e60 100644 (file)
@@ -33,7 +33,7 @@ func (c *Client) IsCollaborator(user, repo, collaborator string) (bool, error) {
        return false, nil
 }
 
-// AddCollaboratorOption options when add some user as a collaborator of a repository
+// AddCollaboratorOption options when adding a user as a collaborator of a repository
 type AddCollaboratorOption struct {
        Permission *string `json:"permission"`
 }
index f5f88cd051df0a5120cb46b36e9ec2c1cb566649..03f626cd6ef2eae5ba11e86cee87a67aabcdccec 100644 (file)
@@ -17,6 +17,7 @@ type DeployKey struct {
        Key      string    `json:"key"`
        URL      string    `json:"url"`
        Title    string    `json:"title"`
+       // swagger:strfmt date-time
        Created  time.Time `json:"created_at"`
        ReadOnly bool      `json:"read_only"`
 }
@@ -33,18 +34,15 @@ func (c *Client) GetDeployKey(user, repo string, keyID int64) (*DeployKey, error
        return key, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/keys/%d", user, repo, keyID), nil, nil, &key)
 }
 
-// CreateKeyOption options when create deploy key
-// swagger:parameters userCurrentPostKey adminCreatePublicKey
+// CreateKeyOption options when creating a key
 type CreateKeyOption struct {
        // Title of the key to add
        //
-       // in: body
        // required: true
        // unique: true
        Title string `json:"title" binding:"Required"`
        // An armored SSH key to add
        //
-       // in: body
        // required: true
        // unique: true
        Key string `json:"key" binding:"Required"`
index 02c5d9b0d37b03ececc9159807f7875ec6220a3b..1005f9fbd84eadd44684ed83269728115f45d775 100644 (file)
@@ -10,8 +10,7 @@ import (
        "time"
 )
 
-// WatchInfo represents a API watch status of one repository
-// swagger:response WatchInfo
+// WatchInfo represents an API watch status of one repository
 type WatchInfo struct {
        Subscribed    bool        `json:"subscribed"`
        Ignored       bool        `json:"ignored"`
index d5cdcd57b71c5875122027da798f8779afed8986..5ce25321afc9622055b8193e686d96f337b3747c 100644 (file)
@@ -37,7 +37,9 @@ type Status struct {
        URL         string      `json:"url"`
        Context     string      `json:"context"`
        Creator     *User       `json:"creator"`
+       // swagger:strfmt date-time
        Created     time.Time   `json:"created_at"`
+       // swagger:strfmt date-time
        Updated     time.Time   `json:"updated_at"`
 }
 
index 9fe2edcbf2a85f916b634e77f64d5f8f9b3cf57f..d104cc9933fe5424c5a7aa1c85b27f443091551e 100644 (file)
@@ -9,20 +9,21 @@ import (
        "fmt"
 )
 
-// User represents a API user.
-// swagger:response User
+// User represents a user
+// swagger:model
 type User struct {
+       // the user's id
        ID        int64  `json:"id"`
+       // the user's username
        UserName  string `json:"login"`
+       // the user's full name
        FullName  string `json:"full_name"`
+       // swagger:strfmt email
        Email     string `json:"email"`
+       // URL to the user's avatar
        AvatarURL string `json:"avatar_url"`
 }
 
-// UserList represents a list of API user.
-// swagger:response UserList
-type UserList []*User
-
 // MarshalJSON implements the json.Marshaler interface for User, adding field(s) for backward compatibility
 func (u User) MarshalJSON() ([]byte, error) {
        // Re-declaring User to avoid recursion
index e167b5dfbdb8ce32137b4c53aa5a4f65b160f02c..721f52144ba1104456eb984f606ed77d6f5532ea 100644 (file)
@@ -9,8 +9,9 @@ import (
        "encoding/json"
 )
 
-// Email en email information of user
+// Email an email address belonging to a user
 type Email struct {
+       // swagger:strfmt email
        Email    string `json:"email"`
        Verified bool   `json:"verified"`
        Primary  bool   `json:"primary"`
@@ -22,8 +23,9 @@ func (c *Client) ListEmails() ([]*Email, error) {
        return emails, c.getParsedResponse("GET", "/user/emails", nil, nil, &emails)
 }
 
-// CreateEmailOption options when create an email
+// CreateEmailOption options when creating email addresses
 type CreateEmailOption struct {
+       // email addresses to add
        Emails []string `json:"emails"`
 }
 
@@ -37,8 +39,14 @@ func (c *Client) AddEmail(opt CreateEmailOption) ([]*Email, error) {
        return emails, c.getParsedResponse("POST", "/user/emails", jsonHeader, bytes.NewReader(body), emails)
 }
 
+// DeleteEmailOption options when deleting email addresses
+type DeleteEmailOption struct {
+       // email addresses to delete
+       Emails []string `json:"emails"`
+}
+
 // DeleteEmail delete one email of current users'
-func (c *Client) DeleteEmail(opt CreateEmailOption) error {
+func (c *Client) DeleteEmail(opt DeleteEmailOption) error {
        body, err := json.Marshal(&opt)
        if err != nil {
                return err
index 87dd749e6cee3a60c914cbf07d640d096234d211..ae5dcdcb105cb1f911bc5de96e2ec2a17baa2503 100644 (file)
@@ -11,12 +11,7 @@ import (
        "time"
 )
 
-// GPGKeyList represents a list of GPGKey
-// swagger:response GPGKeyList
-type GPGKeyList []*GPGKey
-
 // GPGKey a user GPG key to sign commit and tag in repository
-// swagger:response GPGKey
 type GPGKey struct {
        ID                int64          `json:"id"`
        PrimaryKeyID      string         `json:"primary_key_id"`
@@ -28,7 +23,9 @@ type GPGKey struct {
        CanEncryptComms   bool           `json:"can_encrypt_comms"`
        CanEncryptStorage bool           `json:"can_encrypt_storage"`
        CanCertify        bool           `json:"can_certify"`
+       // swagger:strfmt date-time
        Created           time.Time      `json:"created_at,omitempty"`
+       // swagger:strfmt date-time
        Expires           time.Time      `json:"expires_at,omitempty"`
 }
 
@@ -40,11 +37,9 @@ type GPGKeyEmail struct {
 }
 
 // CreateGPGKeyOption options create user GPG key
-// swagger:parameters userCurrentPostGPGKey
 type CreateGPGKeyOption struct {
        // An armored GPG key to add
        //
-       // in: body
        // required: true
        // unique: true
        ArmoredKey string `json:"armored_public_key" binding:"Required"`
index 397c6d17ac23bffeb8ff87bd387c12d808bfc66f..419c0a56d3ac5dbca92325e94ac755ee1d3d58b6 100644 (file)
@@ -11,17 +11,13 @@ import (
        "time"
 )
 
-// PublicKeyList represents a list of PublicKey
-// swagger:response PublicKeyList
-type PublicKeyList []*PublicKey
-
 // PublicKey publickey is a user key to push code to repository
-// swagger:response PublicKey
 type PublicKey struct {
        ID      int64     `json:"id"`
        Key     string    `json:"key"`
        URL     string    `json:"url,omitempty"`
        Title   string    `json:"title,omitempty"`
+       // swagger:strfmt date-time
        Created time.Time `json:"created_at,omitempty"`
 }
 
index bd613945af052e27a9b4506638910e2706da8f54..a26f1f8d40a867a3d243116cbfb4a49885dc818d 100644 (file)
@@ -9,10 +9,10 @@
                        "revisionTime": "2017-10-23T00:52:09Z"
                },
                {
-                       "checksumSHA1": "Zgp5RqU+20L2p9TNl1rSsUIWEEE=",
+                       "checksumSHA1": "OICEgmUefW4L4l/FK/NVFnl/aOM=",
                        "path": "code.gitea.io/sdk/gitea",
-                       "revision": "bc243ad6c268d60658c71185452334b300c268cf",
-                       "revisionTime": "2017-08-21T08:23:17Z"
+                       "revision": "1da52cf95ff3e7953227cfa0469e1c05a7d02557",
+                       "revisionTime": "2017-11-12T09:10:33Z"
                },
                {
                        "checksumSHA1": "bOODD4Gbw3GfcuQPU2dI40crxxk=",