
    b6i5                         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  G d d      Z G d d      Zy)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)construct_type)UnprocessableEntityError)DubbingTranscriptsResponseModel)HttpValidationError   )TranscriptsGetRequestFormatTypec                   Z    e Zd ZdefdZdddedededej                  e	   d	e
e   f
d
Zy)RawTranscriptsClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     t/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/dubbing/transcripts/raw_client.py__init__zRawTranscriptsClient.__init__   
    -    Nrequest_options
dubbing_idlanguage_codeformat_typer    returnc                   | j                   j                  j                  dt        |       dt        |       dt        |       d|      }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                                     }t        ||	      S |j                  d
k(  rUt        t        |j                        t        j                  t        t        t        |j                                           |j                         }t!        |j                  t        |j                        |      # t        $ r6 t!        |j                  t        |j                        |j"                        w xY w)a  
        Fetch the transcript for one of the languages in a dub.

        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 : TranscriptsGetRequestFormatType
            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[DubbingTranscriptsResponseModel]
            Successful Response
        v1/dubbing//transcripts//format/GETmethodr       ,  type_object_responsedata  headersbodystatus_coder6   r7   )r   httpx_clientrequestr
   r9   typingcastr   r   jsonr	   r   dictr6   r   r   r   textr   r!   r"   r#   r    	_response_data_response_jsons           r   getzRawTranscriptsClient.get   sn   < ((55==*:67}EUVcEdDeemn~  @K  oL  nM  N+ > 
	
	ti++1c13"= ) 0 $YUCC$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo  	ty'<'<d9K\K\F]dmdrdrss	ts   AE	 *A4E	 	?F)__name__
__module____qualname__r   r   strr   r<   Optionalr   r	   r   rE    r   r   r   r      s_    .*; . <@;p;p ;p 5	;p  8;p 
5	6;pr   r   c                   Z    e Zd ZdefdZdddedededej                  e	   d	e
e   f
d
Zy)AsyncRawTranscriptsClientr   c                    || _         y r   r   r   s     r   r   z"AsyncRawTranscriptsClient.__init__U   r   r   Nr   r!   r"   r#   r    r$   c                4  K   | j                   j                  j                  dt        |       dt        |       dt        |       d|       d{   }	 d|j                  cxk  rdk  rGn nDt        j                  t        t        t        |j                         	            }t        ||
      S |j                  dk(  rUt        t        |j                        t        j                  t        t        t        |j                         	                  |j                         }t!        |j                  t        |j                        |      7 # t        $ r6 t!        |j                  t        |j                        |j"                        w xY ww)a  
        Fetch the transcript for one of the languages in a dub.

        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 : TranscriptsGetRequestFormatType
            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[DubbingTranscriptsResponseModel]
            Successful Response
        r&   r'   r(   r)   r*   Nr,   r-   r.   r1   r4   r5   r8   )r   r:   r;   r
   r9   r<   r=   r   r   r>   r   r   r?   r6   r   r   r   r@   rA   s           r   rE   zAsyncRawTranscriptsClient.getX   s|    < ..;;CC*:67}EUVcEdDeemn~  @K  oL  nM  N+ D 
 
	
	ti++1c13"= ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo;
6  	ty'<'<d9K\K\F]dmdrdrss	ts8   AFEFAE 3F4A4E (,F?FF)rF   rG   rH   r   r   rI   r   r<   rJ   r   r   r   rE   rK   r   r   rM   rM   T   s_    .*< . <@;p;p ;p 5	;p  8;p 
:	;;pr   rM   )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.unprocessable_entity_errorr   (types.dubbing_transcripts_response_modelr   types.http_validation_errorr   )types.transcripts_get_request_format_typer   r   rM   rK   r   r   <module>r[      sD     ( & H A 5 2 7 I W > V?p ?pD?p ?pr   