o
    i                     @  s~   d dl mZ d dlZd dlmZmZmZmZmZm	Z	m
Z
mZ d dlmZmZ ddlmZ ddlmZ dZ	 G d	d
 d
eZdS )    )annotationsN)DialWhatsAppCallRequestDialWhatsAppCallResponseDisconnectWhatsAppCallRequestDisconnectWhatsAppCallResponseConnectWhatsAppCallRequestConnectWhatsAppCallResponseAcceptWhatsAppCallRequestAcceptWhatsAppCallResponse)ConnectTwilioCallRequestConnectTwilioCallResponse   )Service)VideoGrants	Connectorc                      sT   e Zd ZdZd  fdd	Zd!ddZd"ddZd#ddZd$ddZd%ddZ	  Z
S )&ConnectorServicezClient for LiveKit Connector Service API

    Recommended way to use this service is via `livekit.api.LiveKitAPI`:

    ```python
    from livekit import api
    lkapi = api.LiveKitAPI()
    connector_service = lkapi.connector
    ```
    sessionaiohttp.ClientSessionurlstrapi_key
api_secretc                   s   t  |||| d S )N)super__init__)selfr   r   r   r   	__class__ _/var/www/html/livekit_bhavya/venv/lib/python3.10/site-packages/livekit/api/connector_service.pyr   &   s   zConnectorService.__init__requestr   returnr   c              
     (   | j td|| tddtI dH S )z
        Initiate an outbound WhatsApp call

        Args:
            request: DialWhatsAppCallRequest containing call parameters

        Returns:
            DialWhatsAppCallResponse with the WhatsApp call ID and room name
        DialWhatsAppCallTroom_createN)_clientr   SVC_auth_headerr   r   r   r   r   r   r   dial_whatsapp_call)      
z#ConnectorService.dial_whatsapp_callr   r   c              
     r!   )z
        Disconnect an active WhatsApp call

        Args:
            request: DisconnectWhatsAppCallRequest containing the call ID to disconnect

        Returns:
            DisconnectWhatsAppCallResponse (empty response)
        DisconnectWhatsAppCallTr#   N)r%   r   r&   r'   r   r   r(   r   r   r   disconnect_whatsapp_call=   r*   z)ConnectorService.disconnect_whatsapp_callr   r   c              
     r!   )z
        Connect a WhatsApp call with SDP information

        Args:
            request: ConnectWhatsAppCallRequest containing call ID and SDP

        Returns:
            ConnectWhatsAppCallResponse (empty response)
        ConnectWhatsAppCallTr#   N)r%   r   r&   r'   r   r   r(   r   r   r   connect_whatsapp_callQ   r*   z&ConnectorService.connect_whatsapp_callr	   r
   c              
     r!   )z
        Accept an inbound WhatsApp call

        Args:
            request: AcceptWhatsAppCallRequest containing call parameters and SDP

        Returns:
            AcceptWhatsAppCallResponse with the room name
        AcceptWhatsAppCallTr#   N)r%   r   r&   r'   r   r
   r(   r   r   r   accept_whatsapp_calle   r*   z%ConnectorService.accept_whatsapp_callr   r   c              
     r!   )z
        Connect a Twilio call to a LiveKit room

        Args:
            request: ConnectTwilioCallRequest containing call parameters

        Returns:
            ConnectTwilioCallResponse with the websocket URL for Twilio media stream
        ConnectTwilioCallTr#   N)r%   r   r&   r'   r   r   r(   r   r   r   connect_twilio_cally   r*   z$ConnectorService.connect_twilio_call)r   r   r   r   r   r   r   r   )r   r   r    r   )r   r   r    r   )r   r   r    r   )r   r	   r    r
   )r   r   r    r   )__name__
__module____qualname____doc__r   r)   r,   r.   r0   r2   __classcell__r   r   r   r   r      s    



r   )
__future__r   aiohttp#livekit.protocol.connector_whatsappr   r   r   r   r   r   r	   r
   !livekit.protocol.connector_twilior   r   _servicer   access_tokenr   r&   r   r   r   r   r   <module>   s    (
