SDKsuni-app / uni-app x
Check friendship status
Verify whether the authenticated user maintains a friendship with a specified set of users.
Invoke checkFriend() to batch verify friendship relationships between the authenticated user and one or more target users before displaying profile cards or initiating interactions.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userIDs | string[] | Yes | An array of user IDs to check. |
Code example
import { checkFriend } from '@/uni_modules/unix-openim-sdk'
const response = await checkFriend(['user_a', 'user_b'])
const checks = response?.result ?? []Return value
The Promise resolves with an OpenIMCheckFriendResult | null object containing an array of friendship status records in result:
| Property | Type | Description |
|---|---|---|
userID | string | The user ID checked. |
result | number | 1 indicates that the users are friends; 0 indicates that they are not friends. |
State changes after the call
This is a read-only check that retrieves current local status without triggering friend events. Friendships and blacklists are distinct relationship models; to check blacklist status, call Get the blacklist.
Was this page helpful?