a
    !f`                     @   s   d Z ddlmZ ddlmZmZmZmZmZmZm	Z	 ddl
mZ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 )a  
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Autopilot
    This is the public Twilio REST API.

    NOTE: This class is auto generated by OpenAPI Generator.
    https://openapi-generator.tech
    Do not edit the class manually.
    )datetime)AnyDictListOptionalUnionIteratorAsyncIterator)deserializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s"  e Zd ZdZdeeeef eee d fddZ	e
dddd	Zedd
dZedddZd dddZd dddZejejejejfeeef eeef eeef eeef d dddZejejejejfeeef eeef eeef eeef d dddZedddZ  ZS )WebhookInstancea]  
    :ivar url: The absolute URL of the Webhook resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Webhook resource.
    :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource.
    :ivar sid: The unique string that we created to identify the Webhook resource.
    :ivar unique_name: An application-defined string that uniquely identifies the resource. It can be used in place of the resource's `sid` in the URL to address the resource.
    :ivar events: The list of space-separated events that this Webhook is subscribed to.
    :ivar webhook_url: The URL associated with this Webhook.
    :ivar webhook_method: The method used when calling the webhook's URL.
    N)versionpayloadassistant_sidsidc                    s   t  | |d| _|d| _t|d| _t|d| _|d| _	|d| _
|d| _|d| _|d	| _|d
| _||p| j
d| _d | _d S )Nurlaccount_siddate_createddate_updatedr   r   unique_nameeventswebhook_urlwebhook_methodr   r   )super__init__getr   r   r
   iso8601_datetimer   r   r   r   r   r   r   r   	_solution_context)selfr   r   r   r   	__class__ k/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/autopilot/v1/assistant/webhook.pyr    )   s&    zWebhookInstance.__init__WebhookContextreturnc                 C   s.   | j du r(t| j| jd | jd d| _ | j S )z
        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
        Nr   r   r   )r$   r*   _versionr#   r%   r(   r(   r)   _proxyG   s    
zWebhookInstance._proxyc                 C   s
   | j  S )j
        Deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        )r/   deleter.   r(   r(   r)   r1   W   s    zWebhookInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        N)r/   delete_asyncr.   r(   r(   r)   r3   `   s    zWebhookInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        )r/   fetchr.   r(   r(   r)   r5   i   s    zWebhookInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        N)r/   fetch_asyncr.   r(   r(   r)   r7   r   s    zWebhookInstance.fetch_asyncr   r   r   r   r,   c                 C   s   | j j||||dS )M  
        Update the WebhookInstance

        :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length.
        :param events: The list of space-separated events that this Webhook will subscribe to.
        :param webhook_url: The URL associated with this Webhook.
        :param webhook_method: The method to be used when calling the webhook's URL.

        :returns: The updated WebhookInstance
        r   r   r   r   )r/   updater%   r   r   r   r   r(   r(   r)   r;   {   s    zWebhookInstance.updatec                    s   | j j||||dI dH S )g  
        Asynchronous coroutine to update the WebhookInstance

        :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length.
        :param events: The list of space-separated events that this Webhook will subscribe to.
        :param webhook_url: The URL associated with this Webhook.
        :param webhook_method: The method to be used when calling the webhook's URL.

        :returns: The updated WebhookInstance
        r:   N)r/   update_asyncr<   r(   r(   r)   r>      s    zWebhookInstance.update_asyncc                 C   s$   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s   s   | ]\}}d  ||V  qdS z{}={}Nformat.0kvr(   r(   r)   	<genexpr>       z+WebhookInstance.__repr__.<locals>.<genexpr>z(<Twilio.Autopilot.V1.WebhookInstance {}>joinr#   itemsrC   r%   contextr(   r(   r)   __repr__   s    zWebhookInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r    propertyr/   boolr1   r3   r5   r7   r   unsetr   objectr;   r>   rO   __classcell__r(   r(   r&   r)   r      sJ    
			







r   c                       s   e Zd Zeeed fddZedddZedddZe	dd	d
Z
e	dddZejejejejfeeef eeef eeef eeef e	dddZejejejejfeeef eeef eeef eeef e	dddZedddZ  ZS )r*   )r   r   r   c                    s0   t  | ||d| _djf i | j| _dS )ao  
        Initialize the WebhookContext

        :param version: Version that contains the resource
        :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resource to update.
        :param sid: The Twilio-provided string that uniquely identifies the Webhook resource to update.
        r   z*/Assistants/{assistant_sid}/Webhooks/{sid}Nr   r    r#   rC   _uri)r%   r   r   r   r&   r(   r)   r       s    zWebhookContext.__init__r+   c                 C   s   | j jd| jdS )r0   DELETEmethoduri)r-   r1   r[   r.   r(   r(   r)   r1      s    zWebhookContext.deletec                    s   | j jd| jdI dH S )r2   r\   r]   N)r-   r3   r[   r.   r(   r(   r)   r3      s    zWebhookContext.delete_asyncc                 C   s0   | j jd| jd}t| j || jd | jd dS )r4   GETr]   r   r   r   )r-   r5   r[   r   r#   r%   r   r(   r(   r)   r5      s    zWebhookContext.fetchc                    s6   | j jd| jdI dH }t| j || jd | jd dS )r6   r`   r]   Nr   r   r   )r-   r7   r[   r   r#   ra   r(   r(   r)   r7      s    zWebhookContext.fetch_asyncr8   c                 C   sF   t ||||d}| jjd| j|d}t| j|| jd | jd dS )r9   Z
