o
    eM                     @   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ejejejejejej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
dd Zdd Zdd Z  ZS )WebhookListc                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the WebhookList

        :param Version version: Version that contains the resource
        :param chat_service_sid: The SID of the Conversation Service that the resource is associated with.
        :param conversation_sid: The unique ID of the Conversation for this webhook.

        :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookList
        :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookList
        chat_service_sidconversation_sidzF/Services/{chat_service_sid}/Conversations/{conversation_sid}/WebhooksN )superr	   __init__	_solutionformat_uri)selfversionr   r   	__class__r   l/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/service/conversation/webhook.pyr      s   zWebhookList.__init__c           
      C   sd   t |||t|dd t|dd ||d}| jjd| j|d}	t| j|	| jd | 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.service.conversation.webhook.WebhookInstance
        c                 S      | S Nr   er   r   r   <lambda>=       z$WebhookList.create.<locals>.<lambda>c                 S   r   r   r   r   r   r   r   r   >   r   )TargetConfiguration.UrlConfiguration.MethodConfiguration.FiltersConfiguration.TriggersConfiguration.FlowSidzConfiguration.ReplayAfterPOSTmethoduridatar   r   r
   )	r   ofr   map_versioncreater   WebhookInstancer   )
r   targetconfiguration_urlconfiguration_methodconfiguration_filtersconfiguration_triggersconfiguration_flow_sidconfiguration_replay_afterr(   payloadr   r   r   r,   %   s    
zWebhookList.createNc                 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.service.conversation.webhook.WebhookInstance]
        	page_size)r6   limit)r+   read_limitspagestream)r   r7   r6   limitsr9   r   r   r   r:   L   s   zWebhookList.streamc                 C   s   t | j||dS )au  
        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.service.conversation.webhook.WebhookInstance]
        )r7   r6   )listr:   )r   r7   r6   r   r   r   r<   c   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.service.conversation.webhook.WebhookPage
        )	PageTokenr   PageSizeGET)r&   r'   params)r   r)   r+   r9   r   WebhookPager   )r   
page_tokenpage_numberr6   r(   responser   r   r   r9   u   s   zWebhookList.pagec                 C   s"   | j jjd|}t| j || jS )aM  
        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.service.conversation.webhook.WebhookPage
        r?   )r+   domaintwiliorequestrA   r   )r   
target_urlrD   r   r   r   get_page   s
   

zWebhookList.get_pagec                 C      t | j| jd | jd |dS a5  
        Constructs a WebhookContext

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

        :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext
        :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext
        r   r   r   r   sidWebhookContextr+   r   r   rM   r   r   r   get      	zWebhookList.getc                 C   rJ   rK   rN   rP   r   r   r   __call__   rR   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   unsetr,   r:   r<   r9   rI   rQ   rS   rW   __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 )rA   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 chat_service_sid: The SID of the Conversation Service that the resource is associated with.
        :param conversation_sid: The unique ID of the Conversation for this webhook.

        :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookPage
        :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookPage
        N)r   rA   r   r   )r   r   rD   solutionr   r   r   r      s   
