SDKsHarmonyOSEnterprise
Retrieve specified friend profiles
Batch query detailed friendship records for a list of friend user IDs.
Query friendship records for specific user IDs. This method only returns users with whom you have an established friendship; to retrieve public profiles for strangers, see Retrieve user profiles:
Code example
import sdk, { GetSpecifiedFriendsReq, GetSpecifiedFriendsResp } from '@openimsdk/imsdk';
const request: GetSpecifiedFriendsReq = {
friendUserIDs: ['user_a', 'user_b'],
filterBlack: true,
};
const response: GetSpecifiedFriendsResp = await sdk.getSpecifiedFriends(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
friendUserIDs | string[] | Yes | List of user IDs to look up. |
filterBlack | boolean | Yes | Set to true to omit users currently present in the blocklist. |
Return value
Returns a Promise that resolves to a GetSpecifiedFriendsResp object:
| Property | Type | Description |
|---|---|---|
friendsInfo | IMFriend[] | Array of found friendship records. |
State changes after the call
The returned array might contain fewer items than requested if some user IDs are not friends. Order is not guaranteed to match the input list; map items using friendUserID. For friend event listening and complete field definitions, see Paginate friend list.
Was this page helpful?