o
    lWi#                     @   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 ddl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)jsonable_encoder)RequestOptions)construct_type)ForbiddenError)NotFoundError)TooEarlyError)UnprocessableEntityError)HttpValidationError   ).TranscriptGetTranscriptForDubRequestFormatType)%TranscriptGetTranscriptForDubResponsec                   @   P   e Zd ZdefddZddddededeje d	eje	 d
e
e f
ddZdS )RawTranscriptClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr    r   l/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/dubbing/transcript/raw_client.py__init__      
zRawTranscriptClient.__init__Nformat_typerequest_options
dubbing_idlanguage_coder"   r#   returnc             	   C   s  | j jjdt| dt| dd|i|d}zd|j  kr#dk r8n ntttt|	 d}t
||d	W S |jd
krRtt|jttjttj|	 dd|jdkrltt|jttjttj|	 dd|jdkrtt|jtttt|	 dd|jdkrtt|jttjttj|	 dd|	 }W n ty   t|jt|j|jdw t|jt|j|d)a  
        Returns transcript for the dub as an SRT or WEBVTT file.

        Parameters
        ----------
        dubbing_id : str
            ID of the dubbing project.

        language_code : str
            ID of the language.

        format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType]
            Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio.

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

        Returns
        -------
        HttpResponse[TranscriptGetTranscriptForDubResponse]
            Successful Response
        v1/dubbing//transcript/GETr"   methodparamsr#      ,  type_object_responsedata  headersbody      status_coder7   r8   )r   httpx_clientrequestr	   r=   typingcastr   r   jsonr   r   dictr7   Anyr   r   r   r   r   r   textr   r$   r%   r"   r#   	_response_data_response_jsonr   r   r   get_transcript_for_dub   s   







z*RawTranscriptClient.get_transcript_for_dub)__name__
__module____qualname__r   r   strr@   Optionalr   r
   r   r   rJ   r   r   r   r   r          r   c                   @   r   )AsyncRawTranscriptClientr   c                C   r   r   r   r   r   r   r   r   |   r    z!AsyncRawTranscriptClient.__init__Nr!   r$   r%   r"   r#   r&   c             	      s  | j jjdt| dt| dd|i|dI dH }zd|j  kr'dk r<n ntttt|	 d	}t
||d
W S |jdkrVtt|jttjttj|	 d	d|jdkrptt|jttjttj|	 d	d|jdkrtt|jtttt|	 d	d|jdkrtt|jttjttj|	 d	d|	 }W n ty   t|jt|j|jdw t|jt|j|d)a  
        Returns transcript for the dub as an SRT or WEBVTT file.

        Parameters
        ----------
        dubbing_id : str
            ID of the dubbing project.

        language_code : str
            ID of the language.

        format_type : typing.Optional[TranscriptGetTranscriptForDubRequestFormatType]
            Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio.

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

        Returns
        -------
        AsyncHttpResponse[TranscriptGetTranscriptForDubResponse]
            Successful Response
        r'   r(   r)   r"   r*   Nr-   r.   r/   r2   r5   r6   r9   r:   r;   r<   )r   r>   r?   r	   r=   r@   rA   r   r   rB   r   r   rC   r7   rD   r   r   r   r   r   r   rE   rF   r   r   r   rJ      s   







z/AsyncRawTranscriptClient.get_transcript_for_dub)rK   rL   rM   r   r   rN   r@   rO   r   r
   r   r   rJ   r   r   r   r   rQ   {   rP   rQ   )!r@   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r   core.jsonable_encoderr	   core.request_optionsr
   core.unchecked_base_modelr   errors.forbidden_errorr   errors.not_found_errorr   errors.too_early_errorr   !errors.unprocessable_entity_errorr   types.http_validation_errorr   ;types.transcript_get_transcript_for_dub_request_format_typer   0types.transcript_get_transcript_for_dub_responser   r   rQ   r   r   r   r   <module>   s"   f