patchMail method

Future<RestApiResponse> patchMail({
  1. String uuid = '',
  2. String oid = '',
  3. String from = '-',
  4. List<String>? to,
  5. List<String>? cc,
  6. List<String>? bcc,
  7. String name = '-',
  8. String description = '-',
  9. String subject = '-',
  10. String htmlContent = '-',
  11. String plainContent = '-',
  12. Map<String, dynamic>? templateData,
  13. List<Map<String, dynamic>>? attachments,
  14. int priorityValue = 3,
  15. String priorityText = 'normal',
  16. bool acknowledgementRequired = false,
  17. bool keepCalendar = false,
  18. bool convertImageDataSrcToFileSrc = false,
  19. DateTime? startTime,
  20. String actions = '',
})

This request allows to update existing an email, either the uuid or oid are needed

Hinweis zur neuen API: Aktualisiert eine bestehende E-Mail (PATCH v1/mail); benötigt uuid oder oid.

Implementation

Future<RestApiResponse> patchMail({
  String uuid = '',
  String oid = '',
  String from = '-',
  List<String>? to,
  List<String>? cc,
  List<String>? bcc,
  String name = '-',
  String description = '-',
  String subject = '-',
  String htmlContent = '-',
  String plainContent = '-',
  Map<String, dynamic>? templateData,
  List<Map<String, dynamic>>? attachments,
  int priorityValue = 3,
  String priorityText = 'normal',
  bool acknowledgementRequired = false,
  bool keepCalendar = false,
  bool convertImageDataSrcToFileSrc = false,
  DateTime? startTime,
  String actions = '',
}) {
  final Map<String, String> query = <String, String>{};
  if (actions.isNotEmpty) query['actions'] = actions;

  final Map<String, dynamic> body = <String, dynamic>{};
  if (uuid.isNotEmpty) body['~UUID'] = uuid;
  if (oid.isNotEmpty) body['~ObjectID'] = oid;
  body['from'] = from;
  if (to != null) body['to'] = to;
  if (cc != null) body['cc'] = cc;
  if (bcc != null) body['bcc'] = bcc;
  body['name'] = name;
  body['description'] = description;
  body['subject'] = subject;
  body['htmlContent'] = htmlContent;
  body['plainContent'] = plainContent;
  if (templateData != null) body['templateData'] = templateData;
  if (attachments != null) body['attachments'] = attachments;
  body['acknowledgementRequired'] = acknowledgementRequired;
  body['convertImageDataSrcToFileSrc'] = convertImageDataSrcToFileSrc;
  body['keepCalendar'] = keepCalendar;
  if (startTime != null) body['startTime'] = startTime.toISOFormatString();
  body['priority'] = _priority(priorityValue, priorityText);

  return _execute(
    method: ApiHttpMethod.patch,
    path: '/mail',
    queryParameters: query,
    body: jsonEncode(body),
    operation: 'patchMail',
  );
}