Ë
    ±q±ic
  ã                   ó$   — d Z ddlZ G d„ d«      Zy)zNLiveKit REST Helpers.

Methods that wrap the LiveKit API for room management.
é    Nc            	       ód   — e Zd ZdZddœdedededej                  fd„Zdd	ed
efd„Z	ded
efd„Z
y)ÚLiveKitRESTHelperzlHelper class for interacting with LiveKit's REST API.

    Provides methods for managing LiveKit rooms.
    zhttps://your-livekit-host.com)Úapi_urlÚapi_keyÚ
api_secretr   Úaiohttp_sessionc                óZ   — || _         || _        |j                  d«      | _        || _        y)a,  Initialize the LiveKit REST helper.

        Args:
            api_key: Your LiveKit API key.
            api_secret: Your LiveKit API secret.
            api_url: LiveKit server URL (e.g. "https://your-livekit-host.com").
            aiohttp_session: Async HTTP session for making requests.
        ú/N)r   r   Úrstripr   r   )Úselfr   r   r   r   s        úR/opt/pipecat/venv/lib/python3.12/site-packages/pipecat/transports/livekit/utils.pyÚ__init__zLiveKitRESTHelper.__init__   s*   € ð  ˆŒØ$ˆŒØ—~‘~ cÓ*ˆŒØ.ˆÕó    Úroom_createÚreturnc                 óì   — ddl }ddl}| j                  | j                  t        |j                  «       «      t        |j                  «       «      dz   d|idœ}|j	                  || j
                  d¬«      S )zÌCreate a signed access token for LiveKit API authentication.

        Args:
            room_create: Whether to grant roomCreate permission.

        Returns:
            Signed JWT access token.
        r   Né<   Ú
roomCreate)ÚissÚsubÚnbfÚexpÚvideoÚHS256)Ú	algorithm)ÚtimeÚjwtr   ÚintÚencoder   )r   r   r   r   Úclaimss        r   Ú_create_access_tokenz&LiveKitRESTHelper._create_access_token*   sg   € ó 	ãð —<‘<Ø—<‘<Üt—y‘y“{Ó#Üt—y‘y“{Ó# bÑ(à˜kðñ
ˆð z‰z˜& $§/¡/¸WˆzÓEÐEr   Ú	room_namec           	   ƒ   óŒ  K  — | j                  d¬«      }d|› ddœ}| j                  j                  | j                  › d|d|i¬«      4 ƒd	{  –—† }|j                  d
k7  r6|j                  «       ƒ d	{  –—† }t        d|› d|j                  › d|› «      ‚d	d	d	«      ƒd	{  –—†  y7 ŒZ7 Œ57 Œ	# 1 ƒd	{  –—†7  sw Y   yxY w­w)a2  Delete a LiveKit room by name.

        This will forcibly disconnect all participants currently in the room.

        Args:
            room_name: Name of the room to delete.

        Returns:
            True if deletion was successful.

        Raises:
            Exception: If deletion fails.
        T)r   zBearer zapplication/json)ÚAuthorizationzContent-Typez%/twirp/livekit.RoomService/DeleteRoomÚroom)ÚheadersÚjsonNéÈ   zFailed to delete room [z] (status: z): )r!   r   Úpostr   ÚstatusÚtextÚ	Exception)r   r"   Útokenr&   Úrr+   s         r   Údelete_room_by_namez%LiveKitRESTHelper.delete_room_by_nameC   sò   è ø€ ð ×)Ñ)°dÐ)Ó;ˆà& u gÐ.Ø.ñ
ˆð
 ×'Ñ'×,Ñ,Ø|‰|ˆnÐAÐBØØ˜)Ð$ð -ó 
÷ 	eð 	eð Øx‰x˜3ŠØŸV™V›X—~ÜÐ"9¸)¸ÀKÐPQ×PXÑPXÈzÐY\Ð]aÐ\bÐ cÓdÐd÷	e÷ 	eð ð	eøð &øð	eø÷ 	e÷ 	eð 	eð üsZ   ‚ACÁB)ÁCÁ#B/Á5B+Á6"B/ÂCÂ#B-Â$CÂ+B/Â-CÂ/CÂ5B8Â6CÂ=CN)T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚstrÚaiohttpÚClientSessionr   Úboolr!   r/   © r   r   r   r      sh   „ ñð 7ò/ð ð/ð ð	/ð
 ð/ð !×.Ñ.ó/ñ*F°ð FÀó Fð2°3ð ¸4ô r   r   )r3   r5   r   r8   r   r   ú<module>r9      s   ðñó
 ÷Qò Qr   