
    ihױ                     R   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 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 jL                  e jN                  d      Z( G d d      Z) G d d      Z*y)    N   )SyncClientWrapper)RequestOptions)GetChaptersResponse)jsonable_encoder)construct_type)UnprocessableEntityError)HttpValidationError)JSONDecodeError)ApiError)AddChapterResponseModel)ChapterWithContentResponseModel)ChapterContentInputModel)EditChapterResponseModel)'convert_and_respect_annotation_metadata)DeleteChapterResponseModel)ConvertChapterResponseModel)ChapterSnapshotsResponse)$ChapterSnapshotExtendedResponseModel)AsyncClientWrapper.c                      e Zd ZdefdZdddedej                  e   de	fdZ
edd	ded
edej                  e   dej                  e   def
dZdddededej                  e   d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fdZdddededej                  e   defdZdddededej                  e   defdZdddededej                  e   defdZdddedededej                  e   def
dZedddedededej                  e   dej                  e   dej8                  e   fdZy)ChaptersClientclient_wrapperc                    || _         y N_client_wrapperselfr   s     _/var/www/html/dev/engine/venv/lib/python3.12/site-packages/elevenlabs/studio/chapters/client.py__init__zChaptersClient.__init__   
    -    Nrequest_options
project_idr%   returnc          
      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)
