691 lines
16 KiB
JSON
691 lines
16 KiB
JSON
{
|
||
"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": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/vnd.cnb.api+json"
|
||
],
|
||
"tags": [
|
||
"Users"
|
||
],
|
||
"summary": "获取指定用户的详情信息。Get detailed information for a specified user.",
|
||
"operationId": "GetUserInfo",
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UsersResultForSelf"
|
||
}
|
||
}
|
||
},
|
||
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-profile:r"
|
||
},
|
||
"post": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/vnd.cnb.api+json"
|
||
],
|
||
"tags": [
|
||
"Users"
|
||
],
|
||
"summary": "更新指定用户的详情信息。Updates the specified user's profile information.",
|
||
"operationId": "UpdateUserInfo",
|
||
"parameters": [
|
||
{
|
||
"description": "user info",
|
||
"name": "request",
|
||
"in": "body",
|
||
"required": true,
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UpdateUserInfoPayload"
|
||
}
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK"
|
||
}
|
||
},
|
||
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-profile:rw"
|
||
}
|
||
},
|
||
"/user/autocomplete_source": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/vnd.cnb.api+json"
|
||
],
|
||
"tags": [
|
||
"Users"
|
||
],
|
||
"summary": "查询当前用户用户拥有指定权限的所有资源列表。List resources that the current user has specified permissions for.",
|
||
"operationId": "AutoCompleteSource",
|
||
"parameters": [
|
||
{
|
||
"enum": [
|
||
"Group",
|
||
"Repo"
|
||
],
|
||
"type": "string",
|
||
"default": "Group",
|
||
"description": "Source type",
|
||
"name": "source_type",
|
||
"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": "string",
|
||
"default": "",
|
||
"description": "Filter by resources.",
|
||
"name": "search",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"enum": [
|
||
"Reporter",
|
||
"Developer",
|
||
"Master",
|
||
"Owner"
|
||
],
|
||
"type": "string",
|
||
"default": "Owner",
|
||
"description": "最小仓库权限,默认owner。Minima repository permissions",
|
||
"name": "access",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"enum": [
|
||
"created_at",
|
||
"slug_path"
|
||
],
|
||
"type": "string",
|
||
"default": "created_at",
|
||
"description": "Order field",
|
||
"name": "order_by",
|
||
"in": "query"
|
||
},
|
||
{
|
||
"type": "boolean",
|
||
"default": false,
|
||
"description": "排序顺序。Ordering.",
|
||
"name": "desc",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-engage:r"
|
||
}
|
||
},
|
||
"/user/gpg-keys": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/vnd.cnb.api+json"
|
||
],
|
||
"tags": [
|
||
"Users"
|
||
],
|
||
"summary": "获取用户 GPG keys 列表。List GPG Keys.",
|
||
"operationId": "ListGPGKeys",
|
||
"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",
|
||
"description": "gpg search key",
|
||
"name": "keyword",
|
||
"in": "query"
|
||
}
|
||
],
|
||
"responses": {
|
||
"201": {
|
||
"description": "Created",
|
||
"schema": {
|
||
"$ref": "#/definitions/api.GPGPublicKey"
|
||
}
|
||
},
|
||
"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. \naccount-profile:r"
|
||
}
|
||
},
|
||
"/users/{username}": {
|
||
"get": {
|
||
"security": [
|
||
{
|
||
"BearerAuth": []
|
||
}
|
||
],
|
||
"consumes": [
|
||
"application/json"
|
||
],
|
||
"produces": [
|
||
"application/vnd.cnb.api+json"
|
||
],
|
||
"tags": [
|
||
"Users"
|
||
],
|
||
"summary": "获取指定用户的详情信息。Get detailed information for a specified user.",
|
||
"operationId": "GetUserInfoByName",
|
||
"parameters": [
|
||
{
|
||
"type": "string",
|
||
"description": "User Name",
|
||
"name": "username",
|
||
"in": "path",
|
||
"required": true
|
||
}
|
||
],
|
||
"responses": {
|
||
"200": {
|
||
"description": "OK",
|
||
"schema": {
|
||
"$ref": "#/definitions/dto.UsersResult"
|
||
}
|
||
}
|
||
},
|
||
"description": "访问令牌调用此接口需包含以下权限。Required permissions for access token. \naccount-profile:r"
|
||
}
|
||
}
|
||
},
|
||
"definitions": {
|
||
"dto.UsersResultForSelf": {
|
||
"type": "object",
|
||
"properties": {
|
||
"address": {
|
||
"type": "string"
|
||
},
|
||
"appearance": {
|
||
"type": "string"
|
||
},
|
||
"appreciate_status": {
|
||
"description": "用户赞赏码状态,0-无赞赏码,1-有",
|
||
"type": "integer"
|
||
},
|
||
"avatar": {
|
||
"type": "string"
|
||
},
|
||
"bio": {
|
||
"type": "string"
|
||
},
|
||
"company": {
|
||
"type": "string"
|
||
},
|
||
"created_at": {
|
||
"type": "string"
|
||
},
|
||
"editable": {
|
||
"$ref": "#/definitions/constant.UserEditable"
|
||
},
|
||
"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"
|
||
},
|
||
"language": {
|
||
"type": "string"
|
||
},
|
||
"last_login_at": {
|
||
"type": "string"
|
||
},
|
||
"last_login_ip": {
|
||
"type": "string"
|
||
},
|
||
"location": {
|
||
"type": "string"
|
||
},
|
||
"locked": {
|
||
"type": "boolean"
|
||
},
|
||
"mission_count": {
|
||
"type": "integer"
|
||
},
|
||
"next_updated_name_at": {
|
||
"type": "string"
|
||
},
|
||
"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"
|
||
},
|
||
"updated_name_at": {
|
||
"type": "string"
|
||
},
|
||
"updated_nick_at": {
|
||
"type": "string"
|
||
},
|
||
"username": {
|
||
"type": "string"
|
||
},
|
||
"verified": {
|
||
"description": "认证类型",
|
||
"type": "integer"
|
||
},
|
||
"verified_expire_in": {
|
||
"description": "认证过期时间",
|
||
"type": "string"
|
||
},
|
||
"wechat_mp": {
|
||
"type": "string"
|
||
},
|
||
"wechat_mp_qrcode": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"dto.UpdateUserInfoPayload": {
|
||
"type": "object",
|
||
"properties": {
|
||
"address": {
|
||
"type": "string"
|
||
},
|
||
"bio": {
|
||
"type": "string"
|
||
},
|
||
"company": {
|
||
"type": "string"
|
||
},
|
||
"location": {
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"type": "string"
|
||
},
|
||
"nickname": {
|
||
"type": "string"
|
||
},
|
||
"readme_repo_id": {
|
||
"type": "integer"
|
||
},
|
||
"readme_repo_path": {
|
||
"type": "string"
|
||
},
|
||
"site": {
|
||
"type": "string"
|
||
},
|
||
"wechat_mp": {
|
||
"type": "string"
|
||
},
|
||
"wechat_mp_qrcode": {
|
||
"type": "string"
|
||
}
|
||
}
|
||
},
|
||
"api.GPGPublicKey": {
|
||
"type": "object",
|
||
"properties": {
|
||
"created_at": {
|
||
"description": "主密钥添加时间",
|
||
"type": "string"
|
||
},
|
||
"emails": {
|
||
"description": "邮箱",
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/api.GPGEmail"
|
||
}
|
||
},
|
||
"expired_at": {
|
||
"description": "主密钥过期时间",
|
||
"type": "string"
|
||
},
|
||
"id": {
|
||
"description": "主密钥ID",
|
||
"type": "string"
|
||
},
|
||
"key_id": {
|
||
"description": "公钥 KeyID",
|
||
"type": "string"
|
||
},
|
||
"name": {
|
||
"description": "标题",
|
||
"type": "string"
|
||
},
|
||
"raw_key": {
|
||
"description": "PGP公钥文本",
|
||
"type": "string"
|
||
},
|
||
"subkeys": {
|
||
"description": "子密钥",
|
||
"type": "array",
|
||
"items": {
|
||
"$ref": "#/definitions/api.GPGSubkey"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"die.WebError": {
|
||
"type": "object",
|
||
"properties": {
|
||
"errcode": {
|
||
"type": "integer"
|
||
},
|
||
"errmsg": {
|
||
"type": "string"
|
||
},
|
||
"errparam": {
|
||
"type": "object",
|
||
"additionalProperties": {}
|
||
}
|
||
}
|
||
},
|
||
"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.UserEditable": {
|
||
"type": "object",
|
||
"properties": {
|
||
"avatar": {
|
||
"description": "可修改账户头像",
|
||
"type": "boolean"
|
||
},
|
||
"email": {
|
||
"description": "可修改主邮箱",
|
||
"type": "boolean"
|
||
},
|
||
"logoff": {
|
||
"description": "是否允许注销账户",
|
||
"type": "boolean"
|
||
},
|
||
"nickname": {
|
||
"description": "可修改昵称",
|
||
"type": "boolean"
|
||
},
|
||
"sync-data": {
|
||
"description": "是否允许同步昵称和头像",
|
||
"type": "boolean"
|
||
},
|
||
"username": {
|
||
"description": "可修改账户名",
|
||
"type": "boolean"
|
||
}
|
||
}
|
||
},
|
||
"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"
|
||
]
|
||
}
|
||
}
|
||
} |