renameFriendGroup static method

Future<V2TimCallback> renameFriendGroup({
  1. required String oldName,
  2. required String newName,
})

Implementation

static Future<V2TimCallback> renameFriendGroup({
  required String oldName,
  required String newName,
}) async {
  String param = json.encode(Map<String, dynamic>.from({
    "friendship_modify_friend_group_param_name": oldName,
    "friendship_modify_friend_group_param_new_name": newName,
  }));
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> json_modify_friend_group_param = Tools.string2PointerInt8(param);
  int res = desktopSDK.D_TIMFriendshipModifyFriendGroup(json_modify_friend_group_param, user_data);
  if (res != TIMResult.TIM_SUCC) {
    return V2TimCallback.fromJson({
      "code": res,
      "desc": "",
    });
  } else {
    Map<String, dynamic> data = await getAsyncData(apiKey: userData);
    return V2TimCallback.fromJson({
      "code": data["code"],
      "desc": data["desc"],
    });
  }
}