# 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 .raw_client import AsyncRawBalanceClient, RawBalanceClient
from .types.balance import Balance


class BalanceClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawBalanceClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawBalanceClient
        """
        return self._raw_client

    def get_balance(self, *, request_options: typing.Optional[RequestOptions] = None) -> Balance:
        """
        Get account balance showing available balance and pending charges

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

        Returns
        -------
        Balance

        Examples
        --------
        from soferai import SoferAI

        client = SoferAI(
            api_key="YOUR_API_KEY",
        )
        client.balance.get_balance()
        """
        _response = self._raw_client.get_balance(request_options=request_options)
        return _response.data


class AsyncBalanceClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawBalanceClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawBalanceClient
        """
        return self._raw_client

    async def get_balance(self, *, request_options: typing.Optional[RequestOptions] = None) -> Balance:
        """
        Get account balance showing available balance and pending charges

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

        Returns
        -------
        Balance

        Examples
        --------
        import asyncio

        from soferai import AsyncSoferAI

        client = AsyncSoferAI(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.balance.get_balance()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_balance(request_options=request_options)
        return _response.data
