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,314 @@
{
"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}/-/labels": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"RepoLabels"
],
"summary": "查询仓库的标签列表。List repository labels.",
"operationId": "ListLabels",
"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"
},
{
"type": "string",
"description": "label search key",
"name": "keyword",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/api.Label"
}
}
},
"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-notes:r"
},
"post": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"RepoLabels"
],
"summary": "创建一个 标签。Create a label.",
"operationId": "PostLabel",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"description": "Post Label Form",
"name": "post_label_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.PostLabelForm"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/api.Label"
}
},
"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-notes:rw"
}
},
"/{repo}/-/labels/{name}": {
"delete": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"RepoLabels"
],
"summary": "删除指定的仓库标签。Delete the specified repository label.",
"operationId": "DeleteLabel",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "label name",
"name": "name",
"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-notes:rw"
},
"patch": {
"security": [
{
"BearerAuth": []
}
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"RepoLabels"
],
"summary": "更新标签信息。Update label information.",
"operationId": "PatchLabel",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"type": "string",
"description": "label name",
"name": "name",
"in": "path",
"required": true
},
{
"description": "Patch Label Form",
"name": "patch_label_form",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/api.PatchLabelForm"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/api.Label"
}
},
"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-notes:rw"
}
}
},
"definitions": {
"api.Label": {
"type": "object",
"properties": {
"color": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"die.WebError": {
"type": "object",
"properties": {
"errcode": {
"type": "integer"
},
"errmsg": {
"type": "string"
},
"errparam": {
"type": "object",
"additionalProperties": {}
}
}
},
"api.PostLabelForm": {
"type": "object",
"properties": {
"color": {
"description": "The hexadecimal color code for the label, without the leading `#`.",
"type": "string"
},
"description": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"api.PatchLabelForm": {
"type": "object",
"properties": {
"color": {
"description": "The hexadecimal color code for the label, without the leading `#`.",
"type": "string"
},
"description": {
"type": "string"
},
"new_name": {
"type": "string"
}
}
}
}
}