完善 API Key 能力范围可视化和维护

This commit is contained in:
2026-06-07 19:01:32 +08:00
parent dc14866210
commit f47132a653
19 changed files with 1165 additions and 49 deletions
+219
View File
@@ -3575,6 +3575,82 @@
}
}
},
"/api/admin/users/{userID}/wallet/recharge": {
"post": {
"security": [
{
"BearerAuth": []
}
],
"description": "管理端给指定用户钱包追加充值金额,并记录审计日志;amount 必须大于 0。",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"billing"
],
"summary": "充值用户钱包余额",
"parameters": [
{
"type": "string",
"description": "用户 ID",
"name": "userID",
"in": "path",
"required": true
},
{
"description": "钱包充值请求",
"name": "input",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/httpapi.walletRechargeRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/httpapi.WalletAdjustmentResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/api/playground/api-keys": {
"get": {
"security": [
@@ -3935,6 +4011,76 @@
}
}
},
"/api/v1/api-keys/{apiKeyID}/scopes": {
"patch": {
"security": [
{
"BearerAuth": []
}
],
"description": "更新当前用户拥有的 API Key scopes,至少需要保留一个能力范围。",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"api-keys"
],
"summary": "更新 API Key 能力范围",
"parameters": [
{
"type": "string",
"description": "API Key ID",
"name": "apiKeyID",
"in": "path",
"required": true
},
{
"description": "API Key scope 更新请求",
"name": "input",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/store.UpdateAPIKeyScopesInput"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/store.APIKey"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/api/v1/auth/login": {
"post": {
"description": "使用用户名或邮箱登录本地账号,并返回 24 小时 JWT。",
@@ -5828,6 +5974,43 @@
}
}
},
"/api/workspace/user-groups": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "返回当前用户关联的用户组及策略摘要,供个人中心使用。",
"produces": [
"application/json"
],
"tags": [
"workspace"
],
"summary": "获取当前用户组策略",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/httpapi.UserGroupListResponse"
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/httpapi.ErrorEnvelope"
}
}
}
}
},
"/api/workspace/wallet": {
"get": {
"security": [
@@ -8937,6 +9120,31 @@
}
}
},
"httpapi.walletRechargeRequest": {
"type": "object",
"properties": {
"amount": {
"type": "number",
"example": 100
},
"currency": {
"type": "string",
"example": "resource"
},
"idempotencyKey": {
"type": "string",
"example": "wallet-recharge-20260514-001"
},
"metadata": {
"type": "object",
"additionalProperties": {}
},
"reason": {
"type": "string",
"example": "manual recharge"
}
}
},
"store.APIKey": {
"type": "object",
"properties": {
@@ -11220,6 +11428,17 @@
}
}
},
"store.UpdateAPIKeyScopesInput": {
"type": "object",
"properties": {
"scopes": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"store.UserGroup": {
"type": "object",
"properties": {