setDoNotDisturb method

Future<void> setDoNotDisturb({
  1. required bool enable,
  2. int startHour = 0,
  3. int startMin = 0,
  4. int endHour = 23,
  5. int endMin = 59,
  6. String timezone = 'UTC',
})

Sets do not disturb mode enable with given start and end time.

Implementation

Future<void> setDoNotDisturb({
  required bool enable,
  int startHour = 0,
  int startMin = 0,
  int endHour = 23,
  int endMin = 59,
  String timezone = 'UTC',
}) async {
  if (enable && startHour < 0 ||
      startHour > 23 ||
      startMin < 0 ||
      startMin > 59 ||
      endHour < 0 ||
      endHour > 23 ||
      endMin < 0 ||
      endMin > 59) {
    throw InvalidParameterError();
  }

  return _int.api.send(UserDoNotDisturbSetRequest(
    enable: enable,
    startHour: startHour,
    startMin: startMin,
    endHour: endHour,
    endMin: endMin,
    timezone: timezone,
  ));
}