o
    lWiR                     @  s  d dl mZ d dl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mZ ddlmZ ejrkddlmZmZ ddlm Z m!Z! ddl"m#Z#m$Z$ e%ej&dZ'G dd dZ(G dd dZ)dS )    )annotationsN   )AsyncClientWrapperSyncClientWrapper)RequestOptions)DubbingRenderResponseModel)DubbingResource)
RenderType)SegmentDubResponse)SegmentMigrationResponse)SegmentTranscriptionResponse)SegmentTranslationResponse   )AsyncRawResourceClientRawResourceClient)ResourceRenderRequestLanguage)AsyncLanguageClientLanguageClient)AsyncSegmentClientSegmentClient)AsyncSpeakerClientSpeakerClient.c                   @     e Zd Zd5ddZed6ddZd	d
d7ddZd	d
d8ddZd	d
d9ddZe	d	dd:d d!Z
e	d	dd;d#d$Ze	d	d%d<d-d.Zed/d0 Zed1d2 Zed3d4 Zd	S )=ResourceClientclient_wrapperr   c                C  (   t |d| _|| _d | _d | _d | _d S Nr   )r   _raw_client_client_wrapper	_language_segment_speakerselfr    r%   f/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/dubbing/resource/client.py__init__   
   
zResourceClient.__init__returnr   c                 C     | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawResourceClient
        r   r$   r%   r%   r&   with_raw_response#      	z ResourceClient.with_raw_responseNrequest_options
dubbing_idstrr0   typing.Optional[RequestOptions]r   c                C  s   | j j||d}|jS )a  
        Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource.

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

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

        Returns
        -------
        DubbingResource
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.resource.get(
            dubbing_id="dubbing_id",
        )
        r/   r   getdatar$   r1   r0   	_responser%   r%   r&   r5   .   s   zResourceClient.getsegment_idstyping.Sequence[str]
speaker_idr   c                C     | j j||||d}|jS )a  
        Change the attribution of one or more segments to a different speaker.

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

        segment_ids : typing.Sequence[str]

        speaker_id : str

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

        Returns
        -------
        SegmentMigrationResponse
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.resource.migrate_segments(
            dubbing_id="dubbing_id",
            segment_ids=["segment_ids"],
            speaker_id="speaker_id",
        )
        r9   r;   r0   r   migrate_segmentsr6   r$   r1   r9   r;   r0   r8   r%   r%   r&   r?   M   s   )zResourceClient.migrate_segmentssegmentsr   c                C  s   | j j|||d}|jS )a.  
        Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs.

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

        segments : typing.Sequence[str]
            Transcribe this specific list of segments.

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

        Returns
        -------
        SegmentTranscriptionResponse
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.resource.transcribe(
            dubbing_id="dubbing_id",
            segments=["segments"],
        )
        rA   r0   r   
transcriber6   r$   r1   rA   r0   r8   r%   r%   r&   rD   {   s   &zResourceClient.transcribe	languagesr0   rG   %typing.Optional[typing.Sequence[str]]r   c                C  r<   )a  
        Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs.

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

        segments : typing.Sequence[str]
            Translate only this list of segments.

        languages : typing.Optional[typing.Sequence[str]]
            Translate only these languages for each segment.

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

        Returns
        -------
        SegmentTranslationResponse
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.resource.translate(
            dubbing_id="dubbing_id",
            segments=["segments"],
        )
        rA   rG   r0   r   	translater6   r$   r1   rA   rG   r0   r8   r%   r%   r&   rK         *zResourceClient.translater
   c                C  r<   )a  
        Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations.

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

        segments : typing.Sequence[str]
            Dub only this list of segments.

        languages : typing.Optional[typing.Sequence[str]]
            Dub only these languages for each segment.

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

        Returns
        -------
        SegmentDubResponse
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.resource.dub(
            dubbing_id="dubbing_id",
            segments=["segments"],
        )
        rI   r   dubr6   rL   r%   r%   r&   rO      rM   zResourceClient.dubnormalize_volumer0   languager   render_typer	   rQ   typing.Optional[bool]r   c                C  s   | j j|||||d}|jS )a0  
        Regenerate the output media for a language using the latest Studio state. Please ensure all segments have been dubbed before rendering, otherwise they will be omitted. Renders are generated asynchronously, and to check the status of all renders please use the 'Get Dubbing Resource' endpoint.

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

        language : ResourceRenderRequestLanguage
            The target language code to render, eg. 'es'. To render the source track use 'original'.

        render_type : RenderType
            The type of the render. One of ['mp4', 'aac', 'mp3', 'wav', 'aaf', 'tracks_zip', 'clips_zip']

        normalize_volume : typing.Optional[bool]
            Whether to normalize the volume of the rendered audio.

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

        Returns
        -------
        DubbingRenderResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.resource.render(
            dubbing_id="dubbing_id",
            language="original",
            render_type="mp4",
        )
        rS   rQ   r0   r   renderr6   r$   r1   rR   rS   rQ   r0   r8   r%   r%   r&   rW     s   /zResourceClient.renderc                 C  *   | j d u rddlm} || jd| _ | j S )Nr   )r   r   )r    language.clientr   r   )r$   r   r%   r%   r&   rR   :     
zResourceClient.languagec                 C  rY   )Nr   )r   r   )r!   segment.clientr   r   )r$   r   r%   r%   r&   segmentB  r[   zResourceClient.segmentc                 C  rY   )Nr   )r   r   )r"   speaker.clientr   r   )r$   r   r%   r%   r&   speakerJ  r[   zResourceClient.speaker)r   r   )r)   r   r1   r2   r0   r3   r)   r   
r1   r2   r9   r:   r;   r2   r0   r3   r)   r   r1   r2   rA   r:   r0   r3   r)   r   
r1   r2   rA   r:   rG   rH   r0   r3   r)   r   
r1   r2   rA   r:   rG   rH   r0   r3   r)   r
   r1   r2   rR   r   rS   r	   rQ   rT   r0   r3   r)   r   __name__
