
    >|hR                     
   d dl 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 ddlmZ ddlmZ ddlmZ  e j4                  e j6                  d      Z G d d      Z G d d      Zy)    N   )SyncClientWrapper)core)RequestOptions)%AudioNativeCreateProjectResponseModel)construct_type)UnprocessableEntityError)HttpValidationError)JSONDecodeError)ApiError)*GetAudioNativeProjectSettingsResponseModel)jsonable_encoder)#AudioNativeEditContentResponseModel)AsyncClientWrapper.c                      e Zd ZdefdZeeeeeeeeeeedddedej                  e   dej                  e   dej                  e   d	ej                  e	   d
ej                  e   dej                  e   dej                  e
   dej                  e   dej                  e   dej                  ej                     dej                  e	   dej                  e   defdZdddedej                  e   defdZeeedddedej                  ej                     dej                  e	   dej                  e	   dej                  e   defdZy)AudioNativeClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     ]/var/www/html/test/engine/venv/lib/python3.12/site-packages/elevenlabs/audio_native/client.py__init__zAudioNativeClient.__init__   
    -    Nimageauthortitlesmall
text_colorbackground_colorsessionizationvoice_idmodel_idfileauto_convertrequest_optionsnamer   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   returnc                d   | j                   j                  j                  dd|||||||||	|
|dd|i|t              }	 d|j                  cxk  rdk  r:n n7t        j                  t        t        t        |j                                     S |j                  d	k(  r@t        t        j                  t        t        t        |j                                           |j                         }t        |j                  |
      # t        $ r" t        |j                  |j                  
      w xY w)a	  
        Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet.

        Parameters
        ----------
        name : str
            Project name.

        image : typing.Optional[str]
            (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used.

        author : typing.Optional[str]
            Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used.

        title : typing.Optional[str]
            Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used.

        small : typing.Optional[bool]
            (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used.

        text_color : typing.Optional[str]
            Text color used in the player. If not provided, default text color set in the Player settings is used.

        background_color : typing.Optional[str]
            Background color used in the player. If not provided, default background color set in the Player settings is used.

        sessionization : typing.Optional[int]
            (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used.

        voice_id : typing.Optional[str]
            Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used.

        model_id : typing.Optional[str]
            TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used.

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

        auto_convert : typing.Optional[bool]
            Whether to auto convert the project to audio or not.

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

        Returns
        -------
        AudioNativeCreateProjectResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.audio_native.create(
            name="name",
        )
        v1/audio-nativePOSTr+   r   r    r!   r"   r#   r$   r%   r&   r'   r)   r(   methoddatafilesr*   omit   ,  type_object_  status_codebodyr   httpx_clientrequestOMITr=   typingcastr   r   jsonr	   r
   r   r   textr   r+   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   	_response_response_jsons                   r   createzAudioNativeClient.create   s6   Z ((55== ($4"0$$ ,  ,) > 
	,	Si++1c1{{9"C ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AD AD +D/r*   
project_idc          
      T   | j                   j                  j                  dt        |       dd|      }	 d|j                  cxk  rdk  r:n n7t        j                  t        t        t        |j                                     S |j                  dk(  r@t        t        j                  t        t        t        |j                                           |j                         }t        |j                  |	      # t        $ r" t        |j                  |j                  	      w xY w)
a  
        Get player settings for the specific project.

        Parameters
        ----------
        project_id : str
            The ID of the Studio project.

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

        Returns
        -------
        GetAudioNativeProjectSettingsResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.audio_native.get_settings(
            project_id="21m00Tcm4TlvDq8ikWAM",
        )
        v1/audio-native/	/settingsGETr2   r*   r6   r7   r8   r;   r<   r   r@   rA   r   r=   rC   rD   r   r   rE   r	   r
   r   r   rF   r   rL   r*   rH   rI   s        r   get_settingszAudioNativeClient.get_settings   s   < ((55==/
;<IF+ > 
	
	Si++1c1{{>"H ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AC< AC< <+D'r(   r)   auto_publishr*   rV   c          
      l   | j                   j                  j                  dt        |       dd||dd|i|t              }	 d|j
                  cxk  rdk  r:n n7t        j                  t        t        t        |j                         	            S |j
                  d
k(  r@t        t        j                  t        t        t        |j                         	                  |j                         }t        |j
                  |      # t        $ r" t        |j
                  |j                        w xY w)a  
        Updates content for the specific AudioNative Project.

        Parameters
        ----------
        project_id : str
            The ID of the Studio project.

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

        auto_convert : typing.Optional[bool]
            Whether to auto convert the project to audio or not.

        auto_publish : typing.Optional[bool]
            Whether to auto publish the new project snapshot after it's converted.

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

        Returns
        -------
        AudioNativeEditContentResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.audio_native.update_content(
            project_id="21m00Tcm4TlvDq8ikWAM",
        )
        rN   /contentr/   r)   rV   r(   r1   r6   r7   r8   r;   r<   r   r@   rA   r   rB   r=   rC   rD   r   r   rE   r	   r
   r   r   rF   r   rL   r(   r)   rV   r*   rH   rI   s           r   update_contentz AudioNativeClient.update_content   s+   Z ((55==/
;<HE , ,
  , > 
		Si++1c1{{7"A ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AD AD +D3)__name__
__module____qualname__r   r   rB   strrC   Optionalboolintr   Filer   r   rJ   r   rT   r   r\    r   r   r   r      s
   .*; . '+'+&*'++/15/3)-)-+/.2;?yO yO s#	yO
 $yO s#yO t$yO OOC(yO !//#.yO ,yO //#&yO //#&yO oodii(yO ood+yO  8yO  
/!yOx VZ9O9O39??>3R9O	39O~ ,0.2.2;?POPO oodii(	PO
 ood+PO ood+PO  8PO 
-POr   r   c                      e Zd ZdefdZeeeeeeeeeeedddedej                  e   dej                  e   dej                  e   d	ej                  e	   d
ej                  e   dej                  e   dej                  e
   dej                  e   dej                  e   dej                  ej                     dej                  e	   dej                  e   defdZdddedej                  e   defdZeeedddedej                  ej                     dej                  e	   dej                  e	   dej                  e   defdZy)AsyncAudioNativeClientr   c                    || _         y r   r   r   s     r   r   zAsyncAudioNativeClient.__init__$  r   r   Nr   r+   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r,   c                  K   | j                   j                  j                  dd|||||||||	|
|dd|i|t               d{   }	 d|j                  cxk  rdk  r:n n7t        j                  t        t        t        |j                         	            S |j                  d
k(  r@t        t        j                  t        t        t        |j                         	                  |j                         }t        |j                  |      7 # t        $ r" t        |j                  |j                        w xY ww)a
  
        Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet.

        Parameters
        ----------
        name : str
            Project name.

        image : typing.Optional[str]
            (Deprecated) Image URL used in the player. If not provided, default image set in the Player settings is used.

        author : typing.Optional[str]
            Author used in the player and inserted at the start of the uploaded article. If not provided, the default author set in the Player settings is used.

        title : typing.Optional[str]
            Title used in the player and inserted at the top of the uploaded article. If not provided, the default title set in the Player settings is used.

        small : typing.Optional[bool]
            (Deprecated) Whether to use small player or not. If not provided, default value set in the Player settings is used.

        text_color : typing.Optional[str]
            Text color used in the player. If not provided, default text color set in the Player settings is used.

        background_color : typing.Optional[str]
            Background color used in the player. If not provided, default background color set in the Player settings is used.

        sessionization : typing.Optional[int]
            (Deprecated) Specifies for how many minutes to persist the session across page reloads. If not provided, default sessionization set in the Player settings is used.

        voice_id : typing.Optional[str]
            Voice ID used to voice the content. If not provided, default voice ID set in the Player settings is used.

        model_id : typing.Optional[str]
            TTS Model ID used in the player. If not provided, default model ID set in the Player settings is used.

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

        auto_convert : typing.Optional[bool]
            Whether to auto convert the project to audio or not.

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

        Returns
        -------
        AudioNativeCreateProjectResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


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


        asyncio.run(main())
        r.   r/   r0   r(   r1   Nr6   r7   r8   r;   r<   r?   rG   s                   r   rJ   zAsyncAudioNativeClient.create'  sF    j ..;;CC ($4"0$$ ,  ,) D 
 
	,	Si++1c1{{9"C ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NNY
T  	Sy'<'<9>>RR	Ss8   AD>DD>	AD D>AD 7D>+D;;D>rK   rL   c          
      p  K   | j                   j                  j                  dt        |       dd|       d{   }	 d|j                  cxk  rdk  r:n n7t        j                  t        t        t        |j                                     S |j                  d	k(  r@t        t        j                  t        t        t        |j                                           |j                         }t        |j                  |
      7 # t        $ r" t        |j                  |j                  
      w xY ww)a  
        Get player settings for the specific project.

        Parameters
        ----------
        project_id : str
            The ID of the Studio project.

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

        Returns
        -------
        GetAudioNativeProjectSettingsResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.audio_native.get_settings(
                project_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        rN   rO   rP   rQ   Nr6   r7   r8   r;   r<   rR   rS   s        r   rT   z#AsyncAudioNativeClient.get_settings  s    L ..;;CC/
;<IF+ D 
 
	
	Si++1c1{{>"H ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN7
2  	Sy'<'<9>>RR	Ss5   9D6DD6AD D6AD /D6+D33D6rU   rV   c          
        K   | j                   j                  j                  dt        |       dd||dd|i|t               d{   }	 d|j
                  cxk  rd	k  r:n n7t        j                  t        t        t        |j                         
            S |j
                  dk(  r@t        t        j                  t        t        t        |j                         
                  |j                         }t        |j
                  |      7 # t        $ r" t        |j
                  |j                        w xY ww)aE  
        Updates content for the specific AudioNative Project.

        Parameters
        ----------
        project_id : str
            The ID of the Studio project.

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

        auto_convert : typing.Optional[bool]
            Whether to auto convert the project to audio or not.

        auto_publish : typing.Optional[bool]
            Whether to auto publish the new project snapshot after it's converted.

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

        Returns
        -------
        AudioNativeEditContentResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.audio_native.update_content(
                project_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        rN   rX   r/   rY   r(   r1   Nr6   r7   r8   r;   r<   rZ   r[   s           r   r\   z%AsyncAudioNativeClient.update_content  s;    j ..;;CC/
;<HE , ,
  , D 
 
		Si++1c1{{7"A ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NNG
B  	Sy'<'<9>>RR	Ss8   AEDEAD EAD ;E+D??E)r]   r^   r_   r   r   rB   r`   rC   ra   rb   rc   r   rd   r   r   rJ   r   rT   r   r\   re   r   r   rg   rg   #  s   .*< . '+'+&*'++/15/3)-)-+/.2;?AO AO s#	AO
 $AO s#AO t$AO OOC(AO !//#.AO ,AO //#&AO //#&AO oodii(AO ood+AO  8AO  
/!AOH VZAOAO39??>3RAO	3AON ,0.2.2;?XOXO oodii(	XO
 ood+XO ood+XO  8XO 
-XOr   rg   )rC   core.client_wrapperr    r   core.request_optionsr   0types.audio_native_create_project_response_modelr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr	   types.http_validation_errorr
   json.decoderr   core.api_errorr   6types.get_audio_native_project_settings_response_modelr   core.jsonable_encoderr   .types.audio_native_edit_content_response_modelr   r   rD   AnyrB   r   rg   re   r   r   <module>ry      sf     3  1 d 6 H = ( % o 4 ` 4 v{{6::s#JO JOZbO bOr   