ah  
        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
        -------
        GetChaptersResponse
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.chapters.get_all(
            project_id="21m00Tcm4TlvDq8ikWAM",
        )
        v1/studio/projects/	/chaptersGETmethodr%      ,  type_object_  status_codebodyr   httpx_clientrequestr   r5   typingcastr   r   jsonr	   r
   r   r   textr   r&   r%   	_response_response_jsons        r    get_allzChaptersClient.get_all    s   < ((55==!"2:">!?yI+ > 
	
	Si++1c1{{'"1 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AC< AC< <+D'from_urlr%   namerC   c          
      l   | j                   j                  j                  dt        |       d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 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' must be null. If neither 'from_url' or 'from_document' are provided we will initialize the Studio project as blank.

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

        Returns
        -------
        AddChapterResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.chapters.create(
            project_id="21m00Tcm4TlvDq8ikWAM",
            name="Chapter 1",
        )
        r)   r*   POSTrD   rC   content-typeapplication/jsonr-   r<   headersr%   omitr.   r/   r0   r3   r4   r   r8   r9   r   OMITr5   r:   r;   r   r   r<   r	   r
   r   r   r=   r   r&   rD   rC   r%   r?   r@   s          r    createzChaptersClient.create[   s,   T ((55==!"2:">!?yI$
  2 , > 
		Si++1c1{{+"5 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	S   AD AD +D3
chapter_idc          
      j   | j                   j                  j                  dt        |       d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                  |	      # t        $ r" t        |j                  |j                  	      w xY w)
a  
        Returns information about a specific chapter.

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

        chapter_id : str
            The ID of the chapter.

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

        Returns
        -------
        ChapterWithContentResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.chapters.get(
            project_id="21m00Tcm4TlvDq8ikWAM",
            chapter_id="21m00Tcm4TlvDq8ikWAM",
        )
        r)   
/chapters/r+   r,   r.   r/   r0   r3   r4   r   r8   r9   r   r5   r:   r;   r   r   r<   r	   r
   r   r   r=   r   r&   rR   r%   r?   r@   s         r    getzChaptersClient.get   s   D ((55==!"2:">!?zJZ[eJfIgh+ > 
	
	Si++1c1{{3"= ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	S   AD AD +D2rD   contentr%   rZ   c          
         | j                   j                  j                  dt        |       dt        |       d|t	        |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 a chapter.

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

        chapter_id : str
            The ID of the chapter.

        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
        -------
        EditChapterResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.chapters.edit(
            project_id="21m00Tcm4TlvDq8ikWAM",
            chapter_id="21m00Tcm4TlvDq8ikWAM",
        )
        r)   rT   rF   writer2   
annotation	directionrD   rZ   rH   rI   rJ   r.   r/   r0   r3   r4   r   r8   r9   r   r   r   rN   r5   r:   r;   r   r   r<   r	   r
   r   r   r=   r   r&   rR   rD   rZ   r%   r?   r@   s           r    editzChaptersClient.edit   sF   \ ((55==!"2:">!?zJZ[eJfIghB#0HT[  2 , > 
		Si++1c1{{,"6 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AD# -AD# #+Ec          
      j   | j                   j                  j                  dt        |       d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                  |	      # t        $ r" t        |j                  |j                  	      w xY w)
a  
        Deletes a chapter.

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

        chapter_id : str
            The ID of the chapter.

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

        Returns
        -------
        DeleteChapterResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.chapters.delete(
            project_id="21m00Tcm4TlvDq8ikWAM",
            chapter_id="21m00Tcm4TlvDq8ikWAM",
        )
        r)   rT   DELETEr,   r.   r/   r0   r3   r4   r   r8   r9   r   r5   r:   r;   r   r   r<   r	   r
   r   r   r=   rV   s         r    deletezChaptersClient.delete>  s   D ((55==!"2:">!?zJZ[eJfIgh+ > 
	
	Si++1c1{{."8 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	SrX   c          
      l   | j                   j                  j                  dt        |       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  
        Starts conversion of a specific chapter.

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

        chapter_id : str
            The ID of the chapter.

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

        Returns
        -------
        ConvertChapterResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.chapters.convert(
            project_id="21m00Tcm4TlvDq8ikWAM",
            chapter_id="21m00Tcm4TlvDq8ikWAM",
        )
        r)   rT   /convertrF   r,   r.   r/   r0   r3   r4   r   r8   r9   r   r5   r:   r;   r   r   r<   r	   r
   r   r   r=   rV   s         r    convertzChaptersClient.convert}  s   D ((55==!"2:">!?zJZ[eJfIggop+ > 
	
	Si++1c1{{/"9 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	SrQ   c          
      l   | j                   j                  j                  dt        |       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_  
        Gets information about all the snapshots of a chapter. Each snapshot can be downloaded as audio. Whenever a chapter is converted a snapshot will automatically be created.

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

        chapter_id : str
            The ID of the chapter.

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

        Returns
        -------
        ChapterSnapshotsResponse
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.chapters.get_all_snapshots(
            project_id="21m00Tcm4TlvDq8ikWAM",
            chapter_id="21m00Tcm4TlvDq8ikWAM",
        )
        r)   rT   
/snapshotsr+   r,   r.   r/   r0   r3   r4   r   r8   r9   r   r5   r:   r;   r   r   r<   r	   r
   r   r   r=   rV   s         r    get_all_snapshotsz ChaptersClient.get_all_snapshots  s   D ((55==!"2:">!?zJZ[eJfIggqr+ > 
	
	Si++1c1{{,"6 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	SrQ   chapter_snapshot_idc          
         | j                   j                  j                  dt        |       dt        |       d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                  |
      # t        $ r" t        |j                  |j                  
      w xY w)ah  
        Returns the chapter snapshot.

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

        chapter_id : str
            The ID of the chapter.

        chapter_snapshot_id : str
            The ID of the chapter snapshot.

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

        Returns
        -------
        ChapterSnapshotExtendedResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.studio.chapters.get_chapter_snapshot(
            project_id="21m00Tcm4TlvDq8ikWAM",
            chapter_id="21m00Tcm4TlvDq8ikWAM",
            chapter_snapshot_id="21m00Tcm4TlvDq8ikWAM",
        )
        r)   rT   /snapshots/r+   r,   r.   r/   r0   r3   r4   r   r8   r9   r   r5   r:   r;   r   r   r<   r	   r
   r   r   r=   r   r&   rR   rp   r%   r?   r@   s          r    get_chapter_snapshotz#ChaptersClient.get_chapter_snapshot  s=   V ((55==!"2:">!?zJZ[eJfIggr  tD  EX  tY  sZ  [+ > 
	
	Si++1c1{{8"B ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN  	Sy'<'<9>>RR	Ss   AD AD +D>convert_to_mpegr%   rw   c             #     K   | j                   j                  j                  dt        |       dt        |       dt        |       ddd|iddi|t        	      5 }	 d
|j
                  cxk  rdk  r>n n;||j                  dd      nd}|j                  |      D ]  }|  	 ddd       y|j                          |j
                  dk(  r@t        t        j                  t        t        t        |j                                           |j                         }	t!        |j
                  |	      # t        $ r" t!        |j
                  |j"                        w xY w# 1 sw Y   yxY ww)a6  
        Stream the audio from a chapter snapshot. Use `GET /v1/studio/projects/{project_id}/chapters/{chapter_id}/snapshots` to return the snapshots of a chapter.

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

        chapter_id : str
            The ID of the chapter.

        chapter_snapshot_id : str
            The ID of the chapter snapshot.

        convert_to_mpeg : typing.Optional[bool]
            Whether to convert the audio to mpeg format.

        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.

        Yields
        ------
        typing.Iterator[bytes]
            Streaming audio data
        r)   rT   rr   /streamrF   rw   rH   rI   rJ   r.   r/   N
chunk_size   rz   r3   r0   r4   )r   r8   streamr   rN   r5   rW   
iter_bytesreadr	   r:   r;   r
   r   r<   r   r   r=   
r   r&   rR   rp   rw   r%   r?   _chunk_size_chunkr@   s
             r    stream_snapshotzChaptersClient.stream_snapshotC  s    D !!..55!"2:">!?zJZ[eJfIggr  tD  EX  tY  sZ  Za  b!?  2 , 6 
  	S W)//5#5M\Mh/"5"5lD"InrK"+"6"6+"6"N %$%# 	S  	S$  ((C/2/*&9(1(8  "+!1 y'<'<>RR # W9+@+@y~~VVW= 	S  	Ss>   AE0E$A	D6'	E00A/D6E$6+E!!E$$E-)E0)__name__
__module____qualname__r   r!   strr:   Optionalr   r   rA   rN   r   rP   r   rW   r   r   rc   r   rg   r   rk   r   ro   r   ru   boolIteratorbytesr    r#   r    r   r      s   .*; . VZ9O9O39??>3R9O	9O@ *.;?MOMO 	MO
 //#&MO  8MO 
!MO` gk=O=O+.=ODJOOTbDc=O	(=OH &*=A;?SOSO SO
 ooc"SO !9:SO  8SO 
"SOl gk=O=O+.=ODJOOTbDc=O	#=O@ gk=O=O+.=ODJOOTbDc=O	$=O@ gk=O=O+.=ODJOOTbDc=O	!=OJ <@FOFO FO !	FO  8FO 
.FO\ 26;?BSBS BS !	BS  .BS  8BS 
	BSr#   r   c                      e Zd ZdefdZdddedej                  e   de	fdZ
edd	ded
edej                  e   dej                  e   def
dZdddededej                  e   d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fdZdddededej                  e   defdZdddededej                  e   defdZdddededej                  e   defdZdddedededej                  e   def
dZedddedededej                  e   dej                  e   dej8                  e   fdZy)AsyncChaptersClientr   c                    || _         y r   r   r   s     r    r!   zAsyncChaptersClient.__init__  r"   r#   Nr$   r&   r%   r'   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  
        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
        -------
        GetChaptersResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.chapters.get_all(
                project_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        r)   r*   r+   r,   Nr.   r/   r0   r3   r4   r7   r>   s        r    rA   zAsyncChaptersClient.get_all  s    L ..;;CC!"2:">!?yI+ D 
 
	
	Si++1c1{{'"1 ) 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rB   rD   rC   c          
        K   | j                   j                  j                  dt        |       d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)ay  
        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' must be null. If neither 'from_url' or 'from_document' are provided we will initialize the Studio project as blank.

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

        Returns
        -------
        AddChapterResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.chapters.create(
                project_id="21m00Tcm4TlvDq8ikWAM",
                name="Chapter 1",
            )


        asyncio.run(main())
        r)   r*   rF   rG   rH   rI   rJ   Nr.   r/   r0   r3   r4   rM   rO   s          r    rP   zAsyncChaptersClient.create  s<    d ..;;CC!"2:">!?yI$
  2 , D 
 
		Si++1c1{{+"5 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NNG
B  	Sy'<'<9>>RR	S8   AEDEAD EAD ;E+D??ErR   c          
        K   | j                   j                  j                  dt        |       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                  |
      7 # t        $ r" t        |j                  |j                  
      w xY ww)aU  
        Returns information about a specific chapter.

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

        chapter_id : str
            The ID of the chapter.

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

        Returns
        -------
        ChapterWithContentResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.chapters.get(
                project_id="21m00Tcm4TlvDq8ikWAM",
                chapter_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        r)   rT   r+   r,   Nr.   r/   r0   r3   r4   rU   rV   s         r    rW   zAsyncChaptersClient.get&  s)    T ..;;CC!"2:">!?zJZ[eJfIgh+ D 
 
	
	Si++1c1{{3"= ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN7
2  	Sy'<'<9>>RR	S8   AEDEAD EAD :E+D>>ErY   rZ   c          
        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  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  
        Updates a chapter.

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

        chapter_id : str
            The ID of the chapter.

        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
        -------
        EditChapterResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.chapters.edit(
                project_id="21m00Tcm4TlvDq8ikWAM",
                chapter_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        r)   rT   rF   r\   r]   r`   rH   rI   rJ   Nr.   r/   r0   r3   r4   ra   rb   s           r    rc   zAsyncChaptersClient.editm  sV    l ..;;CC!"2:">!?zJZ[eJfIghB#0HT[  2 , D 
 
		Si++1c1{{,"6 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NNK
F  	Sy'<'<9>>RR	Ss8   A E"D-#E(AD/ 6E7AD/ E/+EEc          
        K   | j                   j                  j                  dt        |       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                  |
      7 # t        $ r" t        |j                  |j                  
      w xY ww)a8  
        Deletes a chapter.

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

        chapter_id : str
            The ID of the chapter.

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

        Returns
        -------
        DeleteChapterResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.chapters.delete(
                project_id="21m00Tcm4TlvDq8ikWAM",
                chapter_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        r)   rT   re   r,   Nr.   r/   r0   r3   r4   rf   rV   s         r    rg   zAsyncChaptersClient.delete  s)    T ..;;CC!"2:">!?zJZ[eJfIgh+ D 
 
	
	Si++1c1{{."8 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN7
2  	Sy'<'<9>>RR	Sr   c          
        K   | j                   j                  j                  dt        |       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)aP  
        Starts conversion of a specific chapter.

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

        chapter_id : str
            The ID of the chapter.

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

        Returns
        -------
        ConvertChapterResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.chapters.convert(
                project_id="21m00Tcm4TlvDq8ikWAM",
                chapter_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        r)   rT   ri   rF   r,   Nr.   r/   r0   r3   r4   rj   rV   s         r    rk   zAsyncChaptersClient.convert  s,    T ..;;CC!"2:">!?zJZ[eJfIggop+ D 
 
	
	Si++1c1{{/"9 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN7
2  	Sy'<'<9>>RR	Sr   c          
        K   | j                   j                  j                  dt        |       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  
        Gets information about all the snapshots of a chapter. Each snapshot can be downloaded as audio. Whenever a chapter is converted a snapshot will automatically be created.

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

        chapter_id : str
            The ID of the chapter.

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

        Returns
        -------
        ChapterSnapshotsResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.chapters.get_all_snapshots(
                project_id="21m00Tcm4TlvDq8ikWAM",
                chapter_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        r)   rT   rm   r+   r,   Nr.   r/   r0   r3   r4   rn   rV   s         r    ro   z%AsyncChaptersClient.get_all_snapshotsX  s,    T ..;;CC!"2:">!?zJZ[eJfIggqr+ D 
 
	
	Si++1c1{{,"6 ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN7
2  	Sy'<'<9>>RR	Sr   rp   c          
        K   | j                   j                  j                  dt        |       dt        |       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                  |      7 # t        $ r" t        |j                  |j                        w xY ww)a  
        Returns the chapter snapshot.

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

        chapter_id : str
            The ID of the chapter.

        chapter_snapshot_id : str
            The ID of the chapter snapshot.

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

        Returns
        -------
        ChapterSnapshotExtendedResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.studio.chapters.get_chapter_snapshot(
                project_id="21m00Tcm4TlvDq8ikWAM",
                chapter_id="21m00Tcm4TlvDq8ikWAM",
                chapter_snapshot_id="21m00Tcm4TlvDq8ikWAM",
            )


        asyncio.run(main())
        r)   rT   rr   r+   r,   Nr.   r/   r0   r3   r4   rs   rt   s          r    ru   z(AsyncChaptersClient.get_chapter_snapshot  sK    f ..;;CC!"2:">!?zJZ[eJfIggr  tD  EX  tY  sZ  [+ D 
 
	
	Si++1c1{{8"B ) 0  $$+.KK+&"5$-NN$4  '^^-N 9#8#8~NN7
2  	Sy'<'<9>>RR	Ss8   AEDEAD &E'AD E+E

Erv   rw   c               B  K   | j                   j                  j                  dt        |       dt        |       dt        |       ddd|iddi|t        	      4 d
{   }	 d|j
                  cxk  rdk  r:n n7||j                  dd      nd}|j                  |      2 3 d
{   }| |j                          d
{    |j
                  dk(  r@t        t        j                  t        t        t        |j                                           |j                         }	t!        |j
                  |	      7 7 6 	 d
d
d
      d
{  7   y
7 # t        $ r" t!        |j
                  |j"                        w xY w# 1 d
{  7  sw Y   y
xY ww)a;  
        Stream the audio from a chapter snapshot. Use `GET /v1/studio/projects/{project_id}/chapters/{chapter_id}/snapshots` to return the snapshots of a chapter.

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

        chapter_id : str
            The ID of the chapter.

        chapter_snapshot_id : str
            The ID of the chapter snapshot.

        convert_to_mpeg : typing.Optional[bool]
            Whether to convert the audio to mpeg format.

        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.

        Yields
        ------
        typing.AsyncIterator[bytes]
            Streaming audio data
        r)   rT   rr   ry   rF   rw   rH   rI   rJ   Nr.   r/   rz   r{   r|   r3   r0   r4   )r   r8   r}   r   rN   r5   rW   aiter_bytesareadr	   r:   r;   r
   r   r<   r   r   r=   r   s
             r    r   z#AsyncChaptersClient.stream_snapshot  s    D ''44;;!"2:">!?zJZ[eJfIggr  tD  EX  tY  sZ  Za  b!?  2 , < 
  	S  	S W)//5#5M\Mh/"5"5lD"InrK(1(=(=(=(U % %f$oo'''((C/2/*&9(1(8  "+!1 y'<'<>RRA 	S%(U# 	S  	S  	S$ ( # W9+@+@y~~VVW= 	S  	S  	Ss   AFE F#F
%A E%E)E*E-EEA#E+F
FEEFEFE+FF

FFFF)r   r   r   r   r!   r   r:   r   r   r   rA   rN   r   rP   r   rW   r   r   rc   r   rg   r   rk   r   ro   r   ru   r   AsyncIteratorr   r   r   r#   r    r   r     s   .*< . VZAOAO39??>3RAO	AOP *.;?UOUO 	UO
 //#&UO  8UO 
!UOp gkEOEO+.EODJOOTbDcEO	(EOX &*=A;?[O[O [O
 ooc"[O !9:[O  8[O 
"[O| gkEOEO+.EODJOOTbDcEO	#EOP gkEOEO+.EODJOOTbDcEO	$EOP gkEOEO+.EODJOOTbDcEO	!EOZ <@NONO NO !	NO  8NO 
.NOl 26;?BSBS BS !	BS  .BS  8BS 
		e	$BSr#   r   )+r:   core.client_wrapperr   core.request_optionsr   types.get_chapters_responser   core.jsonable_encoderr   core.unchecked_base_modelr   !errors.unprocessable_entity_errorr	   types.http_validation_errorr
   json.decoderr   core.api_errorr    types.add_chapter_response_modelr   )types.chapter_with_content_response_modelr   !types.chapter_content_input_modelr   !types.edit_chapter_response_modelr   core.serializationr   #types.delete_chapter_response_modelr   $types.convert_chapter_response_modelr    types.chapter_snapshots_responser   .types.chapter_snapshot_extended_response_modelr   r   r;   AnyrN   r   r   r   r#   r    <module>r      sx     4 2 > 5 7 I > ( & G X I I I M O H b 5 v{{6::s#i	S i	SXi
S i
Sr#   