
    g^                     &    S SK Jr   " S S\5      rg)    )Jwtc                      ^  \ rS rSrSrSrSrSrU 4S jr\	S 5       r
\	S 5       r\	S	 5       rS
 rS rS rS rS rS rSS jrS rSS jrS rS rSrU =r$ )TaskRouterCapabilityToken   v1zhttps://taskrouter.twilio.comz-https://event-bridge.twilio.com/v1/wschannelsHS256c                 H  > [         [        U ]  UUU R                  UR	                  S[
        R                  5      UR	                  SS5      UR	                  SS5      S9  U R                  XU5        Xl        X l	        X0l
        X@l        / U l        UR	                  SS5      (       a  U R                  5         UR	                  S	S5      (       a  U R                  5         UR	                  S
S5      (       a  U R                  5         UR	                  SS5      (       a  U R!                  5         UR	                  SS5      (       a  U R#                  5         UR	                  SS5      (       a  U R%                  5         UR	                  SS5      (       a  U R'                  5         gg)a\  
:param str account_sid: Twilio account sid
:param str auth_token: Twilio auth token used to sign the JWT
:param str workspace_sid: TaskRouter workspace sid
:param str channel_id: TaskRouter channel sid
:param kwargs:
    :param bool allow_web_sockets: shortcut to calling allow_web_sockets, defaults to True
    :param bool allow_fetch_self: shortcut to calling allow_fetch_self, defaults to True
    :param bool allow_update_self: shortcut to calling allow_update_self, defaults to False
    :param bool allow_delete_self: shortcut to calling allow_delete_self, defaults to False
    :param bool allow_fetch_subresources: shortcut to calling allow_fetch_subresources,
                                          defaults to False
    :param bool allow_update_subresources: shortcut to calling allow_update_subresources,
                                           defaults to False
    :param bool allow_delete_subresources: shortcut to calling allow_delete_subresources,
                                           defaults to False
:returns a new TaskRouterCapabilityToken with capabilities set depending on kwargs.
nbfttli  valid_untilN)
secret_keyissuer	algorithmr
   r   r   allow_web_socketsTallow_fetch_selfallow_update_selfFallow_delete_selfallow_fetch_subresourcesallow_delete_subresourcesallow_update_subresources)superr   __init__	ALGORITHMgetr   GENERATE_validate_inputsaccount_sid
auth_tokenworkspace_sid
channel_idpoliciesr   r   r   r   r   r   r   )selfr   r   r   r    kwargs	__class__s         f/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/twilio/jwt/taskrouter/__init__.pyr   "TaskRouterCapabilityToken.__init__
   s[   & 	'7!nn

5#,,/

5$'

=$7 	8 	
 	k*E&$*$::)400""$::($//!!#::)511""$::)511""$::0%88))+::1599**,::1599**, :    c                 d    SR                  U R                  U R                  U R                  5      $ )Nz{}/{}/Workspaces/{})formatDOMAINVERSIONr   r"   s    r%   workspace_url'TaskRouterCapabilityToken.workspace_url=   s*    $++KKt'9'9
 	
r'   c                     [        S5      e)Nz,Subclass must set its specific resource_url.NotImplementedErrorr,   s    r%   resource_url&TaskRouterCapabilityToken.resource_urlC   s    !"PQQr'   c                     [        S5      e)Nz5Subclass must set its specific channel_id sid prefix.r0   r,   s    r%   channel_prefix(TaskRouterCapabilityToken.channel_prefixG   s    !C
 	
r'   c                 >    U R                  U R                  SS5        g )NGETT_make_policyr2   r,   s    r%   r   *TaskRouterCapabilityToken.allow_fetch_selfM   s    $++UD9r'   c                 >    U R                  U R                  SS5        g )NPOSTTr9   r,   s    r%   r   +TaskRouterCapabilityToken.allow_update_selfP   s    $++VT:r'   c                 >    U R                  U R                  SS5        g )NDELETETr9   r,   s    r%   r   +TaskRouterCapabilityToken.allow_delete_selfS   s    $++Xt<r'   c                 D    U R                  U R                  S-   SS5        g )N/**r8   Tr9   r,   s    r%   r   2TaskRouterCapabilityToken.allow_fetch_subresourcesV   s    $++e3UDAr'   c                 D    U R                  U R                  S-   SS5        g )NrC   r=   Tr9   r,   s    r%   r   3TaskRouterCapabilityToken.allow_update_subresourcesY   s    $++e3VTBr'   c                 D    U R                  U R                  S-   SS5        g )NrC   r@   Tr9   r,   s    r%   r   3TaskRouterCapabilityToken.allow_delete_subresources\   s    $++e3XtDr'   c                     U=(       d    U R                   nSR                  U R                  U R                  U5      nU R	                  USS5        U R	                  USS5        g )Nz{}/{}/{}r8   Tr=   )r    r)   EVENTS_BASE_URLr   r:   )r"   r    web_socket_urls      r%   r   +TaskRouterCapabilityToken.allow_web_sockets_   sY    24??
#**  $"2"2J
 	.%6.&$7r'   c                 P   U R                   U R                  U R                  U R                  U R                  U R                  S.nU R                  R                  S5      (       a  U R                  US'   U$ U R                  R                  S5      (       a  U R                  US'   U$ )N)r   r   channelversionfriendly_namer!   WK
worker_sidWQtaskqueue_sid)r   r   r    r+   r!   
startswith)r"   payloads     r%   _generate_payload+TaskRouterCapabilityToken._generate_payloadg   s    ++!//||!__
 ??%%d++$(OOGL!  __''--'+GO$r'   c                     U R                   R                  UUR                  5       UU=(       d    0 U=(       d    0 S.5        g )N)urlmethodallowquery_filterpost_filter)r!   appendupper)r"   rZ   r[   allowedr]   r^   s         r%   r:   &TaskRouterCapabilityToken._make_policyx   s8     ,,.  , 2*0b	
r'   c                 b   U(       a  UR                  S5      (       d  [        SR                  U5      5      eU(       a  UR                  S5      (       d  [        SR                  U5      5      eU(       a   UR                  U R                  5      (       d  [        SR                  U5      5      eg )NACzInvalid account sid provided {}WSz!Invalid workspace sid provided {}zInvalid channel id provided {})rU   
ValueErrorr)   r5   )r"   r   r   r    s       r%   r   *TaskRouterCapabilityToken._validate_inputs   s    +"8"8">">>EEkRSSM$<$<T$B$B@GGVWW!6!6t7J7J!K!K=DDZPQQ "Lr'   c                 @    SR                  U R                  5       5      $ )Nz<TaskRouterCapabilityToken {}>)r)   to_jwtr,   s    r%   __str__!TaskRouterCapabilityToken.__str__   s    /66t{{}EEr'   )r   r   r    r!   r   )N)NN)__name__
__module____qualname____firstlineno__r+   r*   rJ   r   r   propertyr-   r2   r5   r   r   r   r   r   r   r   rW   r:   r   rj   __static_attributes____classcell__)r$   s   @r%   r   r      s    G,FEOI1-f 
 

 R R 
 

:;=BCE8"	
RF Fr'   r   N)
twilio.jwtr   r    r'   r%   <module>ru      s    JF JFr'   