
    >|h/                         d dl mZ ddl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 dd
lmZ d dlmZ d dl mZ  G d d      Z G d d      Zy)   )SyncClientWrapper    N)BreakdownTypes)RequestOptions)UsageCharactersResponseModel)construct_type)UnprocessableEntityError)HttpValidationError)JSONDecodeError)ApiError)AsyncClientWrapperc                       e Zd ZdefdZdddddededej                  e   dej                  e	   d	ej                  e
   d
efdZy)UsageClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     V/var/www/html/test/engine/venv/lib/python3.12/site-packages/elevenlabs/usage/client.py__init__zUsageClient.__init__   
    -    Ninclude_workspace_metricsbreakdown_typerequest_options
start_unixend_unixr   r   r   returnc          
      F   | j                   j                  j                  dd||||d|      }	 d|j                  cxk  rdk  r:n n7t	        j
                  t        t        t        |j                                     S |j                  dk(  r@t        t	        j
                  t        t        t        |j                                           |j                         }t        |j                  |	      # t        $ r" t        |j                  |j                  	      w xY w)
a!  
        Returns the credit usage metrics for the current user or the entire workspace they are part of. The response will return a time axis with unix timestamps for each day and daily usage along that axis. The usage will be broken down by the specified breakdown type. For example, breakdown type "voice" will return the usage of each voice 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.

        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_characters_usage_metrics(
            start_unix=1,
            end_unix=1,
        )
        v1/usage/character-statsGETr   r    r   r   methodparamsr      ,  type_object_  status_codebodyr   httpx_clientrequestr0   typingcastr   r   jsonr	   r
   r   r   textr   r   r    r   r   r   	_response_response_jsons           r   get_characters_usage_metricsz(UsageClient.get_characters_usage_metrics   s   \ ((55==&($-F"0	 , > 

		Si++1c1{{0": ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AC5 ?AC5 5+D )__name__
__module____qualname__r   r   intr5   Optionalboolr   r   r   r<    r   r   r   r      s    .*; . <@:>;?OO OO 	OO
 $*??4#8OO 7OO  8OO 
&OOr   r   c                       e Zd ZdefdZdddddededej                  e   dej                  e	   d	ej                  e
   d
efdZy)AsyncUsageClientr   c                    || _         y r   r   r   s     r   r   zAsyncUsageClient.__init__g   r   r   Nr   r   r    r   r   r   r!   c          
      b  K   | j                   j                  j                  dd||||d|       d{   }	 d|j                  cxk  rdk  r:n n7t	        j
                  t        t        t        |j                                     S |j                  d	k(  r@t        t	        j
                  t        t        t        |j                                           |j                         }t        |j                  |
      7 # t        $ r" t        |j                  |j                  
      w xY ww)a  
        Returns the credit usage metrics for the current user or the entire workspace they are part of. The response will return a time axis with unix timestamps for each day and daily usage along that axis. The usage will be broken down by the specified breakdown type. For example, breakdown type "voice" will return the usage of each voice 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.

        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_characters_usage_metrics(
                start_unix=1,
                end_unix=1,
            )


        asyncio.run(main())
        r#   r$   r%   r&   Nr)   r*   r+   r.   r/   r2   r9   s           r   r<   z-AsyncUsageClient.get_characters_usage_metricsj   s!    l ..;;CC&($-F"0	 , D 

 

		Si++1c1{{0": ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NNC

>  	Sy'<'<9>>RR	Ss4   2D/C?D/AD D/	AD (D/+D,,D/)r=   r>   r?   r   r   r@   r5   rA   rB   r   r   r   r<   rC   r   r   rE   rE   f   s    .*< . <@:>;?WO WO 	WO
 $*??4#8WO 7WO  8WO 
&WOr   rE   )core.client_wrapperr   r5   types.breakdown_typesr   core.request_optionsr   %types.usage_characters_response_modelr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr	   types.http_validation_errorr
   json.decoderr   core.api_errorr   r   r   rE   rC   r   r   <module>rQ      sE    4  2 1 P 6 H = ( % 4SO SOl[O [Or   