update add openapi api

This commit is contained in:
xiongxiao
2026-01-16 13:03:57 +08:00
parent a8f2cb14a7
commit 7787337f13
32 changed files with 39023 additions and 43 deletions

View File

@@ -0,0 +1,932 @@
{
"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}/-/releases": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Releases"
],
"summary": "查询 release 列表。List releases.",
"operationId": "ListReleases",
"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.Release"
}
}
},
"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": [
"Releases"
],
"summary": "新增一个 release。Create a release.",
"operationId": "PostRelease",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"description": "Post Release Form, attachment is optional",
"name": "create_release_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/openapi.PostReleaseForm"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.Release"
}
},
"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}/-/releases/download/{tag}/{filename}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"tags": [
"Releases"
],
"summary": "发起一个获取 release 附件的请求, 302到有一定效期的下载地址。Get a request to fetch a release assets and returns 302 redirect to the assets URL with specific valid time.",
"operationId": "GetReleasesAsset",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "标签名称。示例:`v1.0.0`",
"name": "tag",
"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}/-/releases/latest": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Releases"
],
"summary": "查询最新的 release。Query the latest release.",
"operationId": "GetLatestRelease",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Release"
}
},
"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}/-/releases/tags/{tag}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Releases"
],
"summary": "通过 tag 查询指定 release,包含附件信息。Get a release by tag, include assets information.",
"operationId": "GetReleaseByTag",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "标签名称。",
"name": "tag",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Release"
}
},
"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}/-/releases/{release_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Releases"
],
"summary": "根据 id\t查询指定 release, 包含附件信息。Get a release by id, include assets information.",
"operationId": "GetReleaseByID",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "版本唯一标识符。",
"name": "release_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Release"
}
},
"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": [
"Releases"
],
"summary": "删除指定的 release。Delete a release.",
"operationId": "DeleteRelease",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "版本唯一标识符。",
"name": "release_id",
"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"
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Releases"
],
"summary": "更新 release。Update a release.",
"operationId": "PatchRelease",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "版本唯一标识符。",
"name": "release_id",
"in": "path",
"required": true
},
{
"description": "patch release form",
"name": "patch_release_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/openapi.PatchReleaseForm"
}
}
],
"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}/-/releases/{release_id}/asset-upload-confirmation/{upload_token}/{asset_path}": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Releases"
],
"summary": "确认 release 附件上传完成。Confirm release asset upload.",
"operationId": "PostReleaseAssetUploadConfirmation",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "版本唯一标识符。",
"name": "release_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "PostReleaseAssetUploadURL接口返回值verify_url字段提取的upload_token。",
"name": "upload_token",
"in": "path",
"required": true
},
{
"type": "string",
"description": "PostReleaseAssetUploadURL接口返回值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}/-/releases/{release_id}/asset-upload-url": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Releases"
],
"summary": "新增一个 release 附件。Create a release asset.",
"operationId": "PostReleaseAssetUploadURL",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "版本唯一标识符。",
"name": "release_id",
"in": "path",
"required": true
},
{
"description": "Post Release Asset Upload URL Form",
"name": "create_release_asset_upload_url_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/openapi.PostReleaseAssetUploadURLForm"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/openapi.ReleaseAssetUploadURL"
}
},
"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}/-/releases/{release_id}/assets/{asset_id}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"tags": [
"Releases"
],
"summary": "查询指定的 release 附件 the specified release asset.",
"operationId": "GetReleaseAsset",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "版本唯一标识符。",
"name": "release_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "附件唯一标识符。",
"name": "asset_id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.ReleaseAsset"
}
},
"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": []
}
],
"tags": [
"Releases"
],
"summary": "删除指定的 release 附件 the specified release asset.",
"operationId": "DeleteReleaseAsset",
"parameters": [
{
"type": "string",
"description": "不带.git后缀的仓库名称。格式`组织名称/仓库名称`",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "版本唯一标识符。",
"name": "release_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "附件唯一标识符。",
"name": "asset_id",
"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"
}
}
},
"definitions": {
"api.Release": {
"type": "object",
"properties": {
"assets": {
"description": "附件列表。",
"type": "array",
"items": {
"$ref": "#/definitions/api.ReleaseAsset"
}
},
"author": {
"description": "作者信息。",
"allOf": [
{
"$ref": "#/definitions/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo"
}
]
},
"body": {
"description": "版本描述。",
"type": "string"
},
"created_at": {
"description": "创建时间。",
"type": "string"
},
"draft": {
"description": "是否为草稿版本。",
"type": "boolean"
},
"id": {
"description": "版本唯一标识符。",
"type": "string"
},
"is_latest": {
"description": "是否为最新版本。",
"type": "boolean"
},
"name": {
"description": "版本标题。",
"type": "string"
},
"prerelease": {
"description": "是否为预发布版本。",
"type": "boolean"
},
"published_at": {
"description": "版本发布时间。",
"type": "string"
},
"tag_commitish": {
"description": "标签与提交标识符。",
"type": "string"
},
"tag_name": {
"description": "标签名称。",
"type": "string"
},
"updated_at": {
"description": "更新时间。",
"type": "string"
}
}
},
"die.WebError": {
"type": "object",
"properties": {
"errcode": {
"type": "integer"
},
"errmsg": {
"type": "string"
},
"errparam": {
"type": "object",
"additionalProperties": {}
}
}
},
"openapi.PostReleaseForm": {
"type": "object",
"properties": {
"body": {
"description": "版本描述。",
"type": "string"
},
"draft": {
"description": "是否为草稿版本。",
"type": "boolean"
},
"make_latest": {
"description": "是否设置为最新版本。可选值:`true`,`false`,`legacy`",
"type": "string"
},
"name": {
"description": "版本标题。",
"type": "string"
},
"prerelease": {
"description": "是否为预发布版本。",
"type": "boolean"
},
"tag_name": {
"description": "标签名称。",
"type": "string"
},
"target_commitish": {
"description": "目标提交哈希或分支名称。",
"type": "string"
}
}
},
"openapi.PatchReleaseForm": {
"type": "object",
"properties": {
"body": {
"description": "版本描述。",
"type": "string"
},
"draft": {
"description": "是否为草稿版本。",
"type": "boolean"
},
"make_latest": {
"description": "是否设置为最新版本。可选值:`true`,`false`,`legacy`",
"type": "string"
},
"name": {
"description": "版本标题。",
"type": "string"
},
"prerelease": {
"description": "是否为预发布版本。",
"type": "boolean"
}
}
},
"openapi.PostReleaseAssetUploadURLForm": {
"type": "object",
"properties": {
"asset_name": {
"description": "附件名称。",
"type": "string"
},
"overwrite": {
"description": "是否覆盖同名附件。",
"type": "boolean"
},
"size": {
"description": "附件大小,单位为字节。",
"type": "integer"
},
"ttl": {
"description": "附件存在时间,单位为天",
"type": "integer"
}
}
},
"openapi.ReleaseAssetUploadURL": {
"type": "object",
"properties": {
"expires_in_sec": {
"description": "URL过期时间单位为秒。",
"type": "integer"
},
"upload_url": {
"description": "附件上传URL。",
"type": "string"
},
"verify_url": {
"description": "附件上传确认验证URL。",
"type": "string"
}
}
},
"api.ReleaseAsset": {
"type": "object",
"properties": {
"brower_download_url": {
"description": "浏览器下载URL通过主域名用于用户直接访问。",
"type": "string"
},
"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": {
"description": "附件大小(字节)。",
"type": "integer"
},
"updated_at": {
"description": "更新时间。",
"type": "string"
},
"uploader": {
"description": "附件上传者信息。",
"allOf": [
{
"$ref": "#/definitions/git_woa_com_cnb_monorepo_git_internal_app_git_service_bff_api.UserInfo"
}
]
},
"url": {
"description": "API下载URL通过API域名用于程序化下载。",
"type": "string"
}
}
}
}
}