acceptFriendApplication
Introduction
Accept friend or contact application.
Parameter details
Parameter name |
Parameter type |
Required |
Platform |
Description |
responseType |
FriendResponseTypeEnum |
yes |
All |
The relationship type between the friend(contact) and the current user, including one-way friend and two-way friend. |
type |
FriendApplicationTypeEnum |
yes |
All |
The relationship application type, reflects who made this application. |
userID |
String |
yes |
All |
The target user ID. |
Returned template
V2TimValueCallback<V2TimFriendOperationResult>
{
code : int
desc : String
data : {
resultCode : int
resultInfo : String
userID : String
}
}
Return value details
Code example
V2TimValueCallback<V2TimFriendApplicationResult>
getFriendApplicationListRes = await TencentImSDKPlugin.v2TIMManager
.getFriendshipManager()
.getFriendApplicationList();
if (getFriendApplicationListRes.code == 0) {
getFriendApplicationListRes.data?.unreadCount;
getFriendApplicationListRes.data?.friendApplicationList
?.forEach((element) async {
V2TimValueCallback<V2TimFriendOperationResult>
acceptFriendApplicationRes = await TencentImSDKPlugin.v2TIMManager
.getFriendshipManager()
.acceptFriendApplication(
responseType: FriendResponseTypeEnum
.V2TIM_FRIEND_ACCEPT_AGREE,
type: FriendApplicationTypeEnum.values[element!.type],
userID: "");
if (acceptFriendApplicationRes.code == 0) {
acceptFriendApplicationRes.data?.resultCode;
acceptFriendApplicationRes.data?.resultInfo;
acceptFriendApplicationRes.data?.userID;
}
});
}