Skip to content

list_contacts async

list_contacts(
    contact_list_name: ContactListName,
    *,
    config_overrides: Optional[AsyncSESv2ClientConfig] = None,
    filter: Optional[ListContactsFilter] = None,
    page_size: Optional[MaxItems] = None,
    next_token: Optional[NextToken] = None,
) -> ListContactsResponse

Lists the contacts present in a specific contact list.

Parameters:

  • contact_list_name (ContactListName) –

    The name of the contact list.

  • filter (Optional[ListContactsFilter], default: None ) –

    A filter that can be applied to a list of contacts.

  • page_size (Optional[MaxItems], default: None ) –

    The number of contacts that may be returned at once, which is dependent on if there are more or less contacts than the value of the PageSize. Use this parameter to paginate results. If additional contacts exist beyond the specified limit, the NextToken element is sent in the response. Use the NextToken value in subsequent requests to retrieve additional contacts.

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

    A string token indicating that there might be additional contacts available to be listed. Use the token provided in the Response to use in the subsequent call to ListContacts with the same parameters to retrieve the next page of contacts.

Raises:

Source code in docs_src/capo_sesv2/_services/async_se_sv2.py
async def list_contacts(
    self,
    contact_list_name: "capo_sesv2.types.contact_list_name.ContactListName",
    *,
    config_overrides: Optional[AsyncSESv2ClientConfig] = None,
    filter: Optional[
        "capo_sesv2.types.list_contacts_filter.ListContactsFilter"
    ] = None,
    page_size: Optional["capo_sesv2.types.max_items.MaxItems"] = None,
    next_token: Optional["capo_sesv2.types.next_token.NextToken"] = None,
) -> "capo_sesv2.types.list_contacts_response.ListContactsResponse":
    """<p>Lists the contacts present in a specific contact list.</p>

    Args:
        contact_list_name: <p>The name of the contact list.</p>
        filter: <p>A filter that can be applied to a list of contacts.</p>
        page_size: <p>The number of contacts that may be returned at once, which is dependent on if there are more or less contacts than the value of the PageSize. Use this parameter to paginate results. If additional contacts exist beyond the specified limit, the <code>NextToken</code> element is sent in the response. Use the <code>NextToken</code> value in subsequent requests to retrieve additional contacts.</p>
        next_token: <p>A string token indicating that there might be additional contacts available to be listed. Use the token provided in the Response to use in the subsequent call to ListContacts with the same parameters to retrieve the next page of contacts.</p>

    Raises:
        capo_sesv2.errors.bad_request_exception.BadRequestException: <p>The input you provided is invalid.</p>
        capo_sesv2.errors.not_found_exception.NotFoundException: <p>The resource you attempted to access doesn't exist.</p>
        capo_sesv2.errors.too_many_requests_exception.TooManyRequestsException: <p>Too many requests have been made to the operation.</p>
        capo_sesv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sesv2.types.list_contacts_request.ListContactsRequest]",
    ) -> AsyncOperationResponse[
        "capo_sesv2.types.list_contacts_response.ListContactsResponse"
    ]:
        import capo_sesv2._operations.simple_email_service_v2.list_contacts

        (
            output,
            http_response,
        ) = await capo_sesv2._operations.simple_email_service_v2.list_contacts.async_list_contacts(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListContacts")
    )
    input_: capo_sesv2.types.list_contacts_request.ListContactsRequest = {
        "contact_list_name": contact_list_name
    }
    if filter is not None:
        input_["filter"] = filter
    if page_size is not None:
        input_["page_size"] = page_size
    if next_token is not None:
        input_["next_token"] = next_token

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