Browse SDKs · uni-app / uni-app x
Platform
SDKsuni-app / uni-app xEnterprise

Get conversations in a group

Query detailed metadata and paginated conversation items within a specific conversation group.

Copy

Retrieving conversation group details is a Commercial Edition capability. Query a conversation group along with its member conversations using page-based pagination.

Parameters

ParameterTypeRequiredDescription
conversationGroupIDstringYesIdentifier of the target conversation group.
pagination.pageNumbernumberYesPage number starting from 1.
pagination.showNumbernumberYesNumber of conversation items to fetch per page.

Code example

import { getConversationGroupInfoWithConversations } from '@/uni_modules/unix-openim-sdk'

const result = await getConversationGroupInfoWithConversations({
  conversationGroupID,
  pagination: {
    pageNumber: 1,
    showNumber: 20,
  },
})

if (result != null) {
  renderConversationGroup(
    result.conversationGroup,
    result.conversations,
    result.ConversationTotal ?? 0,
  )
}

Return value

The Promise resolves with an OpenIMConversationGroupInfoWithConversationsResult | null object:

FieldTypeDescription
conversationGroupOpenIMConversationGroupItem | nullMetadata of the requested conversation group.
ConversationTotalnumber | nullTotal count of conversations in this group; note the initial capital letter.
conversationsOpenIMConversationItem[]Array of conversation items for the requested page.

Determine whether pagination is exhausted by comparing the accumulated loaded items against ConversationTotal.

State changes after the call

This call returns a point-in-time snapshot and does not trigger events. Merge group metadata using conversationGroupID and conversation items using conversationID. When conversation group events arrive, reset the pagination offset and re-query as outlined in Conversation group overview.