o
    lWi                     @   s   d dl Z d dlm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 e e jdZG dd dZG dd dZdS )    N)JSONDecodeError   )core)ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)RequestOptions)construct_type)UnprocessableEntityError)AddVoiceIvcResponseModel)HttpValidationError.c                   @   p   e Zd ZdefddZeeedddedeje	j
 deje d	eje d
eje deje dee fddZdS )RawIvcClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   d/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/voices/ivc/raw_client.py__init__      
zRawIvcClient.__init__Nremove_background_noisedescriptionlabelsrequest_optionsnamefilesr   r   r   r    returnc          
   	   C   s   | j jjdd||||dd|i|tdd}z>d|j  kr!dk r6n ntttt|	 d	}t
||d
W S |jdkrNtt|jtttt|	 d	d|	 }	W n tyf   t|jt|j|jdw t|jt|j|	d)a  
        Create a voice clone and add it to your Voices

        Parameters
        ----------
        name : str
            The name that identifies this voice. This will be displayed in the dropdown of the website.

        files : typing.List[core.File]
            See core.File for more documentation

        remove_background_noise : typing.Optional[bool]
            If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse.

        description : typing.Optional[str]
            A description of the voice.

        labels : typing.Optional[str]
            Serialized labels dictionary for the voice.

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

        Returns
        -------
        HttpResponse[AddVoiceIvcResponseModel]
            Successful Response
        v1/voices/addPOSTr!   r   r   r   r"   Tmethoddatar"   r    omitforce_multipart   ,  type_object_responser)     headersbodystatus_coder5   r6   )r   httpx_clientrequestOMITr8   typingcastr   r   jsonr	   r   dictr5   r   r   r   text
r   r!   r"   r   r   r   r    	_response_data_response_jsonr   r   r   create   sP   &

zRawIvcClient.create)__name__
__module____qualname__r   r   r;   strr<   Listr   FileOptionalboolr
   r	   r   rE   r   r   r   r   r      *    
	r   c                   @   r   )AsyncRawIvcClientr   c                C   r   r   r   r   r   r   r   r   j   r   zAsyncRawIvcClient.__init__Nr   r!   r"   r   r   r   r    r#   c          
   	      s   | j jjdd||||dd|i|td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rRtt|jtttt|	 d
d|	 }	W n tyj   t|jt|j|jdw t|jt|j|	d)a  
        Create a voice clone and add it to your Voices

        Parameters
        ----------
        name : str
            The name that identifies this voice. This will be displayed in the dropdown of the website.

        files : typing.List[core.File]
            See core.File for more documentation

        remove_background_noise : typing.Optional[bool]
            If set will remove background noise for voice samples using our audio isolation model. If the samples do not include background noise, it can make the quality worse.

        description : typing.Optional[str]
            A description of the voice.

        labels : typing.Optional[str]
            Serialized labels dictionary for the voice.

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

        Returns
        -------
        AsyncHttpResponse[AddVoiceIvcResponseModel]
            Successful Response
        r$   r%   r&   r"   Tr'   Nr,   r-   r.   r1   r3   r4   r7   )r   r9   r:   r;   r8   r<   r=   r   r   r>   r   r   r?   r5   r   r   r   r@   rA   r   r   r   rE   m   sR   &

zAsyncRawIvcClient.create)rF   rG   rH   r   r   r;   rI   r<   rJ   r   rK   rL   rM   r
   r   r   rE   r   r   r   r   rO   i   rN   rO   )r<   json.decoderr    r   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.request_optionsr
   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr   "types.add_voice_ivc_response_modelr   types.http_validation_errorr   r=   Anyr;   r   rO   r   r   r   r   <module>   s   U