o
    lWi^                     @  s   d dl mZ d dlZddl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mZ d
dlmZ d
dlmZ d
dlmZ d
dlmZ ejr[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   )core)AsyncClientWrapperSyncClientWrapper)RequestOptions)'AddPronunciationDictionaryResponseModel)1GetPronunciationDictionariesMetadataResponseModel)*GetPronunciationDictionaryMetadataResponse   )'AsyncRawPronunciationDictionariesClient"RawPronunciationDictionariesClient)SBodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem)YBodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess)=PronunciationDictionariesCreateFromFileRequestWorkspaceAccess)(PronunciationDictionariesListRequestSort)AsyncRulesClientRulesClient.c                   @     e Zd Zd9ddZed:ddZeeed	d
d;ddZeed	dd<ddZd	dd=d!d"Z	eed	d#d>d&d'Z
d	dd?d+d,Zd	d	d	d	d	d-d@d5d6Zed7d8 Zd	S )APronunciationDictionariesClientclient_wrapperr   c                C     t |d| _|| _d | _d S Nr   )r   _raw_client_client_wrapper_rulesselfr    r   p/var/www/html/asistente-voz-ia/venv/lib/python3.10/site-packages/elevenlabs/pronunciation_dictionaries/client.py__init__"      
z(PronunciationDictionariesClient.__init__returnr   c                 C     | j S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawPronunciationDictionariesClient
        r   r   r   r   r    with_raw_response'      	z1PronunciationDictionariesClient.with_raw_responseNfiledescriptionworkspace_accessrequest_optionsnamestrr*   typing.Optional[core.File]r+   typing.Optional[str]r,   Ntyping.Optional[PronunciationDictionariesCreateFromFileRequestWorkspaceAccess]r-   typing.Optional[RequestOptions]r   c                C     | j j|||||d}|jS )a_  
        Creates a new pronunciation dictionary from a lexicon .PLS file

        Parameters
        ----------
        name : str
            The name of the pronunciation dictionary, used for identification only.

        file : typing.Optional[core.File]
            See core.File for more documentation

        description : typing.Optional[str]
            A description of the pronunciation dictionary, used for identification only.

        workspace_access : typing.Optional[PronunciationDictionariesCreateFromFileRequestWorkspaceAccess]
            Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access.

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

        Returns
        -------
        AddPronunciationDictionaryResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.pronunciation_dictionaries.create_from_file(
            name="name",
        )
        r.   r*   r+   r,   r-   r   create_from_filedatar   r.   r*   r+   r,   r-   	_responser   r   r    r7   2   s   -z0PronunciationDictionariesClient.create_from_filer+   r,   r-   rulesdtyping.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem]jtyping.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess]c                C  r4   )aM  
        Creates a new pronunciation dictionary from provided rules.

        Parameters
        ----------
        rules : typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem]
            List of pronunciation rules. Rule can be either:
                an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', }
                or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' }

        name : str
            The name of the pronunciation dictionary, used for identification only.

        description : typing.Optional[str]
            A description of the pronunciation dictionary, used for identification only.

        workspace_access : typing.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess]
            Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access.

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

        Returns
        -------
        AddPronunciationDictionaryResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs
        from elevenlabs.pronunciation_dictionaries import (
            BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias,
        )

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.pronunciation_dictionaries.create_from_rules(
            rules=[
                BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias(
                    string_to_replace="Thailand",
                    alias="tie-land",
                )
            ],
            name="My Dictionary",
        )
        r<   r.   r+   r,   r-   r   create_from_rulesr8   r   r<   r.   r+   r,   r-   r:   r   r   r    rA   h   s   :z1PronunciationDictionariesClient.create_from_rulesr-   pronunciation_dictionary_idr
   c                C  s   | j j||d}|jS )a  
        Get metadata for a pronunciation dictionary

        Parameters
        ----------
        pronunciation_dictionary_id : str
            The id of the pronunciation dictionary

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

        Returns
        -------
        GetPronunciationDictionaryMetadataResponse
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.pronunciation_dictionaries.get(
            pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM",
        )
        rC   r   getr8   r   rD   r-   r:   r   r   r    rF      s   z#PronunciationDictionariesClient.getarchivedr.   r-   rI   typing.Optional[bool]c                C  s   | j j||||d}|jS )a  
        Partially update the pronunciation dictionary without changing the version

        Parameters
        ----------
        pronunciation_dictionary_id : str
            The id of the pronunciation dictionary

        archived : typing.Optional[bool]
            The name of the pronunciation dictionary, used for identification only.

        name : typing.Optional[str]
            The name of the pronunciation dictionary, used for identification only.

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

        Returns
        -------
        GetPronunciationDictionaryMetadataResponse
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.pronunciation_dictionaries.update(
            pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM",
        )
        rH   r   updater8   r   rD   rI   r.   r-   r:   r   r   r    rL      s   )z&PronunciationDictionariesClient.updatedictionary_id
