getFriendsInfo

Introduction

Get the profile information of the specific friends.

  1. You can get the relationship type from the relation in result.

  2. It is recommended to request for 100 users once, to avoid the risk of refusing from IM Server, which has a limit to inbound request package size in 1MB.

Parameter details

Parameter name Parameter type Required Description
userIDList string[] yes The list of ID of the users to request.

Returned template

V2TimValueCallback<V2TimFriendInfoResult[]>

{
    code : number
    desc : string
    data : V2TimFriendInfoResult[]
}

Return value details

name type description
code number Request result: Error codes. 0 means success.
desc string The description of the error. It will be empty if success.
data V2TimFriendInfoResult[] The list of result.

Code example

import { TencentImSDKPlugin } from 'react-native-tim-js';


const getFriendsInfoRes = await TencentImSDKPlugin.v2TIMManager
    .getFriendshipManager()
    .getFriendsInfo([]);
if (getFriendsInfoRes.code === 0) {

    getFriendsInfoRes.data?.forEach((element) => {
        element.relation;
        element.resultCode;
        element.resultInfo;

        element.friendInfo?.friendCustomInfo;
        element.friendInfo?.friendGroups;
        element.friendInfo?.friendRemark;
        element.friendInfo?.userID;
        element.friendInfo?.userProfile?.allowType;
        element.friendInfo?.userProfile?.birthday;
        element.friendInfo?.userProfile?.customInfo;
        element.friendInfo?.userProfile?.faceUrl;
        element.friendInfo?.userProfile?.gender;
        element.friendInfo?.userProfile?.level;
        element.friendInfo?.userProfile?.nickName;
        element.friendInfo?.userProfile?.role;
        element.friendInfo?.userProfile?.selfSignature;
        element.friendInfo?.userProfile?.userID;
    });
}

results matching ""

    No results matching ""