
    b6ij_                    :   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 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jB                  ejD                  d      Z# G d d      Z$ G d d      Z%y)    )annotationsN   )core)AsyncClientWrapperSyncClientWrapper)RequestOptions)'AddPronunciationDictionaryResponseModel)1GetPronunciationDictionariesMetadataResponseModel)*GetPronunciationDictionaryMetadataResponse)0GetPronunciationDictionaryWithRulesResponseModel   )'AsyncRawPronunciationDictionariesClient"RawPronunciationDictionariesClient)SBodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem)YBodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess)=PronunciationDictionariesCreateFromFileRequestWorkspaceAccess)(PronunciationDictionariesListRequestSort)AsyncRulesClientRulesClient.c                     e Zd ZddZedd       Zeeedd	 	 	 	 	 	 	 	 	 	 	 ddZeedd	 	 	 	 	 	 	 	 	 	 	 ddZdd	 	 	 	 	 dd	Z	eedd
	 	 	 	 	 	 	 	 	 ddZ
dd	 	 	 	 	 	 	 ddZdddddd	 	 	 	 	 	 	 	 	 	 	 ddZed        Zy)PronunciationDictionariesClientc               B    t        |      | _        || _        d | _        y Nclient_wrapper)r   _raw_client_client_wrapper_rulesselfr   s     w/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/pronunciation_dictionaries/client.py__init__z(PronunciationDictionariesClient.__init__%   s    =^\-48    c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawPronunciationDictionariesClient
        r   r    s    r!   with_raw_responsez1PronunciationDictionariesClient.with_raw_response*        r#   Nfiledescriptionworkspace_accessrequest_optionsc               Z    | j                   j                  |||||      }|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",
        )
        namer*   r+   r,   r-   r   create_from_filedatar    r0   r*   r+   r,   r-   	_responses          r!   r2   z0PronunciationDictionariesClient.create_from_file5   s;    Z $$55#-+ 6 
	 ~~r#   r+   r,   r-   c               Z    | j                   j                  |||||      }|j                  S )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",
        )
        rulesr0   r+   r,   r-   r   create_from_rulesr3   r    r9   r0   r+   r,   r-   r5   s          r!   r;   z1PronunciationDictionariesClient.create_from_rulesk   s;    t $$66#-+ 7 
	 ~~r#   r-   c               T    | j                   j                  ||      }|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
        -------
        GetPronunciationDictionaryWithRulesResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.pronunciation_dictionaries.get(
            pronunciation_dictionary_id="21m00Tcm4TlvDq8ikWAM",
        )
        r=   r   getr3   r    pronunciation_dictionary_idr-   r5   s       r!   r@   z#PronunciationDictionariesClient.get   s+    < $$(()DVe(f	~~r#   archivedr0   r-   c               X    | j                   j                  ||||      }|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]
            Whether to archive the pronunciation dictionary.

        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",
        )
        rC   r   updater3   r    rB   rD   r0   r-   r5   s         r!   rG   z&PronunciationDictionariesClient.update   s6    R $$++'(Wf , 
	 ~~r#   c             #     K   | j                   j                  |||      5 }|j                  E d{    ddd       y7 # 1 sw Y   yxY ww)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",
        )
        r=   Nr   downloadr3   )r    dictionary_id
version_idr-   rs        r!   rK   z(PronunciationDictionariesClient.download   sR     D &&}jRa&b 	fgvv	 		 	s)   AA?A	AAA
Acursor	page_sizesortsort_directionr-   c               Z    | j                   j                  |||||      }|j                  S )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",
        )
        rO   r   listr3   r    rP   rQ   rR   rS   r-   r5   s          r!   rV   z$PronunciationDictionariesClient.list"  s;    ` $$)))+ * 
	 ~~r#   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r   rules.clientr   r   )r    r   s     r!   r9   z%PronunciationDictionariesClient.rules[  s+    ;;1%T5I5IJDK{{r#   )r   r   )returnr   r0   strr*   ztyping.Optional[core.File]r+   typing.Optional[str]r,   zNtyping.Optional[PronunciationDictionariesCreateFromFileRequestWorkspaceAccess]r-   typing.Optional[RequestOptions]rZ   r	   r9   zdtyping.Sequence[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostRulesItem]r0   r\   r+   r]   r,   zjtyping.Optional[BodyAddAPronunciationDictionaryV1PronunciationDictionariesAddFromRulesPostWorkspaceAccess]r-   r^   rZ   r	   rB   r\   r-   r^   rZ   r   
