Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Delete friend applications

Batch remove friend application records identified by applicant and recipient user IDs.

Copy

Batch remove application history records using applicant and recipient user ID pairs:

Code example

import sdk, { DeleteFriendRequestsReq, SimpleFriendRequest } from '@openimsdk/imsdk';

const item: SimpleFriendRequest = {
  fromUserID: applicantUserID,
  toUserID: currentUserID,
};
const request: DeleteFriendRequestsReq = {
  friendRequests: [item],
};
await sdk.deleteFriendRequests(request);

Parameters

ParameterTypeRequiredDescription
friendRequestsSimpleFriendRequest[]YesList of objects each containing fromUserID and toUserID.

Return value

Returns a Promise that resolves to void when records are deleted.

State changes after the call

Deleting an application record purges the request history entry; it does not decline the application or remove established friendships. To reject an application, see Reject friend application. Update list views upon receiving EventOnFriendApplicationDeleted correlated by fromUserID:toUserID, or re-query via Retrieve received friend applications.