mirror of
https://github.com/go-gitea/gitea
synced 2025-07-28 05:08:37 +00:00
Refactor repo contents API and add "contents-ext" API (#34822)
See the updated swagger document for details.
This commit is contained in:
104
templates/swagger/v1_json.tmpl
generated
104
templates/swagger/v1_json.tmpl
generated
@@ -7424,13 +7424,14 @@
|
||||
},
|
||||
"/repos/{owner}/{repo}/contents": {
|
||||
"get": {
|
||||
"description": "This API follows GitHub's design, and it is not easy to use. Recommend to use our \"contents-ext\" API instead.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Gets the metadata of all the entries of the root dir",
|
||||
"summary": "Gets the metadata of all the entries of the root dir.",
|
||||
"operationId": "repoGetContentsList",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -7518,15 +7519,72 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/contents/{filepath}": {
|
||||
"/repos/{owner}/{repo}/contents-ext/{filepath}": {
|
||||
"get": {
|
||||
"description": "It guarantees that only one of the response fields is set if the request succeeds. Users can pass \"includes=file_content\" or \"includes=lfs_metadata\" to retrieve more fields.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir",
|
||||
"summary": "The extended \"contents\" API, to get file metadata and/or content, or list a directory.",
|
||||
"operationId": "repoGetContentsExt",
|
||||
"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": "path of the dir, file, symlink or submodule in the repo",
|
||||
"name": "filepath",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the name of the commit/branch/tag, default to the repository’s default branch.",
|
||||
"name": "ref",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "By default this API's response only contains file's metadata. Use comma-separated \"includes\" options to retrieve more fields. Option \"file_content\" will try to retrieve the file content, option \"lfs_metadata\" will try to retrieve LFS metadata.",
|
||||
"name": "includes",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/ContentsExtResponse"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/contents/{filepath}": {
|
||||
"get": {
|
||||
"description": "This API follows GitHub's design, and it is not easy to use. Recommend to use our \"contents-ext\" API instead.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Gets the metadata and contents (if a file) of an entry in a repository, or a list of entries if a dir.",
|
||||
"operationId": "repoGetContents",
|
||||
"parameters": [
|
||||
{
|
||||
@@ -22255,6 +22313,22 @@
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"ContentsExtResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"dir_contents": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ContentsResponse"
|
||||
},
|
||||
"x-go-name": "DirContents"
|
||||
},
|
||||
"file_contents": {
|
||||
"$ref": "#/definitions/ContentsResponse"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"ContentsResponse": {
|
||||
"description": "ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content",
|
||||
"type": "object",
|
||||
@@ -22298,6 +22372,15 @@
|
||||
"format": "date-time",
|
||||
"x-go-name": "LastCommitterDate"
|
||||
},
|
||||
"lfs_oid": {
|
||||
"type": "string",
|
||||
"x-go-name": "LfsOid"
|
||||
},
|
||||
"lfs_size": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "LfsSize"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
@@ -24947,6 +25030,15 @@
|
||||
"type": "string",
|
||||
"x-go-name": "Encoding"
|
||||
},
|
||||
"lfs_oid": {
|
||||
"type": "string",
|
||||
"x-go-name": "LfsOid"
|
||||
},
|
||||
"lfs_size": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "LfsSize"
|
||||
},
|
||||
"sha": {
|
||||
"type": "string",
|
||||
"x-go-name": "SHA"
|
||||
@@ -28693,6 +28785,12 @@
|
||||
"$ref": "#/definitions/Compare"
|
||||
}
|
||||
},
|
||||
"ContentsExtResponse": {
|
||||
"description": "",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/ContentsExtResponse"
|
||||
}
|
||||
},
|
||||
"ContentsListResponse": {
|
||||
"description": "ContentsListResponse",
|
||||
"schema": {
|
||||
|
Reference in New Issue
Block a user