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
+155
View File
@@ -327,6 +327,33 @@ definitions:
date:
type: string
type: object
message_gateway.BindRequest:
properties:
channel_id:
type: string
code:
type: string
type: object
message_gateway.BindingDTO:
properties:
channel_id:
example: "0"
type: string
channel_name:
type: string
channel_type:
type: string
created_at:
type: string
id:
example: "0"
type: string
platform_user_id:
type: string
user_id:
example: "0"
type: string
type: object
message_gateway.ChannelDTO:
properties:
app_id:
@@ -396,6 +423,16 @@ definitions:
type:
type: string
type: object
message_gateway.PublicChannelDTO:
properties:
id:
example: "0"
type: string
name:
type: string
type:
type: string
type: object
message_gateway.UpdateChannelRequest:
properties:
app_id:
@@ -4252,6 +4289,124 @@ paths:
summary: Sample Hello API
tags:
- custom
/api/v1/message-gateway/bindings:
get:
description: Returns the current user's bound messaging channels
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
items:
$ref: '#/definitions/message_gateway.BindingDTO'
type: array
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: List message gateway bindings
tags:
- message-gateway
post:
consumes:
- application/json
description: Binds the current user to a platform identity using a one-time
pairing code
parameters:
- description: bind body
in: body
name: request
required: true
schema:
$ref: '#/definitions/message_gateway.BindRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
$ref: '#/definitions/message_gateway.BindingDTO'
type: object
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.Any'
"409":
description: Conflict
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: Bind a messaging channel
tags:
- message-gateway
/api/v1/message-gateway/bindings/{id}:
delete:
description: Removes a binding owned by the current user
parameters:
- description: binding id
in: path
name: id
required: true
type: integer
produces:
- application/json
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'
security:
- SessionCookie: []
summary: Unbind a messaging channel
tags:
- message-gateway
/api/v1/message-gateway/channels:
get:
description: Returns enabled system bots the current user can pair with
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/response.Any'
- properties:
data:
items:
$ref: '#/definitions/message_gateway.PublicChannelDTO'
type: array
type: object
"401":
description: Unauthorized
schema:
$ref: '#/definitions/response.Any'
security:
- SessionCookie: []
summary: List enabled messaging channels
tags:
- message-gateway
/api/v1/oauth/{source}/authorize:
get:
description: 根据指定认证源名称发起 OAuth 授权,支持 purpose 参数用于区分登录和账号绑定场景。认证源必须已启用。