
    b6i%                         d dl 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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   )core)ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)construct_type)UnprocessableEntityError)EditProjectResponseModel)HttpValidationError.c                       e Zd ZdefdZeeeedddedej                  e   dej                  e	j                     dej                  e   d	ej                  e   d
ej                  e   dee   fdZy)RawContentClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     x/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/studio/projects/content/raw_client.py__init__zRawContentClient.__init__   
    -    Nfrom_urlfrom_documentfrom_content_jsonauto_convertrequest_options
project_idr   r    r!   r"   r#   returnc                   | j                   j                  j                  dt        |       dd|||di |d|in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                        |	      # t         $ r6 t#        |j
                  t        |j                        |j$                        w xY w)aT  
        Updates Studio project content.

        Parameters
        ----------
        project_id : str
            The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects.

        from_url : typing.Optional[str]
            An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank.

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

        from_content_json : typing.Optional[str]

                An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank.

                Example:
                [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}]


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

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

        Returns
        -------
        HttpResponse[EditProjectResponseModel]
            Successful Response
        v1/studio/projects//contentPOSTr   r!   r"   r    Tmethoddatafilesr#   omitforce_multipart   ,  type_object_responser-     headersbodystatus_coder:   r;   )r   httpx_clientrequestr   OMITr=   typingcastr   r   jsonr
   r   dictr:   r   r   r   text
r   r$   r   r    r!   r"   r#   	_response_data_response_jsons
             r   updatezRawContentClient.update   su   V ((55==!"2:">!?xH$%6 ,
7D7PO]3VX ,  > 
		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E 'A4E ?F)__name__
__module____qualname__r   r   r@   strrA   Optionalr   Fileboolr   r
   r   rJ    r   r   r   r      s    .*; . *.4826.2;?RpRp //#&	Rp
 tyy1Rp "??3/Rp ood+Rp  8Rp 
.	/Rpr   r   c                       e Zd ZdefdZeeeedddedej                  e   dej                  e	j                     dej                  e   d	ej                  e   d
ej                  e   dee   fdZy)AsyncRawContentClientr   c                    || _         y r   r   r   s     r   r   zAsyncRawContentClient.__init__o   r   r   Nr   r$   r   r    r!   r"   r#   r%   c                .  K   | j                   j                  j                  dt        |       dd|||di |d|ini |t        d       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)aY  
        Updates Studio project content.

        Parameters
        ----------
        project_id : str
            The ID of the project to be used. You can use the [List projects](/docs/api-reference/studio/get-projects) endpoint to list all the available projects.

        from_url : typing.Optional[str]
            An optional URL from which we will extract content to initialize the Studio project. If this is set, 'from_url' and 'from_content' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank.

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

        from_content_json : typing.Optional[str]

                An optional content to initialize the Studio project with. If this is set, 'from_url' and 'from_document' must be null. If neither 'from_url', 'from_document', 'from_content' are provided we will initialize the Studio project as blank.

                Example:
                [{"name": "Chapter A", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "A", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "B", "type": "tts_node"}]}, {"sub_type": "h1", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "C", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "D", "type": "tts_node"}]}]}, {"name": "Chapter B", "blocks": [{"sub_type": "p", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "E", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "F", "type": "tts_node"}]}, {"sub_type": "h2", "nodes": [{"voice_id": "6lCwbsX1yVjD49QmpkT0", "text": "G", "type": "tts_node"}, {"voice_id": "6lCwbsX1yVjD49QmpkT1", "text": "H", "type": "tts_node"}]}]}]


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

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

        Returns
        -------
        AsyncHttpResponse[EditProjectResponseModel]
            Successful Response
        r'   r(   r)   r*   Nr    Tr+   r1   r2   r3   r6   r8   r9   r<   )r   r>   r?   r   r@   r=   rA   rB   r   r   rC   r	   r   rD   r:   r   r   r   rE   rF   s
             r   rJ   zAsyncRawContentClient.updater   s    V ..;;CC!"2:">!?xH$%6 ,
7D7PO]3VX ,  D 
 
		ti++1c1,"6 ) 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 0F1A4E %,F?FF)rK   rL   rM   r   r   r@   rN   rA   rO   r   rP   rQ   r   r	   r   rJ   rR   r   r   rT   rT   n   s    .*< . *.4826.2;?RpRp //#&	Rp
 tyy1Rp "??3/Rp ood+Rp  8Rp 
3	4Rpr   rT   )rA   json.decoderr    r   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.edit_project_response_modelr   types.http_validation_errorr   rB   Anyr@   r   rT   rR   r   r   <module>rc      s`     (  ' I B 6 3 8 J J ? v{{6::s#Vp VprVp Vpr   