
    b6ix                     B   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 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 jJ                  e jL                  d      Z' G d d      Z( G d d      Z)y)    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)UnprocessableEntityError)AddChapterResponseModel)ChapterContentInputModel)ChapterWithContentResponseModel)ConvertChapterResponseModel)DeleteChapterResponseModel)EditChapterResponseModel)GetChaptersResponse)HttpValidationError.c                      e Zd ZdefdZdddedej                  e   de	e
   fdZedd	ded
edej                  e   dej                  e   de	e   f
dZdddededej                  e   de	e   fdZeedddeded
ej                  e   dej                  e   dej                  e   de	e   fdZdddededej                  e   de	e   fdZdddededej                  e   de	e   fdZy)RawChaptersClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     y/root/.openclaw/workspace/visionaryfx/venv/lib/python3.12/site-packages/elevenlabs/studio/projects/chapters/raw_client.py__init__zRawChaptersClient.__init__   
    -    Nrequest_options
project_idr%   returnc                   | j                   j                  j                  d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                        |      # t        $ r6 t!        |j                  t        |j                        |j"                        w xY w)a|  
        Returns a list of a Studio project's chapters.

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

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

        Returns
        -------
        HttpResponse[GetChaptersResponse]
            Successful Response
        v1/studio/projects/	/chaptersGETmethodr%      ,  type_object_responsedata  headersbodystatus_coder8   r9   )r   httpx_clientrequestr
   r;   typingcastr   r   jsonr	   r   dictr8   r   r   r   textr   r&   r%   	_response_data_response_jsons         r    listzRawChaptersClient.list   sD   & ((55==!"2:">!?yI+ > 
	
	ti++1c1'"1 ) 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D2 A4D2 2?E1from_urlr%   namerI   c                    | j                   j                  j                  dt        |       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 chapter either as blank or from a URL.

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

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

        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.

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

        Returns
        -------
        HttpResponse[AddChapterResponseModel]
            Successful Response
        r)   r*   POSTrJ   rI   content-typeapplication/jsonr-   r@   r8   r%   omitr.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   OMITr;   r>   r?   r   r   r@   r	   r   rA   r8   r   r   r   rB   r   r&   rJ   rI   r%   rD   rE   rF   s           r    createzRawChaptersClient.createQ   sa   < ((55==!"2:">!?yI$
  2 , > 
		ti++1c1+"5 ) 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   AD> A4D> >?E=
chapter_idc                   | j                   j                  j                  dt        |       d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)a  
        Returns information about a specific chapter.

        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.

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

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

        Returns
        -------
        HttpResponse[ChapterWithContentResponseModel]
            Successful Response
        r)   
/chapters/r+   r,   r.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r;   r>   r?   r   r   r@   r	   r   rA   r8   r   r   r   rB   r   r&   rV   r%   rD   rE   rF   s          r    getzRawChaptersClient.get   sP   , ((55==!"2:">!?zJZ[eJfIgh+ > 
	
	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   AD= A4D= =?E<rJ   contentr%   r]   c                6   | j                   j                  j                  dt        |       dt        |       d|t	        |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)ar  
        Updates a chapter.

        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.

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

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

        content : typing.Optional[ChapterContentInputModel]
            The chapter content to use.

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

        Returns
        -------
        HttpResponse[EditChapterResponseModel]
            Successful Response
        r)   rX   rL   writer2   
annotation	directionrJ   r]   rN   rO   rP   r.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r   r   rR   r;   r>   r?   r   r   r@   r	   r   rA   r8   r   r   r   rB   	r   r&   rV   rJ   r]   r%   rD   rE   rF   s	            r    updatezRawChaptersClient.update   s|   D ((55==!"2:">!?zJZ[eJfIghB#0HT[  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E :A4E ?Fc                   | j                   j                  j                  dt        |       d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)a  
        Deletes a chapter.

        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.

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

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

        Returns
        -------
        HttpResponse[DeleteChapterResponseModel]
            Successful Response
        r)   rX   DELETEr,   r.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r;   r>   r?   r   r   r@   r	   r   rA   r8   r   r   r   rB   rY   s          r    deletezRawChaptersClient.delete  sP   , ((55==!"2:">!?zJZ[eJfIgh+ > 
	
	ti++1c1."8 ) 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r[   c                    | j                   j                  j                  dt        |       d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                        |      # t        $ r6 t!        |j                  t        |j                        |j"                        w xY w)a  
        Starts conversion of a specific chapter.

        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.

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

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

        Returns
        -------
        HttpResponse[ConvertChapterResponseModel]
            Successful Response
        r)   rX   /convertrL   r,   r.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r;   r>   r?   r   r   r@   r	   r   rA   r8   r   r   r   rB   rY   s          r    convertzRawChaptersClient.convertK  sS   , ((55==!"2:">!?zJZ[eJfIggop+ > 
	
	ti++1c1/"9 ) 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rU   )__name__
__module____qualname__r   r!   strr>   Optionalr   r	   r   rG   rR   r   rT   r   rZ   r   r   re   r   rh   r   rk    r#   r    r   r      s   .*; . VZ0p0p39??>3R0p	)	*0pn *.;?CpCp 	Cp
 //#&Cp  8Cp 
-	.CpL gk3p3p+.3pDJOOTbDc3p	5	63pt &*=A;?IpIp Ip
 ooc"Ip !9:Ip  8Ip 
.	/IpX gk3p3p+.3pDJOOTbDc3p	0	13pl gk3p3p+.3pDJOOTbDc3p	1	23pr#   r   c                      e Zd ZdefdZdddedej                  e   de	e
   fdZedd	ded
edej                  e   dej                  e   de	e   f
dZdddededej                  e   de	e   fdZeedddeded
ej                  e   dej                  e   dej                  e   de	e   fdZdddededej                  e   de	e   fdZdddededej                  e   de	e   fdZy)AsyncRawChaptersClientr   c                    || _         y r   r   r   s     r    r!   zAsyncRawChaptersClient.__init__  r"   r#   Nr$   r&   r%   r'   c                  K   | j                   j                  j                  dt        |       d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)a  
        Returns a list of a Studio project's chapters.

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

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

        Returns
        -------
        AsyncHttpResponse[GetChaptersResponse]
            Successful Response
        r)   r*   r+   r,   Nr.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r;   r>   r?   r   r   r@   r   r   rA   r8   r   r   r   rB   rC   s         r    rG   zAsyncRawChaptersClient.list  sR    & ..;;CC!"2:">!?yI+ D 
 
	
	ti++1c1'"1 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo;
6  	ty'<'<d9K\K\F]dmdrdrss	ts5   9FD<FAD? FA4D? ,F??E>>FrH   rJ   rI   c                  K   | j                   j                  j                  dt        |       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 chapter either as blank or from a URL.

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

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

        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.

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

        Returns
        -------
        AsyncHttpResponse[AddChapterResponseModel]
            Successful Response
        r)   r*   rL   rM   rN   rO   rP   Nr.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   rR   r;   r>   r?   r   r   r@   r   r   rA   r8   r   r   r   rB   rS   s           r    rT   zAsyncRawChaptersClient.create  sq    < ..;;CC!"2:">!?yI$
  2 , D 
 
		ti++1c1+"5 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`nooK
F  	ty'<'<d9K\K\F]dmdrdrss	t8   AFEFAE (F)A4E ,F?F

FrV   c                  K   | j                   j                  j                  dt        |       d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)a  
        Returns information about a specific chapter.

        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.

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

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

        Returns
        -------
        AsyncHttpResponse[ChapterWithContentResponseModel]
            Successful Response
        r)   rX   r+   r,   Nr.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r;   r>   r?   r   r   r@   r   r   rA   r8   r   r   r   rB   rY   s          r    rZ   zAsyncRawChaptersClient.get  s^    , ..;;CC!"2:">!?zJZ[eJfIgh+ D 
 
	
	ti++1c13"= ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo;
6  	ty'<'<d9K\K\F]dmdrdrss	t8   AFEFAE
 'F(A4E
 ,F
