postAppointments method

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

Erstellt einen neuen Termin im Kalender

Legt einen neuen Kalendereintrag mit allen erforderlichen Informationen an. Unterstützt Teilnehmer, Erinnerungen, Terminserien und Benachrichtigungen.

from - Startzeit des Termins to - Endzeit des Termins title - Titel des Termins place - Ort des Termins description - Beschreibung des Termins owner - Besitzer des Termins remindBefore - Erinnerung vor dem Termin (ISO-Duration) remindAt - Erinnerung zu bestimmter Zeit wholeDay - Ganztägiger Termin (Standard: false) attendeesUserNames - Liste der Teilnehmer-Benutzernamen attendeesAddresses - Liste der Teilnehmer-Adressen attendeesEmails - Liste der Teilnehmer-E-Mail-Adressen isSerial - Terminserie (Standard: false) rrule - Wiederholungsregel (iCalendar RRULE)

Returns: RestApiResponse mit Termin-ID und Erstellungsstatus

Beispiel:

RestApiResponse response = await api.v1.appointments.postAppointments(
  DateTime.now().add(Duration(hours: 1)),
  DateTime.now().add(Duration(hours: 2)),
  title: "Team Meeting",
  place: "Konferenzraum A",
  attendeesUserNames: ["mueller", "schmidt"]
);

Implementation

Future<RestApiResponse> postAppointments(
  DateTime from,
  DateTime to, {
  String title = '',
  String place = '',
  String description = '',
  String owner = '',
  ISODuration? remindBefore,
  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> body = <String, dynamic>{
    'from': from.toISOFormatString(),
    'to': to.toISOFormatString(),
    'title': title,
    'place': place,
    'description': description,
    'owner': owner,
  };
  if (remindBefore != null) {
    body['remindBefore'] = remindBefore.toISOFormatString();
  }
  if (remindAt != null) body['remindAt'] = remindAt.toISOFormatString();
  body['wholeDay'] = wholeDay;
  final Map<String, dynamic> attendees = _attendees(
    attendeesUserNames,
    attendeesAddresses,
    attendeesEmails,
    notificationComment,
    notifyAllAttendees,
  );
  if (attendees.isNotEmpty) body['attendees'] = attendees;
  if (type != null) body['type'] = type;
  if (occupancy != null) body['occupancy'] = occupancy;
  body['isSerial'] = isSerial;
  body['public'] = public;
  body['extern'] = extern;
  if (rrule.isNotEmpty) body['rrule'] = rrule;
  return _bodyRequest(
    ApiHttpMethod.post,
    '/appointments',
    'postAppointments',
    body,
  );
}