
    q	h"                     t    S SK JrJrJrJr  S SKJr  SSKJr	  S SK
Jr  \ " S S5      5       r " S S	\5      rg
)    )OptionalDictUnionClassVar)IntEnum   )rpc_pb2)	dataclassc                   B    \ rS rSr% Sr\\S'   \\S'   \\S'   \\S'   Srg)	RpcInvocationData   a  Data passed to method handler for incoming RPC invocations

Attributes:
    request_id (str): The unique request ID. Will match at both sides of the call, useful for debugging or logging.
    caller_identity (str): The unique participant identity of the caller.
    payload (str): The payload of the request. User-definable format, typically JSON.
    response_timeout (float): The maximum time the caller will wait for a response.

request_idcaller_identitypayloadresponse_timeout N)	__name__
__module____qualname____firstlineno____doc__str__annotations__float__static_attributes__r       A/var/www/html/env/lib/python3.13/site-packages/livekit/rtc/rpc.pyr   r      s     OLr   r   c                   Z  ^  \ rS rSr% Sr " S S\5      r\R                  S\R                  S\R                  S\R                  S\R                  S	\R                  S
\R                  S\R                  S\R                  S\R                   S\R"                  S0r\\\\4      \S'    SS\\S4   S\S\\   4U 4S jjjr\S\4S j5       r\S\4S j5       r\S\\   4S j5       r\S\ RB                  SS 4S j5       r"S\ RB                  4S jr#\SSSS\\   SS 4S jj5       r$Sr%U =r&$ ) RpcError&   ak  
Specialized error handling for RPC methods.

Instances of this type, when thrown in a method handler, will have their `message`
serialized and sent across the wire. The caller will receive an equivalent error on the other side.

Built-in errors are included (codes 1001-1999) but developers may use the code, message, and data fields to create their own errors.
c                   @    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrg)RpcError.ErrorCode0   i  i  i  i  i  i  ix  iy  iz  i{  i|  r   N)r   r   r   r   APPLICATION_ERRORCONNECTION_TIMEOUTRESPONSE_TIMEOUTRECIPIENT_DISCONNECTEDRESPONSE_PAYLOAD_TOO_LARGESEND_FAILEDUNSUPPORTED_METHODRECIPIENT_NOT_FOUNDREQUEST_PAYLOAD_TOO_LARGEUNSUPPORTED_SERVERUNSUPPORTED_VERSIONr   r   r   r   	ErrorCoder"   0   sC     !!%%)"!"$(!!"r   r/   z#Application error in method handlerzConnection timeoutzResponse timeoutzRecipient disconnectedzResponse payload too largezFailed to sendz#Method not supported at destinationzRecipient not foundzRequest payload too largezRPC not supported by serverzUnsupported RPC versionErrorMessagecoder"   messagedatac                 H   > [         TU ]  U5        Xl        X l        X0l        g)a  
Creates an error object with the given code and message, plus an optional data payload.

If thrown in an RPC method handler, the error will be sent back to the caller.

Args:
    code (int): Your error code (Error codes 1001-1999 are reserved for built-in errors)
    message (str): A readable error message.
    data (Optional[str]): Optional additional data associated with the error (JSON recommended)
N)super__init___code_message_data)selfr1   r2   r3   	__class__s       r   r6   RpcError.__init__L   s!      	!

r   returnc                     U R                   $ )zoError code value. Codes 1001-1999 are reserved for built-in errors (see RpcError.ErrorCode for their meanings).)r7   r:   s    r   r1   RpcError.codea        zzr   c                     U R                   $ )zA readable error message.)r8   r?   s    r   r2   RpcError.messagef   s     }}r   c                     U R                   $ )zFOptional additional data associated with the error (JSON recommended).)r9   r?   s    r   r3   RpcError.datak   rA   r   protoc                 R    U " UR                   UR                  UR                  5      $ Nr1   r2   r3   )clsrF   s     r   _from_protoRpcError._from_protop   s    5::u}}ejj99r   c                 j    [         R                  " U R                  U R                  U R                  S9$ )NrI   )	proto_rpcr   r1   r2   r3   r?   s    r   	_to_protoRpcError._to_protot   s#    !!tyy$,,TYYWWr   c                 2    U R                   U   nU " XU5      $ rH   )r0   )rJ   r1   r3   r2   s       r   	_built_inRpcError._built_inw   s    ""4(4$''r   )r7   r9   r8   rH   )'r   r   r   r   r   r   r/   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r0   r   r   r   r   r   intr   r6   propertyr1   r2   r3   classmethodrN   r   rK   rO   rR   r   __classcell__)r;   s   @r   r   r   &   s   #G # 	##%J$$&:""$6((*B,,.J/$$&K%%'<++-H$$&C%%'@4L(4	3/0 $ #	C--.  sm	 * c      hsm   :	 2 2 :z : :X9-- X (1 (# (R\ ( (r   r   N)typingr   r   r   r   enumr   _protor	   rN   dataclassesr
   r   	Exceptionr   r   r   r   <module>r]      s=    3 2  ( !    T(y T(r   