# 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.list_project_purchases_v1response import ListProjectPurchasesV1Response
from .raw_client import AsyncRawPurchasesClient, RawPurchasesClient


class PurchasesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawPurchasesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawPurchasesClient
        """
        return self._raw_client

    def list(
        self,
        project_id: str,
        *,
        limit: typing.Optional[float] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListProjectPurchasesV1Response:
        """
        Returns the original purchased amount on an order transaction

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        limit : typing.Optional[float]
            Number of results to return per page. Default 10. Range [1,1000]

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

        Returns
        -------
        ListProjectPurchasesV1Response
            A list of purchases for a specific project

        Examples
        --------
        from deepgram import DeepgramClient

        client = DeepgramClient(
            api_key="YOUR_API_KEY",
        )
        client.manage.v1.projects.billing.purchases.list(
            project_id="123456-7890-1234-5678-901234",
            limit=1.1,
        )
        """
        _response = self._raw_client.list(project_id, limit=limit, request_options=request_options)
        return _response.data


class AsyncPurchasesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawPurchasesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawPurchasesClient
        """
        return self._raw_client

    async def list(
        self,
        project_id: str,
        *,
        limit: typing.Optional[float] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListProjectPurchasesV1Response:
        """
        Returns the original purchased amount on an order transaction

        Parameters
        ----------
        project_id : str
            The unique identifier of the project

        limit : typing.Optional[float]
            Number of results to return per page. Default 10. Range [1,1000]

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

        Returns
        -------
        ListProjectPurchasesV1Response
            A list of purchases for a specific project

        Examples
        --------
        import asyncio

        from deepgram import AsyncDeepgramClient

        client = AsyncDeepgramClient(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage.v1.projects.billing.purchases.list(
                project_id="123456-7890-1234-5678-901234",
                limit=1.1,
            )


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