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

Update friend details

Update friend remarks, pinned state, or extension values.

Copy

updateFriends() updates selected fields for one or more friendships.

Parameters

ParameterTypeRequiredDescription
friendUserIDsstring[]YesFriend IDs to update. The same values are applied to every target.
remarkstring or nullNoNew friend remark.
isPinnedboolean or nullNoWhether to pin the friends.
exstring or nullNoNew extension string; completely replaces the old value.
import { updateFriends } from '@/uni_modules/unix-openim-sdk'

await updateFriends({
  friendUserIDs: ['user_a', 'user_b'],
  remark: 'Project team',
  isPinned: true,
})

friendUserIDs must not be empty, and at least one update field must be present. If different friends need different values, call the operation separately. ex is a complete replacement string and is not merged as JSON by the SDK.

Promise success means that the update request completed, not that the friend event arrived. Merge final state by userID from onFriendInfoChanged on Get the friend list, or requery when reconciliation is needed.

The commercial single-user alternative uses pinned:

import { updateFriend } from '@/uni_modules/unix-openim-sdk'

await updateFriend({ userID: 'user_a', pinned: true, remark: 'Owner' })

updateFriend() addresses one userID and names the pin field pinned; remark and ex remain complete replacement values. Do not race updateFriends() and the Commercial updateFriend() for the same user. Choose one entry and serialize changes through the friend store.