消息服务接口
版本记录
版本号 | 日期 | 修改内容 |
---|
v0.12.2 | 2024-08-30 | 修复已知问题 |
消息服务
创建主题
接口功能
消息服务通过主题创建接口来创建订阅的主题,并设置主题的相关参数。
接口地址
URL | {Server}/topic/create |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
appId | string | 是 | 应用 ID |
topic | string | 是 | 主题名 |
name | string | 否 | 中文名,页面显示 |
note | string | 否 | 备注信息 |
broadcastType | int | 否 | 0: 广播,1:单播,默认 0 |
consumeType | bool | 否 | false: NACK,true:ACK,默认 false |
retentionDays | int | 否 | 保存天数 ,默认 0 不保存 |
retentionNums | int | 否 | 消息保存条数,默认 1w 条 |
type | int | 否 | 0: 公开 所有人都可以发,1:私有 只能自己发, 默认 1 |
consumer | string | 否 | 消费该主题的应用集合,多个应用间用“,”隔开 |
pointPush | string | 否 | 点对点模式,配置需要推送的应用 ID |
retry | int | 否 | 重试次数,默认 3 次 |
timeoutSet | int | 否 | 超时设置默认 3600s |
pubInterval | int | 否 | 重试间隔设置 默认 10s |
unpub | bool | 否 | false: 发布,true:取消发布,默认 false |
返回值参数说明
参数名称 | 类型 | 是否必填 | 说明 |
---|
code | string | 是 | 返回码,0 成功,其他失败 |
message | string | 是 | 返回信息描述 |
data | object | 否 | 创建成功,返回的结果 |
示例介绍
{
"code": 0,
"message": "success",
"data": {
"topic": "message topic"
},
}
修改主题
接口功能
修改主题相关参数。
接口地址
URL | {Server}/topic/update |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
topic | string | 是 | 主题名 |
name | string | 否 | 中文名,页面显示 |
note | string | 否 | 备注信息 |
unpub | bool | 否 | 未发布主题,默认 false |
返回值参数说明
参数名称 | 类型 | 是否必填 | 说明 |
---|
code | string | 是 | 返回码,0 成功,其他失败 |
message | string | 是 | 返回信息描述 |
data | bool | 否 | 成功为 true,失败为 false |
示例介绍
{
"code": 0,
"message": "success",
"data": true,
}
删除主题
接口功能
删除主题记录。
接口地址
URL | {Server}/topic/delete |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
topic | string | 是 | 要删除的主题名 |
返回值参数说明
参数名称 | 类型 | 是否必填 | 说明 |
---|
code | string | 是 | 返回码,0 成功,其他失败 |
message | string | 是 | 返回信息描述 |
data | bool | 否 | 成功为 true,失败为 false |
示例介绍
{
"code": 0,
"message": "success",
"data": true,
}
生产消息
接口功能
将消息投递到具体的主题上。
接口地址
URL | {Server}/message/pub |
---|
http 请求方式 | post |
返回值参数说明
参数名称 | 类型 | 是否必填 | 说明 |
---|
code | int | 是 | 返回码,200 成功,其他失败 |
message | string | 是 | 返回消息 |
data | bool | 否 | 成功为 true,失败为 false |
示例介绍
{
"code": 0,
"message": "success",
"data": true,
}
消费消息
接口功能
消息中间件向应用端服务提供的 Websocket 推送接口。
接口地址
URL | ws://{Server}/message/sub |
---|
http 请求方式 | websocket |
查询站内信—meStationMsgs
接口功能
查询站内信。
接口地址
URL | /api/graphql |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
where | MsgWhereInput | 否 | 查询条件 |
orderBy | [MsgOrderByWithRelationInput] | 否 | 排序条件 |
cursor | MsgWhereUniqueInput | 否 | 游标 |
skip | Int | 否 | 跳过记录数 |
take | Int | 否 | 获取记录数 |
distinct | [MsgScalarFieldEnum] | 否 | 过滤条件 |
返回值参数说明
参数名称 | 类型 | 说明 |
---|
id | string | 主键 |
appId | String | 应用 Id |
appName | String | 应用名称 |
moduleId | String | 模块 Id |
moduleName | String | 模块名称 |
title | String | 标题 |
content | String | 内容 |
type | Int | 消息类型,0:通知消息,1:待办消息,默认是 0 |
todoNotice | Boolean | 是否发送通知,type=1 时字段有效,默认 false,不发送 |
todoStatus | String | 待办当前处理人,type=1 时字段有效 |
todoCurrent | String | 待办当前处理人,type=1 时字段有效 |
todoType | String | 待办类型,type=1 时字段有效 |
accessAddress | String | 访问地址 |
sender | String | 发送人 |
senderName | String | 发送人名称 |
senderAvatar | String | 发送人头像 |
receiver | String | 接收人 |
isTop | Boolean | 是否置顶 |
status | Int | 状态,0:未读/未处理,1:已读/已处理 |
senderTime | DateTime | 发送时间 |
createBy | String | 创建人 |
createdAt | DateTime | 创建时间 |
updateBy | String | 创建人 |
updatedAt | DateTime | 修改时间 |
示例介绍
{
meStationMsgs{
id
appId
appName
moduleId
moduleName
title
content
type
todoNotice
todoStatus
todoCurrent
todoType
accessAddress
sender
senderName
senderAvatar
receiver
isTop
status
senderTime
createBy
createdAt
updateBy
updatedAt
}
}
查询任务—meTodoMsgs
接口功能
查询任务。
接口地址
URL | /api/graphql |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
where | MsgWhereInput | 否 | 查询条件 |
orderBy | [MsgOrderByWithRelationInput] | 否 | 排序条件 |
cursor | MsgWhereUniqueInput | 否 | 游标 |
skip | Int | 否 | 跳过记录数 |
take | Int | 否 | 获取记录数 |
distinct | [MsgScalarFieldEnum] | 否 | 过滤条件 |
返回值参数说明
参数名称 | 类型 | 说明 |
---|
id | string | 主键 |
appId | String | 应用 Id |
appName | String | 应用名称 |
moduleId | String | 模块 Id |
moduleName | String | 模块名称 |
title | String | 标题 |
content | String | 内容 |
type | Int | 消息类型,0:通知消息,1:待办消息,默认是 0 |
todoNotice | Boolean | 是否发送通知,type=1 时字段有效,默认 false,不发送 |
todoStatus | String | 待办当前处理人,type=1 时字段有效 |
todoCurrent | String | 待办当前处理人,type=1 时字段有效 |
todoType | String | 待办类型,type=1 时字段有效 |
accessAddress | String | 访问地址 |
sender | String | 发送人 |
senderName | String | 发送人名称 |
senderAvatar | String | 发送人头像 |
receiver | String | 接收人 |
isTop | Boolean | 是否置顶 |
status | Int | 状态,0:未读/未处理,1:已读/已处理 |
senderTime | DateTime | 发送时间 |
createBy | String | 创建人 |
createdAt | DateTime | 创建时间 |
updateBy | String | 创建人 |
updatedAt | DateTime | 修改时间 |
示例介绍
{
meTodoMsgs {
id
appId
appName
moduleId
moduleName
title
content
type
todoNotice
todoStatus
todoCurrent
todoType
accessAddress
sender
senderName
senderAvatar
receiver
isTop
status
senderTime
createBy
createdAt
updateBy
updatedAt
}
}
删除任务—deleteOneTodo
接口功能
删除任务。
接口地址
URL | /api/graphql |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
where | MsgWhereUniqueInput! | 是 | 查询条件 |
返回值参数说明
参数名称 | 类型 | 说明 |
---|
id | string | 主键 |
appId | String | 应用 Id |
appName | String | 应用名称 |
moduleId | String | 模块 Id |
moduleName | String | 模块名称 |
title | String | 标题 |
content | String | 内容 |
type | Int | 消息类型,0:通知消息,1:待办消息,默认是 0 |
todoNotice | Boolean | 是否发送通知,type=1 时字段有效,默认 false,不发送 |
todoStatus | String | 待办当前处理人,type=1 时字段有效 |
todoCurrent | String | 待办当前处理人,type=1 时字段有效 |
todoType | String | 待办类型,type=1 时字段有效 |
accessAddress | String | 访问地址 |
sender | String | 发送人 |
senderName | String | 发送人名称 |
senderAvatar | String | 发送人头像 |
receiver | String | 接收人 |
isTop | Boolean | 是否置顶 |
status | Int | 状态,0:未读/未处理,1:已读/已处理 |
senderTime | DateTime | 发送时间 |
createBy | String | 创建人 |
createdAt | DateTime | 创建时间 |
updateBy | String | 创建人 |
updatedAt | DateTime | 修改时间 |
示例介绍
mutation {
deleteOneTodo(where: {}) {
id
appId
moduleId
title
content
type
todoNotice
todoStatus
todoCurrent
todoType
accessAddress
sender
receiver
isTop
status
senderTime
createBy
createdAt
updateBy
updatedAt
}
}
标记已读—markRead
接口功能
标记已读。
接口地址
URL | /api/graphql |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
where | IdWhereListInput! | 是 | |
返回值参数说明
示例介绍
mutation {
markRead(where: { ids: ["string"] }) {
data
}
}
发送消息—pubMsg
接口功能
发送消息。
接口地址
URL | /api/graphql |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
where | PubMsgInput!! | 是 | |
返回值参数说明
示例介绍
mutation {
pubMsg(data: { appId: "string", title: "string", content: "string" }) {
data
}
}
任务置顶—setTodoTop
接口功能
任务置顶。
接口地址
URL | /api/graphql |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
where | IdWhereListInput! | 是 | |
返回值参数说明
示例介绍
mutation {
setTodoTop(where: { ids: ["string"] }) {
data
}
}
更新任务—updateOneTodo
接口功能
更新任务。
接口地址
URL | /api/graphql |
---|
http 请求方式 | post |
请求参数说明
名称 | 类型 | 是否必填 | 描述 |
---|
where | MsgWhereUniqueInput! | 是 | 查询条件 |
data | MsgUpdateInput!! | 是 | 查询条件 |
返回值参数说明
参数名称 | 类型 | 说明 |
---|
id | string | 主键 |
appId | String | 应用 Id |
appName | String | 应用名称 |
moduleId | String | 模块 Id |
moduleName | String | 模块名称 |
title | String | 标题 |
content | String | 内容 |
type | Int | 消息类型,0:通知消息,1:待办消息,默认是 0 |
todoNotice | Boolean | 是否发送通知,type=1 时字段有效,默认 false,不发送 |
todoStatus | String | 待办当前处理人,type=1 时字段有效 |
todoCurrent | String | 待办当前处理人,type=1 时字段有效 |
todoType | String | 待办类型,type=1 时字段有效 |
accessAddress | String | 访问地址 |
sender | String | 发送人 |
senderName | String | 发送人名称 |
senderAvatar | String | 发送人头像 |
receiver | String | 接收人 |
isTop | Boolean | 是否置顶 |
status | Int | 状态,0:未读/未处理,1:已读/已处理 |
senderTime | DateTime | 发送时间 |
createBy | String | 创建人 |
createdAt | DateTime | 创建时间 |
updateBy | String | 创建人 |
updatedAt | DateTime | 修改时间 |
示例介绍
mutation {
updateOneTodo(data: {}, where: {}) {
id
appId
moduleId
title
content
type
todoNotice
todoStatus
todoCurrent
todoType
accessAddress
sender
receiver
isTop
status
senderTime
createBy
createdAt
updateBy
updatedAt
}
}