?F		Fr\   r]   c                T  K   | j                   j                  j                  dt        |       dt        |       d|t	        |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)aw  
        Updates a chapter.

        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.

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

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

        content : typing.Optional[ChapterContentInputModel]
            The chapter content to use.

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

        Returns
        -------
        AsyncHttpResponse[EditChapterResponseModel]
            Successful Response
        r)   rX   rL   r_   r`   rc   rN   rO   rP   Nr.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r   r   rR   r;   r>   r?   r   r   r@   r   r   rA   r8   r   r   r   rB   rd   s	            r    re   zAsyncRawChaptersClient.update1  s    D ..;;CC!"2:">!?zJZ[eJfIghB#0HT[  2 , 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& F(A4E& 8,F(&?F%%F(c                  K   | j                   j                  j                  dt        |       d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)a  
        Deletes a chapter.

        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.

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

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

        Returns
        -------
        AsyncHttpResponse[DeleteChapterResponseModel]
            Successful Response
        r)   rX   rg   r,   Nr.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r;   r>   r?   r   r   r@   r   r   rA   r8   r   r   r   rB   rY   s          r    rh   zAsyncRawChaptersClient.delete|  s^    , ..;;CC!"2:">!?zJZ[eJfIgh+ D 
 
	
	ti++1c1."8 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo;
6  	ty'<'<d9K\K\F]dmdrdrss	try   c                  K   | j                   j                  j                  dt        |       dt        |       d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)a  
        Starts conversion of a specific chapter.

        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.

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

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

        Returns
        -------
        AsyncHttpResponse[ConvertChapterResponseModel]
            Successful Response
        r)   rX   rj   rL   r,   Nr.   r/   r0   r3   r6   r7   r:   )r   r<   r=   r
   r;   r>   r?   r   r   r@   r   r   rA   r8   r   r   r   rB   rY   s          r    rk   zAsyncRawChaptersClient.convert  sa    , ..;;CC!"2:">!?zJZ[eJfIggop+ D 
 
	
	ti++1c1/"9 ) 0 ))%HH$$+. !2!23+&"5$-NN$4	 	 '^^-N 9#8#8$yGXGXBY`noo;
