aboutsummaryrefslogtreecommitdiffstats
path: root/templates/swagger
diff options
context:
space:
mode:
authorqwerty287 <80460567+qwerty287@users.noreply.github.com>2021-10-25 05:43:40 +0200
committerGitHub <noreply@github.com>2021-10-25 11:43:40 +0800
commit3676fafdacaef7ef0a6b72be99a342f91c8d5e5d (patch)
treefcf5a5155bdb1d9b1329e977ea3094fbca7577f2 /templates/swagger
parent843bc9deeb67cba2ac71165fcd0bdcce835cfab5 (diff)
downloadgitea-3676fafdacaef7ef0a6b72be99a342f91c8d5e5d.tar.gz
gitea-3676fafdacaef7ef0a6b72be99a342f91c8d5e5d.zip
Add API to get/edit wiki (#17278)
* Add API to get/edit wiki * Add swagger docs, various improvements * fmt * Fix lint and rm comment * Add page parameter * Add pagination to pages * Add tests * fmt * Update func names * Update error handling * Update type name * Fix lint * Don't delete Home * Update func name * Update routers/api/v1/repo/wiki.go Co-authored-by: delvh <dev.lh@web.de> * Remove unnecessary check * Fix lint * Use English strings * Update integrations/api_wiki_test.go Co-authored-by: delvh <dev.lh@web.de> * Update func and test names * Remove unsed check and avoid duplicated error reports * Improve error handling * Return after error * Document 404 error * Update swagger * Fix lint * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> * Document file encoding * fmt * Apply suggestions * Use convert * Fix integration test * simplify permissions * unify duplicate key Title/Name * improve types & return UTC timestamps * improve types pt.2 - add WikiPageMetaData.LastCommit - add WikiPageMetaData.HTMLURL - replace WikiPageMetaData.Updated with .LastCommit.Committer.Created also delete convert.ToWikiPage(), as it received too many arguments and only had one callsite anyway. sorry for bad advice earlier 🙃 * WikiPage.Content is base64 encoded * simplify error handling in wikiContentsByName() * update swagger * fix & DRY findWikiRepoCommit() error handling ListWikiPages() previously wrote error twice when repo wiki didn't exist * rename Content -> ContentBase64 * Fix test * Fix tests * Update var name * suburl -> sub_url Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Norwin <git@nroo.de> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'templates/swagger')
-rw-r--r--templates/swagger/v1_json.tmpl425
1 files changed, 424 insertions, 1 deletions
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index afb93c50fe..6bbc093481 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -9889,6 +9889,284 @@
}
}
},
+ "/repos/{owner}/{repo}/wiki/new": {
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "Create a wiki page",
+ "operationId": "repoCreateWikiPage",
+ "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/CreateWikiPageOptions"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/WikiPage"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ }
+ }
+ }
+ },
+ "/repos/{owner}/{repo}/wiki/page/{pageName}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "Get a wiki page",
+ "operationId": "repoGetWikiPage",
+ "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 the page",
+ "name": "pageName",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/WikiPage"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "delete": {
+ "tags": [
+ "repository"
+ ],
+ "summary": "Delete a wiki page",
+ "operationId": "repoDeleteWikiPage",
+ "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 the page",
+ "name": "pageName",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ },
+ "patch": {
+ "consumes": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "Edit a wiki page",
+ "operationId": "repoEditWikiPage",
+ "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 the page",
+ "name": "pageName",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/CreateWikiPageOptions"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/WikiPage"
+ },
+ "400": {
+ "$ref": "#/responses/error"
+ },
+ "403": {
+ "$ref": "#/responses/forbidden"
+ }
+ }
+ }
+ },
+ "/repos/{owner}/{repo}/wiki/pages": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "Get all wiki pages",
+ "operationId": "repoGetWikiPages",
+ "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": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/WikiPageList"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
+ "/repos/{owner}/{repo}/wiki/revisions/{pageName}": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "Get revisions of a wiki page",
+ "operationId": "repoGetWikiPageRevisions",
+ "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 the page",
+ "name": "pageName",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/WikiCommitList"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ }
+ }
+ }
+ },
"/repos/{template_owner}/{template_repo}/generate": {
"post": {
"consumes": [
@@ -13666,6 +13944,28 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "CreateWikiPageOptions": {
+ "description": "CreateWikiPageOptions form for creating wiki",
+ "type": "object",
+ "properties": {
+ "content_base64": {
+ "description": "content must be base64 encoded",
+ "type": "string",
+ "x-go-name": "ContentBase64"
+ },
+ "message": {
+ "description": "optional commit message summarizing the change",
+ "type": "string",
+ "x-go-name": "Message"
+ },
+ "title": {
+ "description": "page title. leave empty to keep unchanged",
+ "type": "string",
+ "x-go-name": "Title"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"Cron": {
"description": "Cron represents a Cron task",
"type": "object",
@@ -17376,6 +17676,108 @@
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
+ "WikiCommit": {
+ "description": "WikiCommit page commit/revision",
+ "type": "object",
+ "properties": {
+ "author": {
+ "$ref": "#/definitions/CommitUser"
+ },
+ "commiter": {
+ "$ref": "#/definitions/CommitUser"
+ },
+ "message": {
+ "type": "string",
+ "x-go-name": "Message"
+ },
+ "sha": {
+ "type": "string",
+ "x-go-name": "ID"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
+ "WikiCommitList": {
+ "description": "WikiCommitList commit/revision list",
+ "type": "object",
+ "properties": {
+ "commits": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/WikiCommit"
+ },
+ "x-go-name": "WikiCommits"
+ },
+ "count": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "Count"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
+ "WikiPage": {
+ "description": "WikiPage a wiki page",
+ "type": "object",
+ "properties": {
+ "commit_count": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "CommitCount"
+ },
+ "content_base64": {
+ "description": "Page content, base64 encoded",
+ "type": "string",
+ "x-go-name": "ContentBase64"
+ },
+ "footer": {
+ "type": "string",
+ "x-go-name": "Footer"
+ },
+ "html_url": {
+ "type": "string",
+ "x-go-name": "HTMLURL"
+ },
+ "last_commit": {
+ "$ref": "#/definitions/WikiCommit"
+ },
+ "sidebar": {
+ "type": "string",
+ "x-go-name": "Sidebar"
+ },
+ "sub_url": {
+ "type": "string",
+ "x-go-name": "SubURL"
+ },
+ "title": {
+ "type": "string",
+ "x-go-name": "Title"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
+ "WikiPageMetaData": {
+ "description": "WikiPageMetaData wiki page meta information",
+ "type": "object",
+ "properties": {
+ "html_url": {
+ "type": "string",
+ "x-go-name": "HTMLURL"
+ },
+ "last_commit": {
+ "$ref": "#/definitions/WikiCommit"
+ },
+ "sub_url": {
+ "type": "string",
+ "x-go-name": "SubURL"
+ },
+ "title": {
+ "type": "string",
+ "x-go-name": "Title"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
}
},
"responses": {
@@ -18069,6 +18471,27 @@
"$ref": "#/definitions/WatchInfo"
}
},
+ "WikiCommitList": {
+ "description": "WikiCommitList",
+ "schema": {
+ "$ref": "#/definitions/WikiCommitList"
+ }
+ },
+ "WikiPage": {
+ "description": "WikiPage",
+ "schema": {
+ "$ref": "#/definitions/WikiPage"
+ }
+ },
+ "WikiPageList": {
+ "description": "WikiPageList",
+ "schema": {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/WikiPageMetaData"
+ }
+ }
+ },
"conflict": {
"description": "APIConflict is a conflict empty response"
},
@@ -18117,7 +18540,7 @@
"parameterBodies": {
"description": "parameterBodies",
"schema": {
- "$ref": "#/definitions/UserSettingsOptions"
+ "$ref": "#/definitions/CreateWikiPageOptions"
}
},
"redirect": {