o
    lWi
                     @   sl   d dl Z d dlmZ ddlmZ ddlmZmZ ddlm	Z	m
Z
 ddlmZ G dd	 d	ZG d
d dZdS )    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)RequestOptionsc                   @   <   e Zd ZdefddZdddeje ded fdd	Z	dS )
RawBaseElevenLabsclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   ^/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/raw_base_client.py__init__      
zRawBaseElevenLabs.__init__Nrequest_optionsr   returnc                C   s   | j jjdd|d}zd|j  krdk rn nt|ddW S | }W n ty7   t|jt|j	|j
dw t|jt|j	|d)	a  
        Add a generated voice to the voice library.

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

        Returns
        -------
        HttpResponse[None]
        *v1/text-to-voice/create-voice-from-previewPOSTmethodr      ,  Nresponsedatastatus_codeheadersbody)r   httpx_clientrequestr$   r   jsonr   r   dictr%   textr   r   	_response_response_jsonr   r   r   save_a_voice_preview   s   z&RawBaseElevenLabs.save_a_voice_preview)
__name__
__module____qualname__r   r   typingOptionalr	   r   r/   r   r   r   r   r      s    &r   c                   @   r
   )
AsyncRawBaseElevenLabsr   c                C   r   r   r   r   r   r   r   r   ,   r   zAsyncRawBaseElevenLabs.__init__Nr   r   r   c                   s   | j jjdd|dI dH }zd|j  krdk r#n nt|ddW S | }W n ty;   t|jt|j	|j
dw t|jt|j	|d)	a  
        Add a generated voice to the voice library.

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

        Returns
        -------
        AsyncHttpResponse[None]
        r   r   r   Nr   r   r    r#   )r   r'   r(   r$   r   r)   r   r   r*   r%   r+   r,   r   r   r   r/   /   s   z+AsyncRawBaseElevenLabs.save_a_voice_preview)
r0   r1   r2   r   r   r3   r4   r	   r   r/   r   r   r   r   r5   +   s    r5   )r3   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r   core.request_optionsr	   r   r5   r   r   r   r   <module>   s   