6  	ty'<'<d9K\K\F]dmdrdrss	trw   )rl   rm   rn   r   r!   ro   r>   rp   r   r   r   rG   rR   r   rT   r   rZ   r   r   re   r   rh   r   rk   rq   r#   r    rs   rs     s   .*< . VZ0p0p39??>3R0p	.	/0pn *.;?CpCp 	Cp
 //#&Cp  8Cp 
2	3CpL gk3p3p+.3pDJOOTbDc3p	:	;3pt &*=A;?IpIp Ip
 ooc"Ip !9:Ip  8Ip 
3	4IpX gk3p3p+.3pDJOOTbDc3p	5	63pl gk3p3p+.3pDJOOTbDc3p	6	73pr#   rs   )*r>   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r	   core.jsonable_encoderr
   core.request_optionsr   core.serializationr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr    types.add_chapter_response_modelr   !types.chapter_content_input_modelr   )types.chapter_with_content_response_modelr   $types.convert_chapter_response_modelr   #types.delete_chapter_response_modelr   !types.edit_chapter_response_modelr   types.get_chapters_responser   types.http_validation_errorr   r?   AnyrR   r   rs   rq   r#   r    <module>r      sr     ( ' I B 6 3 J 8 J H J Y P N J ? ? v{{6::s#cp cpLcp cpr#   