feat(message-gateway): add user bind and unbind APIs

This commit is contained in:
ryan
2026-08-16 12:19:32 +08:00
parent 69d39d906f
commit 635c1760ad
10 changed files with 1118 additions and 0 deletions
+254
View File
@@ -4574,6 +4574,205 @@ const docTemplate = `{
}
}
},
"/api/v1/message-gateway/bindings": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "Returns the current user's bound messaging channels",
"produces": [
"application/json"
],
"tags": [
"message-gateway"
],
"summary": "List message gateway bindings",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Any"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/message_gateway.BindingDTO"
}
}
}
}
]
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.Any"
}
}
}
},
"post": {
"security": [
{
"SessionCookie": []
}
],
"description": "Binds the current user to a platform identity using a one-time pairing code",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"message-gateway"
],
"summary": "Bind a messaging channel",
"parameters": [
{
"description": "bind body",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/message_gateway.BindRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Any"
},
{
"type": "object",
"properties": {
"data": {
"$ref": "#/definitions/message_gateway.BindingDTO"
}
}
}
]
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"409": {
"description": "Conflict",
"schema": {
"$ref": "#/definitions/response.Any"
}
}
}
}
},
"/api/v1/message-gateway/bindings/{id}": {
"delete": {
"security": [
{
"SessionCookie": []
}
],
"description": "Removes a binding owned by the current user",
"produces": [
"application/json"
],
"tags": [
"message-gateway"
],
"summary": "Unbind a messaging channel",
"parameters": [
{
"type": "integer",
"description": "binding id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"403": {
"description": "Forbidden",
"schema": {
"$ref": "#/definitions/response.Any"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Any"
}
}
}
}
},
"/api/v1/message-gateway/channels": {
"get": {
"security": [
{
"SessionCookie": []
}
],
"description": "Returns enabled system bots the current user can pair with",
"produces": [
"application/json"
],
"tags": [
"message-gateway"
],
"summary": "List enabled messaging channels",
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/response.Any"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/message_gateway.PublicChannelDTO"
}
}
}
}
]
}
},
"401": {
"description": "Unauthorized",
"schema": {
"$ref": "#/definitions/response.Any"
}
}
}
}
},
"/api/v1/oauth/callback": {
"post": {
"description": "接收前端传回的 state 和 code,完成 OAuth/OIDC 认证并建立会话。支持登录(login)和账号绑定(bind)两种场景。",
@@ -6432,6 +6631,46 @@ const docTemplate = `{
}
}
},
"message_gateway.BindRequest": {
"type": "object",
"properties": {
"channel_id": {
"type": "string"
},
"code": {
"type": "string"
}
}
},
"message_gateway.BindingDTO": {
"type": "object",
"properties": {
"channel_id": {
"type": "string",
"example": "0"
},
"channel_name": {
"type": "string"
},
"channel_type": {
"type": "string"
},
"created_at": {
"type": "string"
},
"id": {
"type": "string",
"example": "0"
},
"platform_user_id": {
"type": "string"
},
"user_id": {
"type": "string",
"example": "0"
}
}
},
"message_gateway.ChannelDTO": {
"type": "object",
"properties": {
@@ -6537,6 +6776,21 @@ const docTemplate = `{
}
}
},
"message_gateway.PublicChannelDTO": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "0"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"message_gateway.UpdateChannelRequest": {
"type": "object",
"properties": {