Skip to content

search_contacts async

search_contacts(
    instance_id: InstanceId,
    time_range: SearchContactsTimeRange,
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    search_criteria: Optional[SearchCriteria] = None,
    max_results: Optional[MaxResult100] = None,
    next_token: Optional[LargeNextToken] = None,
    sort: Optional[Sort] = None,
) -> SearchContactsResponse

Searches contacts in an Connect Customer instance.

Parameters:

  • instance_id (InstanceId) –

    The identifier of Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

  • time_range (SearchContactsTimeRange) –

    Time range that you want to search results.

  • search_criteria (Optional[SearchCriteria], default: None ) –

    The search criteria to be used to return contacts.

  • max_results (Optional[MaxResult100], default: None ) –

    The maximum number of results to return per page.

  • next_token (Optional[LargeNextToken], default: None ) –

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

  • sort (Optional[Sort], default: None ) –

    Specifies a field to sort by and a sort order.

Raises:

Source code in docs_src/capo_connect/_services/async_connect.py
async def search_contacts(
    self,
    instance_id: "capo_connect.types.instance_id.InstanceId",
    time_range: "capo_connect.types.search_contacts_time_range.SearchContactsTimeRange",
    *,
    config_overrides: Optional[AsyncConnectClientConfig] = None,
    search_criteria: Optional[
        "capo_connect.types.search_criteria.SearchCriteria"
    ] = None,
    max_results: Optional["capo_connect.types.max_result100.MaxResult100"] = None,
    next_token: Optional[
        "capo_connect.types.large_next_token.LargeNextToken"
    ] = None,
    sort: Optional["capo_connect.types.sort.Sort"] = None,
) -> "capo_connect.types.search_contacts_response.SearchContactsResponse":
    """<p>Searches contacts in an Connect Customer instance.</p>

    Args:
        instance_id: <p>The identifier of Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.</p>
        time_range: <p>Time range that you want to search results.</p>
        search_criteria: <p>The search criteria to be used to return contacts.</p>
        max_results: <p>The maximum number of results to return per page.</p>
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
        sort: <p>Specifies a field to sort by and a sort order.</p>

    Raises:
        capo_connect.errors.internal_service_exception.InternalServiceException: <p>Request processing failed because of an error or failure with the service.</p>
        capo_connect.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the specified parameters are not valid.</p>
        capo_connect.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_connect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p>
        capo_connect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_connect.types.search_contacts_request.SearchContactsRequest]",
    ) -> AsyncOperationResponse[
        "capo_connect.types.search_contacts_response.SearchContactsResponse"
    ]:
        import capo_connect._operations.amazon_connect_service.search_contacts

        (
            output,
            http_response,
        ) = await capo_connect._operations.amazon_connect_service.search_contacts.async_search_contacts(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_connect.types.search_contacts_request.SearchContactsRequest",
    ) -> dict[str, Any]:
        import capo_connect.types.search_contacts_request

        return capo_connect.types.search_contacts_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_connect.types.search_contacts_response.SearchContactsResponse",
    ) -> dict[str, Any]:
        import capo_connect.types.search_contacts_response

        return capo_connect.types.search_contacts_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "SearchContacts",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_connect.types.search_contacts_request.SearchContactsRequest = {
        "instance_id": instance_id,
        "time_range": time_range,
    }
    if search_criteria is not None:
        input_["search_criteria"] = search_criteria
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if sort is not None:
        input_["sort"] = sort

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