TIMConvSetDraft

Introduction

Set conversation draft

Conversation draft saves the current unsending typing message. Edit the content by the conv_draft field in ConvInfo.

Only support text content.

Draft is stored locally, thus can be synchronized and will be invalid after uninstalling.

Parameter details

Parameter name Parameter type Required Description
param convSetDrat yes Param of setting conversation draft

Returned template

number

data:number Refer to TIMResult for the definition of return value

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 { convSetDrat, draftParams, draftMessage, messageElem } from "im_electron_sdk/dist/interfaces";

let convID = "";
let convType = 0;
let draft_edit_time = (Date.now() / 1000) + 60 * 60 * 24

let message_elem: messageElem = {
    elem_type: 0,  // required
    text_elem_content: ""// required
}

let draft_msg: draftMessage = {
    message_elem_array: [message_elem] // required
}
let draftParam: draftParams = {
    draft_edit_time: draft_edit_time, // required
    draft_msg: draft_msg,// required
    draft_user_define: "",// required
}

let param: convSetDrat = {
    convId: convID,// required
    convType: convType,// required
    draftParam: draftParam,// required
}
let { code } = await timRenderInstance.TIMConvSetDraft(param)
if (code == 0) {
    //设置成功
}

results matching ""

    No results matching ""