TIMFriendshipModifyFriendProfile
Introduction
Modify friend's profile
Modify friend's profile, supported fileds please check FriendProfileItem. You can update multiple fields at one time. You can add prefix TagSNS_Custom for custom string key, or it is automatically attached by the SDK.
Parameter details
Parameter name | Parameter type | Required | Description |
---|---|---|---|
modifyFriendProfileParams | ModifyFriendProfileParams | yes | Param of modifying friend's profile |
Returned template
Promise<commonResult<string>>
{
code: TIMResult | TIMErrCode;
desc?: string | undefined;
json_param?: string | undefined;
json_params?: string | 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 | string | undefined | Return value of calling API |
json_params | string | 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 { ModifyFriendProfileParams, FriendProfileItem, FriendProfileCustemStringInfo } from "im_electron_sdk/dist/interfaces";
let customString: FriendProfileCustemStringInfo = {
user_data: '', // optional
friend_profile_custom_string_info_key: '', // required
friend_profile_custom_string_info_value: '' // required
}
let friendProfileItem: FriendProfileItem = {
friend_profile_item_remark: "", // optional
friend_profile_item_group_name_array: [""], // optional
friend_profile_item_custom_string_array: [customString] // optional
}
let param: ModifyFriendProfileParams = {
params: {
friendship_modify_friend_profile_param_identifier: "", // optional
friendship_modify_friend_profile_param_item: friendProfileItem // optional
},
user_data: "1234" // optional
}
const { code } = await timRenderInstance.TIMFriendshipModifyFriendProfile(param);
if (code == 0) {
// success
}