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,463 @@
{
"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": {
"/user/stared-repos": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Starring"
],
"summary": "获取当前用户 star 的仓库列表。List all stared repositories.",
"operationId": "GetUserAllStaredRepos",
"parameters": [
{
"type": "integer",
"default": 1,
"description": "Pagination page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Pagination page size",
"name": "page_size",
"in": "query"
},
{
"type": "string",
"default": "",
"description": "Filter by repositories",
"name": "search",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "排序顺序。Ordering.",
"name": "desc",
"in": "query"
},
{
"enum": [
"created_at",
"last_updated_at",
"stared_time",
"stars",
"forks"
],
"type": "string",
"default": "last_updated_at",
"description": "Order field",
"name": "order_by",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Repos4User"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/users/{username}/stared-repos": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Starring"
],
"summary": "获取指定用户的 star 仓库列表。Get the list of repositories starred by the specified user.",
"operationId": "GetUserStaredRepos",
"parameters": [
{
"type": "string",
"description": "UserName",
"name": "username",
"in": "path",
"required": true
},
{
"type": "string",
"default": "",
"description": "过滤仓库。Filter by repositories",
"name": "search",
"in": "query"
},
{
"type": "integer",
"default": 1,
"description": "Pagination page number",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "Pagination page size",
"name": "page_size",
"in": "query"
},
{
"type": "boolean",
"default": false,
"description": "Ordering",
"name": "desc",
"in": "query"
},
{
"enum": [
"created_at",
"last_updated_at",
"stars",
"forks"
],
"type": "string",
"default": "last_updated_at",
"description": "Order field",
"name": "order_by",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.Repos4User"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/{slug}/-/stars": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Starring"
],
"summary": "获取指定仓库的star用户列表。Get the list of users who starred the specified repository.",
"operationId": "ListStarUsers",
"parameters": [
{
"type": "string",
"description": "slug",
"name": "slug",
"in": "path",
"required": true
},
{
"enum": [
"all",
"followed"
],
"type": "string",
"description": "Filter type",
"name": "filter_type",
"in": "query",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "page",
"name": "page",
"in": "query"
},
{
"type": "integer",
"default": 10,
"description": "page",
"name": "page_size",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.RepoStarUsers"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-basic-info:r"
}
}
},
"definitions": {
"dto.Repos4User": {
"type": "object",
"properties": {
"access": {
"allOf": [
{
"$ref": "#/definitions/constant.AccessRole"
}
],
"readOnly": true
},
"created_at": {
"type": "string"
},
"description": {
"type": "string"
},
"display_module": {
"$ref": "#/definitions/constant.RepoDisplayModule"
},
"flags": {
"$ref": "#/definitions/flags.Repo"
},
"fork_count": {
"type": "integer"
},
"forked_from_repo": {
"description": "预留",
"allOf": [
{
"$ref": "#/definitions/dto.Slugs"
}
]
},
"freeze": {
"type": "boolean",
"readOnly": true
},
"id": {
"type": "string"
},
"language": {
"description": "仓库程序语言,预留",
"type": "string"
},
"languages": {
"description": "仓库语言",
"allOf": [
{
"$ref": "#/definitions/dto.RepoLanguage"
}
]
},
"last_update_nickname": {
"description": "最新代码更新人姓名",
"type": "string"
},
"last_update_username": {
"description": "最新代码更新人账户名",
"type": "string"
},
"last_updated_at": {
"description": "最新代码更新时间",
"allOf": [
{
"$ref": "#/definitions/convert.NullTime"
}
]
},
"license": {
"type": "string"
},
"mark_count": {
"type": "integer"
},
"name": {
"type": "string"
},
"open_issue_count": {
"description": "开启的issue数",
"type": "integer"
},
"open_pull_request_count": {
"description": "开启的pull request数",
"type": "integer"
},
"path": {
"description": "完整仓库路径",
"type": "string"
},
"pinned": {
"type": "boolean"
},
"pinned_time": {
"type": "string"
},
"second_languages": {
"description": "第二语言",
"allOf": [
{
"$ref": "#/definitions/dto.RepoLanguage"
}
]
},
"site": {
"type": "string"
},
"star_count": {
"type": "integer"
},
"star_time": {
"type": "string"
},
"stared": {
"type": "boolean"
},
"status": {
"allOf": [
{
"$ref": "#/definitions/constant.RepoStatus"
}
],
"readOnly": true
},
"tags": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
}
}
}
},
"topics": {
"type": "string"
},
"updated_at": {
"type": "string"
},
"visibility_level": {
"$ref": "#/definitions/constant.Visibility"
},
"web_url": {
"type": "string"
}
}
},
"dto.RepoStarUsers": {
"type": "object",
"properties": {
"my_follow_count": {
"type": "integer"
},
"total": {
"type": "integer"
},
"users": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.StarUser"
}
}
}
},
"constant.RepoDisplayModule": {
"type": "object",
"properties": {
"activity": {
"description": "仓库动态",
"type": "boolean"
},
"contributors": {
"description": "仓库贡献者",
"type": "boolean"
},
"release": {
"description": "仓库版本",
"type": "boolean"
}
}
},
"flags.Repo": {
"description": "仓库特性标记,内容为枚举的组合,英文逗号分割",
"type": "string",
"enum": [
"Unknown",
"KnowledgeBase"
],
"x-enum-comments": {
"KnowledgeBase": "KnowledgeBase 知识库",
"Unknown": "Unknown 未知"
},
"x-enum-descriptions": [
"Unknown 未知",
"KnowledgeBase 知识库"
],
"x-enum-varnames": [
"Unknown",
"KnowledgeBase"
]
},
"constant.Visibility": {
"type": "string",
"enum": [
"Private",
"Public",
"Secret"
],
"x-enum-comments": {
"VisibilityPrivate": "VisibilityPrivate 私有仓库 - 仓库的访问必须显式授予每个用户",
"VisibilityPublic": "VisibilityPublic 公共仓库 - 可以不经任何身份验证克隆该项目",
"VisibilitySecret": "VisibilitySecret 加密仓库 - 仓库特定角色身份才能读取解密"
},
"x-enum-descriptions": [
"VisibilityPrivate 私有仓库 - 仓库的访问必须显式授予每个用户",
"VisibilityPublic 公共仓库 - 可以不经任何身份验证克隆该项目",
"VisibilitySecret 加密仓库 - 仓库特定角色身份才能读取解密"
],
"x-enum-varnames": [
"VisibilityPrivate",
"VisibilityPublic",
"VisibilitySecret"
]
}
}
}