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,158 @@
{
"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}/-/assets/{assetID}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"description": "通过 asset 记录 id 删除一个 assetrelease和commit附件不能通过该接口删除\n访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-manage:rw",
"tags": [
"Assets"
],
"summary": "通过 asset 记录 id 删除一个 asset",
"operationId": "DeleteAsset",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "integer",
"format": "int64",
"description": "asset id",
"name": "assetID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"422": {
"description": "release和commit附件不能通过该接口删除",
"schema": {
"$ref": "#/definitions/die.WebError"
}
}
}
}
},
"/{slug}/-/list-assets": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Assets"
],
"summary": "仓库的 asset 记录列表",
"operationId": "ListAssets",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "slug",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "第几页从1开始",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "每页多少条数据",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.AssetRecords"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-manage:r"
}
}
},
"definitions": {
"die.WebError": {
"type": "object",
"properties": {
"errcode": {
"type": "integer"
},
"errmsg": {
"type": "string"
},
"errparam": {
"type": "object",
"additionalProperties": {}
}
}
},
"dto.AssetRecords": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"origin_path": {
"description": "来源地址,例如 release 附件的来源地址是对应的 release 页面。issue和pr文件没有。",
"type": "string"
},
"path": {
"type": "string"
},
"record_type": {
"description": "资源类型slug_img和slug_file可调用DeleteAsset接口直接删除该资源repo_release和repo_commit则不行",
"allOf": [
{
"$ref": "#/definitions/dto.AssetRecordType"
}
]
},
"referer": {
"type": "string"
},
"size_in_byte": {
"type": "integer"
}
}
}
}
}