postAppointments method
- 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 = '',
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,
);
}