o
    eG                     @   s   d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlm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 )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)	serialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd Z fddZdddZdddZejejejfdd	Zd
d Z	ejejejejejejfddZ
dd Zdd Zdd Z  ZS )WebhookListc                    s2   t t| | d|i| _djdi | j| _dS )ad  
        Initialize the WebhookList

        :param Version version: Version that contains the resource
        :param conversation_sid: The unique ID of the Conversation for this webhook.

        :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookList
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookList
        conversation_sidz*/Conversations/{conversation_sid}/WebhooksN )superr	   __init__	_solutionformat_uri)selfversionr
   	__class__r   d/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/conversation/webhook.pyr      s   

zWebhookList.__init__Nc                 C   s0   | j ||}| j|d d}| j ||d S )a  
        Streams WebhookInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int page_size: Number of records to fetch per request, when not set will use
                              the default value of 50 records.  If no page_size is defined
                              but a limit is defined, stream() will attempt to read the
                              limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        :rtype: list[twilio.rest.conversations.v1.conversation.webhook.WebhookInstance]
        	page_size)r   limit)_versionread_limitspagestream)r   r   r   limitsr   r   r   r   r   $   s   zWebhookList.streamc                 C   s   t | j||dS )am  
        Lists WebhookInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int page_size: Number of records to fetch per request, when not set will use
                              the default value of 50 records.  If no page_size is defined
                              but a limit is defined, list() will attempt to read the limit
                              with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        :rtype: list[twilio.rest.conversations.v1.conversation.webhook.WebhookInstance]
        )r   r   )listr   )r   r   r   r   r   r   r   ;   s   zWebhookList.listc                 C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of WebhookInstance records from the API.
        Request is executed immediately

        :param str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of WebhookInstance
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookPage
        )	PageTokenr   PageSizeGET)methoduriparams)r   ofr   r   r   WebhookPager   )r   
page_tokenpage_numberr   dataresponser   r   r   r   M   s   zWebhookList.pagec                 C   s"   | j jjd|}t| j || jS )aE  
        Retrieve a specific page of WebhookInstance records from the API.
        Request is executed immediately

        :param str target_url: API-generated URL for the requested results page

        :returns: Page of WebhookInstance
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookPage
        r    )r   domaintwiliorequestr%   r   )r   
target_urlr)   r   r   r   get_page`   s
   

zWebhookList.get_pagec           
      C   s\   t |||t|dd t|dd ||d}| jjd| j|d}	t| j|	| jd dS )	a  
        Create the WebhookInstance

        :param WebhookInstance.Target target: The target of this webhook.
        :param unicode configuration_url: The absolute url the webhook request should be sent to.
        :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request.
        :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation.
        :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation.
        :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to.
        :param unicode configuration_replay_after: The message index for which and it's successors the webhook will be replayed.

        :returns: The created WebhookInstance
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance
        c                 S      | S Nr   er   r   r   <lambda>       z$WebhookList.create.<locals>.<lambda>c                 S   r/   r0   r   r1   r   r   r   r3      r4   )TargetConfiguration.UrlConfiguration.MethodConfiguration.FiltersConfiguration.TriggersConfiguration.FlowSidzConfiguration.ReplayAfterPOSTr!   r"   r(   r
   r
   )	r   r$   r   mapr   creater   WebhookInstancer   )
r   targetconfiguration_urlconfiguration_methodconfiguration_filtersconfiguration_triggersconfiguration_flow_sidconfiguration_replay_afterr(   payloadr   r   r   r?   q   s   
zWebhookList.createc                 C      t | j| jd |dS a%  
        Constructs a WebhookContext

        :param sid: A 34 character string that uniquely identifies this resource.

        :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookContext
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookContext
        r
   r
   sidWebhookContextr   r   r   rL   r   r   r   get      	zWebhookList.getc                 C   rI   rJ   rM   rO   r   r   r   __call__   rQ   zWebhookList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z%<Twilio.Conversations.V1.WebhookList>r   r   r   r   r   __repr__      zWebhookList.__repr__)NN)__name__
__module____qualname__r   r   r   r   unsetr   r.   r?   rP   rR   rV   __classcell__r   r   r   r   r	      s$    



"r	   c                       s,   e Zd Z fddZdd Zdd Z  ZS )r%   c                    s   t t| || || _dS )a  
        Initialize the WebhookPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param conversation_sid: The unique ID of the Conversation for this webhook.

        :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookPage
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookPage
        N)r   r%   r   r   )r   r   r)   solutionr   r   r   r      s   
zWebhookPage.__init__c                 C   s   t | j|| jd dS )a  
        Build an instance of WebhookInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance
        r
   r=   )r@   r   r   r   rH   r   r   r   get_instance   rQ   zWebhookPage.get_instancec                 C   rS   )rT   z%<Twilio.Conversations.V1.WebhookPage>r   rU   r   r   r   rV      rW   zWebhookPage.__repr__)rX   rY   rZ   r   r_   rV   r\   r   r   r   r   r%      s    r%   c                       sR   e Zd Z fddZdd ZejejejejejfddZdd Zd	d
 Z	  Z
S )rN   c                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the WebhookContext

        :param Version version: Version that contains the resource
        :param conversation_sid: The unique ID of the Conversation for this webhook.
        :param sid: A 34 character string that uniquely identifies this resource.

        :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookContext
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookContext
        rK   z0/Conversations/{conversation_sid}/Webhooks/{sid}Nr   )r   rN   r   r   r   r   )r   r   r
   rL   r   r   r   r      s   zWebhookContext.__init__c                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the WebhookInstance

        :returns: The fetched WebhookInstance
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance
        r    r!   r"   r
   rL   rK   )r   fetchr   r@   r   r^   r   r   r   rb      s   zWebhookContext.fetchc              
   C   s`   t ||t|dd t|dd |d}| jjd| j|d}t| j|| jd | jd d	S )
  
        Update the WebhookInstance

        :param unicode configuration_url: The absolute url the webhook request should be sent to.
        :param WebhookInstance.Method configuration_method: The HTTP method to be used when sending a webhook request.
        :param list[unicode] configuration_filters: The list of events, firing webhook event for this Conversation.
        :param list[unicode] configuration_triggers: The list of keywords, firing webhook event for this Conversation.
        :param unicode configuration_flow_sid: The studio flow SID, where the webhook should be sent to.

        :returns: The updated WebhookInstance
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance
        c                 S   r/   r0   r   r1   r   r   r   r3     r4   z'WebhookContext.update.<locals>.<lambda>c                 S   r/   r0   r   r1   r   r   r   r3     r4   )r6   r7   r8   r9   r:   r;   r<   r
   rL   rK   )	r   r$   r   r>   r   updater   r@   r   )r   rB   rC   rD   rE   rF   r(   rH   r   r   r   rd      s   zWebhookContext.updatec                 C   s   | j jd| jdS )~
        Deletes the WebhookInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETEra   )r   deleter   rU   r   r   r   rg     s   zWebhookContext.deletec                 C   $   d dd | j D }d|S )rT    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>/      z*WebhookContext.__repr__.<locals>.<genexpr>z+<Twilio.Conversations.V1.WebhookContext {}>joinr   itemsr   r   contextr   r   r   rV   (     
zWebhookContext.__repr__)rX   rY   rZ   r   rb   r   r[   rd   rg   rV   r\   r   r   r   r   rN      s    
"	rN   c                       s   e Zd ZG dd deZG dd deZd" fdd	Zedd	 Zed
d Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zdd ZejejejejejfddZdd Zd d! Z  ZS )#r@   c                   @   s   e Zd ZdZdZdZdS )zWebhookInstance.TargetwebhooktriggerstudioN)rX   rY   rZ   WEBHOOKTRIGGERSTUDIOr   r   r   r   r5   5  s    r5   c                   @   s   e Zd ZdZdZdS )zWebhookInstance.Methodr    r;   N)rX   rY   rZ   r    r;   r   r   r   r   Method:  s    r   Nc                    s   t t| | |d|d|d|d|d|dt|dt|dd	| _d
| _||p<| jd d| _d
S )z
        Initialize the WebhookInstance

        :returns: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookInstance
        rL   account_sidr
   rA   urlconfigurationdate_createddate_updated)rL   r   r
   rA   r   r   r   r   NrK   )	r   r@   r   rP   r   iso8601_datetime_properties_contextr   )r   r   rH   r
   rL   r   r   r   r   >  s   zWebhookInstance.__init__c                 C   s.   | j du rt| j| jd | jd d| _ | j S )a;  
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: WebhookContext for this WebhookInstance
        :rtype: twilio.rest.conversations.v1.conversation.webhook.WebhookContext
        Nr
   rL   rK   )r   rN   r   r   rU   r   r   r   _proxyW  s   
	zWebhookInstance._proxyc                 C   
   | j d S )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rL   r   rU   r   r   r   rL   h     
