o
    lWi                     @   s   d dl Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ d	d
lmZmZ G dd dZG dd dZdS )    N   )AsyncClientWrapperSyncClientWrapper)RequestOptions)BreakdownTypes)
MetricType)UsageAggregationInterval)UsageCharactersResponseModel   )AsyncRawUsageClientRawUsageClientc                   @      e Zd ZdefddZedefddZdddddddd	ed
ede	j
e de	j
e de	j
e de	j
e de	j
e de	j
e defddZdS )UsageClientclient_wrapperc                C      t |d| _d S N)r   )r   _raw_clientselfr    r   [/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/usage/client.py__init__      zUsageClient.__init__returnc                 C      | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawUsageClient
        r   r   r   r   r   with_raw_response      	zUsageClient.with_raw_responseNinclude_workspace_metricsbreakdown_typeaggregation_intervalaggregation_bucket_sizemetricrequest_options
start_unixend_unixr    r!   r"   r#   r$   r%   c          
   
   C   s"   | j j||||||||d}	|	jS )a  
        Returns the usage metrics for the current user or the entire workspace they are part of. The response provides a time axis based on the specified aggregation interval (default: day), with usage values for each interval along that axis. Usage is broken down by the selected breakdown type. For example, breakdown type "voice" will return the usage of each voice for each interval along the time axis.

        Parameters
        ----------
        start_unix : int
            UTC Unix timestamp for the start of the usage window, in milliseconds. To include the first day of the window, the timestamp should be at 00:00:00 of that day.

        end_unix : int
            UTC Unix timestamp for the end of the usage window, in milliseconds. To include the last day of the window, the timestamp should be at 23:59:59 of that day.

        include_workspace_metrics : typing.Optional[bool]
            Whether or not to include the statistics of the entire workspace.

        breakdown_type : typing.Optional[BreakdownTypes]
            How to break down the information. Cannot be "user" if include_workspace_metrics is False.

        aggregation_interval : typing.Optional[UsageAggregationInterval]
            How to aggregate usage data over time. Can be "hour", "day", "week", "month", or "cumulative".

        aggregation_bucket_size : typing.Optional[int]
            Aggregation bucket size in seconds. Overrides the aggregation interval.

        metric : typing.Optional[MetricType]
            Which metric to aggregate.

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

        Returns
        -------
        UsageCharactersResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.usage.get(
            start_unix=1,
            end_unix=1,
            include_workspace_metrics=True,
            breakdown_type="none",
            aggregation_interval="hour",
            aggregation_bucket_size=1,
            metric="credits",
        )
        r&   r'   r    r!   r"   r#   r$   r%   r   getdata
r   r&   r'   r    r!   r"   r#   r$   r%   	_responser   r   r   r*      s   ?
zUsageClient.get)__name__
__module____qualname__r   r   propertyr   r   inttypingOptionalboolr   r   r   r   r	   r*   r   r   r   r   r      :    	
r   c                   @   r   )AsyncUsageClientr   c                C   r   r   )r   r   r   r   r   r   r   j   r   zAsyncUsageClient.__init__r   c                 C   r   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawUsageClient
        r   r   r   r   r   r   m   r   z"AsyncUsageClient.with_raw_responseNr   r&   r'   r    r!   r"   r#   r$   r%   c          
   
      s*   | j j||||||||dI dH }	|	jS )a	  
        Returns the usage metrics for the current user or the entire workspace they are part of. The response provides a time axis based on the specified aggregation interval (default: day), with usage values for each interval along that axis. Usage is broken down by the selected breakdown type. For example, breakdown type "voice" will return the usage of each voice for each interval along the time axis.

        Parameters
        ----------
        start_unix : int
            UTC Unix timestamp for the start of the usage window, in milliseconds. To include the first day of the window, the timestamp should be at 00:00:00 of that day.

        end_unix : int
            UTC Unix timestamp for the end of the usage window, in milliseconds. To include the last day of the window, the timestamp should be at 23:59:59 of that day.

        include_workspace_metrics : typing.Optional[bool]
            Whether or not to include the statistics of the entire workspace.

        breakdown_type : typing.Optional[BreakdownTypes]
            How to break down the information. Cannot be "user" if include_workspace_metrics is False.

        aggregation_interval : typing.Optional[UsageAggregationInterval]
            How to aggregate usage data over time. Can be "hour", "day", "week", "month", or "cumulative".

        aggregation_bucket_size : typing.Optional[int]
            Aggregation bucket size in seconds. Overrides the aggregation interval.

        metric : typing.Optional[MetricType]
            Which metric to aggregate.

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

        Returns
        -------
        UsageCharactersResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.usage.get(
                start_unix=1,
                end_unix=1,
                include_workspace_metrics=True,
                breakdown_type="none",
                aggregation_interval="hour",
                aggregation_bucket_size=1,
                metric="credits",
            )


        asyncio.run(main())
        r(   Nr)   r,   r   r   r   r*   x   s   G
zAsyncUsageClient.get)r.   r/   r0   r   r   r1   r   r   r2   r3   r4   r5   r   r   r   r   r	   r*   r   r   r   r   r7   i   r6   r7   )r3   core.client_wrapperr   r   core.request_optionsr   types.breakdown_typesr   types.metric_typer    types.usage_aggregation_intervalr   %types.usage_characters_response_modelr	   
raw_clientr   r   r   r7   r   r   r   r   <module>   s   [