startArchiveSearch method
Initiates a search across emails in the specified archive.
May throw AccessDeniedException.
May throw ConflictException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter archiveId :
The identifier of the archive to search emails in.
Parameter fromTimestamp :
The start timestamp of the range to search emails from.
Parameter maxResults :
The maximum number of search results to return.
Parameter toTimestamp :
The end timestamp of the range to search emails from.
Parameter filters :
Criteria to filter which emails are included in the search results.
Implementation
Future<StartArchiveSearchResponse> startArchiveSearch({
required String archiveId,
required DateTime fromTimestamp,
required int maxResults,
required DateTime toTimestamp,
ArchiveFilters? filters,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
0,
1000,
isRequired: true,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'MailManagerSvc.StartArchiveSearch'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ArchiveId': archiveId,
'FromTimestamp': unixTimestampToJson(fromTimestamp),
'MaxResults': maxResults,
'ToTimestamp': unixTimestampToJson(toTimestamp),
if (filters != null) 'Filters': filters,
},
);
return StartArchiveSearchResponse.fromJson(jsonResponse.body);
}