deleteTopicFromCommunity static method

Future<V2TimValueCallback<List<V2TimTopicOperationResult>>> deleteTopicFromCommunity({
  1. required String groupID,
  2. required List<String> topicIDList,
})

Implementation

static Future<V2TimValueCallback<List<V2TimTopicOperationResult>>> deleteTopicFromCommunity({
  required String groupID,
  required List<String> topicIDList,
}) async {
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> json_topic_id_array = Tools.string2PointerInt8(json.encode(topicIDList));
  Pointer<Uint8> group_id = Tools.string2PointerInt8(groupID);
  int res = desktopSDK.D_TIMGroupDeleteTopicFromCommunity(group_id, json_topic_id_array, user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimValueCallback<List<V2TimTopicOperationResult>>.fromJson({
      "code": res,
      "desc": "",
    });
  } 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> jso = element;
      list.add(Map<String, dynamic>.from({
        "errorCode": jso["group_topic_operation_result_error_code"],
        "errorMessage": jso["group_topic_operation_result_error_message"],
        "topicID": jso["group_topic_operation_result_topic_id"] // TODO
      }));
    }
    return V2TimValueCallback<List<V2TimTopicOperationResult>>.fromJson({
      "code": data['code'],
      "desc": data['desc'],
      "data": list,
    });
  }
}