# 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_billing_fields_v1response import ListBillingFieldsV1Response
from .raw_client import AsyncRawFieldsClient, RawFieldsClient


class FieldsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawFieldsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawFieldsClient
        """
        return self._raw_client

    def list(
        self,
        project_id: str,
        *,
        start: typing.Optional[str] = None,
        end: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListBillingFieldsV1Response:
        """
        Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available.

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

        start : typing.Optional[str]
            Start date of the requested date range. Format accepted is YYYY-MM-DD

        end : typing.Optional[str]
            End date of the requested date range. Format accepted is YYYY-MM-DD

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

        Returns
        -------
        ListBillingFieldsV1Response
            A list of billing fields for a specific project

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

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


class AsyncFieldsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawFieldsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawFieldsClient
        """
        return self._raw_client

    async def list(
        self,
        project_id: str,
        *,
        start: typing.Optional[str] = None,
        end: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListBillingFieldsV1Response:
        """
        Lists the accessors, deployment types, tags, and line items used for billing data in the specified time period. Use this endpoint if you want to filter your results from the Billing Breakdown endpoint and want to know what filters are available.

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

        start : typing.Optional[str]
            Start date of the requested date range. Format accepted is YYYY-MM-DD

        end : typing.Optional[str]
            End date of the requested date range. Format accepted is YYYY-MM-DD

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

        Returns
        -------
        ListBillingFieldsV1Response
            A list of billing fields 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.fields.list(
                project_id="123456-7890-1234-5678-901234",
                start="start",
                end="end",
            )


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