# This file was auto-generated by Fern from our API Definition.

import typing
from ..core.client_wrapper import SyncClientWrapper
from .raw_client import RawCustomersClient
from .custom_attribute_definitions.client import CustomAttributeDefinitionsClient
from .groups.client import GroupsClient
from .segments.client import SegmentsClient
from .cards.client import CardsClient
from .custom_attributes.client import CustomAttributesClient
from ..types.customer_sort_field import CustomerSortField
from ..types.sort_order import SortOrder
from ..core.request_options import RequestOptions
from ..core.pagination import SyncPager
from ..types.customer import Customer
from ..types.list_customers_response import ListCustomersResponse
from ..core.unchecked_base_model import construct_type
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..requests.address import AddressParams
from ..requests.customer_tax_ids import CustomerTaxIdsParams
from ..types.create_customer_response import CreateCustomerResponse
from ..requests.bulk_create_customer_data import BulkCreateCustomerDataParams
from ..types.bulk_create_customers_response import BulkCreateCustomersResponse
from ..types.bulk_delete_customers_response import BulkDeleteCustomersResponse
from ..types.bulk_retrieve_customers_response import BulkRetrieveCustomersResponse
from ..requests.bulk_update_customer_data import BulkUpdateCustomerDataParams
from ..types.bulk_update_customers_response import BulkUpdateCustomersResponse
from ..requests.customer_query import CustomerQueryParams
from ..types.search_customers_response import SearchCustomersResponse
from ..types.get_customer_response import GetCustomerResponse
from ..types.update_customer_response import UpdateCustomerResponse
from ..types.delete_customer_response import DeleteCustomerResponse
from ..core.client_wrapper import AsyncClientWrapper
from .raw_client import AsyncRawCustomersClient
from .custom_attribute_definitions.client import AsyncCustomAttributeDefinitionsClient
from .groups.client import AsyncGroupsClient
from .segments.client import AsyncSegmentsClient
from .cards.client import AsyncCardsClient
from .custom_attributes.client import AsyncCustomAttributesClient
from ..core.pagination import AsyncPager

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class CustomersClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawCustomersClient(client_wrapper=client_wrapper)
        self.custom_attribute_definitions = CustomAttributeDefinitionsClient(client_wrapper=client_wrapper)

        self.groups = GroupsClient(client_wrapper=client_wrapper)

        self.segments = SegmentsClient(client_wrapper=client_wrapper)

        self.cards = CardsClient(client_wrapper=client_wrapper)

        self.custom_attributes = CustomAttributesClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawCustomersClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawCustomersClient
        """
        return self._raw_client

    def list(
        self,
        *,
        cursor: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        sort_field: typing.Optional[CustomerSortField] = None,
        sort_order: typing.Optional[SortOrder] = None,
        count: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SyncPager[Customer]:
        """
        Lists customer profiles associated with a Square account.

        Under normal operating conditions, newly created or updated customer profiles become available
        for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated
        profiles can take closer to one minute or longer, especially during network incidents and outages.

        Parameters
        ----------
        cursor : typing.Optional[str]
            A pagination cursor returned by a previous call to this endpoint.
            Provide this cursor to retrieve the next set of results for your original query.

            For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

        limit : typing.Optional[int]
            The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
            If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.

            For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

        sort_field : typing.Optional[CustomerSortField]
            Indicates how customers should be sorted.

            The default value is `DEFAULT`.

        sort_order : typing.Optional[SortOrder]
            Indicates whether customers should be sorted in ascending (`ASC`) or
            descending (`DESC`) order.

            The default value is `ASC`.

        count : typing.Optional[bool]
            Indicates whether to return the total count of customers in the `count` field of the response.

            The default value is `false`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        SyncPager[Customer]
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        response = client.customers.list()
        for item in response:
            yield item
        # alternatively, you can paginate page-by-page
        for page in response.iter_pages():
            yield page
        """
        _response = self._raw_client._client_wrapper.httpx_client.request(
            "v2/customers",
            method="GET",
            params={
                "cursor": cursor,
                "limit": limit,
                "sort_field": sort_field,
                "sort_order": sort_order,
                "count": count,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _parsed_response = typing.cast(
                    ListCustomersResponse,
                    construct_type(
                        type_=ListCustomersResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                _parsed_next = _parsed_response.cursor
                _has_next = _parsed_next is not None and _parsed_next != ""
                _get_next = lambda: self.list(
                    cursor=_parsed_next,
                    limit=limit,
                    sort_field=sort_field,
                    sort_order=sort_order,
                    count=count,
                    request_options=request_options,
                )
                _items = _parsed_response.customers
                return SyncPager(has_next=_has_next, items=_items, get_next=_get_next)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def create(
        self,
        *,
        idempotency_key: typing.Optional[str] = OMIT,
        given_name: typing.Optional[str] = OMIT,
        family_name: typing.Optional[str] = OMIT,
        company_name: typing.Optional[str] = OMIT,
        nickname: typing.Optional[str] = OMIT,
        email_address: typing.Optional[str] = OMIT,
        address: typing.Optional[AddressParams] = OMIT,
        phone_number: typing.Optional[str] = OMIT,
        reference_id: typing.Optional[str] = OMIT,
        note: typing.Optional[str] = OMIT,
        birthday: typing.Optional[str] = OMIT,
        tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateCustomerResponse:
        """
        Creates a new customer for a business.

        You must provide at least one of the following values in your request to this
        endpoint:

        - `given_name`
        - `family_name`
        - `company_name`
        - `email_address`
        - `phone_number`

        Parameters
        ----------
        idempotency_key : typing.Optional[str]
            The idempotency key for the request.	For more information, see
            [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).

        given_name : typing.Optional[str]
            The given name (that is, the first name) associated with the customer profile.

            The maximum length for this value is 300 characters.

        family_name : typing.Optional[str]
            The family name (that is, the last name) associated with the customer profile.

            The maximum length for this value is 300 characters.

        company_name : typing.Optional[str]
            A business name associated with the customer profile.

            The maximum length for this value is 500 characters.

        nickname : typing.Optional[str]
            A nickname for the customer profile.

            The maximum length for this value is 100 characters.

        email_address : typing.Optional[str]
            The email address associated with the customer profile.

            The maximum length for this value is 254 characters.

        address : typing.Optional[AddressParams]
            The physical address associated with the customer profile. For maximum length constraints, see
            [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
            The `first_name` and `last_name` fields are ignored if they are present in the request.

        phone_number : typing.Optional[str]
            The phone number associated with the customer profile. The phone number must be valid and can contain
            9–16 digits, with an optional `+` prefix and country code. For more information, see
            [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).

        reference_id : typing.Optional[str]
            An optional second ID used to associate the customer profile with an
            entity in another system.

            The maximum length for this value is 100 characters.

        note : typing.Optional[str]
            A custom note associated with the customer profile.

        birthday : typing.Optional[str]
            The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
            specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
            format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.

        tax_ids : typing.Optional[CustomerTaxIdsParams]
            The tax ID associated with the customer profile. This field is available only for customers of sellers
            in EU countries or the United Kingdom. For more information,
            see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        CreateCustomerResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.create(
            given_name="Amelia",
            family_name="Earhart",
            email_address="Amelia.Earhart@example.com",
            address={
                "address_line1": "500 Electric Ave",
                "address_line2": "Suite 600",
                "locality": "New York",
                "administrative_district_level1": "NY",
                "postal_code": "10003",
                "country": "US",
            },
            phone_number="+1-212-555-4240",
            reference_id="YOUR_REFERENCE_ID",
            note="a customer",
        )
        """
        response = self._raw_client.create(
            idempotency_key=idempotency_key,
            given_name=given_name,
            family_name=family_name,
            company_name=company_name,
            nickname=nickname,
            email_address=email_address,
            address=address,
            phone_number=phone_number,
            reference_id=reference_id,
            note=note,
            birthday=birthday,
            tax_ids=tax_ids,
            request_options=request_options,
        )
        return response.data

    def batch_create(
        self,
        *,
        customers: typing.Dict[str, BulkCreateCustomerDataParams],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> BulkCreateCustomersResponse:
        """
        Creates multiple [customer profiles](entity:Customer) for a business.

        This endpoint takes a map of individual create requests and returns a map of responses.

        You must provide at least one of the following values in each create request:

        - `given_name`
        - `family_name`
        - `company_name`
        - `email_address`
        - `phone_number`

        Parameters
        ----------
        customers : typing.Dict[str, BulkCreateCustomerDataParams]
            A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }`
            key-value pairs.

            Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
            that uniquely identifies the create request. Each value contains the customer data used to create the
            customer profile.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkCreateCustomersResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.batch_create(
            customers={
                "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": {
                    "given_name": "Amelia",
                    "family_name": "Earhart",
                    "email_address": "Amelia.Earhart@example.com",
                    "address": {
                        "address_line1": "500 Electric Ave",
                        "address_line2": "Suite 600",
                        "locality": "New York",
                        "administrative_district_level1": "NY",
                        "postal_code": "10003",
                        "country": "US",
                    },
                    "phone_number": "+1-212-555-4240",
                    "reference_id": "YOUR_REFERENCE_ID",
                    "note": "a customer",
                },
                "d1689f23-b25d-4932-b2f0-aed00f5e2029": {
                    "given_name": "Marie",
                    "family_name": "Curie",
                    "email_address": "Marie.Curie@example.com",
                    "address": {
                        "address_line1": "500 Electric Ave",
                        "address_line2": "Suite 601",
                        "locality": "New York",
                        "administrative_district_level1": "NY",
                        "postal_code": "10003",
                        "country": "US",
                    },
                    "phone_number": "+1-212-444-4240",
                    "reference_id": "YOUR_REFERENCE_ID",
                    "note": "another customer",
                },
            },
        )
        """
        response = self._raw_client.batch_create(customers=customers, request_options=request_options)
        return response.data

    def bulk_delete_customers(
        self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> BulkDeleteCustomersResponse:
        """
        Deletes multiple customer profiles.

        The endpoint takes a list of customer IDs and returns a map of responses.

        Parameters
        ----------
        customer_ids : typing.Sequence[str]
            The IDs of the [customer profiles](entity:Customer) to delete.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkDeleteCustomersResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.bulk_delete_customers(
            customer_ids=[
                "8DDA5NZVBZFGAX0V3HPF81HHE0",
                "N18CPRVXR5214XPBBA6BZQWF3C",
                "2GYD7WNXF7BJZW1PMGNXZ3Y8M8",
            ],
        )
        """
        response = self._raw_client.bulk_delete_customers(customer_ids=customer_ids, request_options=request_options)
        return response.data

    def bulk_retrieve_customers(
        self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> BulkRetrieveCustomersResponse:
        """
        Retrieves multiple customer profiles.

        This endpoint takes a list of customer IDs and returns a map of responses.

        Parameters
        ----------
        customer_ids : typing.Sequence[str]
            The IDs of the [customer profiles](entity:Customer) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkRetrieveCustomersResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.bulk_retrieve_customers(
            customer_ids=[
                "8DDA5NZVBZFGAX0V3HPF81HHE0",
                "N18CPRVXR5214XPBBA6BZQWF3C",
                "2GYD7WNXF7BJZW1PMGNXZ3Y8M8",
            ],
        )
        """
        response = self._raw_client.bulk_retrieve_customers(customer_ids=customer_ids, request_options=request_options)
        return response.data

    def bulk_update_customers(
        self,
        *,
        customers: typing.Dict[str, BulkUpdateCustomerDataParams],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> BulkUpdateCustomersResponse:
        """
        Updates multiple customer profiles.

        This endpoint takes a map of individual update requests and returns a map of responses.

        Parameters
        ----------
        customers : typing.Dict[str, BulkUpdateCustomerDataParams]
            A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }`
            key-value pairs.

            Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile
            that was created by merging existing profiles, provide the ID of the newly created profile.

            Each value contains the updated customer data. Only new or changed fields are required. To add or
            update a field, specify the new value. To remove a field, specify `null`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkUpdateCustomersResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.bulk_update_customers(
            customers={
                "8DDA5NZVBZFGAX0V3HPF81HHE0": {
                    "email_address": "New.Amelia.Earhart@example.com",
                    "note": "updated customer note",
                    "version": 2,
                },
                "N18CPRVXR5214XPBBA6BZQWF3C": {
                    "given_name": "Marie",
                    "family_name": "Curie",
                    "version": 0,
                },
            },
        )
        """
        response = self._raw_client.bulk_update_customers(customers=customers, request_options=request_options)
        return response.data

    def search(
        self,
        *,
        cursor: typing.Optional[str] = OMIT,
        limit: typing.Optional[int] = OMIT,
        query: typing.Optional[CustomerQueryParams] = OMIT,
        count: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SearchCustomersResponse:
        """
        Searches the customer profiles associated with a Square account using one or more supported query filters.

        Calling `SearchCustomers` without any explicit query filter returns all
        customer profiles ordered alphabetically based on `given_name` and
        `family_name`.

        Under normal operating conditions, newly created or updated customer profiles become available
        for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated
        profiles can take closer to one minute or longer, especially during network incidents and outages.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Include the pagination cursor in subsequent calls to this endpoint to retrieve
            the next set of results associated with the original query.

            For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

        limit : typing.Optional[int]
            The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
            If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.

            For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

        query : typing.Optional[CustomerQueryParams]
            The filtering and sorting criteria for the search request. If a query is not specified,
            Square returns all customer profiles ordered alphabetically by `given_name` and `family_name`.

        count : typing.Optional[bool]
            Indicates whether to return the total count of matching customers in the `count` field of the response.

            The default value is `false`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        SearchCustomersResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.search(
            limit=2,
            query={
                "filter": {
                    "creation_source": {"values": ["THIRD_PARTY"], "rule": "INCLUDE"},
                    "created_at": {
                        "start_at": "2018-01-01T00:00:00-00:00",
                        "end_at": "2018-02-01T00:00:00-00:00",
                    },
                    "email_address": {"fuzzy": "example.com"},
                    "group_ids": {"all_": ["545AXB44B4XXWMVQ4W8SBT3HHF"]},
                },
                "sort": {"field": "CREATED_AT", "order": "ASC"},
            },
        )
        """
        response = self._raw_client.search(
            cursor=cursor, limit=limit, query=query, count=count, request_options=request_options
        )
        return response.data

    def get(self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> GetCustomerResponse:
        """
        Returns details for a single customer.

        Parameters
        ----------
        customer_id : str
            The ID of the customer to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetCustomerResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.get(
            customer_id="customer_id",
        )
        """
        response = self._raw_client.get(customer_id, request_options=request_options)
        return response.data

    def update(
        self,
        customer_id: str,
        *,
        given_name: typing.Optional[str] = OMIT,
        family_name: typing.Optional[str] = OMIT,
        company_name: typing.Optional[str] = OMIT,
        nickname: typing.Optional[str] = OMIT,
        email_address: typing.Optional[str] = OMIT,
        address: typing.Optional[AddressParams] = OMIT,
        phone_number: typing.Optional[str] = OMIT,
        reference_id: typing.Optional[str] = OMIT,
        note: typing.Optional[str] = OMIT,
        birthday: typing.Optional[str] = OMIT,
        version: typing.Optional[int] = OMIT,
        tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdateCustomerResponse:
        """
        Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request.
        To add or update a field, specify the new value. To remove a field, specify `null`.

        To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.

        Parameters
        ----------
        customer_id : str
            The ID of the customer to update.

        given_name : typing.Optional[str]
            The given name (that is, the first name) associated with the customer profile.

            The maximum length for this value is 300 characters.

        family_name : typing.Optional[str]
            The family name (that is, the last name) associated with the customer profile.

            The maximum length for this value is 300 characters.

        company_name : typing.Optional[str]
            A business name associated with the customer profile.

            The maximum length for this value is 500 characters.

        nickname : typing.Optional[str]
            A nickname for the customer profile.

            The maximum length for this value is 100 characters.

        email_address : typing.Optional[str]
            The email address associated with the customer profile.

            The maximum length for this value is 254 characters.

        address : typing.Optional[AddressParams]
            The physical address associated with the customer profile. Only new or changed fields are required in the request.

            For maximum length constraints, see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
            The `first_name` and `last_name` fields are ignored if they are present in the request.

        phone_number : typing.Optional[str]
            The phone number associated with the customer profile. The phone number must be valid and can contain
            9–16 digits, with an optional `+` prefix and country code. For more information, see
            [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).

        reference_id : typing.Optional[str]
            An optional second ID used to associate the customer profile with an
            entity in another system.

            The maximum length for this value is 100 characters.

        note : typing.Optional[str]
            A custom note associated with the customer profile.

        birthday : typing.Optional[str]
            The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
            specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
            format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.

        version : typing.Optional[int]
            The current version of the customer profile.

            As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile).

        tax_ids : typing.Optional[CustomerTaxIdsParams]
            The tax ID associated with the customer profile. This field is available only for customers of sellers
            in EU countries or the United Kingdom. For more information,
            see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        UpdateCustomerResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.update(
            customer_id="customer_id",
            email_address="New.Amelia.Earhart@example.com",
            note="updated customer note",
            version=2,
        )
        """
        response = self._raw_client.update(
            customer_id,
            given_name=given_name,
            family_name=family_name,
            company_name=company_name,
            nickname=nickname,
            email_address=email_address,
            address=address,
            phone_number=phone_number,
            reference_id=reference_id,
            note=note,
            birthday=birthday,
            version=version,
            tax_ids=tax_ids,
            request_options=request_options,
        )
        return response.data

    def delete(
        self,
        customer_id: str,
        *,
        version: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DeleteCustomerResponse:
        """
        Deletes a customer profile from a business.

        To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.

        Parameters
        ----------
        customer_id : str
            The ID of the customer to delete.

        version : typing.Optional[int]
            The current version of the customer profile.

            As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control.  For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DeleteCustomerResponse
            Success

        Examples
        --------
        from square import Square

        client = Square(
            token="YOUR_TOKEN",
        )
        client.customers.delete(
            customer_id="customer_id",
        )
        """
        response = self._raw_client.delete(customer_id, version=version, request_options=request_options)
        return response.data


class AsyncCustomersClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawCustomersClient(client_wrapper=client_wrapper)
        self.custom_attribute_definitions = AsyncCustomAttributeDefinitionsClient(client_wrapper=client_wrapper)

        self.groups = AsyncGroupsClient(client_wrapper=client_wrapper)

        self.segments = AsyncSegmentsClient(client_wrapper=client_wrapper)

        self.cards = AsyncCardsClient(client_wrapper=client_wrapper)

        self.custom_attributes = AsyncCustomAttributesClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawCustomersClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawCustomersClient
        """
        return self._raw_client

    async def list(
        self,
        *,
        cursor: typing.Optional[str] = None,
        limit: typing.Optional[int] = None,
        sort_field: typing.Optional[CustomerSortField] = None,
        sort_order: typing.Optional[SortOrder] = None,
        count: typing.Optional[bool] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AsyncPager[Customer]:
        """
        Lists customer profiles associated with a Square account.

        Under normal operating conditions, newly created or updated customer profiles become available
        for the listing operation in well under 30 seconds. Occasionally, propagation of the new or updated
        profiles can take closer to one minute or longer, especially during network incidents and outages.

        Parameters
        ----------
        cursor : typing.Optional[str]
            A pagination cursor returned by a previous call to this endpoint.
            Provide this cursor to retrieve the next set of results for your original query.

            For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

        limit : typing.Optional[int]
            The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
            If the specified limit is less than 1 or greater than 100, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.

            For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

        sort_field : typing.Optional[CustomerSortField]
            Indicates how customers should be sorted.

            The default value is `DEFAULT`.

        sort_order : typing.Optional[SortOrder]
            Indicates whether customers should be sorted in ascending (`ASC`) or
            descending (`DESC`) order.

            The default value is `ASC`.

        count : typing.Optional[bool]
            Indicates whether to return the total count of customers in the `count` field of the response.

            The default value is `false`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncPager[Customer]
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            response = await client.customers.list()
            async for item in response:
                yield item
            # alternatively, you can paginate page-by-page
            async for page in response.iter_pages():
                yield page


        asyncio.run(main())
        """
        _response = await self._raw_client._client_wrapper.httpx_client.request(
            "v2/customers",
            method="GET",
            params={
                "cursor": cursor,
                "limit": limit,
                "sort_field": sort_field,
                "sort_order": sort_order,
                "count": count,
            },
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _parsed_response = typing.cast(
                    ListCustomersResponse,
                    construct_type(
                        type_=ListCustomersResponse,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                _parsed_next = _parsed_response.cursor
                _has_next = _parsed_next is not None and _parsed_next != ""
                _get_next = lambda: self.list(
                    cursor=_parsed_next,
                    limit=limit,
                    sort_field=sort_field,
                    sort_order=sort_order,
                    count=count,
                    request_options=request_options,
                )
                _items = _parsed_response.customers
                return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next)
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def create(
        self,
        *,
        idempotency_key: typing.Optional[str] = OMIT,
        given_name: typing.Optional[str] = OMIT,
        family_name: typing.Optional[str] = OMIT,
        company_name: typing.Optional[str] = OMIT,
        nickname: typing.Optional[str] = OMIT,
        email_address: typing.Optional[str] = OMIT,
        address: typing.Optional[AddressParams] = OMIT,
        phone_number: typing.Optional[str] = OMIT,
        reference_id: typing.Optional[str] = OMIT,
        note: typing.Optional[str] = OMIT,
        birthday: typing.Optional[str] = OMIT,
        tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> CreateCustomerResponse:
        """
        Creates a new customer for a business.

        You must provide at least one of the following values in your request to this
        endpoint:

        - `given_name`
        - `family_name`
        - `company_name`
        - `email_address`
        - `phone_number`

        Parameters
        ----------
        idempotency_key : typing.Optional[str]
            The idempotency key for the request.	For more information, see
            [Idempotency](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).

        given_name : typing.Optional[str]
            The given name (that is, the first name) associated with the customer profile.

            The maximum length for this value is 300 characters.

        family_name : typing.Optional[str]
            The family name (that is, the last name) associated with the customer profile.

            The maximum length for this value is 300 characters.

        company_name : typing.Optional[str]
            A business name associated with the customer profile.

            The maximum length for this value is 500 characters.

        nickname : typing.Optional[str]
            A nickname for the customer profile.

            The maximum length for this value is 100 characters.

        email_address : typing.Optional[str]
            The email address associated with the customer profile.

            The maximum length for this value is 254 characters.

        address : typing.Optional[AddressParams]
            The physical address associated with the customer profile. For maximum length constraints, see
            [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
            The `first_name` and `last_name` fields are ignored if they are present in the request.

        phone_number : typing.Optional[str]
            The phone number associated with the customer profile. The phone number must be valid and can contain
            9–16 digits, with an optional `+` prefix and country code. For more information, see
            [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).

        reference_id : typing.Optional[str]
            An optional second ID used to associate the customer profile with an
            entity in another system.

            The maximum length for this value is 100 characters.

        note : typing.Optional[str]
            A custom note associated with the customer profile.

        birthday : typing.Optional[str]
            The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
            specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
            format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.

        tax_ids : typing.Optional[CustomerTaxIdsParams]
            The tax ID associated with the customer profile. This field is available only for customers of sellers
            in EU countries or the United Kingdom. For more information,
            see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        CreateCustomerResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.create(
                given_name="Amelia",
                family_name="Earhart",
                email_address="Amelia.Earhart@example.com",
                address={
                    "address_line1": "500 Electric Ave",
                    "address_line2": "Suite 600",
                    "locality": "New York",
                    "administrative_district_level1": "NY",
                    "postal_code": "10003",
                    "country": "US",
                },
                phone_number="+1-212-555-4240",
                reference_id="YOUR_REFERENCE_ID",
                note="a customer",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.create(
            idempotency_key=idempotency_key,
            given_name=given_name,
            family_name=family_name,
            company_name=company_name,
            nickname=nickname,
            email_address=email_address,
            address=address,
            phone_number=phone_number,
            reference_id=reference_id,
            note=note,
            birthday=birthday,
            tax_ids=tax_ids,
            request_options=request_options,
        )
        return response.data

    async def batch_create(
        self,
        *,
        customers: typing.Dict[str, BulkCreateCustomerDataParams],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> BulkCreateCustomersResponse:
        """
        Creates multiple [customer profiles](entity:Customer) for a business.

        This endpoint takes a map of individual create requests and returns a map of responses.

        You must provide at least one of the following values in each create request:

        - `given_name`
        - `family_name`
        - `company_name`
        - `email_address`
        - `phone_number`

        Parameters
        ----------
        customers : typing.Dict[str, BulkCreateCustomerDataParams]
            A map of 1 to 100 individual create requests, represented by `idempotency key: { customer data }`
            key-value pairs.

            Each key is an [idempotency key](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency)
            that uniquely identifies the create request. Each value contains the customer data used to create the
            customer profile.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkCreateCustomersResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.batch_create(
                customers={
                    "8bb76c4f-e35d-4c5b-90de-1194cd9179f0": {
                        "given_name": "Amelia",
                        "family_name": "Earhart",
                        "email_address": "Amelia.Earhart@example.com",
                        "address": {
                            "address_line1": "500 Electric Ave",
                            "address_line2": "Suite 600",
                            "locality": "New York",
                            "administrative_district_level1": "NY",
                            "postal_code": "10003",
                            "country": "US",
                        },
                        "phone_number": "+1-212-555-4240",
                        "reference_id": "YOUR_REFERENCE_ID",
                        "note": "a customer",
                    },
                    "d1689f23-b25d-4932-b2f0-aed00f5e2029": {
                        "given_name": "Marie",
                        "family_name": "Curie",
                        "email_address": "Marie.Curie@example.com",
                        "address": {
                            "address_line1": "500 Electric Ave",
                            "address_line2": "Suite 601",
                            "locality": "New York",
                            "administrative_district_level1": "NY",
                            "postal_code": "10003",
                            "country": "US",
                        },
                        "phone_number": "+1-212-444-4240",
                        "reference_id": "YOUR_REFERENCE_ID",
                        "note": "another customer",
                    },
                },
            )


        asyncio.run(main())
        """
        response = await self._raw_client.batch_create(customers=customers, request_options=request_options)
        return response.data

    async def bulk_delete_customers(
        self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> BulkDeleteCustomersResponse:
        """
        Deletes multiple customer profiles.

        The endpoint takes a list of customer IDs and returns a map of responses.

        Parameters
        ----------
        customer_ids : typing.Sequence[str]
            The IDs of the [customer profiles](entity:Customer) to delete.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkDeleteCustomersResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.bulk_delete_customers(
                customer_ids=[
                    "8DDA5NZVBZFGAX0V3HPF81HHE0",
                    "N18CPRVXR5214XPBBA6BZQWF3C",
                    "2GYD7WNXF7BJZW1PMGNXZ3Y8M8",
                ],
            )


        asyncio.run(main())
        """
        response = await self._raw_client.bulk_delete_customers(
            customer_ids=customer_ids, request_options=request_options
        )
        return response.data

    async def bulk_retrieve_customers(
        self, *, customer_ids: typing.Sequence[str], request_options: typing.Optional[RequestOptions] = None
    ) -> BulkRetrieveCustomersResponse:
        """
        Retrieves multiple customer profiles.

        This endpoint takes a list of customer IDs and returns a map of responses.

        Parameters
        ----------
        customer_ids : typing.Sequence[str]
            The IDs of the [customer profiles](entity:Customer) to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkRetrieveCustomersResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.bulk_retrieve_customers(
                customer_ids=[
                    "8DDA5NZVBZFGAX0V3HPF81HHE0",
                    "N18CPRVXR5214XPBBA6BZQWF3C",
                    "2GYD7WNXF7BJZW1PMGNXZ3Y8M8",
                ],
            )


        asyncio.run(main())
        """
        response = await self._raw_client.bulk_retrieve_customers(
            customer_ids=customer_ids, request_options=request_options
        )
        return response.data

    async def bulk_update_customers(
        self,
        *,
        customers: typing.Dict[str, BulkUpdateCustomerDataParams],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> BulkUpdateCustomersResponse:
        """
        Updates multiple customer profiles.

        This endpoint takes a map of individual update requests and returns a map of responses.

        Parameters
        ----------
        customers : typing.Dict[str, BulkUpdateCustomerDataParams]
            A map of 1 to 100 individual update requests, represented by `customer ID: { customer data }`
            key-value pairs.

            Each key is the ID of the [customer profile](entity:Customer) to update. To update a customer profile
            that was created by merging existing profiles, provide the ID of the newly created profile.

            Each value contains the updated customer data. Only new or changed fields are required. To add or
            update a field, specify the new value. To remove a field, specify `null`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        BulkUpdateCustomersResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.bulk_update_customers(
                customers={
                    "8DDA5NZVBZFGAX0V3HPF81HHE0": {
                        "email_address": "New.Amelia.Earhart@example.com",
                        "note": "updated customer note",
                        "version": 2,
                    },
                    "N18CPRVXR5214XPBBA6BZQWF3C": {
                        "given_name": "Marie",
                        "family_name": "Curie",
                        "version": 0,
                    },
                },
            )


        asyncio.run(main())
        """
        response = await self._raw_client.bulk_update_customers(customers=customers, request_options=request_options)
        return response.data

    async def search(
        self,
        *,
        cursor: typing.Optional[str] = OMIT,
        limit: typing.Optional[int] = OMIT,
        query: typing.Optional[CustomerQueryParams] = OMIT,
        count: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> SearchCustomersResponse:
        """
        Searches the customer profiles associated with a Square account using one or more supported query filters.

        Calling `SearchCustomers` without any explicit query filter returns all
        customer profiles ordered alphabetically based on `given_name` and
        `family_name`.

        Under normal operating conditions, newly created or updated customer profiles become available
        for the search operation in well under 30 seconds. Occasionally, propagation of the new or updated
        profiles can take closer to one minute or longer, especially during network incidents and outages.

        Parameters
        ----------
        cursor : typing.Optional[str]
            Include the pagination cursor in subsequent calls to this endpoint to retrieve
            the next set of results associated with the original query.

            For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

        limit : typing.Optional[int]
            The maximum number of results to return in a single page. This limit is advisory. The response might contain more or fewer results.
            If the specified limit is invalid, Square returns a `400 VALUE_TOO_LOW` or `400 VALUE_TOO_HIGH` error. The default value is 100.

            For more information, see [Pagination](https://developer.squareup.com/docs/build-basics/common-api-patterns/pagination).

        query : typing.Optional[CustomerQueryParams]
            The filtering and sorting criteria for the search request. If a query is not specified,
            Square returns all customer profiles ordered alphabetically by `given_name` and `family_name`.

        count : typing.Optional[bool]
            Indicates whether to return the total count of matching customers in the `count` field of the response.

            The default value is `false`.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        SearchCustomersResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.search(
                limit=2,
                query={
                    "filter": {
                        "creation_source": {
                            "values": ["THIRD_PARTY"],
                            "rule": "INCLUDE",
                        },
                        "created_at": {
                            "start_at": "2018-01-01T00:00:00-00:00",
                            "end_at": "2018-02-01T00:00:00-00:00",
                        },
                        "email_address": {"fuzzy": "example.com"},
                        "group_ids": {"all_": ["545AXB44B4XXWMVQ4W8SBT3HHF"]},
                    },
                    "sort": {"field": "CREATED_AT", "order": "ASC"},
                },
            )


        asyncio.run(main())
        """
        response = await self._raw_client.search(
            cursor=cursor, limit=limit, query=query, count=count, request_options=request_options
        )
        return response.data

    async def get(
        self, customer_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> GetCustomerResponse:
        """
        Returns details for a single customer.

        Parameters
        ----------
        customer_id : str
            The ID of the customer to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        GetCustomerResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.get(
                customer_id="customer_id",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.get(customer_id, request_options=request_options)
        return response.data

    async def update(
        self,
        customer_id: str,
        *,
        given_name: typing.Optional[str] = OMIT,
        family_name: typing.Optional[str] = OMIT,
        company_name: typing.Optional[str] = OMIT,
        nickname: typing.Optional[str] = OMIT,
        email_address: typing.Optional[str] = OMIT,
        address: typing.Optional[AddressParams] = OMIT,
        phone_number: typing.Optional[str] = OMIT,
        reference_id: typing.Optional[str] = OMIT,
        note: typing.Optional[str] = OMIT,
        birthday: typing.Optional[str] = OMIT,
        version: typing.Optional[int] = OMIT,
        tax_ids: typing.Optional[CustomerTaxIdsParams] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> UpdateCustomerResponse:
        """
        Updates a customer profile. This endpoint supports sparse updates, so only new or changed fields are required in the request.
        To add or update a field, specify the new value. To remove a field, specify `null`.

        To update a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.

        Parameters
        ----------
        customer_id : str
            The ID of the customer to update.

        given_name : typing.Optional[str]
            The given name (that is, the first name) associated with the customer profile.

            The maximum length for this value is 300 characters.

        family_name : typing.Optional[str]
            The family name (that is, the last name) associated with the customer profile.

            The maximum length for this value is 300 characters.

        company_name : typing.Optional[str]
            A business name associated with the customer profile.

            The maximum length for this value is 500 characters.

        nickname : typing.Optional[str]
            A nickname for the customer profile.

            The maximum length for this value is 100 characters.

        email_address : typing.Optional[str]
            The email address associated with the customer profile.

            The maximum length for this value is 254 characters.

        address : typing.Optional[AddressParams]
            The physical address associated with the customer profile. Only new or changed fields are required in the request.

            For maximum length constraints, see [Customer addresses](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#address).
            The `first_name` and `last_name` fields are ignored if they are present in the request.

        phone_number : typing.Optional[str]
            The phone number associated with the customer profile. The phone number must be valid and can contain
            9–16 digits, with an optional `+` prefix and country code. For more information, see
            [Customer phone numbers](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#phone-number).

        reference_id : typing.Optional[str]
            An optional second ID used to associate the customer profile with an
            entity in another system.

            The maximum length for this value is 100 characters.

        note : typing.Optional[str]
            A custom note associated with the customer profile.

        birthday : typing.Optional[str]
            The birthday associated with the customer profile, in `YYYY-MM-DD` or `MM-DD` format. For example,
            specify `1998-09-21` for September 21, 1998, or `09-21` for September 21. Birthdays are returned in `YYYY-MM-DD`
            format, where `YYYY` is the specified birth year or `0000` if a birth year is not specified.

        version : typing.Optional[int]
            The current version of the customer profile.

            As a best practice, you should include this field to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control. For more information, see [Update a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#update-a-customer-profile).

        tax_ids : typing.Optional[CustomerTaxIdsParams]
            The tax ID associated with the customer profile. This field is available only for customers of sellers
            in EU countries or the United Kingdom. For more information,
            see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-it-does#customer-tax-ids).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        UpdateCustomerResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.update(
                customer_id="customer_id",
                email_address="New.Amelia.Earhart@example.com",
                note="updated customer note",
                version=2,
            )


        asyncio.run(main())
        """
        response = await self._raw_client.update(
            customer_id,
            given_name=given_name,
            family_name=family_name,
            company_name=company_name,
            nickname=nickname,
            email_address=email_address,
            address=address,
            phone_number=phone_number,
            reference_id=reference_id,
            note=note,
            birthday=birthday,
            version=version,
            tax_ids=tax_ids,
            request_options=request_options,
        )
        return response.data

    async def delete(
        self,
        customer_id: str,
        *,
        version: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DeleteCustomerResponse:
        """
        Deletes a customer profile from a business.

        To delete a customer profile that was created by merging existing profiles, you must use the ID of the newly created profile.

        Parameters
        ----------
        customer_id : str
            The ID of the customer to delete.

        version : typing.Optional[int]
            The current version of the customer profile.

            As a best practice, you should include this parameter to enable [optimistic concurrency](https://developer.squareup.com/docs/build-basics/common-api-patterns/optimistic-concurrency) control.  For more information, see [Delete a customer profile](https://developer.squareup.com/docs/customers-api/use-the-api/keep-records#delete-customer-profile).

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        DeleteCustomerResponse
            Success

        Examples
        --------
        import asyncio

        from square import AsyncSquare

        client = AsyncSquare(
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.customers.delete(
                customer_id="customer_id",
            )


        asyncio.run(main())
        """
        response = await self._raw_client.delete(customer_id, version=version, request_options=request_options)
        return response.data
