# 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.account_usage_statistics_input import AccountUsageStatisticsInput
from ..types.account_usage_statistics_interval import AccountUsageStatisticsInterval
from .raw_client import AsyncRawAccountClient, RawAccountClient


class AccountClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAccountClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawAccountClient
        """
        return self._raw_client

    def get_usage(
        self,
        *,
        limit: typing.Optional[int] = None,
        interval: typing.Optional[AccountUsageStatisticsInterval] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AccountUsageStatisticsInput:
        """
        Get the usage statistics of your API account

        Parameters
        ----------
        limit : typing.Optional[int]
            The number of data points to return (max 168).

        interval : typing.Optional[AccountUsageStatisticsInterval]
            The time interval for the usage statistics.

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

        Returns
        -------
        AccountUsageStatisticsInput
            Success

        Examples
        --------
        from tradewatch import TradewatchApi

        client = TradewatchApi(
            api_key="YOUR_API_KEY",
        )
        client.account.get_usage()
        """
        _response = self._raw_client.get_usage(limit=limit, interval=interval, request_options=request_options)
        return _response.data


class AsyncAccountClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAccountClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawAccountClient
        """
        return self._raw_client

    async def get_usage(
        self,
        *,
        limit: typing.Optional[int] = None,
        interval: typing.Optional[AccountUsageStatisticsInterval] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> AccountUsageStatisticsInput:
        """
        Get the usage statistics of your API account

        Parameters
        ----------
        limit : typing.Optional[int]
            The number of data points to return (max 168).

        interval : typing.Optional[AccountUsageStatisticsInterval]
            The time interval for the usage statistics.

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

        Returns
        -------
        AccountUsageStatisticsInput
            Success

        Examples
        --------
        import asyncio

        from tradewatch import AsyncTradewatchApi

        client = AsyncTradewatchApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.account.get_usage()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_usage(limit=limit, interval=interval, request_options=request_options)
        return _response.data
