SDKsHarmonyOSEnterprise
Update friend profile
Modify a friend’s remark note, pinned status, or custom relationship metadata.
Update friend information one friend at a time. Include only the fields you wish to change. The ex parameter is an opaque replacement string; the engine does not automatically merge existing JSON attributes:
Code example
import sdk, { UpdateFriendReq } from '@openimsdk/imsdk';
const request: UpdateFriendReq = {
userID: friendUserID,
remark: remark.trim(),
pinned: true,
};
await sdk.updateFriend(request);Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
userID | string | Yes | Target friend's user identifier. |
remark | string | No | Private remark note for this friend. |
pinned | boolean | No | Whether to pin this friend in contact listings. |
ex | string | No | Updated complete relationship metadata string. |
Return value
Returns a Promise that resolves to void upon updating the friend record on the server.
State changes after the call
Resolving the Promise confirms that the request reached the server; it does not guarantee that asynchronous friend events have arrived. When EventOnFriendInfoChanged arrives, update local state keyed by friendUserID (matching the target userID). For listener setup, see Paginate friend list.
Was this page helpful?