aiobearychat.openapi.message_api
¶
消息相关 API.
auto generated by script at 2017-08-24 21:50:13.459796. don’t edit it.
-
class
aiobearychat.openapi.message_api.
MessageAPI
(requester: aiobearychat.abc.Requester, token: str, *, base_url: str, **kwargs)[源代码]¶ 消息相关 API.
-
create
(vchannel_id: str, text: str, attachments: list, **requester_params: typing.Any) → aiobearychat.sansio.Response[源代码]¶ 发送一条消息到指定聊天会话。
官方文档地址:https://github.com/bearyinnovative/OpenAPI/blob/master/api/message.create.md
参数: - vchannel_id (
str
) – 指定的目标聊天会话 id (示例:=bw52O
) - text (
str
) – 消息内容 (示例:中午吃啥啊?
) - attachments (
list
) – 消息附件
返回: response. 一个
aiobearychat.sansio.Response
实例返回类型: response.body
返回值示例:response.status 等于 201 时: { "key": "1485236262366.0193", "updated": "2017-01-24T13:37:42.000+0000", "is_channel": false, "uid": "=bw52O", "fallback": null, "attachments": [], "created": "2017-01-24T13:37:42.000+0000", "vchannel_id": "=bw52O", "refer_key": null, "robot_id": null, "created_ts": 1485236262366, "team_id": "=bw52O", "subtype": "normal", "text": "hello" }
- vchannel_id (
-
delete
(vchannel_id: str, message_key: str, **requester_params: typing.Any) → aiobearychat.sansio.Response[源代码]¶ 删除一条消息。
官方文档地址:https://github.com/bearyinnovative/OpenAPI/blob/master/api/message.delete.md
参数: - vchannel_id (
str
) – 消息聊天会话 id (示例:=bw52O
) - message_key (
str
) – 删除的消息 key (示例:1487667236785.0077
)
返回: response. 一个
aiobearychat.sansio.Response
实例返回类型: response.body
返回值示例:response.status 等于 204 时:
- vchannel_id (
-
info
(vchannel_id: str, message_key: str, **requester_params: typing.Any) → aiobearychat.sansio.Response[源代码]¶ 返回一条消息的信息。
官方文档地址:https://github.com/bearyinnovative/OpenAPI/blob/master/api/message.info.md
参数: - vchannel_id (
str
) – 指定的目标聊天会话 id (示例:=bw52O
) - message_key (
str
) – 获取消息的 key (示例:1487667236785.0077
)
返回: response. 一个
aiobearychat.sansio.Response
实例返回类型: response.body
返回值示例:response.status 等于 200 时: { "key": "1485236262366.0193", "updated": "2017-01-24T13:37:42.000+0000", "is_channel": false, "uid": "=bw52O", "fallback": null, "attachments": [], "created": "2017-01-24T13:37:42.000+0000", "vchannel_id": "=bw52O", "refer_key": null, "robot_id": null, "created_ts": 1485236262366, "team_id": "=bw52O", "subtype": "normal", "text": "hello" }
- vchannel_id (
-
query
(vchannel_id: str, query: str, **requester_params: typing.Any) → aiobearychat.sansio.Response[源代码]¶ 查询指定 vchannel 下的消息列表。支持以下几种查询算法:
查询 vchannel 下最新的消息,支持参数:
limit
: 查询数量限制,最大值为 100, 默认 20
从指定位置开始拉取若干条消息,支持参数:
key
: 开始位置的消息 key, 不可以和ts
同时使用ts
: 开始位置的消息 ts, 不可以和ts
同时使用forward
: 向前(时间发生方向)获取条数backward
: 向后(时间发生方向)获取条数
注意:
- 使用
key
查询时,查询区间不包括 key 对应的消息 - 使用
ts
查询时,查询区间包括 ts 对应的消息 forward
/backward
参数可以同时使用forward
/backward
参数最大值为 100,forward
/backward
均未指定时,默认使用forward=100
拉取一定时间窗口内的消息,支持参数:
from_key
/to_key
: 窗口区间的消息 keyfrom_ts
/to_ts
: 窗口区间的消息 tsforward
: 从 from 方向往 to 方向取的消息数backward
: 从 to 方向往 from 方向取的消息数
注意:
{from,to}_key
和{from,to}_ts
不可以混用使用
{from,to}_key
查询时,查询区间不包括 key 对应的消息使用
{from,to}_ts
查询时,查询区间包括 ts 对应的消息forward
和backward
参数只能选其中一个forward
/backward
均未指定时,默认使用forward=100
如果查询区间开始值比结束值大,返回空结果
官方文档地址:https://github.com/bearyinnovative/OpenAPI/blob/master/api/message.query.md
param vchannel_id: 待查询 vchannel_id (示例: =bw52O
)type vchannel_id: str
param query: 消息查询 payload type query: str
return: response. 一个 aiobearychat.sansio.Response
实例rtype: aiobearychat.sansio.Response
response.body
返回值示例:response.status 等于 200 时: { "messages": [ { "key": "1485236262366.0193", "updated": "2017-01-24T13:37:42.000+0000", "is_channel": false, "uid": "=bw52O", "fallback": null, "attachments": [], "created": "2017-01-24T13:37:42.000+0000", "vchannel_id": "=bw52O", "refer_key": null, "robot_id": null, "created_ts": 1485236262366, "team_id": "=bw52O", "subtype": "normal", "text": "hello" } ] }
-
update_text
(vchannel_id: str, message_key: str, text: str, **requester_params: typing.Any) → aiobearychat.sansio.Response[源代码]¶ 更新一条消息的内容。
官方文档地址:https://github.com/bearyinnovative/OpenAPI/blob/master/api/message.update_text.md
参数: - vchannel_id (
str
) – 消息聊天会话 id (示例:=bw52O
) - message_key (
str
) – 更新的消息 key (示例:1487667236785.0077
) - text (
str
) – 更新的消息内容 (示例:中午吃啥啊?
)
返回: response. 一个
aiobearychat.sansio.Response
实例返回类型: response.body
返回值示例:response.status 等于 200 时: { "key": "1485236262366.0193", "updated": "2017-01-24T13:37:42.000+0000", "is_channel": false, "uid": "=bw52O", "fallback": null, "attachments": [], "created": "2017-01-24T13:37:42.000+0000", "vchannel_id": "=bw52O", "refer_key": null, "robot_id": null, "created_ts": 1485236262366, "team_id": "=bw52O", "subtype": "normal", "text": "hello" }
- vchannel_id (
-