muteGroupMember static method

Future<V2TimCallback> muteGroupMember({
  1. required String groupID,
  2. required String userID,
  3. required int seconds,
})

Implementation

static Future<V2TimCallback> muteGroupMember({
  required String groupID,
  required String userID,
  required int seconds,
}) async {
  int flag = 0x00;

  flag = flag | 0x01 << 2;

  String param = json.encode({
    "group_modify_member_info_group_id": groupID,
    "group_modify_member_info_identifier": userID,
    "group_modify_member_info_shutup_time": seconds > 315360000 ? 315360000 : seconds,
    "group_modify_member_info_modify_flag": flag,
  });
  String userData = Tools.generateUserData();
  Pointer<Uint8> user_data = Tools.string2PointerInt8(userData);
  Pointer<Uint8> json_group_modifymeminfo_param = Tools.string2PointerInt8(param);
  int res = desktopSDK.D_TIMGroupModifyMemberInfo(json_group_modifymeminfo_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"],
    });
  }
}