o
    f>h&                     @   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
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                   @   s6   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   s   || _ || _|| _|| _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   sH   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,   s   



zChatGrant.to_payload)NNNNr   
__module____qualname____doc__r    propertyr$   r(   r   r   r   r   r      s    

r   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    =   s   
zSyncGrant.__init__c                 C   r!   )N	data_syncr   r#   r   r   r   r$   A   r%   zSyncGrant.keyc                 C   s(   i }| j r
| j |d< | jr| j|d< |S )Nr   r   r0   r&   r   r   r   r(   E   s   

zSyncGrant.to_payload)NNr)   r   r   r   r   r/   :   s    

r/   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   r4   r5   r6   r   r   r   r   r   r    R   s   zVoiceGrant.__init__c                 C   r!   )Nvoicer   r#   r   r   r   r$   e   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   r3   r&   r   r   r   r(   i   s   


zVoiceGrant.to_payload)NNNNNr)   r   r   r   r   r2   O   s    

r2   c                   @   r.   )

VideoGrantzGrant to access Twilio VideoNc                 C   s
   || _ d S r   room)r   r?   r   r   r   r       s   
zVideoGrant.__init__c                 C   r!   )Nvideor   r#   r   r   r   r$      r%   zVideoGrant.keyc                 C   s   i }| j r
| j |d< |S )Nr?   r>   r&   r   r   r   r(      s   
zVideoGrant.to_payloadr   r)   r   r   r   r   r=      s    

r=   c                   @   r.   )
TaskRouterGrantz!Grant to access Twilio TaskRouterNc                 C   s   || _ || _|| _d S r   workspace_sid
worker_sidrole)r   rC   rD   rE   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 )NrC   rD   rE   rB   r&   r   r   r   r(      s   


zTaskRouterGrant.to_payload)NNNr)   r   r   r   r   rA      s    

rA   c                   @   r.   )
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       s   
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.rH   r#   r   r   r   r(      s   zPlaybackGrant.to_payloadr   r)   r   r   r   r   rG      s    

rG   )twilio.jwt.access_tokenr   r   r   r   r   r/   r2   r=   rA   rG   r   r   r   r   <module>   s    !0