Package com.foxinmy.weixin4j.qy.api
Class ChatApi
- java.lang.Object
-
- com.foxinmy.weixin4j.api.BaseApi
-
- com.foxinmy.weixin4j.qy.api.QyApi
-
- com.foxinmy.weixin4j.qy.api.ChatApi
-
-
Field Summary
-
Fields inherited from class com.foxinmy.weixin4j.api.BaseApi
weixinExecutor
-
-
Constructor Summary
Constructors Constructor Description ChatApi(TokenManager tokenManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApiResultclearChatNotify(String targetId, String owner, ChatType chatType)清除会话未读状态StringcreateChat(ChatInfo chatInfo)创建会话 如果会话id为空,程序会自动生成一个唯一IDChatInfogetChat(String chatId)获取会话ApiResultquitChat(String chatId, String operator)退出会话ApiResultsendChatMessage(ChatMessage message)发送消息List<String>setChatMute(List<ChatMute> chatMutes)设置成员接收到的消息是否提醒。主要场景是用于对接企业im的在线状态,如成员处于在线状态时,可以设置该成员的消息免打扰。当成员离线时,关闭免打扰状态 ,对微信端进行提醒。ApiResultupdateChat(ChatInfo chatInfo, String operator, List<String> addUsers, List<String> deleteUsers)更新会话-
Methods inherited from class com.foxinmy.weixin4j.qy.api.QyApi
weixinBundle
-
Methods inherited from class com.foxinmy.weixin4j.api.BaseApi
getRequestUri
-
-
-
-
Constructor Detail
-
ChatApi
public ChatApi(TokenManager tokenManager)
-
-
Method Detail
-
createChat
public String createChat(ChatInfo chatInfo) throws WeixinException
创建会话 如果会话id为空,程序会自动生成一个唯一ID- Parameters:
chatInfo- 会话信息- Returns:
- 会话ID
- Throws:
WeixinException- See Also:
ChatInfo, 创建会话
-
getChat
public ChatInfo getChat(String chatId) throws WeixinException
获取会话- Parameters:
chatId- 会话ID- Returns:
- 会话信息
- Throws:
WeixinException- See Also:
ChatInfo, 获取会话
-
updateChat
public ApiResult updateChat(ChatInfo chatInfo, String operator, List<String> addUsers, List<String> deleteUsers) throws WeixinException
更新会话- Parameters:
chatInfo- 会话信息 至少保持会话ID不能为空operator- 操作人useridaddUsers- 会话新增成员列表deleteUsers- 会话退出成员列表- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
ChatInfo, 修改会话信息
-
quitChat
public ApiResult quitChat(String chatId, String operator) throws WeixinException
退出会话- Parameters:
chatId- 会话IDoperator- 操作人userid- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
- 退出会话
-
clearChatNotify
public ApiResult clearChatNotify(String targetId, String owner, ChatType chatType) throws WeixinException
清除会话未读状态- Parameters:
targetId- 会话值,为userid|chatid,分别表示:成员id|会话idowner- 会话所有者的useridchatType- 会话类型:single|group,分别表示:群聊|单聊- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
- 清除会话未读状态
-
setChatMute
public List<String> setChatMute(List<ChatMute> chatMutes) throws WeixinException
设置成员接收到的消息是否提醒。主要场景是用于对接企业im的在线状态,如成员处于在线状态时,可以设置该成员的消息免打扰。当成员离线时,关闭免打扰状态 ,对微信端进行提醒。- Parameters:
chatMutes- 提醒参数- Returns:
- 列表中不存在的成员,剩余合法成员会继续执行。
- Throws:
WeixinException- See Also:
ChatMute, 设置成员新消息免打扰
-
sendChatMessage
public ApiResult sendChatMessage(ChatMessage message) throws WeixinException
发送消息- Parameters:
message- 消息对象- Returns:
- 处理结果
- Throws:
WeixinException- See Also:
ChatMessage, 发送消息
-
-