getFriendList

Introduction

Load the list of friend or contacts.

Parameter details

This API has no parameters

Returned template

V2TimValueCallback<V2TimFriendInfo[]>

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

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 V2TimFriendInfo[] The list of friends and contacts.

Code example

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


const getFriendListRes = await TencentImSDKPlugin.v2TIMManager
    .getFriendshipManager()
    .getFriendList();
if (getFriendListRes.code == 0) {

    getFriendListRes.data?.forEach((element) => {
        element.friendCustomInfo;
        element.friendGroups;
        element.friendRemark;
        element.userID;
        element.userProfile?.allowType;
        element.userProfile?.birthday;
        element.userProfile?.customInfo;
        element.userProfile?.faceUrl;
        element.userProfile?.gender;
        element.userProfile?.level;
        element.userProfile?.nickName;
        element.userProfile?.role;
        element.userProfile?.selfSignature;
        element.userProfile?.userID;
    });
}

results matching ""

    No results matching ""