__module____qualname__r'   propertyr-   r5   r?   rD   OMITrK   rO   rW   rR   r]   r_   r%   r%   r%   r&   r      s0    

%3.458

r   c                   @  r   )=AsyncResourceClientr   r   c                C  r   r   )r   r   r   r    r!   r"   r#   r%   r%   r&   r'   T  r(   zAsyncResourceClient.__init__r)   r   c                 C  r*   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawResourceClient
        r+   r,   r%   r%   r&   r-   [  r.   z%AsyncResourceClient.with_raw_responseNr/   r1   r2   r0   r3   r   c                  s   | j j||dI dH }|jS )a  
        Given a dubbing ID generated from the '/v1/dubbing' endpoint with studio enabled, returns the dubbing resource.

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

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

        Returns
        -------
        DubbingResource
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.resource.get(
                dubbing_id="dubbing_id",
            )


        asyncio.run(main())
        r/   Nr4   r7   r%   r%   r&   r5   f  s   $zAsyncResourceClient.getr9   r:   r;   r   c                  "   | j j||||dI dH }|jS )a  
        Change the attribution of one or more segments to a different speaker.

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

        segment_ids : typing.Sequence[str]

        speaker_id : str

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

        Returns
        -------
        SegmentMigrationResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.resource.migrate_segments(
                dubbing_id="dubbing_id",
                segment_ids=["segment_ids"],
                speaker_id="speaker_id",
            )


        asyncio.run(main())
        r=   Nr>   r@   r%   r%   r&   r?     s
   1z$AsyncResourceClient.migrate_segmentsrA   r   c                  s    | j j|||dI dH }|jS )a  
        Regenerate the transcriptions for the specified segments. Does not automatically regenerate translations or dubs.

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

        segments : typing.Sequence[str]
            Transcribe this specific list of segments.

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

        Returns
        -------
        SegmentTranscriptionResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.resource.transcribe(
                dubbing_id="dubbing_id",
                segments=["segments"],
            )


        asyncio.run(main())
        rB   NrC   rE   r%   r%   r&   rD     s   .zAsyncResourceClient.transcriberF   rG   rH   r   c                  rm   )ah  
        Regenerate the translations for either the entire resource or the specified segments/languages. Will automatically transcribe missing transcriptions. Will not automatically regenerate the dubs.

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

        segments : typing.Sequence[str]
            Translate only this list of segments.

        languages : typing.Optional[typing.Sequence[str]]
            Translate only these languages for each segment.

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

        Returns
        -------
        SegmentTranslationResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.resource.translate(
                dubbing_id="dubbing_id",
                segments=["segments"],
            )


        asyncio.run(main())
        rI   NrJ   rL   r%   r%   r&   rK     
   2zAsyncResourceClient.translater
   c                  rm   )a=  
        Regenerate the dubs for either the entire resource or the specified segments/languages. Will automatically transcribe and translate any missing transcriptions and translations.

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

        segments : typing.Sequence[str]
            Dub only this list of segments.

        languages : typing.Optional[typing.Sequence[str]]
            Dub only these languages for each segment.

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

        Returns
        -------
        SegmentDubResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.resource.dub(
                dubbing_id="dubbing_id",
                segments=["segments"],
            )


        asyncio.run(main())
        rI   NrN   rL   r%   r%   r&   rO   +  rn   zAsyncResourceClient.dubrP   rR   r   rS   r	   rQ   rT   r   c                  s$   | j j|||||dI dH }|jS )a  
        Regenerate the output media for a language using the latest Studio state. Please ensure all segments have been dubbed before rendering, otherwise they will be omitted. Renders are generated asynchronously, and to check the status of all renders please use the 'Get Dubbing Resource' endpoint.

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

        language : ResourceRenderRequestLanguage
            The target language code to render, eg. 'es'. To render the source track use 'original'.

        render_type : RenderType
            The type of the render. One of ['mp4', 'aac', 'mp3', 'wav', 'aaf', 'tracks_zip', 'clips_zip']

        normalize_volume : typing.Optional[bool]
            Whether to normalize the volume of the rendered audio.

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

        Returns
        -------
        DubbingRenderResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.resource.render(
                dubbing_id="dubbing_id",
                language="original",
                render_type="mp4",
            )


        asyncio.run(main())
        rU   NrV   rX   r%   r%   r&   rW   b  s   7zAsyncResourceClient.renderc                 C  rY   )Nr   )r   r   )r    rZ   r   r   )r$   r   r%   r%   r&   rR     r[   zAsyncResourceClient.languagec                 C  rY   )Nr   )r   r   )r!   r\   r   r   )r$   r   r%   r%   r&   r]     r[   zAsyncResourceClient.segmentc                 C  rY   )Nr   )r   r   )r"   r^   r   r   )r$   r   r%   r%   r&   r_     r[   zAsyncResourceClient.speaker)r   r   )r)   r   r`   ra   rb   rc   rd   re   rf   r%   r%   r%   r&   rl   S  s0    

-;6<=@

rl   )*
__future__r   typingcore.client_wrapperr   r   core.request_optionsr   #types.dubbing_render_response_modelr   types.dubbing_resourcer   types.render_typer	   types.segment_dub_responser
    types.segment_migration_responser   $types.segment_transcription_responser   "types.segment_translation_responser   
raw_clientr   r   &types.resource_render_request_languager   TYPE_CHECKINGrZ   r   r   r\   r   r   r^   r   r   castAnyrk   r   rl   r%   r%   r%   r&   <module>   s,     :