rB   r\   rD   ztyping.Optional[bool]r0   r]   r-   r^   rZ   r   )rL   r\   rM   r\   r-   r^   rZ   ztyping.Iterator[bytes]rP   r]   rQ   ztyping.Optional[int]rR   z9typing.Optional[PronunciationDictionariesListRequestSort]rS   r]   r-   r^   rZ   r
   __name__
__module____qualname__r"   propertyr'   OMITr2   r;   r@   rG   rK   rV   r9    r#   r!   r   r   $   s   9
     ,0,0ko;?4 4 )	4
 *4 i4 94 
14v -1 ;?A tA 	A
 *A
A 9A 
1AH gk+.Dc	9J +/%);?,%(, (	,
 #, 9, 
4,^ jn# #.1#Gf#	#P (,*.JN/3;?7 %7 (	7
 H7 -7 97 
;7r  r#   r   c                     e Zd ZddZedd       Zeeedd	 	 	 	 	 	 	 	 	 	 	 ddZeedd	 	 	 	 	 	 	 	 	 	 	 ddZdd	 	 	 	 	 dd	Z	eedd
	 	 	 	 	 	 	 	 	 ddZ
dd	 	 	 	 	 	 	 ddZdddddd	 	 	 	 	 	 	 	 	 	 	 ddZed        Zy)$AsyncPronunciationDictionariesClientc               B    t        |      | _        || _        d | _        y r   )r   r   r   r   r   s     r!   r"   z-AsyncPronunciationDictionariesClient.__init__e  s    BR`a-9=r#   c                    | j                   S )z
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawPronunciationDictionariesClient
        r%   r&   s    r!   r'   z6AsyncPronunciationDictionariesClient.with_raw_responsej  r(   r#   Nr)   c               v   K   | j                   j                  |||||       d{   }|j                  S 7 w)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())
        r/   Nr1   r4   s          r!   r2   z5AsyncPronunciationDictionariesClient.create_from_fileu  sI     j **;;#-+ < 
 
	 ~~
   $979r6   c               v   K   | j                   j                  |||||       d{   }|j                  S 7 w)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())
        r8   Nr:   r<   s          r!   r;   z6AsyncPronunciationDictionariesClient.create_from_rules  sI     D **<<#-+ = 
 
	 ~~
ro   r=   c               p   K   | j                   j                  ||       d{   }|j                  S 7 w)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
        -------
        GetPronunciationDictionaryWithRulesResponseModel
            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())
        r=   Nr?   rA   s       r!   r@   z(AsyncPronunciationDictionariesClient.get  s9     L **../J\k.ll	~~ ms   !646rC   c               t   K   | j                   j                  ||||       d{   }|j                  S 7 w)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]
            Whether to archive the pronunciation dictionary.

        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())
        rC   NrF   rH   s         r!   rG   z+AsyncPronunciationDictionariesClient.update'  sD     b **11'(Wf 2 
 
	 ~~
s   #868c                 K   | j                   j                  |||      4 d{   }|j                  2 3 d{   }| 7 7 6 ddd      d{  7   y# 1 d{  7  sw Y   yxY ww)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())
        r=   NrJ   )r    rL   rM   r-   rN   _chunks         r!   rK   z-AsyncPronunciationDictionariesClient.download]  sq     T ##,,]JXg,h 	 	lm !  f		 	 	 	 	sd   #A1AA1AA	AA	AA1A		A
A1AA1A."A%#A.*A1rO   c               v   K   | j                   j                  |||||       d{   }|j                  S 7 w)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())
        rO   NrU   rW   s          r!   rV   z)AsyncPronunciationDictionariesClient.list  sI     p **//)+ 0 
 
	 ~~
ro   c                n    | j                   ddlm}  || j                        | _         | j                   S )Nr   )r   r   )r   rY   r   r   )r    r   s     r!   r9   z*AsyncPronunciationDictionariesClient.rules  s+    ;;6*$:N:NODK{{r#   )r   r   )rZ   r   r[   r_   r`   ra   )rL   r\   rM   r\   r-   r^   rZ   ztyping.AsyncIterator[bytes]rb   rc   ri   r#   r!   rk   rk   d  s   >
     ,0,0ko;?< < )	<
 *< i< 9< 
1<F -1 ;?I tI 	I
 *I
I 9I 
1IX gk'+.'Dc'	9'Z +/%);?4%(4 (	4
 #4 94 
44n jn, ,.1,Gf,	$,b (,*.JN/3;?? %? (	?
 H? -? 9? 
;?B  r#   rk   )&
__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   <types.get_pronunciation_dictionary_with_rules_response_modelr   
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_CHECKINGrY   r   r   castAnyrh   r   rk   ri   r#   r!   <module>r      s    #   G 1 g n d i	;v{{6::s#} }@
n nr#   