summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorGustavo Marin <gustavo.marin@intelygenz.com>2020-02-29 07:19:32 +0100
committerGitHub <noreply@github.com>2020-02-29 03:19:32 -0300
commitaf61b2249ab9d0afb7424509112d06c578dca059 (patch)
tree1857e96d874b956136de1fe652366f00027550a5 /templates
parent7e8cdba18120c4588d1921f07593a9a66eaa1411 (diff)
downloadgitea-af61b2249ab9d0afb7424509112d06c578dca059.tar.gz
gitea-af61b2249ab9d0afb7424509112d06c578dca059.zip
adds API endpoints to manage OAuth2 Application (list/create/delete) (#10437)
* add API endpoint to create OAuth2 Application. * move endpoint to /user. Add swagger documentations and proper response type. * change json tags to snake_case. add CreateOAuth2ApplicationOptions to swagger docs. * change response status to Created (201) * add methods to list OAuth2 apps and delete an existing OAuth2 app by ID. * add APIFormat convert method and file header * fixed header * hide secret on oauth2 application list * add Created time to API response * add API integration tests for create/list/delete OAuth2 applications. Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Diffstat (limited to 'templates')
-rw-r--r--templates/swagger/v1_json.tmpl154
1 files changed, 153 insertions, 1 deletions
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index bac1f05710..07d760212e 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -8071,6 +8071,89 @@
}
}
},
+ "/user/applications/oauth2": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "user"
+ ],
+ "summary": "List the authenticated user's oauth2 applications",
+ "operationId": "userGetOauth2Application",
+ "parameters": [
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results, maximum page size is 50",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/OAuth2ApplicationList"
+ }
+ }
+ },
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "user"
+ ],
+ "summary": "creates a new OAuth2 application",
+ "operationId": "userCreateOAuth2Application",
+ "parameters": [
+ {
+ "name": "body",
+ "in": "body",
+ "required": true,
+ "schema": {
+ "$ref": "#/definitions/CreateOAuth2ApplicationOptions"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/OAuth2Application"
+ }
+ }
+ }
+ },
+ "/user/applications/oauth2/{id}": {
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "user"
+ ],
+ "summary": "delete an OAuth2 Application",
+ "operationId": "userDeleteOAuth2Application",
+ "parameters": [
+ {
+ "type": "integer",
+ "format": "int64",
+ "description": "token to be deleted",
+ "name": "id",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ }
+ }
+ }
+ },
"/user/emails": {
"get": {
"produces": [
@@ -10357,6 +10440,24 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "CreateOAuth2ApplicationOptions": {
+ "description": "CreateOAuth2ApplicationOptions holds options to create an oauth2 application",
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string",
+ "x-go-name": "Name"
+ },
+ "redirect_uris": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "RedirectURIs"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"CreateOrgOption": {
"description": "CreateOrgOption options for creating an organization",
"type": "object",
@@ -12198,6 +12299,42 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "OAuth2Application": {
+ "type": "object",
+ "title": "OAuth2Application represents an OAuth2 application.",
+ "properties": {
+ "client_id": {
+ "type": "string",
+ "x-go-name": "ClientID"
+ },
+ "client_secret": {
+ "type": "string",
+ "x-go-name": "ClientSecret"
+ },
+ "created": {
+ "type": "string",
+ "format": "date-time",
+ "x-go-name": "Created"
+ },
+ "id": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "ID"
+ },
+ "name": {
+ "type": "string",
+ "x-go-name": "Name"
+ },
+ "redirect_uris": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ },
+ "x-go-name": "RedirectURIs"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"Organization": {
"description": "Organization represents an organization",
"type": "object",
@@ -13689,6 +13826,21 @@
}
}
},
+ "OAuth2Application": {
+ "description": "OAuth2Application",
+ "schema": {
+ "$ref": "#/definitions/OAuth2Application"
+ }
+ },
+ "OAuth2ApplicationList": {
+ "description": "OAuth2ApplicationList represents a list of OAuth2 applications.",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/OAuth2Application"
+ }
+ }
+ },
"Organization": {
"description": "Organization",
"schema": {
@@ -13971,7 +14123,7 @@
"parameterBodies": {
"description": "parameterBodies",
"schema": {
- "$ref": "#/definitions/EditBranchProtectionOption"
+ "$ref": "#/definitions/CreateOAuth2ApplicationOptions"
}
},
"redirect": {