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

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.created_at import CreatedAt
from ..types.customer_number_nullable import CustomerNumberNullable
from ..types.customer_query_records import CustomerQueryRecords
from ..types.customer_status import CustomerStatus
from ..types.email import Email
from ..types.entrypointfield import Entrypointfield
from ..types.idempotency_key import IdempotencyKey
from ..types.identifierfields import Identifierfields
from ..types.payabli_api_response_00_responsedatanonobject import PayabliApiResponse00Responsedatanonobject
from ..types.payabli_api_response_customer_query import PayabliApiResponseCustomerQuery
from ..types.shippingaddress import Shippingaddress
from ..types.shippingaddressadditional import Shippingaddressadditional
from ..types.shippingcity import Shippingcity
from ..types.shippingcountry import Shippingcountry
from ..types.shippingstate import Shippingstate
from ..types.shippingzip import Shippingzip
from ..types.timezone import Timezone
from .raw_client import AsyncRawCustomerClient, RawCustomerClient

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


class CustomerClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawCustomerClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawCustomerClient
        """
        return self._raw_client

    def add_customer(
        self,
        entry: Entrypointfield,
        *,
        force_customer_creation: typing.Optional[bool] = None,
        replace_existing: typing.Optional[int] = None,
        idempotency_key: typing.Optional[IdempotencyKey] = None,
        customer_number: typing.Optional[CustomerNumberNullable] = OMIT,
        customer_username: typing.Optional[str] = OMIT,
        customer_psw: typing.Optional[str] = OMIT,
        customer_status: typing.Optional[CustomerStatus] = OMIT,
        company: typing.Optional[str] = OMIT,
        firstname: typing.Optional[str] = OMIT,
        lastname: typing.Optional[str] = OMIT,
        phone: typing.Optional[str] = OMIT,
        email: typing.Optional[Email] = OMIT,
        address: typing.Optional[str] = OMIT,
        address_1: typing.Optional[str] = OMIT,
        city: typing.Optional[str] = OMIT,
        state: typing.Optional[str] = OMIT,
        zip: typing.Optional[str] = OMIT,
        country: typing.Optional[str] = OMIT,
        shipping_address: typing.Optional[Shippingaddress] = OMIT,
        shipping_address_1: typing.Optional[Shippingaddressadditional] = OMIT,
        shipping_city: typing.Optional[Shippingcity] = OMIT,
        shipping_state: typing.Optional[Shippingstate] = OMIT,
        shipping_zip: typing.Optional[Shippingzip] = OMIT,
        shipping_country: typing.Optional[Shippingcountry] = OMIT,
        balance: typing.Optional[float] = OMIT,
        time_zone: typing.Optional[Timezone] = OMIT,
        additional_fields: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        identifier_fields: typing.Optional[Identifierfields] = OMIT,
        created_at: typing.Optional[CreatedAt] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PayabliApiResponseCustomerQuery:
        """
        Creates a customer in an entrypoint. An identifier is required to create customer records. Change your identifier settings in Settings > Custom Fields in PartnerHub.
        If you don't include an identifier, the record is rejected.

        Parameters
        ----------
        entry : Entrypointfield

        force_customer_creation : typing.Optional[bool]
            When `true`, the request creates a new customer record, regardless of whether customer identifiers match an existing customer.

        replace_existing : typing.Optional[int]
            Flag indicating to replace existing customer with a new record. Possible values: 0 (don't replace), 1 (replace). Default is `0`.

        idempotency_key : typing.Optional[IdempotencyKey]

        customer_number : typing.Optional[CustomerNumberNullable]

        customer_username : typing.Optional[str]
            Customer username for customer portal

        customer_psw : typing.Optional[str]
            Customer password for customer portal

        customer_status : typing.Optional[CustomerStatus]

        company : typing.Optional[str]
            Company name

        firstname : typing.Optional[str]
            Customer first name

        lastname : typing.Optional[str]
            Customer last name

        phone : typing.Optional[str]
            Customer phone number

        email : typing.Optional[Email]
            Customer email address.

        address : typing.Optional[str]
            Customer address

        address_1 : typing.Optional[str]
            Additional customer address

        city : typing.Optional[str]
            Customer city

        state : typing.Optional[str]
            Customer State

        zip : typing.Optional[str]
            Customer postal code

        country : typing.Optional[str]
            Customer country in ISO-3166-1 alpha 2 format. See https://en.wikipedia.org/wiki/ISO_3166-1 for reference.

        shipping_address : typing.Optional[Shippingaddress]

        shipping_address_1 : typing.Optional[Shippingaddressadditional]

        shipping_city : typing.Optional[Shippingcity]

        shipping_state : typing.Optional[Shippingstate]

        shipping_zip : typing.Optional[Shippingzip]

        shipping_country : typing.Optional[Shippingcountry]

        balance : typing.Optional[float]
            Customer balance.

        time_zone : typing.Optional[Timezone]

        additional_fields : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Additional Custom fields in format "key":"value".

        identifier_fields : typing.Optional[Identifierfields]

        created_at : typing.Optional[CreatedAt]

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

        Returns
        -------
        PayabliApiResponseCustomerQuery
            Success

        Examples
        --------
        from payabli import payabli

        client = payabli(
            api_key="YOUR_API_KEY",
        )
        client.customer.add_customer(
            entry="8cfec329267",
            customer_number="12356ACB",
            firstname="Irene",
            lastname="Canizales",
            address_1="123 Bishop's Trail",
            city="Mountain City",
            state="TN",
            zip="37612",
            country="US",
            email="irene@canizalesconcrete.com",
            identifier_fields=["email"],
            time_zone=-5,
        )
        """
        _response = self._raw_client.add_customer(
            entry,
            force_customer_creation=force_customer_creation,
            replace_existing=replace_existing,
            idempotency_key=idempotency_key,
            customer_number=customer_number,
            customer_username=customer_username,
            customer_psw=customer_psw,
            customer_status=customer_status,
            company=company,
            firstname=firstname,
            lastname=lastname,
            phone=phone,
            email=email,
            address=address,
            address_1=address_1,
            city=city,
            state=state,
            zip=zip,
            country=country,
            shipping_address=shipping_address,
            shipping_address_1=shipping_address_1,
            shipping_city=shipping_city,
            shipping_state=shipping_state,
            shipping_zip=shipping_zip,
            shipping_country=shipping_country,
            balance=balance,
            time_zone=time_zone,
            additional_fields=additional_fields,
            identifier_fields=identifier_fields,
            created_at=created_at,
            request_options=request_options,
        )
        return _response.data

    def delete_customer(
        self, customer_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PayabliApiResponse00Responsedatanonobject:
        """
        Delete a customer record.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

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

        Returns
        -------
        PayabliApiResponse00Responsedatanonobject
            Success

        Examples
        --------
        from payabli import payabli

        client = payabli(
            api_key="YOUR_API_KEY",
        )
        client.customer.delete_customer(
            customer_id=998,
        )
        """
        _response = self._raw_client.delete_customer(customer_id, request_options=request_options)
        return _response.data

    def get_customer(
        self, customer_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> CustomerQueryRecords:
        """
        Retrieves a customer's record and details.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

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

        Returns
        -------
        CustomerQueryRecords
            Success

        Examples
        --------
        from payabli import payabli

        client = payabli(
            api_key="YOUR_API_KEY",
        )
        client.customer.get_customer(
            customer_id=998,
        )
        """
        _response = self._raw_client.get_customer(customer_id, request_options=request_options)
        return _response.data

    def link_customer_transaction(
        self, customer_id: int, trans_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PayabliApiResponse00Responsedatanonobject:
        """
        Links a customer to a transaction by ID.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

        trans_id : str
            ReferenceId for the transaction (PaymentId).

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

        Returns
        -------
        PayabliApiResponse00Responsedatanonobject
            Success

        Examples
        --------
        from payabli import payabli

        client = payabli(
            api_key="YOUR_API_KEY",
        )
        client.customer.link_customer_transaction(
            customer_id=998,
            trans_id="45-as456777hhhhhhhhhh77777777-324",
        )
        """
        _response = self._raw_client.link_customer_transaction(customer_id, trans_id, request_options=request_options)
        return _response.data

    def request_consent(
        self, customer_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PayabliApiResponse00Responsedatanonobject:
        """
        Sends the consent opt-in email to the customer email address in the customer record.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

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

        Returns
        -------
        PayabliApiResponse00Responsedatanonobject
            Success

        Examples
        --------
        from payabli import payabli

        client = payabli(
            api_key="YOUR_API_KEY",
        )
        client.customer.request_consent(
            customer_id=998,
        )
        """
        _response = self._raw_client.request_consent(customer_id, request_options=request_options)
        return _response.data

    def update_customer(
        self,
        customer_id: int,
        *,
        customer_number: typing.Optional[CustomerNumberNullable] = OMIT,
        customer_username: typing.Optional[str] = OMIT,
        customer_psw: typing.Optional[str] = OMIT,
        customer_status: typing.Optional[CustomerStatus] = OMIT,
        company: typing.Optional[str] = OMIT,
        firstname: typing.Optional[str] = OMIT,
        lastname: typing.Optional[str] = OMIT,
        phone: typing.Optional[str] = OMIT,
        email: typing.Optional[Email] = OMIT,
        address: typing.Optional[str] = OMIT,
        address_1: typing.Optional[str] = OMIT,
        city: typing.Optional[str] = OMIT,
        state: typing.Optional[str] = OMIT,
        zip: typing.Optional[str] = OMIT,
        country: typing.Optional[str] = OMIT,
        shipping_address: typing.Optional[Shippingaddress] = OMIT,
        shipping_address_1: typing.Optional[Shippingaddressadditional] = OMIT,
        shipping_city: typing.Optional[Shippingcity] = OMIT,
        shipping_state: typing.Optional[Shippingstate] = OMIT,
        shipping_zip: typing.Optional[Shippingzip] = OMIT,
        shipping_country: typing.Optional[Shippingcountry] = OMIT,
        balance: typing.Optional[float] = OMIT,
        time_zone: typing.Optional[Timezone] = OMIT,
        additional_fields: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        identifier_fields: typing.Optional[Identifierfields] = OMIT,
        created_at: typing.Optional[CreatedAt] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PayabliApiResponse00Responsedatanonobject:
        """
        Update a customer record. Include only the fields you want to change.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

        customer_number : typing.Optional[CustomerNumberNullable]

        customer_username : typing.Optional[str]
            Customer username for customer portal

        customer_psw : typing.Optional[str]
            Customer password for customer portal

        customer_status : typing.Optional[CustomerStatus]

        company : typing.Optional[str]
            Company name

        firstname : typing.Optional[str]
            Customer first name

        lastname : typing.Optional[str]
            Customer last name

        phone : typing.Optional[str]
            Customer phone number

        email : typing.Optional[Email]
            Customer email address.

        address : typing.Optional[str]
            Customer address

        address_1 : typing.Optional[str]
            Additional customer address

        city : typing.Optional[str]
            Customer city

        state : typing.Optional[str]
            Customer State

        zip : typing.Optional[str]
            Customer postal code

        country : typing.Optional[str]
            Customer country in ISO-3166-1 alpha 2 format. See https://en.wikipedia.org/wiki/ISO_3166-1 for reference.

        shipping_address : typing.Optional[Shippingaddress]

        shipping_address_1 : typing.Optional[Shippingaddressadditional]

        shipping_city : typing.Optional[Shippingcity]

        shipping_state : typing.Optional[Shippingstate]

        shipping_zip : typing.Optional[Shippingzip]

        shipping_country : typing.Optional[Shippingcountry]

        balance : typing.Optional[float]
            Customer balance.

        time_zone : typing.Optional[Timezone]

        additional_fields : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Additional Custom fields in format "key":"value".

        identifier_fields : typing.Optional[Identifierfields]

        created_at : typing.Optional[CreatedAt]

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

        Returns
        -------
        PayabliApiResponse00Responsedatanonobject
            Success

        Examples
        --------
        from payabli import payabli

        client = payabli(
            api_key="YOUR_API_KEY",
        )
        client.customer.update_customer(
            customer_id=998,
            firstname="Irene",
            lastname="Canizales",
            address_1="145 Bishop's Trail",
            city="Mountain City",
            state="TN",
            zip="37612",
            country="US",
        )
        """
        _response = self._raw_client.update_customer(
            customer_id,
            customer_number=customer_number,
            customer_username=customer_username,
            customer_psw=customer_psw,
            customer_status=customer_status,
            company=company,
            firstname=firstname,
            lastname=lastname,
            phone=phone,
            email=email,
            address=address,
            address_1=address_1,
            city=city,
            state=state,
            zip=zip,
            country=country,
            shipping_address=shipping_address,
            shipping_address_1=shipping_address_1,
            shipping_city=shipping_city,
            shipping_state=shipping_state,
            shipping_zip=shipping_zip,
            shipping_country=shipping_country,
            balance=balance,
            time_zone=time_zone,
            additional_fields=additional_fields,
            identifier_fields=identifier_fields,
            created_at=created_at,
            request_options=request_options,
        )
        return _response.data


class AsyncCustomerClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawCustomerClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawCustomerClient
        """
        return self._raw_client

    async def add_customer(
        self,
        entry: Entrypointfield,
        *,
        force_customer_creation: typing.Optional[bool] = None,
        replace_existing: typing.Optional[int] = None,
        idempotency_key: typing.Optional[IdempotencyKey] = None,
        customer_number: typing.Optional[CustomerNumberNullable] = OMIT,
        customer_username: typing.Optional[str] = OMIT,
        customer_psw: typing.Optional[str] = OMIT,
        customer_status: typing.Optional[CustomerStatus] = OMIT,
        company: typing.Optional[str] = OMIT,
        firstname: typing.Optional[str] = OMIT,
        lastname: typing.Optional[str] = OMIT,
        phone: typing.Optional[str] = OMIT,
        email: typing.Optional[Email] = OMIT,
        address: typing.Optional[str] = OMIT,
        address_1: typing.Optional[str] = OMIT,
        city: typing.Optional[str] = OMIT,
        state: typing.Optional[str] = OMIT,
        zip: typing.Optional[str] = OMIT,
        country: typing.Optional[str] = OMIT,
        shipping_address: typing.Optional[Shippingaddress] = OMIT,
        shipping_address_1: typing.Optional[Shippingaddressadditional] = OMIT,
        shipping_city: typing.Optional[Shippingcity] = OMIT,
        shipping_state: typing.Optional[Shippingstate] = OMIT,
        shipping_zip: typing.Optional[Shippingzip] = OMIT,
        shipping_country: typing.Optional[Shippingcountry] = OMIT,
        balance: typing.Optional[float] = OMIT,
        time_zone: typing.Optional[Timezone] = OMIT,
        additional_fields: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        identifier_fields: typing.Optional[Identifierfields] = OMIT,
        created_at: typing.Optional[CreatedAt] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PayabliApiResponseCustomerQuery:
        """
        Creates a customer in an entrypoint. An identifier is required to create customer records. Change your identifier settings in Settings > Custom Fields in PartnerHub.
        If you don't include an identifier, the record is rejected.

        Parameters
        ----------
        entry : Entrypointfield

        force_customer_creation : typing.Optional[bool]
            When `true`, the request creates a new customer record, regardless of whether customer identifiers match an existing customer.

        replace_existing : typing.Optional[int]
            Flag indicating to replace existing customer with a new record. Possible values: 0 (don't replace), 1 (replace). Default is `0`.

        idempotency_key : typing.Optional[IdempotencyKey]

        customer_number : typing.Optional[CustomerNumberNullable]

        customer_username : typing.Optional[str]
            Customer username for customer portal

        customer_psw : typing.Optional[str]
            Customer password for customer portal

        customer_status : typing.Optional[CustomerStatus]

        company : typing.Optional[str]
            Company name

        firstname : typing.Optional[str]
            Customer first name

        lastname : typing.Optional[str]
            Customer last name

        phone : typing.Optional[str]
            Customer phone number

        email : typing.Optional[Email]
            Customer email address.

        address : typing.Optional[str]
            Customer address

        address_1 : typing.Optional[str]
            Additional customer address

        city : typing.Optional[str]
            Customer city

        state : typing.Optional[str]
            Customer State

        zip : typing.Optional[str]
            Customer postal code

        country : typing.Optional[str]
            Customer country in ISO-3166-1 alpha 2 format. See https://en.wikipedia.org/wiki/ISO_3166-1 for reference.

        shipping_address : typing.Optional[Shippingaddress]

        shipping_address_1 : typing.Optional[Shippingaddressadditional]

        shipping_city : typing.Optional[Shippingcity]

        shipping_state : typing.Optional[Shippingstate]

        shipping_zip : typing.Optional[Shippingzip]

        shipping_country : typing.Optional[Shippingcountry]

        balance : typing.Optional[float]
            Customer balance.

        time_zone : typing.Optional[Timezone]

        additional_fields : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Additional Custom fields in format "key":"value".

        identifier_fields : typing.Optional[Identifierfields]

        created_at : typing.Optional[CreatedAt]

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

        Returns
        -------
        PayabliApiResponseCustomerQuery
            Success

        Examples
        --------
        import asyncio

        from payabli import Asyncpayabli

        client = Asyncpayabli(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.customer.add_customer(
                entry="8cfec329267",
                customer_number="12356ACB",
                firstname="Irene",
                lastname="Canizales",
                address_1="123 Bishop's Trail",
                city="Mountain City",
                state="TN",
                zip="37612",
                country="US",
                email="irene@canizalesconcrete.com",
                identifier_fields=["email"],
                time_zone=-5,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.add_customer(
            entry,
            force_customer_creation=force_customer_creation,
            replace_existing=replace_existing,
            idempotency_key=idempotency_key,
            customer_number=customer_number,
            customer_username=customer_username,
            customer_psw=customer_psw,
            customer_status=customer_status,
            company=company,
            firstname=firstname,
            lastname=lastname,
            phone=phone,
            email=email,
            address=address,
            address_1=address_1,
            city=city,
            state=state,
            zip=zip,
            country=country,
            shipping_address=shipping_address,
            shipping_address_1=shipping_address_1,
            shipping_city=shipping_city,
            shipping_state=shipping_state,
            shipping_zip=shipping_zip,
            shipping_country=shipping_country,
            balance=balance,
            time_zone=time_zone,
            additional_fields=additional_fields,
            identifier_fields=identifier_fields,
            created_at=created_at,
            request_options=request_options,
        )
        return _response.data

    async def delete_customer(
        self, customer_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PayabliApiResponse00Responsedatanonobject:
        """
        Delete a customer record.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

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

        Returns
        -------
        PayabliApiResponse00Responsedatanonobject
            Success

        Examples
        --------
        import asyncio

        from payabli import Asyncpayabli

        client = Asyncpayabli(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.customer.delete_customer(
                customer_id=998,
            )


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

    async def get_customer(
        self, customer_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> CustomerQueryRecords:
        """
        Retrieves a customer's record and details.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

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

        Returns
        -------
        CustomerQueryRecords
            Success

        Examples
        --------
        import asyncio

        from payabli import Asyncpayabli

        client = Asyncpayabli(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.customer.get_customer(
                customer_id=998,
            )


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

    async def link_customer_transaction(
        self, customer_id: int, trans_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PayabliApiResponse00Responsedatanonobject:
        """
        Links a customer to a transaction by ID.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

        trans_id : str
            ReferenceId for the transaction (PaymentId).

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

        Returns
        -------
        PayabliApiResponse00Responsedatanonobject
            Success

        Examples
        --------
        import asyncio

        from payabli import Asyncpayabli

        client = Asyncpayabli(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.customer.link_customer_transaction(
                customer_id=998,
                trans_id="45-as456777hhhhhhhhhh77777777-324",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.link_customer_transaction(
            customer_id, trans_id, request_options=request_options
        )
        return _response.data

    async def request_consent(
        self, customer_id: int, *, request_options: typing.Optional[RequestOptions] = None
    ) -> PayabliApiResponse00Responsedatanonobject:
        """
        Sends the consent opt-in email to the customer email address in the customer record.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

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

        Returns
        -------
        PayabliApiResponse00Responsedatanonobject
            Success

        Examples
        --------
        import asyncio

        from payabli import Asyncpayabli

        client = Asyncpayabli(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.customer.request_consent(
                customer_id=998,
            )


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

    async def update_customer(
        self,
        customer_id: int,
        *,
        customer_number: typing.Optional[CustomerNumberNullable] = OMIT,
        customer_username: typing.Optional[str] = OMIT,
        customer_psw: typing.Optional[str] = OMIT,
        customer_status: typing.Optional[CustomerStatus] = OMIT,
        company: typing.Optional[str] = OMIT,
        firstname: typing.Optional[str] = OMIT,
        lastname: typing.Optional[str] = OMIT,
        phone: typing.Optional[str] = OMIT,
        email: typing.Optional[Email] = OMIT,
        address: typing.Optional[str] = OMIT,
        address_1: typing.Optional[str] = OMIT,
        city: typing.Optional[str] = OMIT,
        state: typing.Optional[str] = OMIT,
        zip: typing.Optional[str] = OMIT,
        country: typing.Optional[str] = OMIT,
        shipping_address: typing.Optional[Shippingaddress] = OMIT,
        shipping_address_1: typing.Optional[Shippingaddressadditional] = OMIT,
        shipping_city: typing.Optional[Shippingcity] = OMIT,
        shipping_state: typing.Optional[Shippingstate] = OMIT,
        shipping_zip: typing.Optional[Shippingzip] = OMIT,
        shipping_country: typing.Optional[Shippingcountry] = OMIT,
        balance: typing.Optional[float] = OMIT,
        time_zone: typing.Optional[Timezone] = OMIT,
        additional_fields: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        identifier_fields: typing.Optional[Identifierfields] = OMIT,
        created_at: typing.Optional[CreatedAt] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> PayabliApiResponse00Responsedatanonobject:
        """
        Update a customer record. Include only the fields you want to change.

        Parameters
        ----------
        customer_id : int
            Payabli-generated customer ID. Maps to "Customer ID" column in PartnerHub.

        customer_number : typing.Optional[CustomerNumberNullable]

        customer_username : typing.Optional[str]
            Customer username for customer portal

        customer_psw : typing.Optional[str]
            Customer password for customer portal

        customer_status : typing.Optional[CustomerStatus]

        company : typing.Optional[str]
            Company name

        firstname : typing.Optional[str]
            Customer first name

        lastname : typing.Optional[str]
            Customer last name

        phone : typing.Optional[str]
            Customer phone number

        email : typing.Optional[Email]
            Customer email address.

        address : typing.Optional[str]
            Customer address

        address_1 : typing.Optional[str]
            Additional customer address

        city : typing.Optional[str]
            Customer city

        state : typing.Optional[str]
            Customer State

        zip : typing.Optional[str]
            Customer postal code

        country : typing.Optional[str]
            Customer country in ISO-3166-1 alpha 2 format. See https://en.wikipedia.org/wiki/ISO_3166-1 for reference.

        shipping_address : typing.Optional[Shippingaddress]

        shipping_address_1 : typing.Optional[Shippingaddressadditional]

        shipping_city : typing.Optional[Shippingcity]

        shipping_state : typing.Optional[Shippingstate]

        shipping_zip : typing.Optional[Shippingzip]

        shipping_country : typing.Optional[Shippingcountry]

        balance : typing.Optional[float]
            Customer balance.

        time_zone : typing.Optional[Timezone]

        additional_fields : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Additional Custom fields in format "key":"value".

        identifier_fields : typing.Optional[Identifierfields]

        created_at : typing.Optional[CreatedAt]

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

        Returns
        -------
        PayabliApiResponse00Responsedatanonobject
            Success

        Examples
        --------
        import asyncio

        from payabli import Asyncpayabli

        client = Asyncpayabli(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.customer.update_customer(
                customer_id=998,
                firstname="Irene",
                lastname="Canizales",
                address_1="145 Bishop's Trail",
                city="Mountain City",
                state="TN",
                zip="37612",
                country="US",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_customer(
            customer_id,
            customer_number=customer_number,
            customer_username=customer_username,
            customer_psw=customer_psw,
            customer_status=customer_status,
            company=company,
            firstname=firstname,
            lastname=lastname,
            phone=phone,
            email=email,
            address=address,
            address_1=address_1,
            city=city,
            state=state,
            zip=zip,
            country=country,
            shipping_address=shipping_address,
            shipping_address_1=shipping_address_1,
            shipping_city=shipping_city,
            shipping_state=shipping_state,
            shipping_zip=shipping_zip,
            shipping_country=shipping_country,
            balance=balance,
            time_zone=time_zone,
            additional_fields=additional_fields,
            identifier_fields=identifier_fields,
            created_at=created_at,
            request_options=request_options,
        )
        return _response.data
