
    b6i;D                         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  e j2                  e j4                  d      Z G d d      Z G d d      Zy)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)construct_type)UnprocessableEntityError)AddVoiceResponseModel)HttpValidationError)"StartPvcVoiceTrainingResponseModel.c                      e Zd ZdefdZeedddededej                  e   dej                  ej                  eej                  e   f      d	ej                  e
   d
ee   fdZeeeedddedej                  e   dej                  e   dej                  e   dej                  ej                  eej                  e   f      d	ej                  e
   d
ee   fdZedddedej                  e   d	ej                  e
   d
ee   fdZy)RawPvcClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     k/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/voices/pvc/raw_client.py__init__zRawPvcClient.__init__   
    -    Ndescriptionlabelsrequest_optionsnamelanguager   r    r!   returnc                   | j                   j                  j                  dd||||dddi|t              }	 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  
        Creates a new PVC voice with metadata but no samples

        Parameters
        ----------
        name : str
            The name that identifies this voice. This will be displayed in the dropdown of the website.

        language : str
            Language used in the samples.

        description : typing.Optional[str]
            Description to use for the created voice.

        labels : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Labels for the voice. Keys can be language, accent, gender, or age.

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

        Returns
        -------
        HttpResponse[AddVoiceResponseModel]
            Successful Response
        v1/voices/pvcPOSTr"   r#   r   r    content-typeapplication/jsonmethodjsonheadersr!   omit   ,  type_object_responsedata  r.   bodystatus_coder.   r:   )r   httpx_clientrequestOMITr<   typingcastr   r   r-   r	   r   dictr.   r   r   r   text	r   r"   r#   r   r    r!   	_response_data_response_jsons	            r   createzRawPvcClient.create   sX   D ((55==$* 	  2 , > 
		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D3 A4D3 3?E2r"   r#   r   r    r!   voice_idc                   | j                   j                  j                  dt        |       d||||dddi|t              }	 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  
        Edit PVC voice metadata

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        name : typing.Optional[str]
            The name that identifies this voice. This will be displayed in the dropdown of the website.

        language : typing.Optional[str]
            Language used in the samples.

        description : typing.Optional[str]
            Description to use for the created voice.

        labels : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Labels for the voice. Keys can be language, accent, gender, or age.

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

        Returns
        -------
        HttpResponse[AddVoiceResponseModel]
            Successful Response
        v1/voices/pvc/r'   r(   r)   r*   r+   r0   r1   r2   r5   r8   r9   r;   )r   r=   r>   r
   r?   r<   r@   rA   r   r   r-   r	   r   rB   r.   r   r   r   rC   