zWebhookPage.__init__c                 C   s   t | j|| jd | jd dS )a)  
        Build an instance of WebhookInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance
        :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance
        r   r   r
   )r-   r+   r   r   r5   r   r   r   get_instance   s   	zWebhookPage.get_instancec                 C   rT   )rU   z%<Twilio.Conversations.V1.WebhookPage>r   rV   r   r   r   rW      rX   zWebhookPage.__repr__)rY   rZ   r[   r   r`   rW   r]   r   r   r   r   rA      s    rA   c                       sR   e Zd Z fddZ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 )rO   c                    s6   t t| | |||d| _djdi | j| _dS )a:  
        Initialize the WebhookContext

        :param Version version: Version that contains the resource
        :param chat_service_sid: The SID of the Conversation Service that the resource is associated with.
        :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.service.conversation.webhook.WebhookContext
        :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookContext
        rL   zL/Services/{chat_service_sid}/Conversations/{conversation_sid}/Webhooks/{sid}Nr   )r   rO   r   r   r   r   )r   r   r   r   rM   r   r   r   r      s   zWebhookContext.__init__c              
   C   sh   t ||t|dd t|dd |d}| jjd| j|d}t| j|| jd | 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.service.conversation.webhook.WebhookInstance
        c                 S   r   r   r   r   r   r   r   r     r   z'WebhookContext.update.<locals>.<lambda>c                 S   r   r   r   r   r   r   r   r     r   )r   r    r!   r"   r#   r$   r%   r   r   rM   rL   )	r   r)   r   r*   r+   updater   r-   r   )r   r/   r0   r1   r2   r3   r(   r5   r   r   r   rb     s   zWebhookContext.updatec                 C   s   | j jd| jdS )~
        Deletes the WebhookInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETEr&   r'   )r+   deleter   rV   r   r   r   rf   +  s   zWebhookContext.deletec                 C   s8   | j jd| jd}t| j || jd | jd | jd dS )
        Fetch the WebhookInstance

        :returns: The fetched WebhookInstance
        :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance
        r?   re   r   r   rM   rL   )r+   fetchr   r-   r   r_   r   r   r   rh   4  s   zWebhookContext.fetchc                 C   $   d dd | j D }d|S )rU    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>L      z*WebhookContext.__repr__.<locals>.<genexpr>z+<Twilio.Conversations.V1.WebhookContext {}>joinr   itemsr   r   contextr   r   r   rW   E     
zWebhookContext.__repr__)rY   rZ   r[   r   r   r\   rb   rf   rh   rW   r]   r   r   r   r   rO      s    
#	rO   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edd Z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 )%r-   c                   @   s   e Zd ZdZdZdZdS )zWebhookInstance.TargetwebhooktriggerstudioN)rY   rZ   r[   WEBHOOKTRIGGERSTUDIOr   r   r   r   r   R  s    r   c                   @   s   e Zd ZdZdZdS )zWebhookInstance.Methodr?   r$   N)rY   rZ   r[   r?   r$   r   r   r   r   MethodW  s    r   Nc                    s   t t| | |d|d|d|d|d|d|dt|dt|d	d
	| _d| _|||pA| jd d| _dS )z
        Initialize the WebhookInstance

        :returns: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance
        :rtype: twilio.rest.conversations.v1.service.conversation.webhook.WebhookInstance
        rM   account_sidr   r   r.   urlconfigurationdate_createddate_updated)	rM   r   r   r   r.   r   r   r   r   NrL   )	r   r-   r   rQ   r   iso8601_datetime_properties_contextr   )r   r   r5   r   r   rM   r   r   r   r   [  s    zWebhookInstance.__init__c                 C   s6   | j du rt| j| jd | jd | jd d| _ | j S )aC  
        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.service.conversation.webhook.WebhookContext
        Nr   r   rM   rL   )r   rO   r+   r   rV   r   r   r   _proxyz  s   
	zWebhookInstance._proxyc                 C   
   | j d S )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rM   r   rV   r   r   r   rM        
zWebhookInstance.sidc                 C   r   )zs
        :returns: The unique ID of the Account responsible for this conversation.
        :rtype: unicode
        r   r   rV   r   r   r   r     r   zWebhookInstance.account_sidc                 C   r   )z}
        :returns: The SID of the Conversation Service that the resource is associated with.
        :rtype: unicode
        r   r   rV   r   r   r   r     r   z WebhookInstance.chat_service_sidc                 C   r   )zg
        :returns: The unique ID of the Conversation for this webhook.
        :rtype: unicode
        r   r   rV   r   r   r   r     r   z WebhookInstance.conversation_sidc                 C   r   )zO
        :returns: The target of this webhook.
        :rtype: unicode
        r.   r   rV   r   r   r   r.     r   zWebhookInstance.targetc                 C   r   )zU
        :returns: An absolute URL for this webhook.
        :rtype: unicode
        r   r   rV   r   r   r   r     r   zWebhookInstance.urlc                 C   r   )zS
        :returns: The configuration of this webhook.
        :rtype: dict
        r   r   rV   r   r   r   r     r   zWebhookInstance.configurationc                 C   r   )z]
        :returns: The date that this resource was created.
        :rtype: datetime
        r   r   rV   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   rV   r   r   r   r     r   zWebhookInstance.date_updatedc                 C   s   | j j|||||dS )ra   )r/   r0   r1   r2   r3   )r   rb   )r   r/   r0   r1   r2   r3   r   r   r   rb     s   zWebhookInstance.updatec                 C   
   | j  S )rc   )r   rf   rV   r   r   r   rf        
zWebhookInstance.deletec                 C   r   )rg   )r   rh   rV   r   r   r   rh     r   zWebhookInstance.fetchc                 C   ri   )rU   rj   c                 s   rk   rl   rm   rn   r   r   r   rr     rs   z+WebhookInstance.__repr__.<locals>.<genexpr>z,<Twilio.Conversations.V1.WebhookInstance {}>rt   rw   r   r   r   rW     ry   zWebhookInstance.__repr__r   )rY   rZ   r[   objectr   r   r   propertyr   rM   r   r   r   r.   r   r   r   r   r   r\   rb   rf   rh   rW   r]   r   r   r   r   r-   P  sD    










		r-   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   rA   rO   r-   r   r   r   r   <module>   s    2-`