
    b6i[$                         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      Z G d d      Z y)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)construct_type)ForbiddenError)NotFoundError)TooEarlyError)UnprocessableEntityError)HttpValidationError   ).TranscriptGetTranscriptForDubRequestFormatType)%TranscriptGetTranscriptForDubResponsec                   v    e Zd ZdefdZddddededej                  e   dej                  e	   d	e
e   f
d
Zy)RawTranscriptClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     s/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/dubbing/transcript/raw_client.py__init__zRawTranscriptClient.__init__   
    -    Nformat_typerequest_options
dubbing_idlanguage_coder#   r$   returnc                   | j                   j                  j                  dt        |       dt        |       dd|i|      }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||	      S |j                  d
k(  rit        t        |j                        t        j                  t
        j                  t        t
        j                  |j                                           |j                  dk(  rit        t        |j                        t        j                  t
        j                  t        t
        j                  |j                                           |j                  dk(  rUt!        t        |j                        t        j                  t"        t        t"        |j                                           |j                  dk(  rit%        t        |j                        t        j                  t
        j                  t        t
        j                  |j                                           |j                         }t)        |j                  t        |j                        |      # t&        $ r6 t)        |j                  t        |j                        |j*                        w xY w)a@  
        Returns transcript for the dub as an SRT or WEBVTT file.

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

        language_code : str
            ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media.

        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_coder9   r:   )r   httpx_clientrequestr
   r?   typingcastr   r   jsonr	   r   dictr9   Anyr   r   r   r   r   r   textr   r%   r&   r#   r$   	_response_data_response_jsons           r   get_transcript_for_dubz*RawTranscriptClient.get_transcript_for_dub   sa   < ((55==*:67|DTUbDcCde{ , > 
	8	ti++1c19"C ) 0 $YUCC$$+$ !2!23

&"(**$-NN$4	 	 $$+# !2!23

&"(**$-NN$4	 	 $$+. !2!23+&"5$-NN$4	 	 $$+# !2!23

&"(**$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AJ( !GJ( (?K')__name__
__module____qualname__r   r   strrB   Optionalr   r   r	   r   rL    r!   r   r   r      ss    .*; . X\;?_p_p _p
 __%ST_p  8_p 
;	<_pr!   r   c                   v    e Zd ZdefdZddddededej                  e   dej                  e	   d	e
e   f
d
Zy)AsyncRawTranscriptClientr   c                    || _         y r   r   r   s     r   r   z!AsyncRawTranscriptClient.__init__|   r    r!   Nr"   r%   r&   r#   r$   r'   c                  K   | j                   j                  j                  dt        |       dt        |       dd|i|       d{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                         	            }t        ||
      S |j                  dk(  rit        t        |j                        t        j                  t
        j                  t        t
        j                  |j                         	                  |j                  dk(  rit        t        |j                        t        j                  t
        j                  t        t
        j                  |j                         	                  |j                  dk(  rUt!        t        |j                        t        j                  t"        t        t"        |j                         	                  |j                  dk(  rit%        t        |j                        t        j                  t
        j                  t        t
        j                  |j                         	                  |j                         }t)        |j                  t        |j                        |      7 i# t&        $ r6 t)        |j                  t        |j                        |j*                        w xY ww)aE  
        Returns transcript for the dub as an SRT or WEBVTT file.

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

        language_code : str
            ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media.

        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/   r0   r1   r4   r7   r8   r;   r<   r=   r>   )r   r@   rA   r
   r?   rB   rC   r   r   rD   r   r   rE   r9   rF   r   r   r   r   r   r   rG   rH   s           r   rL   z/AsyncRawTranscriptClient.get_transcript_for_dub   sq    < ..;;CC*:67|DTUbDcCde{ , D 
 
	8	ti++1c19"C ) 0 ))%HH$$+$ !2!23

&"(**$-NN$4	 	 $$+# !2!23

&"(**$-NN$4	 	 $$+. !2!23+&"5$-NN$4	 	 $$+# !2!23

&"(**$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooC
~  	ty'<'<d9K\K\F]dmdrdrss	ts8   AK7	J2
K7AJ5 *K7+GJ5 ,K75?K44K7)rM   rN   rO   r   r   rP   rB   rQ   r   r   r   r   rL   rR   r!   r   rT   rT   {   ss    .*< . X\;?_p_p _p
 __%ST_p  8_p 
@	A_pr!   rT   )!rB   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   rT   rR   r!   r   <module>re      sQ     ( & H A 5 2 7 4 3 3 I > w ccp cpLcp cpr!   