TIMFriendshipHandleFriendAddRequest
Introduction
Handle friend add request
When set user_profile_add_permission as kTIMProfileAddPermission_NeedConfirm, other user add you as friend will invoke a pendency request and it is handled by this API.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
handleFriendAddParams | HandleFriendAddParams | yes | Param of handling friend add request |
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 | TIMResult | TIMErrCode | 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 { HandleFriendAddParams } from "im_electron_sdk/dist/interfaces";
let param: HandleFriendAddParams = {
params: {
friend_response_identifier: "", // optional
friend_response_action: 1, // optional
friend_response_remark: "", // optional
friend_response_group_name: "", // optional
},
user_data: "" // optional
}
const { code } = await timRenderInstance.TIMFriendshipHandleFriendAddRequest(param);
if (code == 0) {
// success
}