r   rJ   r"   r#   r   r    r!   rE   rF   rG   s
             r   updatezRawPvcClient.updated   sf   L ((55==-h789$* 	  2 , > 
		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D?  A4D? ??E>model_idr!   rP   c                   | j                   j                  j                  dt        |       ddd|iddi|t              }	 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(  
        Start PVC training process for a voice.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        model_id : typing.Optional[str]
            The model ID to use for the conversion.

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

        Returns
        -------
        HttpResponse[StartPvcVoiceTrainingResponseModel]
            Successful Response
        rL   /trainr'   rP   r)   r*   r+   r0   r1   r2   r5   r8   r9   r;   )r   r=   r>   r
   r?   r<   r@   rA   r   r   r-   r	   r   rB   r.   r   r   r   rC   r   rJ   rP   r!   rE   rF   rG   s          r   trainzRawPvcClient.train   s`   4 ((55==-h78?H  2 , > 
		ti++1c16"@ ) 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D= A4D= =?E<)__name__
__module____qualname__r   r   r?   strr@   OptionalDictr   r	   r   rH   rN   r   rT    r   r   r   r      s   .*; . -1JN;?Ip Ip 	Ip
 __S)Ip C1E,E FGIp  8Ip 
+	,Ip^ &*)-,0JN;?MpMp ooc"	Mp
 //#&Mp __S)Mp C1E,E FGMp  8Mp 
+	,Mpf *.;?>p>p //#&	>p
  8>p 
8	9>pr   r   c                      e Zd ZdefdZeedddededej                  e   dej                  ej                  eej                  e   f      d	ej                  e
   d
ee   fdZeeeedddedej                  e   dej                  e   dej                  e   dej                  ej                  eej                  e   f      d	ej                  e
   d
ee   fdZedddedej                  e   d	ej                  e
   d
ee   fdZy)AsyncRawPvcClientr   c                    || _         y r   r   r   s     r   r   zAsyncRawPvcClient.__init__   r   r   Nr   r"   r#   r   r    r!   r$   c                  K   | j                   j                  j                  dd||||dddi|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                        |      7 # t        $ r6 t!        |j                  t        |j                        |j"                        w xY ww)a  
        Creates a new PVC voice with metadata but no samples

        Parameters
        ----------
        name : str
            The name that identifies this voice. This will be displayed in the dropdown of the website.

        language : str
            Language used in the samples.

        description : typing.Optional[str]
            Description to use for the created voice.

        labels : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Labels for the voice. Keys can be language, accent, gender, or age.

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

        Returns
        -------
        AsyncHttpResponse[AddVoiceResponseModel]
            Successful Response
        r&   r'   r(   r)   r*   r+   Nr0   r1   r2   r5   r8   r9   r;   )r   r=   r>   r?   r<   r@   rA   r   r   r-   r   r   rB   r.   r   r   r   rC   rD   s	            r   rH   zAsyncRawPvcClient.create   sh    D ..;;CC$* 	  2 , D 
 
		ti++1c1)"3 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooO
J  	ty'<'<d9K\K\F]dmdrdrss	ts5   :FD=FAE  FA4E  ,F ?E??FrI   rJ   c                   K   | j                   j                  j                  dt        |       d||||dddi|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                        |	      7 # t         $ r6 t#        |j
                  t        |j                        |j$                        w xY ww)a  
        Edit PVC voice metadata

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        name : typing.Optional[str]
            The name that identifies this voice. This will be displayed in the dropdown of the website.

        language : typing.Optional[str]
            Language used in the samples.

        description : typing.Optional[str]
            Description to use for the created voice.

        labels : typing.Optional[typing.Dict[str, typing.Optional[str]]]
            Labels for the voice. Keys can be language, accent, gender, or age.

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

        Returns
        -------
        AsyncHttpResponse[AddVoiceResponseModel]
            Successful Response
        rL   r'   r(   r)   r*   r+   Nr0   r1   r2   r5   r8   r9   r;   )r   r=   r>   r
   r?   r<   r@   rA   r   r   r-   r   r   rB   r.   r   r   r   rC   rM   s
             r   rN   zAsyncRawPvcClient.updateC  sv    L ..;;CC-h789$* 	  2 , D 
 
		ti++1c1)"3 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooO
J  	ty'<'<d9K\K\F]dmdrdrss	ts8   AFE		FAE )F*A4E ,F?FFrO   rP   c                  K   | j                   j                  j                  dt        |       ddd|iddi|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                        |      7 # t         $ r6 t#        |j
                  t        |j                        |j$                        w xY ww)a-  
        Start PVC training process for a voice.

        Parameters
        ----------
        voice_id : str
            Voice ID to be used, you can use https://api.elevenlabs.io/v1/voices to list all the available voices.

        model_id : typing.Optional[str]
            The model ID to use for the conversion.

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

        Returns
        -------
        AsyncHttpResponse[StartPvcVoiceTrainingResponseModel]
            Successful Response
        rL   rR   r'   rP   r)   r*   r+   Nr0   r1   r2   r5   r8   r9   r;   )r   r=   r>   r
   r?   r<   r@   rA   r   r   r-   r   r   rB   r.   r   r   r   rC   rS   s          r   rT   zAsyncRawPvcClient.train  sp    4 ..;;CC-h78?H  2 , D 
 
		ti++1c16"@ ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooI
D  	ty'<'<d9K\K\F]dmdrdrss	ts8   AFEFAE
 'F(A4E
 ,F
?F		F)rU   rV   rW   r   r   r?   rX   r@   rY   rZ   r   r   r   rH   rN   r   rT   r[   r   r   r]   r]      s   .*< . -1JN;?Ip Ip 	Ip
 __S)Ip C1E,E FGIp  8Ip 
0	1Ip^ &*)-,0JN;?MpMp ooc"	Mp
 //#&Mp __S)Mp C1E,E FGMp  8Mp 
0	1Mpf *.;?>p>p //#&	>p
  8>p 
=	>>pr   r]   )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.add_voice_response_modelr   types.http_validation_errorr   -types.start_pvc_voice_training_response_modelr   rA   Anyr?   r   r]   r[   r   r   <module>rn      s`     ( & H A 5 2 7 I C > _ v{{6::s#\p \p~\p \pr   