UniqueNameZEventsZ
WebhookUrlZWebhookMethodPOSTr^   r_   datar   r   r   )r   ofr-   r;   r[   r   r#   r%   r   r   r   r   re   r   r(   r(   r)   r;   	  s$    	zWebhookContext.updatec                    sL   t ||||d}| jjd| j|dI dH }t| j|| jd | jd dS )r=   rb   rc   rd   Nr   r   r   )r   rf   r-   r>   r[   r   r#   rg   r(   r(   r)   r>   0  s$    	zWebhookContext.update_asyncc                 C   s$   d dd | j D }d|S )r?   r@   c                 s   s   | ]\}}d  ||V  qdS rA   rB   rD   r(   r(   r)   rH   ]  rI   z*WebhookContext.__repr__.<locals>.<genexpr>z'<Twilio.Autopilot.V1.WebhookContext {}>rJ   rM   r(   r(   r)   rO   W  s    zWebhookContext.__repr__)rP   rQ   rR   r   rT   r    rV   r1   r3   r   r5   r7   r   rW   r   rX   r;   r>   rO   rY   r(   r(   r&   r)   r*      s8   



)



'r*   c                   @   s2   e Zd Zeeef edddZedddZdS )WebhookPage)r   r,   c                 C   s   t | j|| jd dS )zm
        Build an instance of WebhookInstance

        :param payload: Payload response from the API
        r   r   )r   r-   r#   ra   r(   r(   r)   get_instanceb  s    zWebhookPage.get_instancer+   c                 C   s   dS )r?   z!<Twilio.Autopilot.V1.WebhookPage>r(   r.   r(   r(   r)   rO   l  s    zWebhookPage.__repr__N)	rP   rQ   rR   r   rT   r   r   rj   rO   r(   r(   r(   r)   rh   a  s   
rh   c                       s  e Zd Zeed fddZejfeeeeee	f e
dddZejfeeeeee	f e
dddZd%ee ee ee
 d
ddZd&ee ee ee
 d
ddZd'ee ee ee
 d