zWebhookInstance.sidc                 C   r   )zs
        :returns: The unique ID of the Account responsible for this conversation.
        :rtype: unicode
        r   r   rU   r   r   r   r   p  r   zWebhookInstance.account_sidc                 C   r   )zg
        :returns: The unique ID of the Conversation for this webhook.
        :rtype: unicode
        r
   r   rU   r   r   r   r
   x  r   z WebhookInstance.conversation_sidc                 C   r   )zO
        :returns: The target of this webhook.
        :rtype: unicode
        rA   r   rU   r   r   r   rA     r   zWebhookInstance.targetc                 C   r   )zU
        :returns: An absolute URL for this webhook.
        :rtype: unicode
        r   r   rU   r   r   r   r     r   zWebhookInstance.urlc                 C   r   )zS
        :returns: The configuration of this webhook.
        :rtype: dict
        r   r   rU   r   r   r   r     r   zWebhookInstance.configurationc                 C   r   )z]
        :returns: The date that this resource was created.
        :rtype: datetime
        r   r   rU   r   r   r   r     r   zWebhookInstance.date_createdc                 C   r   )zb
        :returns: The date that this resource was last updated.
        :rtype: datetime
        r   r   rU   r   r   r   r     r   zWebhookInstance.date_updatedc                 C   
   | j  S )r`   )r   rb   rU   r   r   r   rb        
zWebhookInstance.fetchc                 C   s   | j j|||||dS )rc   )rB   rC   rD   rE   rF   )r   rd   )r   rB   rC   rD   rE   rF   r   r   r   rd     s   zWebhookInstance.updatec                 C   r   )re   )r   rg   rU   r   r   r   rg     r   zWebhookInstance.deletec                 C   rh   )rT   ri   c                 s   rj   rk   rl   rm   r   r   r   rq     rr   z+WebhookInstance.__repr__.<locals>.<genexpr>z,<Twilio.Conversations.V1.WebhookInstance {}>rs   rv   r   r   r   rV     rx   zWebhookInstance.__repr__r0   )rX   rY   rZ   objectr5   r   r   propertyr   rL   r   r
   rA   r   r   r   r   rb   r   r[   rd   rg   rV   r\   r   r   r   r   r@   3  s>    








	
	r@   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r%   rN   r@   r   r   r   r   <module>   s    "'Y