version_idtyping.Iterator[bytes]c                c  sF    | j j|||d}|jE dH  W d   dS 1 sw   Y  dS )a  
        Get a PLS file with a pronunciation dictionary version rules

        Parameters
        ----------
        dictionary_id : str
            The id of the pronunciation dictionary

        version_id : str
            The id of the pronunciation dictionary version

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.Iterator[bytes]
            The PLS file containing pronunciation dictionary rules

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.pronunciation_dictionaries.download(
            dictionary_id="dictionary_id",
            version_id="version_id",
        )
        rC   Nr   downloadr8   )r   rN   rO   r-   rr   r   r    rR      s   ""z(PronunciationDictionariesClient.downloadcursor	page_sizesortsort_directionr-   rU   rV   typing.Optional[int]rW   9typing.Optional[PronunciationDictionariesListRequestSort]rX   r	   c                C  r4   )a  
        Get a list of the pronunciation dictionaries you have access to and their metadata

        Parameters
        ----------
        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

        page_size : typing.Optional[int]
            How many pronunciation dictionaries to return at maximum. Can not exceed 100, defaults to 30.

        sort : typing.Optional[PronunciationDictionariesListRequestSort]
            Which field to sort by, one of 'created_at_unix' or 'name'.

        sort_direction : typing.Optional[str]
            Which direction to sort the voices in. 'ascending' or 'descending'.

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

        Returns
        -------
        GetPronunciationDictionariesMetadataResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.pronunciation_dictionaries.list(
            cursor="cursor",
            page_size=1,
            sort="creation_time_unix",
            sort_direction="sort_direction",
        )
        rT   r   listr8   r   rU   rV   rW   rX   r-   r:   r   r   r    r\     s   0z$PronunciationDictionariesClient.listc                 C  *   | j d u rddlm} || jd| _ | j S )Nr   )r   r   )r   rules.clientr   r   )r   r   r   r   r    r<   X     
z%PronunciationDictionariesClient.rules)r   r   )r#   r   r.   r/   r*   r0   r+   r1   r,   r2   r-   r3   r#   r   r<   r=   r.   r/   r+   r1   r,   r>   r-   r3   r#   r   rD   r/   r-   r3   r#   r
   
rD   r/   rI   rJ   r.   r1   r-   r3   r#   r
   )rN   r/   rO   r/   r-   r3   r#   rP   rU   r1   rV   rY   rW   rZ   rX   r1   r-   r3   r#   r	   __name__