ddZd(ee ee ee
 d
ddZejejejfeee	f eee	f eee	f edddZejejejfeee	f eee	f eee	f edddZeedddZeedddZeedddZeedd d!Zed"d#d$Z  ZS ))WebhookList)r   r   c                    s.   t  | d|i| _djf i | j| _dS )a  
        Initialize the WebhookList

        :param version: Version that contains the resource
        :param assistant_sid: The SID of the [Assistant](https://www.twilio.com/docs/autopilot/api/assistant) that is the parent of the resources to read.

        r   z$/Assistants/{assistant_sid}/WebhooksNrZ   )r%   r   r   r&   r(   r)   r    v  s    zWebhookList.__init__r8   c                 C   s>   t ||||d}| jjd| j|d}t| j|| jd dS )aM  
        Create the WebhookInstance

        :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length.
        :param events: The list of space-separated events that this Webhook will subscribe to.
        :param webhook_url: The URL associated with this Webhook.
        :param webhook_method: The method to be used when calling the webhook's URL.

        :returns: The created WebhookInstance
        rb   rc   rd   r   ri   )r   rf   r-   creater[   r   r#   rg   r(   r(   r)   rl     s    	zWebhookList.createc                    sD   t ||||d}| jjd| j|dI dH }t| j|| jd dS )a\  
        Asynchronously create the WebhookInstance

        :param unique_name: An application-defined string that uniquely identifies the new resource. It can be used as an alternative to the `sid` in the URL path to address the resource. This value must be unique and 64 characters or less in length.
        :param events: The list of space-separated events that this Webhook will subscribe to.
        :param webhook_url: The URL associated with this Webhook.
        :param webhook_method: The method to be used when calling the webhook's URL.

        :returns: The created WebhookInstance
        rb   rc   rd   Nr   ri   )r   rf   r-   create_asyncr[   r   r#   rg   r(   r(   r)   rm     s    	zWebhookList.create_asyncN)limit	page_sizer,   c                 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 limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param 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
        ro   ro   rn   )r-   read_limitspagestreamr%   rn   ro   Zlimitsrr   r(   r(   r)   rs     s    zWebhookList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )al  
        Asynchronously 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 limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param 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
        ro   rp   Nrn   )r-   rq   
page_asyncstream_asyncrt   r(   r(   r)   rv     s    zWebhookList.stream_asyncc                 C   s   t | j||dS )a  
        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 limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param 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: list that will contain up to limit results
        rn   ro   )listrs   r%   rn   ro   r(   r(   r)   rx      s    zWebhookList.listc                    s$   dd | j ||dI dH 2 I dH S )a	  
        Asynchronously 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 limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param 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: list that will contain up to limit results
        c                    s   g | z3 d H W }|q6 S )Nr(   )rE   recordr(   r(   r)   
<listcomp>-  s   z*WebhookList.list_async.<locals>.<listcomp>rw   N)rv   ry   r(   r(   r)   
list_async  s    
zWebhookList.list_async)
page_tokenpage_numberro   r,   c                 C   s6   t |||d}| jjd| j|d}t| j|| jS )as  
        Retrieve a single page of WebhookInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebhookInstance
        Z	PageTokenr   ZPageSizer`   r^   r_   params)r   rf   r-   rr   r[   rh   r#   r%   r}   r~   ro   re   responser(   r(   r)   rr   5  s    zWebhookList.pagec                    s<   t |||d}| jjd| j|dI dH }t| j|| jS )a  
        Asynchronously retrieve a single page of WebhookInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebhookInstance
        r   r`   r   N)r   rf   r-   ru   r[   rh   r#   r   r(   r(   r)   ru   P  s    zWebhookList.page_async)
target_urlr,   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of WebhookInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebhookInstance
        r`   )r-   domaintwiliorequestrh   r#   r%   r   r   r(   r(   r)   get_pagem  s    	zWebhookList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of WebhookInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebhookInstance
        r`   N)r-   r   r   Zrequest_asyncrh   r#   r   r(   r(   r)   get_page_asyncy  s    	zWebhookList.get_page_async)r   r,   c                 C   s   t | j| jd |dS z
        Constructs a WebhookContext

        :param sid: The Twilio-provided string that uniquely identifies the Webhook resource to update.
        r   r   r*   r-   r#   r%   r   r(   r(   r)   r!     s    zWebhookList.getc                 C   s   t | j| jd |dS r   r   r   r(   r(   r)   __call__  s    zWebhookList.__call__r+   c                 C   s   dS )r?   z!<Twilio.Autopilot.V1.WebhookList>r(   r.   r(   r(   r)   rO     s    zWebhookList.__repr__)NN)NN)NN)NN) rP   rQ   rR   r   rT   r    r   rW   r   rX   r   rl   rm   r   intr   rs   r	   rv   r   rx   r|   rh   rr   ru   r   r   r*   r!   r   rO   rY   r(   r(   r&   r)   rk   u  s   
)
&        







rk   N)rS   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   r*   rh   rk   r(   r(   r(   r)   <module>   s   $  -