create static method

AttendeeProperty? create({
  1. Uri? attendeeUri,
  2. String? attendeeEmail,
  3. ParticipantStatus? participantStatus,
  4. Uri? delegatedToUri,
  5. String? delegatedToEmail,
  6. Uri? delegatedFromUri,
  7. String? delegatedFromEmail,
  8. Role? role,
  9. bool? rsvp,
  10. CalendarUserType? userType,
  11. String? commonName,
  12. Uri? alternateRepresentation,
  13. Uri? directory,
})
override

Creates an attendee with the specified attendeeUri or attendeeEmail.

Any other parameters are optional.

Implementation

static AttendeeProperty? create({
  Uri? attendeeUri,
  String? attendeeEmail,
  ParticipantStatus? participantStatus,
  Uri? delegatedToUri,
  String? delegatedToEmail,
  Uri? delegatedFromUri,
  String? delegatedFromEmail,
  Role? role,
  bool? rsvp,
  CalendarUserType? userType,
  String? commonName,
  Uri? alternateRepresentation,
  Uri? directory,
}) {
  if (attendeeEmail == null && attendeeUri == null) {
    return null;
  }
  attendeeUri ??= Uri.parse('mailto:$attendeeEmail');
  final prop = AttendeeProperty('$propertyName:$attendeeUri');
  if (participantStatus != null) {
    prop[ParameterType.participantStatus] = ParticipantStatusParameter.value(
      ParameterType.participantStatus.typeName ?? '',
      participantStatus,
    );
  }
  if (delegatedToEmail != null) {
    delegatedToUri = Uri.parse('mailto:$delegatedToEmail');
  }
  if (delegatedToUri != null) {
    prop[ParameterType.delegateTo] = UriParameter.value(
      ParameterType.delegateTo.typeName ?? '',
      delegatedToUri,
    );
  }
  if (delegatedFromEmail != null) {
    delegatedFromUri = Uri.parse('mailto:$delegatedFromEmail');
  }
  if (delegatedFromUri != null) {
    prop[ParameterType.delegateFrom] = UriParameter.value(
      ParameterType.delegateFrom.typeName ?? '',
      delegatedFromUri,
    );
  }
  if (role != null) {
    prop[ParameterType.participantRole] = ParticipantRoleParameter.value(
      ParameterType.participantRole.typeName ?? '',
      role,
    );
  }
  if (rsvp != null) {
    prop[ParameterType.rsvp] =
        BooleanParameter.value(ParameterType.rsvp.typeName ?? '', rsvp);
  }
  if (userType != null) {
    prop[ParameterType.calendarUserType] = CalendarUserTypeParameter.value(
      ParameterType.calendarUserType.typeName ?? '',
      userType,
    );
  }
  if (commonName != null) {
    prop[ParameterType.commonName] = TextParameter.value(
      ParameterType.commonName.typeName ?? '',
      commonName,
    );
  }
  if (alternateRepresentation != null) {
    prop[ParameterType.alternateRepresentation] = UriParameter.value(
      ParameterType.alternateRepresentation.typeName ?? '',
      alternateRepresentation,
    );
  }
  if (directory != null) {
    prop[ParameterType.directory] =
        UriParameter.value(ParameterType.directory.typeName ?? '', directory);
  }

  return prop;
}