Query a conversation
Introduction
ZIM supports querying detailed information of a conversation by specifying the conversation ID.
Procedures
After the login, a user can use the queryConversation interface to specify the conversation ID and conversation type to get detailed information about the corresponding conversation, including the conversation name, unread count, and notification status.
String conversationID = "convId";
ZIMConversationType type = ZIMConversationType.PEER;
// Query a conversation
zim.queryConversation(conversationID,type, new ZIMConversationQueriedCallback() {
@Override
public void onConversationQueried(ZIMConversation conversation, ZIMError errorInfo) {
}
});
1
// Query conversation information
[[ZIM getInstance] queryConversation:@"targetConversationID" conversationType:ZIMConversationTypePeer callback:^(ZIMConversation * _Nonnull conversation, ZIMError * _Nonnull errorInfo) {
// Callback for the result of the query conversation operation
if (errorInfo.code == ZIMErrorCodeSuccessS) {
} else {
// You can print the error code and error message to troubleshoot the error cause, referring to the ZIM official website error code documentation
}
}];
1
// Query conversation information
var conversationID = "xxx";
var conversationType = 0;
zim.queryConversation(conversationID, conversationType)
.then(function({ conversation }){
// Query successful, you need to save and maintain the conversation object in the array
})
.catch(function(err){
// Query failed
})
1
// Query conversation information
ZIM.getInstance().queryConversation("conversationID", ZIMConversationType.peer).then((value){
// Query succeeded
}).catchError((onError){
// Query failed, you can print the error code and error message to troubleshoot the error cause, refer to the ZIM official website error code documentation
});
1
// Query the information of a conversation
zim_->queryConversation(
"conv_id", conv_type,
[=](std::shared_ptr<zim::ZIMConversation> conv, const zim::ZIMError &errorInfo) {
// Operation result
if (errorInfo.code == zim::ZIMErrorCode::ZIM_ERROR_CODE_SUCCESS) {
// Operation succeeded
} else {
// Operation failed, you can print the error code and error message and troubleshoot the error by looking for the ZIM official error code documentation.
}
});
1
// Query conversation information
ZIM.GetInstance().QueryConversation(
"conv_id", ZIMConversationType.Peer,
(ZIMConversation conv, ZIMError errorInfo) => {
// Callback for the result of the query conversation operation
if (errorInfo.code == ZIMErrorCode.Success) {
} else {
// You can print the error code and error message to troubleshoot the issue, refer to the ZIM official website error code documentation for troubleshooting
}
});
1