TIMMsgListDelete

Introduction

Delete message list

Delete local messages as well as the server messages. Beware of the following

Save and reuse the original message list Json to avoid message reconstruction.

Delete maximum 30 messages once.

Maximum invoking 1 time per second.

If an account retrieved these messgaes on other device before deletion, these messgaes stay on those devices, meaning that message deletion is not synchronized on different devices.

Parameter details

Parameter name Parameter type Required Description
msgListDeleteParams MsgListDeleteParams yes Param of deleting message list

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 TIMResultTIMErrCode 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 { MsgListDeleteParams,MsgGetMsgListParams,Json_value_msg } from "im_electron_sdk/dist/interfaces";
let convId = ''
let convType=0
let param2:MsgGetMsgListParams = {
    conv_id:convId,
    conv_type: convType,
    params: {
        msg_getmsglist_param_last_msg: null,
        msg_getmsglist_param_count: 2,
        msg_getmsglist_param_is_ramble: true,
    },
    user_data: ""
}
let m = await timRenderInstance.TIMMsgGetMsgList(param2);
let json_msg_param:Json_value_msg = m.json_params[0];
let param : MsgListDeleteParams = {
    conv_id: convId,
    conv_type: convType,
    params: [json_msg_param],
    user_data: ''
}

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

results matching ""

    No results matching ""