SDKsHarmonyOSEnterprise
Retrieve conversations in a group
Paginate conversations belonging to a specific conversation group along with group details.
Query conversation group details and its member conversations within a single paginated response.
Code example
import sdk, {
GetConversationGroupInfoWithConversationsReq,
GetConversationGroupInfoWithConversationsResp,
} from '@openimsdk/imsdk';
const request: GetConversationGroupInfoWithConversationsReq = {
conversationGroupID: conversationGroupID,
pagination: {
pageNumber: 1,
showNumber: 20,
},
};
const response: GetConversationGroupInfoWithConversationsResp =
await sdk.getConversationGroupInfoWithConversations(request);
renderConversationGroup(response.conversationGroup, response.conversations);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationGroupID | string | Yes | Target conversation group identifier. |
pagination.pageNumber | number | Yes | Page index, starting from 1. |
pagination.showNumber | number | Yes | Number of conversations to retrieve per page. |
Return value
Returns a Promise that resolves to a GetConversationGroupInfoWithConversationsResp object:
| Property | Type | Description |
|---|---|---|
conversationGroup | IMConversationGroup | Profile metadata of the queried conversation group. |
conversations | IMConversation[] | List of conversation records for the current page. |
isEnd | boolean | Whether the final page of conversations has been reached. |
State changes after the call
If member association events arrive while paging through the list, reset the pagination offset and re-query from the first page to prevent inconsistent page boundary snapshots. For event listeners, see Conversation groups overview.
Was this page helpful?