startArchiveExport method

Future<StartArchiveExportResponse> startArchiveExport({
  1. required String archiveId,
  2. required ExportDestinationConfiguration exportDestinationConfiguration,
  3. required DateTime fromTimestamp,
  4. required DateTime toTimestamp,
  5. ArchiveFilters? filters,
  6. bool? includeMetadata,
  7. int? maxResults,
})

Initiates an export of emails from the specified archive.

May throw AccessDeniedException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter archiveId : The identifier of the archive to export emails from.

Parameter exportDestinationConfiguration : Details on where to deliver the exported email data.

Parameter fromTimestamp : The start of the timestamp range to include emails from.

Parameter toTimestamp : The end of the timestamp range to include emails from.

Parameter filters : Criteria to filter which emails are included in the export.

Parameter includeMetadata : Whether to include message metadata as JSON files in the export.

Parameter maxResults : The maximum number of email items to include in the export.

Implementation

Future<StartArchiveExportResponse> startArchiveExport({
  required String archiveId,
  required ExportDestinationConfiguration exportDestinationConfiguration,
  required DateTime fromTimestamp,
  required DateTime toTimestamp,
  ArchiveFilters? filters,
  bool? includeMetadata,
  int? maxResults,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'MailManagerSvc.StartArchiveExport'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ArchiveId': archiveId,
      'ExportDestinationConfiguration': exportDestinationConfiguration,
      'FromTimestamp': unixTimestampToJson(fromTimestamp),
      'ToTimestamp': unixTimestampToJson(toTimestamp),
      if (filters != null) 'Filters': filters,
      if (includeMetadata != null) 'IncludeMetadata': includeMetadata,
      if (maxResults != null) 'MaxResults': maxResults,
    },
  );

  return StartArchiveExportResponse.fromJson(jsonResponse.body);
}