TIMMsgDownloadElemToPath

Introduction

Download message elements

Download message elements including image, file, sound and video. Fields like msg_download_elem_param_flag、msg_download_elem_param_id、msg_download_elem_param_business_id、msg_download_elem_param_url can be found in the element. And msg_download_elem_param_type is download type TIMDownloadType, the path must be UTF-8 encoded.

Parameter details

Parameter name Parameter type Required Description
msgDownloadElemToPathParams MsgDownloadElemToPathParams yes Param of downloading message elements

Returned template

Promise<commonResult<DownloadElemResult>>

{
    code: TIMResult | TIMErrCode;
    desc?: string | undefined;
    json_param?: DownloadElemResult | undefined;
    json_params?: DownloadElemResult | 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 DownloadElemResult | undefined Return value of calling API
json_params DownloadElemResult | 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 { MsgDownloadElemToPathParams, Json_download_elem_param } from "im_electron_sdk/dist/interfaces";
let params: Json_download_elem_param = {
    msg_download_elem_param_flag: 0,
    msg_download_elem_param_type: 0,
    msg_download_elem_param_id: '',
    msg_download_elem_param_business_id: 0,
    msg_download_elem_param_url: ''
}
let param: MsgDownloadElemToPathParams = {
    params: params,
    path: '',
    user_data: ''
}

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

results matching ""

    No results matching ""