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,387 @@
{
"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": {
"/users/{username}/activities": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Activities"
],
"summary": "获取个人动态活跃详情汇总。Get user activities by date.",
"operationId": "GetUserActivitiesByDate",
"parameters": [
{
"type": "string",
"description": "UserName",
"name": "username",
"in": "path",
"required": true
},
{
"type": "string",
"description": "查询日期,格式 yyyyMM或者 yyyyMMdd",
"name": "date",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/dto.ActivityDate"
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/users/{username}/repo-activities/{activityType}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Activities"
],
"summary": "个人仓库动态详情列表。List of personal repository activity details.",
"operationId": "GetUserRepoActivityDetails",
"parameters": [
{
"type": "string",
"description": "UserName",
"name": "username",
"in": "path",
"required": true
},
{
"enum": [
"issue",
"pull_request",
"code_review"
],
"type": "string",
"description": "activity type",
"name": "activityType",
"in": "path",
"required": true
},
{
"type": "string",
"description": "仓库路径",
"name": "slug",
"in": "query",
"required": true
},
{
"type": "string",
"description": "查询日期,格式 yyyyMM或者 yyyyMMdd",
"name": "date",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "返回 []dto.ActivityPullRequestDetail|[]dto.ActivityIssueDetail",
"schema": {
"type": "array",
"items": {}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
}
},
"/{repo}/-/top-activity-users": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/vnd.cnb.api+json"
],
"tags": [
"Activities"
],
"summary": "获取仓库 top 活跃用户。List the top active users",
"operationId": "TopContributors",
"parameters": [
{
"type": "string",
"description": "repo",
"name": "repo",
"in": "path",
"required": true
},
{
"maximum": 10,
"minimum": 1,
"type": "integer",
"default": 5,
"description": "返回的用户个数",
"name": "top",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.UsersResult"
}
}
}
},
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \nrepo-base-info:r"
}
}
},
"definitions": {
"dto.ActivityDate": {
"type": "object",
"properties": {
"code_review_count": {
"type": "integer"
},
"code_reviews": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ActivityRepoDetail"
}
},
"commit_count": {
"type": "integer"
},
"commits": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ActivityRepoDetail"
}
},
"group_count": {
"type": "integer"
},
"groups": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ActivityJoinGroupDetail"
}
},
"issues": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ActivityRepoDetail"
}
},
"issues_count": {
"type": "integer"
},
"private_score": {
"type": "integer"
},
"pull_request_count": {
"type": "integer"
},
"pull_requests": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ActivityRepoDetail"
}
},
"repo_count": {
"type": "integer"
},
"repos": {
"type": "array",
"items": {
"$ref": "#/definitions/dto.ActivityCreateRepoDetail"
}
}
}
},
"dto.UsersResult": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"appreciate_status": {
"description": "用户赞赏码状态0-无赞赏码1-有",
"type": "integer"
},
"avatar": {
"type": "string"
},
"bio": {
"type": "string"
},
"company": {
"type": "string"
},
"created_at": {
"type": "string"
},
"email": {
"type": "string"
},
"follow_count": {
"type": "integer"
},
"follow_mission_count": {
"type": "integer"
},
"follow_repo_count": {
"type": "integer"
},
"follower_count": {
"type": "integer"
},
"freeze": {
"type": "boolean"
},
"gender": {
"type": "integer"
},
"group_count": {
"type": "integer"
},
"id": {
"type": "string"
},
"is_following": {
"description": "查询人是否follow了此用户",
"type": "boolean"
},
"location": {
"type": "string"
},
"locked": {
"type": "boolean"
},
"mission_count": {
"type": "integer"
},
"nickname": {
"type": "string"
},
"public_mission_count": {
"type": "integer"
},
"public_registry_count": {
"type": "integer"
},
"public_repo_count": {
"type": "integer"
},
"readme_repo_path": {
"type": "string",
"readOnly": true
},
"registry_count": {
"type": "integer"
},
"repo_count": {
"type": "integer"
},
"reward_amount": {
"type": "integer"
},
"reward_count": {
"type": "integer"
},
"site": {
"type": "string"
},
"stars_count": {
"type": "integer"
},
"type": {
"$ref": "#/definitions/constant.UserType"
},
"username": {
"type": "string"
},
"verified": {
"description": "认证类型",
"type": "integer"
},
"verified_expire_in": {
"description": "认证过期时间",
"type": "string"
},
"wechat_mp": {
"type": "string"
},
"wechat_mp_qrcode": {
"type": "string"
}
}
},
"constant.UserType": {
"type": "integer",
"format": "int32",
"enum": [
0,
1,
2,
3,
4
],
"x-enum-comments": {
"IoaUser": "IoaUser ioa 用户",
"OauthUser": "OauthUser oauth 授权用户",
"RobotUser": "RobotUser 助手用户",
"TestUser": "TestUser 测试用户",
"WeChatUser": "WeChatUser 微信用户"
},
"x-enum-descriptions": [
"WeChatUser 微信用户",
"OauthUser oauth 授权用户",
"TestUser 测试用户",
"RobotUser 助手用户",
"IoaUser ioa 用户"
],
"x-enum-varnames": [
"WeChatUser",
"OauthUser",
"TestUser",
"RobotUser",
"IoaUser"
]
}
}
}