
    i              
           d dl Z d dlmZ d dlmZmZ  G d dej                  Zdej        de	de
e	         d	e j        e	ef         fd
Zdej        de	de
e	         d	e j        e	ef         fdZdS )    N)urljoin)
client_libtypesc                       e Zd ZU eed<   dS )_TokenResponsejwtN)__name__
__module____qualname__str__annotations__     n/root/projects/qq-shell/venv/lib/python3.11/site-packages/inngest/experimental/realtime/subscription_tokens.pyr   r      s         	HHHHHr   r   clientchanneltopicsreturnc                 L  K   g }|D ]}|                     ||dd           | j                            t          | j        d          |           d{V }t          |t                    r|t                              |	                                          }|||j
        dS )z
    Create a subscription token for a given channel and topics.
    The token can be used by a client to subscribe to realtime events,
    including front-end applications using the @inngest/realtime npm package.
    runr   namekind/v1/realtime/tokenurlbodyNr   r   key)append_http_clientpostr   _api_origin
isinstance	Exceptionr   model_validatejsonr   r   r   r   datatopicresresponse_datas          r   get_subscription_tokenr-      s       D 
 
" 	
 	
 	
 	
 #((F&(<== )        C #y!! 	"11#((**==M    r   c                 <   g }|D ]}|                     ||dd           | j                            t          | j        d          |          }t          |t                    r|t                              |	                                          }|||j
        dS )z
    Create a subscription token for a given channel and topics synchronously.
    The token can be used by a client to subscribe to realtime events,
    including front-end applications using the @inngest/realtime npm package.
    r   r   r   r   r   )r    r!   	post_syncr   r#   r$   r%   r   r&   r'   r   r(   s          r   get_subscription_token_syncr0   0   s     D 
 
" 	
 	
 	
 	
 

'
'F&(<== (  C #y!! 	"11#((**==M    r   )typingurllib.parser   inngest._internalr   r   	BaseModelr   Inngestr   listMappingobjectr-   r0   r   r   r   <module>r9      s                / / / / / / / /    U_   """ I" ^CK 	" " " "J""" I" ^CK 	" " " " " "r   