__module____qualname__r!   propertyr'   OMITr7   rA   rF   rL   rR   r\   r<   r   r   r   r    r   !   s:    
;D%/(9r   c                   @  r   )A$AsyncPronunciationDictionariesClientr   r   c                C  r   r   )r   r   r   r   r   r   r   r    r!   b  r"   z-AsyncPronunciationDictionariesClient.__init__r#   r   c                 C  r$   )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawPronunciationDictionariesClient
        r%   r&   r   r   r    r'   g  r(   z6AsyncPronunciationDictionariesClient.with_raw_responseNr)   r.   r/   r*   r0   r+   r1   r,   r2   r-   r3   r   c                  $   | j j|||||dI dH }|jS )a  
        Creates a new pronunciation dictionary from a lexicon .PLS file

        Parameters
        ----------
        name : str
            The name of the pronunciation dictionary, used for identification only.

        file : typing.Optional[core.File]
            See core.File for more documentation

        description : typing.Optional[str]
            A description of the pronunciation dictionary, used for identification only.

        workspace_access : typing.Optional[PronunciationDictionariesCreateFromFileRequestWorkspaceAccess]
            Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access.

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

        Returns
        -------
        AddPronunciationDictionaryResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.pronunciation_dictionaries.create_from_file(
                name="name",
            )


        asyncio.run(main())
        r5   Nr6   r9   r   r   r    r7   r  s   5z5AsyncPronunciationDictionariesClient.create_from_filer;   r<   r=   r>   c                  rm   )a  
        Creates a new pronunciation dictionary from provided rules.

        Parameters
        ----------
        rules : typing.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem]
            List of pronunciation rules. Rule can be either:
                an alias rule: {'string_to_replace': 'a', 'type': 'alias', 'alias': 'b', }
                or a phoneme rule: {'string_to_replace': 'a', 'type': 'phoneme', 'phoneme': 'b', 'alphabet': 'ipa' }

        name : str
            The name of the pronunciation dictionary, used for identification only.

        description : typing.Optional[str]
            A description of the pronunciation dictionary, used for identification only.

        workspace_access : typing.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess]
            Should be one of 'admin', 'editor' or 'viewer'. If not provided, defaults to no access.

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

        Returns
        -------
        AddPronunciationDictionaryResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs
        from elevenlabs.pronunciation_dictionaries import (
            BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias,
        )

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.pronunciation_dictionaries.create_from_rules(
                rules=[
                    BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem_Alias(
                        string_to_replace="Thailand",
                        alias="tie-land",
                    )
                ],
                name="My Dictionary",
            )


        asyncio.run(main())
        r?   Nr@   rB   r   r   r    rA     s   Bz6AsyncPronunciationDictionariesClient.create_from_rulesrC   rD   r
   c                  s   | j j||dI dH }|jS )a$  
        Get metadata for a pronunciation dictionary

        Parameters
        ----------
        pronunciation_dictionary_id : str
            The id of the pronunciation dictionary

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

        Returns
        -------
        GetPronunciationDictionaryMetadataResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.pronunciation_dictionaries.get(
                pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        rC   NrE   rG   r   r   r    rF     s   &z(AsyncPronunciationDictionariesClient.getrH   rI   rJ   c                  s"   | j j||||dI dH }|jS )a=  
        Partially update the pronunciation dictionary without changing the version

        Parameters
        ----------
        pronunciation_dictionary_id : str
            The id of the pronunciation dictionary

        archived : typing.Optional[bool]
            The name of the pronunciation dictionary, used for identification only.

        name : typing.Optional[str]
            The name of the pronunciation dictionary, used for identification only.

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

        Returns
        -------
        GetPronunciationDictionaryMetadataResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.pronunciation_dictionaries.update(
                pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        rH   NrK   rM   r   r   r    rL   $  s
   1z+AsyncPronunciationDictionariesClient.updaterN   rO   typing.AsyncIterator[bytes]c             	   C sj   | j j|||d4 I dH }|j2 z	3 dH W }|V  q6 W d  I dH  dS 1 I dH s.w   Y  dS )a  
        Get a PLS file with a pronunciation dictionary version rules

        Parameters
        ----------
        dictionary_id : str
            The id of the pronunciation dictionary

        version_id : str
            The id of the pronunciation dictionary version

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

        Returns
        -------
        typing.AsyncIterator[bytes]
            The PLS file containing pronunciation dictionary rules

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.pronunciation_dictionaries.download(
                dictionary_id="dictionary_id",
                version_id="version_id",
            )


        asyncio.run(main())
        rC   NrQ   )r   rN   rO   r-   rS   _chunkr   r   r    rR   Z  s   *.z-AsyncPronunciationDictionariesClient.downloadrT   rU   rV   rY   rW   rZ   rX   r	   c                  rm   )ad  
        Get a list of the pronunciation dictionaries you have access to and their metadata

        Parameters
        ----------
        cursor : typing.Optional[str]
            Used for fetching next page. Cursor is returned in the response.

        page_size : typing.Optional[int]
            How many pronunciation dictionaries to return at maximum. Can not exceed 100, defaults to 30.

        sort : typing.Optional[PronunciationDictionariesListRequestSort]
            Which field to sort by, one of 'created_at_unix' or 'name'.

        sort_direction : typing.Optional[str]
            Which direction to sort the voices in. 'ascending' or 'descending'.

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

        Returns
        -------
        GetPronunciationDictionariesMetadataResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.pronunciation_dictionaries.list(
                cursor="cursor",
                page_size=1,
                sort="creation_time_unix",
                sort_direction="sort_direction",
            )


        asyncio.run(main())
        rT   Nr[   r]   r   r   r    r\     s   8z)AsyncPronunciationDictionariesClient.listc                 C  r^   )Nr   )r   r   )r   r_   r   r   )r   r   r   r   r    r<     r`   z*AsyncPronunciationDictionariesClient.rules)r   r   )r#   r   ra   rb   rc   rd   )rN   r/   rO   r/   r-   r3   r#   rn   re   rf   r   r   r   r    rl   a  s:    
CL-71Arl   )$
__future__r   typing r   core.client_wrapperr   r   core.request_optionsr   1types.add_pronunciation_dictionary_response_modelr   <types.get_pronunciation_dictionaries_metadata_response_modelr	   4types.get_pronunciation_dictionary_metadata_responser
   
raw_clientr   r   gtypes.body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_rules_itemr   mtypes.body_add_a_pronunciation_dictionary_v_1_pronunciation_dictionaries_add_from_rules_post_workspace_accessr   Jtypes.pronunciation_dictionaries_create_from_file_request_workspace_accessr   2types.pronunciation_dictionaries_list_request_sortr   TYPE_CHECKINGr_   r   r   castAnyrk   r   rl   r   r   r   r    <module>   s(     B