Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Retrieve joined group list with pagination

Paginate through the list of groups that the current account has joined.

Copy

Use page-based pagination to load joined groups incrementally when the user belongs to many groups.

Parameters

ParameterTypeRequiredDescription
pagination.pageNumbernumberYesPage number, starting from 1.
pagination.showNumbernumberYesNumber of groups to fetch per page.

Code example

import sdk, { GetJoinedGroupsPageReq, GetJoinedGroupsPageResp } from '@openimsdk/imsdk';

const request: GetJoinedGroupsPageReq = {
  pagination: { pageNumber: 1, showNumber: 50 },
};
const response: GetJoinedGroupsPageResp = await sdk.getJoinedGroupsPage(request);
const groups = response.groups;

Return value

Returns a Promise resolving to GetJoinedGroupsPageResp:

PropertyTypeDescription
groupsIMGroup[]List of group profile items for the current page.

State changes after the call

The response does not include a total count or next-page cursor; when groups.length < showNumber, the end of the list has been reached. If group creation, dismissal, or leave events occur as documented in Group overview, reset pagination and reload from page 1 to prevent inconsistent displays or duplicates.