o
    eC                     @   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 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)values)InstanceContext)InstanceResource)ListResource)Pagec                       sx   e Zd 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fddZdd Zdd Zdd Z  ZS )WebhookList PLEASE NOTE that this class contains preview products that are subject
    to change. Use them with caution. If you currently do not have developer
    preview access, please contact help@twilio.com. c                    s2   t t| | d|i| _djdi | j| _dS )a[  
        Initialize the WebhookList

        :param Version version: Version that contains the resource
        :param assistant_sid: The SID of the Assistant that is the parent of the resource

        :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookList
        :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookList
        assistant_sidz$/Assistants/{assistant_sid}/WebhooksN )superr   __init__	_solutionformat_uri)selfversionr
   	__class__r   ]/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/autopilot/v1/assistant/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.autopilot.v1.assistant.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 )af  
        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.autopilot.v1.assistant.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.autopilot.v1.assistant.webhook.WebhookPage
        )	PageTokenr   PageSizeGET)methoduriparams)r   ofr   r   r   WebhookPager   )r   
page_tokenpage_numberr   dataresponser   r   r   r   O   s   zWebhookList.pagec                 C   s"   | j jjd|}t| j || jS )a>  
        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.autopilot.v1.assistant.webhook.WebhookPage
        r    )r   domaintwiliorequestr%   r   )r   
target_urlr)   r   r   r   get_pageb   s
   

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

        :param unicode unique_name: An application-defined string that uniquely identifies the resource
        :param unicode events: The list of space-separated events that this Webhook will subscribe to.
        :param unicode webhook_url: The URL associated with this Webhook.
        :param unicode webhook_method: The method to be used when calling the webhook's URL.

        :returns: The created WebhookInstance
        :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance
        
UniqueNameEvents
WebhookUrlWebhookMethodPOSTr!   r"   r(   r
   r
   )r   r$   r   creater   WebhookInstancer   r   unique_nameeventswebhook_urlwebhook_methodr(   payloadr   r   r   r7   s   s   zWebhookList.createc                 C      t | j| jd |dS a  
        Constructs a WebhookContext

        :param sid: The unique string that identifies the resource to fetch

        :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext
        :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext
        r
   r
   sidWebhookContextr   r   r   rB   r   r   r   get      	zWebhookList.getc                 C   r?   r@   rC   rE   r   r   r   __call__   rG   zWebhookList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z!<Twilio.Autopilot.V1.WebhookList>r   r   r   r   r   __repr__      zWebhookList.__repr__)NN)__name__
__module____qualname____doc__r   r   r   r   unsetr   r.   r7   rF   rH   rL   __classcell__r   r   r   r   r      s    


r   c                       s0   e Zd ZdZ fddZdd Zdd Z  ZS )r%   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 assistant_sid: The SID of the Assistant that is the parent of the resource

        :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookPage
        :rtype: twilio.rest.autopilot.v1.assistant.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.autopilot.v1.assistant.webhook.WebhookInstance
        :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance
        r
   r6   )r8   r   r   r   r>   r   r   r   get_instance   rG   zWebhookPage.get_instancec                 C   rI   )rJ   z!<Twilio.Autopilot.V1.WebhookPage>r   rK   r   r   r   rL      rM   zWebhookPage.__repr__)rN   rO   rP   rQ   r   rV   rL   rS   r   r   r   r   r%      s
    r%   c                       sR   e Zd ZdZ fddZdd ZejejejejfddZdd	 Z	d
d Z
  ZS )rD   r	   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 assistant_sid: The SID of the Assistant that is the parent of the resource to fetch
        :param sid: The unique string that identifies the resource to fetch

        :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext
        :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookContext
        rA   z*/Assistants/{assistant_sid}/Webhooks/{sid}Nr   )r   rD   r   r   r   r   )r   r   r
   rB   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.autopilot.v1.assistant.webhook.WebhookInstance
        r    r!   r"   r
   rB   rA   )r   fetchr   r8   r   rU   r   r   r   rY      s   zWebhookContext.fetchc                 C   sF   t ||||d}| jjd| j|d}t| j|| jd | jd dS )  
        Update the WebhookInstance

        :param unicode unique_name: An application-defined string that uniquely identifies the resource
        :param unicode events: The list of space-separated events that this Webhook will subscribe to.
        :param unicode webhook_url: The URL associated with this Webhook.
        :param unicode webhook_method: The method to be used when calling the webhook's URL.

        :returns: The updated WebhookInstance
        :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance
        r/   r4   r5   r
   rB   rA   )r   r$   r   updater   r8   r   r9   r   r   r   r[      s   zWebhookContext.updatec                 C   s   | j jd| jdS )~
        Deletes the WebhookInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErX   )r   deleter   rK   r   r   r   r^     s   zWebhookContext.deletec                 C   $   d dd | j D }d|S )rJ    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>'      z*WebhookContext.__repr__.<locals>.<genexpr>z'<Twilio.Autopilot.V1.WebhookContext {}>joinr   itemsr   r   contextr   r   r   rL         
