o
    iV                     @  s   d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
mZmZmZ ddlZddlZddlZddlmZ eG dd	 d	ZeG d
d dZeG dd dZeG dd dZeG dd dZeG dd dZedejjjdZG dd dZdS )zoRPC client using SDK Core. (unstable)

Nothing in this module should be considered stable. The API may change.
    )annotations)	dataclass)	timedelta)MappingOptionalTupleTypeTypeVarUnionN)RPCErrorc                   @  s2   e Zd ZU dZded< ded< ded< ded< dS )	ClientTlsConfigz=Python representation of the Rust struct for configuring TLS.zOptional[bytes]server_root_ca_certOptional[str]domainclient_certclient_private_keyN__name__
__module____qualname____doc____annotations__ r   r   ^/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/temporalio/bridge/client.pyr      s   
 r   c                   @  sB   e Zd ZU dZded< ded< ded< ded< ded	< ded
< dS )ClientRetryConfigz?Python representation of the Rust struct for configuring retry.intinitial_interval_millisfloatrandomization_factor
multipliermax_interval_millisOptional[int]max_elapsed_time_millismax_retriesNr   r   r   r   r   r      s   
 r   c                   @  s"   e Zd ZU dZded< ded< dS )ClientKeepAliveConfigzDPython representation of the Rust struct for configuring keep alive.r   interval_millistimeout_millisNr   r   r   r   r   r$   )      
 r$   c                   @  s"   e Zd ZU dZded< ded< dS )ClientHttpConnectProxyConfigzDPython representation of the Rust struct for configuring HTTP proxy.strtarget_hostzOptional[Tuple[str, str]]
basic_authNr   r   r   r   r   r(   1   r'   r(   c                   @  sb   e Zd ZU dZded< ded< ded< ded< d	ed
< ded< ded< ded< ded< ded< dS )ClientConfigzDPython representation of the Rust struct for configuring the client.r)   
target_urlMapping[str, Union[str, bytes]]metadatar   api_keyidentityzOptional[ClientTlsConfig]
tls_configzOptional[ClientRetryConfig]retry_configzOptional[ClientKeepAliveConfig]keep_alive_configclient_nameclient_versionz&Optional[ClientHttpConnectProxyConfig]http_connect_proxy_configNr   r   r   r   r   r,   9   s   
 r,   c                   @  s:   e Zd ZU dZded< ded< ded< ded	< d
ed< dS )RpcCallz9Python representation of the Rust struct for an RPC call.r)   rpcbytesreqboolretryr.   r/   r!   r&   Nr   r   r   r   r   r8   I   s   
 r8   ProtoMessage)boundc                   @  sF   e Zd ZdZed%ddZd&ddZd'ddZd(ddZd)d"d#Z	d$S )*ClientzRPC client using SDK Core.runtime!temporalio.bridge.runtime.Runtimeconfigr,   returnc                   s    t | tjj| j|I dH S )z!Establish connection with server.N)r@   
temporaliobridgetemporal_sdk_bridgeconnect_client_ref)rA   rC   r   r   r   connectZ   s   zClient.connectref/temporalio.bridge.temporal_sdk_bridge.ClientRefc                 C  s   || _ || _dS )z5Initialize client with underlying SDK Core reference.N)_runtimerI   )selfrA   rK   r   r   r   __init__f   s   
zClient.__init__r/   r.   Nonec                 C     | j | dS )z*Update underlying metadata on Core client.N)rI   update_metadata)rN   r/   r   r   r   rR   o      zClient.update_metadatar0   r   c                 C  rQ   )z)Update underlying API key on Core client.N)rI   update_api_key)rN   r0   r   r   r   rT   s   rS   zClient.update_api_keyservicer)   r9   r;   google.protobuf.message.Message	resp_typeType[ProtoMessage]r=   r<   timeoutOptional[timedelta]r>   c                  s   |rt | d nd}t|| |||}	|dkr"| j|	}
n3|dkr-| j|	}
n(|dkr8| j|	}
n|dkrC| j|	}
n|dkrN| j	|	}
nt
d| | }||
I dH  |S )	zMake RPC call using SDK Core.i  NworkflowoperatorcloudtesthealthzUnrecognized service )roundtotal_secondsr8   SerializeToStringrI   call_workflow_servicecall_operator_servicecall_cloud_servicecall_test_servicecall_health_service
ValueErrorParseFromString)rN   rU   r9   r;   rW   r=   r/   rY   r&   callresp_futrespr   r   r   rj   w   s"   zClient.callN)rA   rB   rC   r,   rD   r@   )rA   rB   rK   rL   )r/   r.   rD   rP   )r0   r   rD   rP   )rU   r)   r9   r)   r;   rV   rW   rX   r=   r<   r/   r.   rY   rZ   rD   r>   )
r   r   r   r   staticmethodrJ   rO   rR   rT   rj   r   r   r   r   r@   W   s    

	
r@   )r   
__future__r   dataclassesr   datetimer   typingr   r   r   r   r	   r
   google.protobuf.messagegoogletemporalio.bridge.runtimerE   %temporalio.bridge.temporal_sdk_bridger   r   r   r$   r(   r,   r8   protobufmessageMessager>   r@   r   r   r   r   <module>   s.     	
