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

Check friendship status

Verify whether the authenticated user maintains a friendship with a specified set of users.

Copy

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

ParameterTypeRequiredDescription
userIDsstring[]YesAn 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:

PropertyTypeDescription
userIDstringThe user ID checked.
resultnumber1 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.