o
    lWi4                     @   s   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 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 e e jdZG dd dZG dd dZdS )    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)UnprocessableEntityError)EditVoiceSettingsResponseModel)HttpValidationError)VoiceSettings.c                
   @      e Zd ZdefddZdddeje dee	 fdd	Z
ddd
edeje dee	 fddZddd
ede	deje dee fddZdS )RawSettingsClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   i/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/voices/settings/raw_client.py__init__      
zRawSettingsClient.__init__Nrequest_optionsr   returnc                C   s   | j jjdd|d}z&d|j  krdk r+n ntttt| d}t	||dW S | }W n t
yC   t|jt|j|jdw t|jt|j|d)	a  
        Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app.

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

        Returns
        -------
        HttpResponse[VoiceSettings]
            Successful Response
        v1/voices/settings/defaultGETmethodr      ,  type_object_responsedatastatus_codeheadersbody)r   httpx_clientrequestr.   typingcastr   r   jsonr   r   r   dictr/   textr   r   	_response_data_response_jsonr   r   r   get_default   s(   zRawSettingsClient.get_defaultvoice_idc             	   C   s   | j jjdt| dd|d}z>d|j  krdk r1n ntttt|	 d}t
||dW S |jd	krItt|jtttt|	 dd
|	 }W n tya   t|jt|j|jdw t|jt|j|d)aN  
        Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

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

        Returns
        -------
        HttpResponse[VoiceSettings]
            Successful Response
        
v1/voices/	/settingsr"   r#   r%   r&   r'   r*     r/   r0   r-   )r   r1   r2   r	   r.   r3   r4   r   r   r5   r   r   r6   r/   r   r   r   r7   r   r=   r   r9   r:   r;   r   r   r   get<   s>   

zRawSettingsClient.getr2   c             	   C   s   | j jjdt| ddt|tddddi|td}z>d	|j  kr&d
k r;n nt	t
tt
| d}t||dW S |jdkrStt|jt	ttt| dd| }W n tyk   t|jt|j|jdw t|jt|j|d)a  
        Edit your settings for a specific voice. "similarity_boost" corresponds to "Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app.

        Parameters
        ----------
        voice_id : str
            ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices.

        request : VoiceSettings

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

        Returns
        -------
        HttpResponse[EditVoiceSettingsResponseModel]
            Successful Response
        r>   /settings/editPOSTwriter)   
annotation	directioncontent-typeapplication/jsonr$   r5   r/   r   omitr%   r&   r'   r*   r@   rA   r-   )r   r1   r2   r	   r   r   OMITr.   r3   r4   r   r   r5   r   r   r6   r/   r   r   r   r7   r   r=   r2   r   r9   r:   r;   r   r   r   updaten   sF   


zRawSettingsClient.update)__name__
__module____qualname__r   r   r3   Optionalr
   r   r   r<   strrC   r   rP   r   r   r   r   r      s*    "#
3r   c                
   @   r   )AsyncRawSettingsClientr   c                C   r   r   r   r   r   r   r   r      r   zAsyncRawSettingsClient.__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ttt| d}t	||dW S | }W n t
yG   t|jt|j|jd	w t|jt|j|d	)
a  
        Gets the default settings for voices. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app.

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

        Returns
        -------
        AsyncHttpResponse[VoiceSettings]
            Successful Response
        r!   r"   r#   Nr%   r&   r'   r*   r-   )r   r1   r2   r.   r3   r4   r   r   r5   r   r   r   r6   r/   r7   r8   r   r   r   r<      s*   z"AsyncRawSettingsClient.get_defaultr=   c             	      s   | j jjdt| dd|dI dH }z>d|j  kr dk r5n ntttt|	 d}t
||d	W S |jd
krMtt|jtttt|	 dd|	 }W n tye   t|jt|j|jdw t|jt|j|d)aS  
        Returns the settings for a specific voice. "similarity_boost" corresponds to"Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

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

        Returns
        -------
        AsyncHttpResponse[VoiceSettings]
            Successful Response
        r>   r?   r"   r#   Nr%   r&   r'   r*   r@   rA   r-   )r   r1   r2   r	   r.   r3   r4   r   r   r5   r   r   r6   r/   r   r   r   r7   rB   r   r   r   rC      s@   

zAsyncRawSettingsClient.getr2   c             	      s   | j jjdt| ddt|tddddi|tdI d	H }z>d
|j  kr*dk r?n nt	t
tt
| d}t||dW S |jdkrWtt|jt	ttt| dd| }W n tyo   t|jt|j|jdw t|jt|j|d)a  
        Edit your settings for a specific voice. "similarity_boost" corresponds to "Clarity + Similarity Enhancement" in the web app and "stability" corresponds to "Stability" slider in the web app.

        Parameters
        ----------
        voice_id : str
            ID of the voice to be used. You can use the [Get voices](/docs/api-reference/voices/search) endpoint list all the available voices.

        request : VoiceSettings

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

        Returns
        -------
        AsyncHttpResponse[EditVoiceSettingsResponseModel]
            Successful Response
        r>   rD   rE   rF   rG   rJ   rK   rL   Nr%   r&   r'   r*   r@   rA   r-   )r   r1   r2   r	   r   r   rN   r.   r3   r4   r   r   r5   r   r   r6   r/   r   r   r   r7   rO   r   r   r   rP     sH   


zAsyncRawSettingsClient.update)rQ   rR   rS   r   r   r3   rT   r
   r   r   r<   rU   rC   r   rP   r   r   r   r   rV      s4    
%
3rV   ) r3   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r   core.jsonable_encoderr	   core.request_optionsr
   core.serializationr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr   (types.edit_voice_settings_response_modelr   types.http_validation_errorr   types.voice_settingsr   r4   AnyrN   r   rV   r   r   r   r   <module>   s"    