Ë
    %ò€iE  ã                   óp   — d dl Z 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  G d	„ d
«      Zy)é    Né   )ÚRoomService)ÚEgressService)ÚIngressService)Ú
SipService)ÚAgentDispatchService)ÚOptionalc                   ó  — e Zd ZdZ	 	 	 ddddœdee   dee   dee   deej                     deej                     f
d	„Z	e
d
efd„«       Ze
d
efd„«       Ze
d
efd„«       Ze
d
efd„«       Ze
d
efd„«       Zd„ Zd„ Zd„ Zy)Ú
LiveKitAPIa  LiveKit Server API Client

    This class is the main entrypoint, which exposes all services.

    Usage:

    ```python
    from livekit import api
    lkapi = api.LiveKitAPI()
    rooms = await lkapi.room.list_rooms(api.proto_room.ListRoomsRequest(names=['test-room']))
    ```
    N)ÚtimeoutÚsessionÚurlÚapi_keyÚ
api_secretr   r   c                óœ  — |xs t        j                  d«      }|xs t        j                  d«      }|xs t        j                  d«      }|st        d«      ‚|r|st        d«      ‚d| _        || _        | j                  s:d| _        |st        j                  d¬	«      }t        j                  |¬
«      | _        t        | j                  |||«      | _	        t        | j                  |||«      | _        t        | j                  |||«      | _        t        | j                  |||«      | _        t!        | j                  |||«      | _        y)a  Create a new LiveKitAPI instance.

        Args:
            url: LiveKit server URL (read from `LIVEKIT_URL` environment variable if not provided)
            api_key: API key (read from `LIVEKIT_API_KEY` environment variable if not provided)
            api_secret: API secret (read from `LIVEKIT_API_SECRET` environment variable if not provided)
            timeout: Request timeout (default: 60 seconds)
            session: aiohttp.ClientSession instance to use for requests, if not provided, a new one will be created
        ÚLIVEKIT_URLÚLIVEKIT_API_KEYÚLIVEKIT_API_SECRETzurl must be setz"api_key and api_secret must be setTFé<   )Útotal)r   N)ÚosÚgetenvÚ
ValueErrorÚ_custom_sessionÚ_sessionÚaiohttpÚClientTimeoutÚClientSessionr   Ú_roomr   Ú_ingressr   Ú_egressr   Ú_sipr   Ú_agent_dispatch)Úselfr   r   r   r   r   s         úQ/var/www/html/engine/venv/lib/python3.12/site-packages/livekit/api/livekit_api.pyÚ__init__zLiveKitAPI.__init__   s  € ð$ Ò-”R—Y‘Y˜}Ó-ˆØÒ9œRŸY™YÐ'8Ó9ˆØÒB¤2§9¡9Ð-AÓ#Bˆ
áÜÐ.Ó/Ð/á™jÜÐAÓBÐBà#ˆÔØˆŒØ}Š}Ø#(ˆDÔ ÙÜ!×/Ñ/°bÔ9Ü#×1Ñ1¸'ÔBˆDŒMä  §¡°°W¸jÓIˆŒ
Ü& t§}¡}°c¸7ÀJÓOˆŒÜ$ T§]¡]°C¸À*ÓMˆŒÜ˜tŸ}™}¨c°7¸JÓGˆŒ	Ü3°D·M±MÀ3ÈÐQ[Ó\ˆÕó    Úreturnc                 ó   — | j                   S )z$Instance of the AgentDispatchService)r#   ©r$   s    r%   Úagent_dispatchzLiveKitAPI.agent_dispatchC   s   € ð ×#Ñ#Ð#r'   c                 ó   — | j                   S )zInstance of the RoomService)r   r*   s    r%   ÚroomzLiveKitAPI.roomH   s   € ð z‰zÐr'   c                 ó   — | j                   S )zInstance of the IngressService)r    r*   s    r%   ÚingresszLiveKitAPI.ingressM   s   € ð }‰}Ðr'   c                 ó   — | j                   S )zInstance of the EgressService)r!   r*   s    r%   ÚegresszLiveKitAPI.egressR   s   € ð |‰|Ðr'   c                 ó   — | j                   S )zInstance of the SipService)r"   r*   s    r%   ÚsipzLiveKitAPI.sipW   s   € ð y‰yÐr'   c              ƒ   ón   K  — | j                   s#| j                  j                  «       ƒ d{  –—†  yy7 Œ­w)zqClose the API client

        Call this before your application exits or when the API client is no longer needed.N)r   r   Úcloser*   s    r%   ÚaclosezLiveKitAPI.aclose\   s/   è ø€ ð
 ×#Ò#Ø—-‘-×%Ñ%Ó'×'Ñ'ð $Ø'ús   ‚*5¬3­5c              ƒ   ó   K  — | S ­w)ú*@private

        Support for `async with`© r*   s    r%   Ú
__aenter__zLiveKitAPI.__aenter__d   s   è ø€ ð ˆùs   ‚c              ƒ   ó@   K  — | j                  «       ƒ d{  –—†  y7 Œ­w)r8   N)r6   )r$   Úexc_typeÚexc_valÚexc_tbs       r%   Ú	__aexit__zLiveKitAPI.__aexit__j   s   è ø€ ð k‰k‹m×Òús   ‚–—)NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   Ústrr   r   r   r&   Úpropertyr   r+   r   r-   r   r/   r   r1   r   r3   r6   r:   r?   r9   r'   r%   r   r      s  „ ñð "Ø!%Ø$(ð	(]ð 48Ø37ò(]àc‰]ð(]ð ˜#‘ð(]ð ˜S‘Mð	(]ð ˜'×/Ñ/Ñ0ð(]ð ˜'×/Ñ/Ñ0ó(]ðT ð$Ð 4ò $ó ð$ð ðkò ó ðð ð˜ò ó ðð ð˜ò ó ðð ðZò ó ðò(òór'   r   )r   r   Úroom_servicer   Úegress_servicer   Úingress_servicer   Úsip_servicer   Úagent_dispatch_servicer   Útypingr	   r   r9   r'   r%   ú<module>rL      s)   ðÛ Û 	Ý %Ý )Ý +Ý #Ý 8Ý ÷cò cr'   