zWebhookContext.__repr__)rN   rO   rP   rQ   r   rY   r   rR   r[   r^   rL   rS   r   r   r   r   rD      s    
	rD   c                       s   e Zd Zd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dd Zdd ZejejejejfddZdd  Zd!d" Z  ZS )$r8   r	   Nc                    s   t t| | |d|dt|dt|d|d|d|d|d|d	|d
d
| _d| _||pD| jd d| _dS )z
        Initialize the WebhookInstance

        :returns: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance
        :rtype: twilio.rest.autopilot.v1.assistant.webhook.WebhookInstance
        urlaccount_siddate_createddate_updatedr
   rB   r:   r;   r<   r=   )
rp   rq   rr   rs   r
   rB   r:   r;   r<   r=   NrA   )	r   r8   r   rF   r   iso8601_datetime_properties_contextr   )r   r   r>   r
   rB   r   r   r   r   0  s   zWebhookInstance.__init__c                 C   s.   | j du rt| j| jd | jd d| _ | j S )a4  
        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.autopilot.v1.assistant.webhook.WebhookContext
        Nr
   rB   rA   )rv   rD   r   r   rK   r   r   r   _proxyK  s   
	zWebhookInstance._proxyc                 C   
   | j d S )z\
        :returns: The absolute URL of the Webhook resource
        :rtype: unicode
        rp   ru   rK   r   r   r   rp   \     
zWebhookInstance.urlc                 C   rx   )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        rq   ry   rK   r   r   r   rq   d  rz   zWebhookInstance.account_sidc                 C   rx   )zt
        :returns: The RFC 2822 date and time in GMT when the resource was created
        :rtype: datetime
        rr   ry   rK   r   r   r   rr   l  rz   zWebhookInstance.date_createdc                 C   rx   )zy
        :returns: The RFC 2822 date and time in GMT when the resource was last updated
        :rtype: datetime
        rs   ry   rK   r   r   r   rs   t  rz   zWebhookInstance.date_updatedc                 C   rx   )zo
        :returns: The SID of the Assistant that is the parent of the resource
        :rtype: unicode
        r
   ry   rK   r   r   r   r
   |  rz   zWebhookInstance.assistant_sidc                 C   rx   )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rB   ry   rK   r   r   r   rB     rz   zWebhookInstance.sidc                 C   rx   )zw
        :returns: An application-defined string that uniquely identifies the resource
        :rtype: unicode
        r:   ry   rK   r   r   r   r:     rz   zWebhookInstance.unique_namec                 C   rx   )zz
        :returns: The list of space-separated events that this Webhook is subscribed to.
        :rtype: unicode
        r;   ry   rK   r   r   r   r;     rz   zWebhookInstance.eventsc                 C   rx   )zY
        :returns: The URL associated with this Webhook.
        :rtype: unicode
        r<   ry   rK   r   r   r   r<     rz   zWebhookInstance.webhook_urlc                 C   rx   )zc
        :returns: The method used when calling the webhook's URL.
        :rtype: unicode
        r=   ry   rK   r   r   r   r=     rz   zWebhookInstance.webhook_methodc                 C   
   | j  S )rW   )rw   rY   rK   r   r   r   rY        
zWebhookInstance.fetchc                 C   s   | j j||||dS )rZ   )r:   r;   r<   r=   )rw   r[   )r   r:   r;   r<   r=   r   r   r   r[     s   zWebhookInstance.updatec                 C   r{   )r\   )rw   r^   rK   r   r   r   r^     r|   zWebhookInstance.deletec                 C   r_   )rJ   r`   c                 s   ra   rb   rc   rd   r   r   r   rh     ri   z+WebhookInstance.__repr__.<locals>.<genexpr>z(<Twilio.Autopilot.V1.WebhookInstance {}>rj   rm   r   r   r   rL     ro   zWebhookInstance.__repr__)N)rN   rO   rP   rQ   r   propertyrw   rp   rq   rr   rs   r
   rB   r:   r;   r<   r=   rY   r   rR   r[   r^   rL   rS   r   r   r   r   r8   +  s>    










	
	r8   N)rQ   twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r%   rD   r8   r   r   r   r   <module>   s    *W