Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Search joined groups

Search through groups that the current account has joined and synced locally.

Copy

This method searches groups that the current account has already joined and synchronized locally; it does not discover public groups.

Parameters

ParameterTypeRequiredDescription
keywordstringYesNon-empty keyword trimmed of whitespace.
searchGroupIDbooleanYesWhether to match against groupID.
searchGroupNamebooleanYesWhether to match against the group name.

Code example

import sdk, { SearchGroupsReq, SearchGroupsResp } from '@openimsdk/imsdk';

const request: SearchGroupsReq = {
  keyword: keyword.trim(),
  searchGroupID: true,
  searchGroupName: true,
};
const response: SearchGroupsResp = await sdk.searchGroups(request);
const groups = response.groups;

Return value

Returns a Promise resolving to SearchGroupsResp:

PropertyTypeDescription
groupsIMGroup[]Array of matching joined groups.

State changes after the call

Display search results as a separate result set rather than overwriting the complete joined group list retrieved via Retrieve joined group list with pagination. Public group directories, category filtering, and complex permission checks should be provided by your backend service.