patchAppointmentsCreateException method

Future<RestApiResponse> patchAppointmentsCreateException(
  1. String id,
  2. DateTime exceptionFrom,
  3. DateTime from,
  4. DateTime to, {
  5. String title = '',
  6. String place = '',
  7. String description = '',
  8. String owner = '',
  9. ISODuration remindBefore = const ISODuration(year: 0),
  10. DateTime? remindAt,
  11. bool wholeDay = false,
  12. bool group = false,
  13. List<String>? attendeesUserNames,
  14. List<String>? attendeesAddresses,
  15. List<String>? attendeesEmails,
  16. String notificationComment = '',
  17. bool notifyAllAttendees = false,
  18. bool isSerial = false,
  19. bool public = false,
  20. bool extern = false,
  21. int? type,
  22. int? occupancy,
  23. String rrule = '',
})

This request allows to create Termin series exception

id OID or ~UUID of the Termin series appointment

exceptionFrom start date of the appointment

optional fields: new appointment data

Implementation

Future<RestApiResponse> patchAppointmentsCreateException(
  String id,
  DateTime exceptionFrom,
  DateTime from,
  DateTime to, {
  String title = '',
  String place = '',
  String description = '',
  String owner = '',
  ISODuration remindBefore = const ISODuration(year: 0),
  DateTime? remindAt,
  bool wholeDay = false,
  bool group = false,
  List<String>? attendeesUserNames,
  List<String>? attendeesAddresses,
  List<String>? attendeesEmails,
  String notificationComment = '',
  bool notifyAllAttendees = false,
  bool isSerial = false,
  bool public = false,
  bool extern = false,
  int? type,
  int? occupancy,
  String rrule = '',
}) {
  final Map<String, dynamic> exceptionBody = <String, dynamic>{
    'from': from.toISOFormatString(),
    'to': to.toISOFormatString(),
  };
  if (title.isNotEmpty) exceptionBody['title'] = title;
  if (place.isNotEmpty) exceptionBody['place'] = place;
  if (description.isNotEmpty) exceptionBody['description'] = description;
  if (owner.isNotEmpty) exceptionBody['owner'] = owner;
  if (remindBefore != const ISODuration(year: 0)) {
    exceptionBody['remindBefore'] = remindBefore.toISOFormatString();
  }
  if (remindAt != null) {
    exceptionBody['remindAt'] = remindAt.toISOFormatString();
  }
  if (wholeDay) exceptionBody['wholeDay'] = wholeDay;
  if (group) {
    // Bewusste Legacy-Parität: Das alte API schreibt hier wholeDay.
    exceptionBody['group'] = wholeDay;
  }
  final Map<String, dynamic> attendees = _attendees(
    attendeesUserNames,
    attendeesAddresses,
    attendeesEmails,
    notificationComment,
    notifyAllAttendees,
  );
  if (attendees.isNotEmpty) exceptionBody['attendees'] = attendees;
  if (isSerial) exceptionBody['isSerial'] = isSerial;
  exceptionBody['public'] = public;
  exceptionBody['extern'] = extern;
  if (type != null) exceptionBody['type'] = type;
  if (occupancy != null) exceptionBody['occupancy'] = occupancy;
  if (rrule.isNotEmpty) exceptionBody['rrule'] = rrule;
  return _bodyRequest(
    ApiHttpMethod.patch,
    '/appointments/$id/createException',
    'patchAppointmentsCreateException',
    <String, dynamic>{
      'exceptionFrom': exceptionFrom.toISOFormatString(),
      'exceptionBody': exceptionBody,
    },
  );
}