TIMFriendshipAddFriend

Introduction

Add friend

Add unidirectional/bidirectional friend, please check Adding friends.

Parameter details

Parameter name Parameter type Required Description
addFriendParams AddFriendParams yes Param of adding friend

Returned template

Promise<commonResult<FriendResult>>

{
    code: TIMResult | TIMErrCode;
    desc?: string | undefined;
    json_param?: FriendResult | undefined;
    json_params?: FriendResult | 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 FriendResult | undefined Return value of calling API
json_params FriendResult | 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 { AddFriendParams } from "im_electron_sdk/dist/interfaces";
let param: AddFriendParams = {
    params: {
        friendship_add_friend_param_identifier: "",    // required
        friendship_add_friend_param_friend_type: 1,    // required
        friendship_add_friend_param_remark: "",    // optional
        friendship_add_friend_param_group_name: "",    // optional
        friendship_add_friend_param_add_source: "",    // optional
        friendship_add_friend_param_add_wording: "",    // optional
    },
    user_data: ""    // optional
}

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

results matching ""

    No results matching ""