Files
cnb/docs/api-groups/git/api.json
2026-01-16 13:03:57 +08:00

2402 lines
64 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"swagger": "2.0",
"info": {
"title": "CNB OPENAPI",
"contact": {
"name": "Open API Support",
"url": "https://docs.cnb.cool/",
"email": "cnb@tencent.com"
},
"version": "1.0"
},
"paths": {
"/{repo}/-/commit-assets/download/{commit_id}/{filename}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"tags": [
"Git"
],
"summary": "发起一个获取 commits 附件的请求, 302到有一定效期的下载地址。Get a request to fetch a commit assets and returns 302 redirect to the assets URL with specific valid time.",
"operationId": "GetCommitAssets",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "commit_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "文件名称。示例:`test.png`",
"name": "filename",
"in": "path",
"required": true
},
{
"type": "boolean",
"default": false,
"description": "是否可以下载true表示302的下载地址有效期12小时最多下载10次。",
"name": "share",
"in": "query"
}
],
"responses": {
"302": {
"description": "Found"
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-contents:r"
}
},
"/{repo}/-/git/archive-commit-changed-files/{sha1}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"tags": [
"Git"
],
"summary": "打包下载 commit 变更文件。Download archive of changed files for a commit.",
"operationId": "GetArchiveCommitChangedFiles",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "sha1",
"in": "path",
"required": true
}
],
"responses": {
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/archive-compare-changed-files/{base_head}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "打包下载两次 ref 之间的变更文件。Download archive of changed files for a compare.",
"operationId": "GetArchiveCompareChangedFiles",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "用于Git比较操作的基准和头部分支或提交的SHA值。格式`base...head`",
"name": "base_head",
"in": "path",
"required": true
}
],
"responses": {
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/archive/{ref_with_path}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [],
"tags": [
"Git"
],
"summary": "下载仓库内容",
"operationId": "GetArchive",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "包含路径的Git引用。格式`分支名`,`标签名`,`提交哈希`,`分支名/文件路径`",
"name": "ref_with_path",
"in": "path",
"required": true
}
],
"responses": {
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/blobs": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "创建一个 blob。Create a blob.",
"operationId": "CreateBlob",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"description": "PostBlobForm",
"name": "post_blob_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.PostBlobForm"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.Blob"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/branches": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询分支列表。List branches.",
"operationId": "ListBranches",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "分页页码。",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 30,
"description": "分页页大小。",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.Branch"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "创建新分支。Create a new branch based on a start point.",
"operationId": "CreateBranch",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"description": "Create Branch Form",
"name": "create_branch_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/openapi.CreateBranchForm"
}
}
],
"responses": {
"201": {
"description": "Created"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/branches/{branch}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询指定分支。Get a branch.",
"operationId": "GetBranch",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "分支名称。",
"name": "branch",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.BranchDetail"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "删除指定分支。Delete the specified branch.",
"operationId": "DeleteBranch",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "分支名称。",
"name": "branch",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/commit-annotations-in-batch": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询指定 commit 的元数据。Get commit annotations in batch.",
"operationId": "GetCommitAnnotationsInBatch",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"description": "Get Commit Annotations In Batch Form",
"name": "get_commit_annotations_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/web.GetCommitAnnotationsInBatchForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/web.CommitAnnotationInBatch"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/commit-annotations/{sha}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询指定 commit 的元数据。Get commit annotations.",
"operationId": "GetCommitAnnotations",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "sha",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/web.CommitAnnotation"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "设定指定 commit 的元数据。Put commit annotations.",
"operationId": "PutCommitAnnotations",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "sha",
"in": "path",
"required": true
},
{
"description": "Put Commit Annotations Form",
"name": "put_commit_annotations_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/openapi.PutCommitAnnotationsForm"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/commit-annotations/{sha}/{key}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "删除指定 commit 的元数据。Delete commit annotation.",
"operationId": "DeleteCommitAnnotation",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "sha",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的元数据键名。",
"name": "key",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/commit-assets/{sha1}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询指定 commit 的附件。List commit assets.",
"operationId": "GetCommitAssetsBySha",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "sha1",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.CommitAsset"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/commit-assets/{sha1}/asset-upload-confirmation/{upload_token}/{asset_path}": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "确认 commit 附件上传完成。Confirm commit asset upload.",
"operationId": "PostCommitAssetUploadConfirmation",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "sha1",
"in": "path",
"required": true
},
{
"type": "string",
"description": "PostCommitAssetUploadURL接口返回值verify_url字段提取的upload_token。",
"name": "upload_token",
"in": "path",
"required": true
},
{
"type": "string",
"description": "PostCommitAssetUploadURL接口返回值verify_url字段提取的asset_path。",
"name": "asset_path",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "附件保持的天数。0 表示永久,最大不能超过 180 天",
"name": "ttl",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/commit-assets/{sha1}/asset-upload-url": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "新增一个 commit 附件。Create a commit asset.",
"operationId": "PostCommitAssetUploadURL",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "sha1",
"in": "path",
"required": true
},
{
"description": "Post Commit Asset Upload URL Form",
"name": "create_commit_asset_upload_url_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/openapi.PostCommitAssetUploadURLForm"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/openapi.CommitAssetUploadURL"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/commit-assets/{sha1}/{asset_id}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "删除指定 commit 的附件。Delete commit asset.",
"operationId": "DeleteCommitAsset",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值。",
"name": "sha1",
"in": "path",
"required": true
},
{
"type": "string",
"description": "附件唯一标识符。",
"name": "asset_id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/commit-statuses/{commitish}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询指定 commit 的提交状态。List commit check statuses.",
"operationId": "GetCommitStatuses",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Git引用标识符。格式`分支名称`,`提交哈希值`,`标签名称`",
"name": "commitish",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.CommitStatus"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/commits": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询 commit 列表。List commits.",
"operationId": "ListCommits",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交标识符。格式:`分支名称`,`提交哈希值`",
"name": "sha",
"in": "query"
},
{
"type": "string",
"description": "作者匹配模式支持Git原生正则表达式匹配作者信息。",
"name": "author",
"in": "query"
},
{
"type": "string",
"description": "提交者匹配模式支持Git原生正则表达式匹配提交者信息。",
"name": "committer",
"in": "query"
},
{
"type": "string",
"description": "提交时间起始范围。示例:`2025-01-01T00:00:00Z`",
"name": "since",
"in": "query"
},
{
"type": "string",
"description": "提交时间结束范围。示例:`2025-12-31T23:59:59Z`",
"name": "until",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "分页页码。",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 30,
"description": "分页页大小。",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.Commit"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/commits/{ref}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询指定 commit。Get a commit.",
"operationId": "GetCommit",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "提交的哈希值或分支名称。",
"name": "ref",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Commit"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/compare/{base_head}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "比较两个提交、分支或标签之间差异的接口。Compare two commits, branches, or tags.",
"operationId": "GetCompareCommits",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "用于Git比较操作的基准和头部分支或提交的SHA值。格式`base...head`",
"name": "base_head",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.CompareResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/contents": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json",
"application/vnd.cnb.raw+json"
],
"tags": [
"Git"
],
"summary": "查询仓库文件和目录内容。List repository files and directories.",
"operationId": "GetContentWithoutPath",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "ref",
"name": "ref",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Content"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/contents/{file_path}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json",
"application/vnd.cnb.raw+json"
],
"tags": [
"Git"
],
"summary": "查询仓库文件列表或文件。List repository files or file.",
"operationId": "GetContent",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "path",
"name": "file_path",
"in": "path",
"required": true
},
{
"type": "string",
"description": "ref",
"name": "ref",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Content"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/head": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "获取仓库默认分支。Get the default branch of the repository.",
"operationId": "GetHead",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/openapi.HeadRef"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/raw/{ref_with_path}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [],
"tags": [
"Git"
],
"summary": "获得仓库指定文件内容",
"operationId": "GetRaw",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "ref with path",
"name": "ref_with_path",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "max blob size limit",
"name": "max_in_byte",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "string"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
},
"/{repo}/-/git/tag-annotations/{tag_with_key}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "删除指定 tag 的元数据。Delete the metadata of the specified tag.",
"operationId": "DeleteTagAnnotation",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "tag with key",
"name": "tag_with_key",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-contents:rw"
}
},
"/{repo}/-/git/tag-annotations/{tag}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询指定 tag 的元数据。Query the metadata of the specified tag.",
"operationId": "GetTagAnnotations",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "tag",
"name": "tag",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/web.TagAnnotation"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-contents:r"
},
"put": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "设定指定 tag 的元数据。Set the metadata of the specified tag.",
"operationId": "PutTagAnnotations",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "tag",
"name": "tag",
"in": "path",
"required": true
},
{
"description": "Put Tag Annotations Form",
"name": "put_tag_annotations_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/openapi.PutTagAnnotationsForm"
}
}
],
"responses": {
"200": {
"description": "OK"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-contents:rw"
}
},
"/{repo}/-/git/tags": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询 tag 列表。List tags.",
"operationId": "ListTags",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "pagination page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 30,
"description": "pagination page size",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.Tag"
}
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-contents:r"
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "创建一个 tag。Create a tag.",
"operationId": "CreateTag",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"description": "PostTagFrom",
"name": "post_tag_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.PostTagFrom"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.Tag"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:rw"
}
},
"/{repo}/-/git/tags/{tag}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "查询指定 tag。Get a tag.",
"operationId": "GetTag",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "tag name",
"name": "tag",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Tag"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-contents:r"
},
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "删除指定 tag。Delete the specified tag.",
"operationId": "DeleteTag",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "tag name",
"name": "tag",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-contents:rw"
}
},
"/{slug}/-/lfs/{oid}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Git"
],
"summary": "获取 git lfs 文件下载链接",
"operationId": "GetPresignedLFSDownloadLink",
"parameters": [
{
"type": "string",
"description": "repo slug",
"name": "slug",
"in": "path",
"required": true
},
{
"type": "string",
"description": "lfs oid",
"name": "oid",
"in": "path",
"required": true
},
{
"type": "string",
"description": "download filename",
"name": "name",
"in": "query",
"required": true
}
],
"responses": {
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/die.WebError"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-code:r"
}
}
},
"definitions": {
"die.WebError": {
"type": "object",
"properties": {
"errcode": {
"type": "integer"
},
"errmsg": {
"type": "string"
},
"errparam": {
"type": "object",
"additionalProperties": {}
}
}
},
"api.PostBlobForm": {
"type": "object",
"properties": {
"content": {
"description": "Blob的内容。",
"type": "string"
},
"encoding": {
"description": "内容的编码格式。可选值:`utf-8`,`base64`",
"type": "string",
"default": "utf-8"
}
}
},
"api.Blob": {
"type": "object",
"properties": {
"sha": {
"description": "提交的哈希值。",
"type": "string"
}
}
},
"api.Branch": {
"type": "object",
"properties": {
"commit": {
"description": "分支指向的最新提交信息。",
"type": "object",
"properties": {
"sha": {
"description": "最新提交的哈希值。",
"type": "string"
}
}
},
"name": {
"description": "分支名称。",
"type": "string"
},
"protected": {
"description": "分支是否是保护分支。",
"type": "boolean"
}
}
},
"openapi.CreateBranchForm": {
"type": "object",
"properties": {
"name": {
"description": "新分支的名称。",
"type": "string"
},
"start_point": {
"description": "新分支的起始点。格式:`分支名称`,`提交哈希`,`标签名称`",
"type": "string"
}
}
},
"api.BranchDetail": {
"type": "object",
"properties": {
"commit": {
"description": "分支指向的最新提交信息。",
"allOf": [
{
"$ref": "#/definitions/api.Commit"
}
]
},
"name": {
"description": "分支名称。",
"type": "string"
},
"protected": {
"description": "分支是否是保护分支。",
"type": "boolean"
}
}
},
"web.GetCommitAnnotationsInBatchForm": {
"type": "object",
"properties": {
"commit_hashes": {
"description": "提交哈希值列表。",
"type": "array",
"items": {
"type": "string"
}
},
"keys": {
"description": "元数据键列表。",
"type": "array",
"items": {
"type": "string"
}
}
}
},
"web.CommitAnnotationInBatch": {
"type": "object",
"properties": {
"annotations": {
"description": "提交元数据列表。",
"type": "array",
"items": {
"$ref": "#/definitions/web.CommitAnnotation"
}
},
"commit_hash": {
"description": "提交哈希值。",
"type": "string"
}
}
},
"web.CommitAnnotation": {
"type": "object",
"properties": {
"key": {
"description": "元数据键名。",
"type": "string"
},
"meta": {
"description": "扩展元数据。",
"type": "object",
"additionalProperties": {}
},
"value": {
"description": "元数据值。",
"type": "string"
}
}
},
"openapi.PutCommitAnnotationsForm": {
"type": "object",
"properties": {
"annotations": {
"description": "提交元数据列表。",
"type": "array",
"items": {
"$ref": "#/definitions/openapi.PutCommitAnnotation"
}
}
}
},
"api.CommitAsset": {
"type": "object",
"properties": {
"author": {
"description": "提交附件作者信息。",
"allOf": [
{
"$ref": "#/definitions/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo"
}
]
},
"content_type": {
"description": "附件内容类型。",
"type": "string"
},
"created_at": {
"description": "附件创建时间。",
"type": "string"
},
"download_count": {
"description": "下载次数。",
"type": "integer"
},
"id": {
"description": "附件唯一标识符。",
"type": "string"
},
"name": {
"description": "附件名称。",
"type": "string"
},
"path": {
"description": "附件路径。",
"type": "string"
},
"size_in_byte": {
"description": "附件大小(字节)。",
"type": "integer"
},
"updated_at": {
"description": "附件更新时间。",
"type": "string"
}
}
},
"openapi.PostCommitAssetUploadURLForm": {
"type": "object",
"properties": {
"asset_name": {
"description": "附件名称",
"type": "string"
},
"size": {
"description": "附件大小,单位为字节。 Attachment size, in bytes.",
"type": "integer"
},
"ttl": {
"description": "附件存在时间,单位为天",
"type": "integer"
}
}
},
"openapi.CommitAssetUploadURL": {
"type": "object",
"properties": {
"expires_in_sec": {
"description": "URL过期时间单位为秒。",
"type": "integer"
},
"upload_url": {
"description": "附件上传URL。",
"type": "string"
},
"verify_url": {
"description": "附件上传确认URL。",
"type": "string"
}
}
},
"git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.CommitStatus": {
"type": "object",
"properties": {
"context": {
"description": "提交状态上下文标识符。",
"type": "string"
},
"created_at": {
"description": "创建时间。",
"type": "string"
},
"description": {
"description": "提交状态描述信息。",
"type": "string"
},
"state": {
"description": "提交状态。枚举值:`pending`,`success`,`failure`,`error`,`skip`",
"type": "string"
},
"target_url": {
"description": "提交状态详情链接。",
"type": "string"
},
"updated_at": {
"description": "更新时间。",
"type": "string"
}
}
},
"api.Commit": {
"type": "object",
"properties": {
"author": {
"description": "提交的作者信息。",
"allOf": [
{
"$ref": "#/definitions/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo"
}
]
},
"commit": {
"description": "提交的详细信息。",
"allOf": [
{
"$ref": "#/definitions/api.CommitObject"
}
]
},
"committer": {
"description": "提交的提交者信息。",
"allOf": [
{
"$ref": "#/definitions/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo"
}
]
},
"parents": {
"description": "父提交列表。",
"type": "array",
"items": {
"$ref": "#/definitions/api.CommitParent"
}
},
"sha": {
"description": "提交的哈希值。",
"type": "string"
}
}
},
"api.CompareResponse": {
"type": "object",
"properties": {
"base_commit": {
"description": "基准对比提交。",
"allOf": [
{
"$ref": "#/definitions/api.Commit"
}
]
},
"commits": {
"description": "提交列表。",
"type": "array",
"items": {
"$ref": "#/definitions/api.Commit"
}
},
"files": {
"description": "文件差异列表。",
"type": "array",
"items": {
"$ref": "#/definitions/api.CommitDiffFilePatch"
}
},
"head_commit": {
"description": "源分支最新提交。",
"allOf": [
{
"$ref": "#/definitions/api.Commit"
}
]
},
"merge_base_commit": {
"description": "共同祖先提交。",
"allOf": [
{
"$ref": "#/definitions/api.Commit"
}
]
},
"total_commits": {
"description": "总提交数。",
"type": "integer"
}
}
},
"api.Content": {
"type": "object",
"properties": {
"content": {
"type": "string"
},
"encoding": {
"type": "string"
},
"entries": {
"type": "array",
"items": {
"$ref": "#/definitions/api.TreeEntry"
}
},
"lfs_download_url": {
"type": "string"
},
"lfs_oid": {
"type": "string"
},
"lfs_size": {
"type": "integer"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"sha": {
"type": "string"
},
"size": {
"type": "integer"
},
"type": {
"type": "string"
}
}
},
"openapi.HeadRef": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"protected": {
"type": "boolean"
}
}
},
"web.TagAnnotation": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"meta": {
"type": "object",
"additionalProperties": {}
},
"value": {
"type": "string"
}
}
},
"openapi.PutTagAnnotationsForm": {
"type": "object",
"properties": {
"annotations": {
"type": "array",
"items": {
"$ref": "#/definitions/openapi.PutTagAnnotation"
}
}
}
},
"api.Tag": {
"type": "object",
"properties": {
"commit": {
"$ref": "#/definitions/api.Commit"
},
"name": {
"type": "string"
},
"target": {
"type": "string"
},
"target_type": {
"type": "string"
},
"verification": {
"$ref": "#/definitions/api.TagObjectVerification"
}
}
},
"api.PostTagFrom": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"name": {
"type": "string"
},
"target": {
"type": "string"
}
}
},
"api.TagObjectVerification": {
"type": "object",
"properties": {
"payload": {
"type": "string"
},
"reason": {
"type": "string"
},
"signature": {
"type": "string"
},
"verified": {
"type": "boolean"
},
"verified_at": {
"type": "string"
}
}
}
}
}