Skip to content

start_archive_search async

start_archive_search(
    archive_id: ArchiveId,
    from_timestamp: datetime,
    to_timestamp: datetime,
    max_results: SearchMaxResults,
    *,
    config_overrides: Optional[AsyncMailManagerClientConfig] = None,
    filters: Optional[ArchiveFilters] = None,
) -> StartArchiveSearchResponse

Initiates a search across emails in the specified archive.

Parameters:

  • archive_id (ArchiveId) –

    The identifier of the archive to search emails in.

  • filters (Optional[ArchiveFilters], default: None ) –

    Criteria to filter which emails are included in the search results.

  • from_timestamp (datetime) –

    The start timestamp of the range to search emails from.

  • to_timestamp (datetime) –

    The end timestamp of the range to search emails from.

  • max_results (SearchMaxResults) –

    The maximum number of search results to return.

Raises:

Source code in docs_src/capo_mailmanager/_services/async_mail_manager.py
async def start_archive_search(
    self,
    archive_id: "capo_mailmanager.types.archive_id.ArchiveId",
    from_timestamp: datetime.datetime,
    to_timestamp: datetime.datetime,
    max_results: "capo_mailmanager.types.search_max_results.SearchMaxResults",
    *,
    config_overrides: Optional[AsyncMailManagerClientConfig] = None,
    filters: Optional[
        "capo_mailmanager.types.archive_filters.ArchiveFilters"
    ] = None,
) -> "capo_mailmanager.types.start_archive_search_response.StartArchiveSearchResponse":
    """<p>Initiates a search across emails in the specified archive.</p>

    Args:
        archive_id: <p>The identifier of the archive to search emails in.</p>
        filters: <p>Criteria to filter which emails are included in the search results.</p>
        from_timestamp: <p>The start timestamp of the range to search emails from.</p>
        to_timestamp: <p>The end timestamp of the range to search emails from.</p>
        max_results: <p>The maximum number of search results to return.</p>

    Raises:
        capo_mailmanager.errors.access_denied_exception.AccessDeniedException: <p>Occurs when a user is denied access to a specific resource or action.</p>
        capo_mailmanager.errors.conflict_exception.ConflictException: <p>The request configuration has conflicts. For details, see the accompanying error message.</p>
        capo_mailmanager.errors.resource_not_found_exception.ResourceNotFoundException: <p>Occurs when a requested resource is not found.</p>
        capo_mailmanager.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Occurs when an operation exceeds a predefined service quota or limit.</p>
        capo_mailmanager.errors.throttling_exception.ThrottlingException: <p>Occurs when a service's request rate limit is exceeded, resulting in throttling of further requests.</p>
        capo_mailmanager.errors.validation_exception.ValidationException: <p>The request validation has failed. For details, see the accompanying error message.</p>
        capo_mailmanager.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_mailmanager.types.start_archive_search_request.StartArchiveSearchRequest]",
    ) -> AsyncOperationResponse[
        "capo_mailmanager.types.start_archive_search_response.StartArchiveSearchResponse"
    ]:
        import capo_mailmanager._operations.mail_manager_svc.start_archive_search

        (
            output,
            http_response,
        ) = await capo_mailmanager._operations.mail_manager_svc.start_archive_search.async_start_archive_search(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartArchiveSearch")
    )
    input_: capo_mailmanager.types.start_archive_search_request.StartArchiveSearchRequest = {
        "archive_id": archive_id,
        "from_timestamp": from_timestamp,
        "to_timestamp": to_timestamp,
        "max_results": max_results,
    }
    if filters is not None:
        input_["filters"] = filters

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output