deleteConversationList static method

Future<V2TimValueCallback<List<V2TimConversationOperationResult>>> deleteConversationList({
  1. required List<String> conversationIDList,
  2. required bool clearMessage,
})

Implementation

static Future<V2TimValueCallback<List<V2TimConversationOperationResult>>> deleteConversationList({
  required List<String> conversationIDList,
  required bool clearMessage,
}) async {
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> conversationIDListPtr = Tools.string2PointerInt8(json.encode(conversationIDList));

  int res1 = desktopSDK.D_TIMConvDeleteConversationList(conversationIDListPtr, clearMessage ? 1 : 0, user_data);
  if (res1 != TIMResult.TIM_SUCC) {
    return V2TimValueCallback<List<V2TimConversationOperationResult>>.fromJson({
      "code": res1,
      "desc": "",
      "data": [],
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);

    List<Map<String, dynamic>> dataList = List<Map<String, dynamic>>.from(
      json.decode(data["json_param"].isEmpty ? json.encode([]) : data["json_param"]),
    );
    List<Map<String, dynamic>> list = List<Map<String, dynamic>>.empty(growable: true);
    for (var element in dataList) {
      Map<String, dynamic> res = element;
      res["conversationID"] = element["conversation_operation_result_conversation_id"];
      res["resultCode"] = element["conversation_operation_result_result_code"];
      res["resultInfo"] = element["conversation_operation_result_result_info"];
      list.add(res);
    }
    return V2TimValueCallback<List<V2TimConversationOperationResult>>.fromJson({
      "code": data["code"],
      "desc": data["desc"],
      "data": list,
    });
  }
}