TIMConvPinConversation

Introduction

Pin conversation

The new SDK version has added the pinConversation API to pin/unpin conversations to/from the top. It also supports roaming and multi-client synchronization.

If you call SetConvEventCallback in advance to add a conversation listener, you can get the ConvInfo object in the callback.

The ConvInfo conversation object has added the conv_is_pinned field, which is used to determine whether a conversation is pinned on top.

Call TIMConvGetConvList to retrieve the list of conversation. It'll return pinned conversation then unpinned conversation. You can check convInfo object's conv_is_pinned.

Pinned conversation lines before the unpinned ones. But it doesn't affect the inner sequence. Eg. 5 conversation is sequence are 1,2,3,4,5 and you pin 2 and 3 then the sequence becomes 2,3,1,4,5. Appearently 2 and 3 are at the front, and 2 is before 3.

The sequence of conversation is lined by convInfo object's conv_active_time.

Parameter details

Parameter name Parameter type Required Description
param convPinConversation yes Param of pinning conversation

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 { convPinConversation } from "im_electron_sdk/dist/interfaces";

let convId = ""
let convType = 0
let isPinned = true

let param: convPinConversation = {
    convId: convId,  // required
    convType: convType,  // required
    isPinned: isPinned,  // required
    user_data: '',   // optional
}
let { code } = await timRenderInstance.TIMConvPinConversation(param)

if (code == 0) {
    //操作成功
}

results matching ""

    No results matching ""