TIMFriendshipSearchFriends

Introduction

Search friend

Only locally stored users can be searched for, such as contacts or user profiles that have been pulled.

You can set the search keyword friendship_search_param_keyword_list and specify the search scope to set whether to search by the userID, nickName, and remark fields of a user.

Parameter details

Parameter name Parameter type Required Description
searchFriendsParams SearchFriendsParams yes Param of searching friend

Returned template

Promise<commonResult<Array<FriendInfoGetResult>>>

{
    code: TIMResult | TIMErrCode;
    desc?: string | undefined;
    json_param?: Array<FriendInfoGetResult> | undefined;
    json_params?: Array<FriendInfoGetResult> | undefined; 
    user_data?: string | undefined;
}

Return value details

name type description
code TIMResultTIMErrCode Request result: Error codes. 0 means success.
desc string | undefined The description of the error. It will be empty if success.
json_param Array< FriendInfoGetResult > | undefined Return value of calling API
json_params Array< FriendInfoGetResult > | undefined Return value of calling API. Compatible field, which is returned in some cases.
user_data string | undefined ImSDK is responsible for transporting user-defined data without any processing

Code example

import TimRender from "im_electron_sdk/dist/renderer";
const timRenderInstance = new TimRender();
import { SearchFriendsParams } from "im_electron_sdk/dist/interfaces";
let keyword = ''
let field = 0
let param: SearchFriendsParams = {
    params: {
        friendship_search_param_keyword_list: [keyword],    // optional
        friendship_search_param_search_field_list: [field]        // optional
    },
    user_data: ""    // optional
}

const { code } = await timRenderInstance.TIMFriendshipSearchFriends(param);
if (code == 0) {
    // success
}

results matching ""

    No results matching ""