Browse SDKs · HarmonyOS
Platform
SDKsHarmonyOSEnterprise

Retrieve sent friend applications

Paginate friend requests dispatched by the current signed-in user.

Copy

Pass send: true to paginate friend requests initiated by the signed-in account:

Code example

import sdk, { GetFriendApplicationReq, GetFriendApplicationResp } from '@openimsdk/imsdk';

const request: GetFriendApplicationReq = {
  send: true,
  handleResults: [],
  pagination: {
    pageNumber: 1,
    showNumber: 20,
  },
};
const response: GetFriendApplicationResp = await sdk.getFriendApplication(request);
showSentApplications(response.applications);

Parameters

ParameterTypeRequiredDescription
sendbooleanYesSet to true to query outgoing requests sent by the current user.
handleResultsHandleResult[]YesFilter array by review status; pass [] to query all states.
pagination.pageNumbernumberYesPage index, starting from 1.
pagination.showNumbernumberYesNumber of requests to fetch per page.

Return value

Returns a Promise that resolves to a GetFriendApplicationResp object containing applications: IMFriendApplication[]:

PropertyTypeDescription
fromUserIDstringCurrent user ID (sender).
toUserIDstringTarget user ID (recipient).
handleResultHandleResultCurrent review status (ResultDefault, ResultAccept, or ResultDecline).
reqMsgstringVerification note attached by the sender.
handleMsgstringNote returned by the reviewer.
createTimenumberRequest dispatch timestamp in Unix milliseconds.

State changes after the call

Track application records locally using the composite key fromUserID:toUserID. This query executes locally and does not emit events. For incoming request event listeners, see Retrieve received friend applications.