o
    eq                     @   s   d dl mZ d dlZd dlZdd ZG dd deZG dd deZG d	d
 d
eZG dd deZG dd deZ	G dd deZ
G dd deZG dd deZdS )    )AccessTokenGrantNc                    s   t   fdd}|S )zThis is a decorator which can be used to mark functions
    as deprecated. It will result in a warning being emitted
    when the function is used.c                     s>   t dt t jd jtdd t dt  | i |S )NalwayszCall to deprecated function {}.   )category
stackleveldefault)warningssimplefilterDeprecationWarningwarnformat__name__)argskwargsfunc Q/var/www/html/venv/lib/python3.10/site-packages/twilio/jwt/access_token/grants.pynew_func   s   zdeprecated.<locals>.new_func)	functoolswraps)r   r   r   r   r   
deprecated   s   r   c                   @   s2   e Zd ZdZ		d	ddZedd Zdd ZdS )
	ChatGrantzGrant to access Twilio ChatNc                 C      || _ || _|| _|| _d S Nservice_sidendpoint_iddeployment_role_sidpush_credential_sidselfr   r   r   r   r   r   r   __init__   s   
zChatGrant.__init__c                 C      dS )Nchatr   r!   r   r   r   key      zChatGrant.keyc                 C   H   i }| j r
| j |d< | jr| j|d< | jr| j|d< | jr"| j|d< |S Nr   r   r   r   r   r!   grantr   r   r   
to_payload#      



zChatGrant.to_payloadNNNNr   
__module____qualname____doc__r"   propertyr&   r,   r   r   r   r   r      s    

r   c                   @   s6   e Zd ZdZe		d	ddZedd Zdd ZdS )
IpMessagingGrantz#Grant to access Twilio IP MessagingNc                 C   r   r   r   r    r   r   r   r"   4   s   
zIpMessagingGrant.__init__c                 C   r#   )Nip_messagingr   r%   r   r   r   r&   <   r'   zIpMessagingGrant.keyc                 C   r(   r)   r   r*   r   r   r   r,   @   r-   zIpMessagingGrant.to_payloadr.   	r   r0   r1   r2   r   r"   r3   r&   r,   r   r   r   r   r4   1   s    
r4   c                   @   .   e Zd ZdZd	ddZedd Zdd ZdS )
	SyncGrantzGrant to access Twilio SyncNc                 C   s   || _ || _d S r   r   r   )r!   r   r   r   r   r   r"   P   s   
zSyncGrant.__init__c                 C   r#   )N	data_syncr   r%   r   r   r   r&   T   r'   zSyncGrant.keyc                 C   s(   i }| j r
| j |d< | jr| j|d< |S )Nr   r   r9   r*   r   r   r   r,   X   s   

zSyncGrant.to_payload)NNr/   r   r   r   r   r8   N   s    

r8   c                   @   s8   e Zd ZdZ					d	ddZedd Zdd ZdS )

VoiceGrantz)Grant to access Twilio Programmable VoiceNc                 C   s*   || _ 	 || _	 || _	 || _	 || _d S r   incoming_allowoutgoing_application_sidoutgoing_application_paramsr   r   )r!   r=   r>   r?   r   r   r   r   r   r"   d   s   zVoiceGrant.__init__c                 C   r#   )Nvoicer   r%   r   r   r   r&   u   r'   zVoiceGrant.keyc                 C   sv   i }| j du ri |d< d|d d< | jr)i |d< | j|d d< | jr)| j|d d< | jr1| j|d< | jr9| j|d< |S )	NTincomingallowoutgoingapplication_sidparamsr   r   r<   r*   r   r   r   r,   y   s   


zVoiceGrant.to_payload)NNNNNr/   r   r   r   r   r;   b   s    

r;   c                   @   s2   e Zd ZdZed	ddZedd Zdd ZdS )
ConversationsGrantz$Grant to access Twilio ConversationsNc                 C   
   || _ d S r   configuration_profile_sid)r!   rI   r   r   r   r"         
zConversationsGrant.__init__c                 C   r#   )Nrtcr   r%   r   r   r   r&      r'   zConversationsGrant.keyc                 C      i }| j r
| j |d< |S )NrI   rH   r*   r   r   r   r,         
zConversationsGrant.to_payloadr   r6   r   r   r   r   rF      s    
rF   c                   @   r7   )

VideoGrantzGrant to access Twilio VideoNc                 C   rG   r   room)r!   rP   r   r   r   r"      s   
zVideoGrant.__init__c                 C   r#   )Nvideor   r%   r   r   r   r&      r'   zVideoGrant.keyc                 C   rL   )NrP   rO   r*   r   r   r   r,      rM   zVideoGrant.to_payloadr   r/   r   r   r   r   rN      s    

rN   c                   @   r7   )
TaskRouterGrantz!Grant to access Twilio TaskRouterNc                 C   s   || _ || _|| _d S r   workspace_sid
worker_sidrole)r!   rT   rU   rV   r   r   r   r"      s   
zTaskRouterGrant.__init__c                 C   r#   )Ntask_routerr   r%   r   r   r   r&      r'   zTaskRouterGrant.keyc                 C   s8   i }| j r
| j |d< | jr| j|d< | jr| j|d< |S )NrT   rU   rV   rS   r*   r   r   r   r,      s   


zTaskRouterGrant.to_payload)NNNr/   r   r   r   r   rR      s    

rR   c                   @   r7   )
PlaybackGrantz"Grant to access Twilio Live streamNc                 C   s
   || _ dS )zFInitialize a PlaybackGrant with a grant retrieved from the Twilio API.Nr+   r*   r   r   r   r"      rJ   zPlaybackGrant.__init__c                 C   r#   )zReturn the grant's key.playerr   r%   r   r   r   r&      s   zPlaybackGrant.keyc                 C   s   | j S )zReturn the grant.rY   r%   r   r   r   r,      s   zPlaybackGrant.to_payloadr   r/   r   r   r   r   rX      s    

rX   )twilio.jwt.access_tokenr   r   r   r   r   r4   r8   r;   rF   rN   rR   rX   r   r   r   r   <module>   s    -