o
    /i`                     @   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dedeeef dedee f fddZ	e
d ddZd	efddZd	efddZd!ddZd!ddZejejejejfdeeef deeef deeef deeef d	d f
ddZejejejejfdeeef deeef deeef deeef d	d f
ddZd	ef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
| _||pM| 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__ e/var/www/html/philips/venv/lib/python3.10/site-packages/twilio/rest/autopilot/v1/assistant/webhook.pyr    )   s&   
zWebhookInstance.__init__returnWebhookContextc                 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   
   | j  S )j
        Deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        )r.   deleter-   r(   r(   r)   r1   W      
zWebhookInstance.deletec                       | 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)   r5   `      zWebhookInstance.delete_asyncc                 C   r/   )[
        Fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        )r.   fetchr-   r(   r(   r)   r8   i   r2   zWebhookInstance.fetchc                    r3   )u
        Asynchronous coroutine to fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        N)r.   fetch_asyncr-   r(   r(   r)   r:   r   r6   zWebhookInstance.fetch_asyncr   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   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 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#   itemsrG   r%   contextr(   r(   r)   __repr__      
zWebhookInstance.__repr__N)r*   r+   )r*   r   )__name__
__module____qualname____doc__r   r   strr   r   r    propertyr.   boolr1   r5   r8   r:   r   unsetr   objectr=   r@   rS   __classcell__r(   r(   r&   r)   r      sb    
	
	
	









r   c                       s  e Zd Zdededef fddZdefddZdefd	d
Zde	fddZ
de	fddZejejejejfdeeef deeef deeef deeef de	f
ddZejejejejfdeeef deeef deeef deeef de	f
ddZdefddZ  ZS )r+   r   r   r   c                    s0   t  | ||d| _djd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}Nr(   r   r    r#   rG   _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   ra   r-   r(   r(   r)   r1      s   zWebhookContext.deletec                    s   | j jd| jdI dH S )r4   rb   rc   N)r,   r5   ra   r-   r(   r(   r)   r5      s
   zWebhookContext.delete_asyncc                 C   s0   | j jd| jd}t| j || jd | jd dS )r7   GETrc   r   r   r   )r,   r8   ra   r   r#   r%   r   r(   r(   r)   r8      s   zWebhookContext.fetchc                    s8   | j jd| jdI dH }t| j || jd | jd dS )r9   rf   rc   Nr   r   r   )r,   r:   ra   r   r#   rg   r(   r(   r)   r:      s   zWebhookContext.fetch_asyncr   r   r   r   c                 C   sF   t ||||d}| jjd| j|d}t| j|| jd | jd dS )r;   
UniqueNameEvents
WebhookUrlWebhookMethodPOSTrd   re   datar   r   r   )r   ofr,   r=   ra   r   r#   r%   r   r   r   r   ro   r   r(   r(   r)   r=   	  s$   	zWebhookContext.updatec                    sN   t ||||d}| jjd| j|dI dH }t| j|| jd | jd dS )r?   rh   rm   rn   Nr   r   r   )r   rp   r,   r@   ra   r   r#   rq   r(   r(   r)   r@   0  s&   	zWebhookContext.update_asyncc                 C   rA   )rB   rC   c                 s   rD   rE   rF   rH   r(   r(   r)   rL   ]  rM   z*WebhookContext.__repr__.<locals>.<genexpr>z'<Twilio.Autopilot.V1.WebhookContext {}>rN   rQ   r(   r(   r)   rS   W  rT   zWebhookContext.__repr__)rV   rW   rX   r   rZ   r    r\   r1   r5   r   r8   r:   r   r]   r   r^   r=   r@   rS   r_   r(   r(   r&   r)   r+      sJ    




)




'r+   c                   @   s4   e Zd Zdeeef defddZdefddZdS )WebhookPager   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#   rg   r(   r(   r)   get_instanceb     zWebhookPage.get_instancec                 C      dS )rB   z!<Twilio.Autopilot.V1.WebhookPage>r(   r-   r(   r(   r)   rS   l     zWebhookPage.__repr__N)	rV   rW   rX   r   rZ   r   r   rt   rS   r(   r(   r(   r)   rr   a  s    
rr   c                       s  e Zd Zdedef fddZejfdedededeee	f d	e
f
d
dZejfdedededeee	f d	e
f
ddZ		d+dee dee d	ee
 fddZ		d+dee dee d	ee
 fddZ		d+dee dee d	ee
 fddZ		d+dee dee d	ee
 fddZejejejfdeee	f deee	f deee	f d	efddZejejejfdeee	f deee	f deee	f d	efddZded	efd d!Zded	efd"d#Zd$ed	efd%d&Zd$ed	efd'd(Zd	efd)d*Z  ZS ),WebhookListr   r   c                    s.   t  | d|i| _djd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}/WebhooksNr(   r`   )r%   r   r   r&   r(   r)   r    v  s   zWebhookList.__init__r   r   r   r   r*   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
        rh   rm   rn   r   rs   )r   rp   r,   createra   r   r#   rq   r(   r(   r)   ry     s   	zWebhookList.createc                    sF   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
        rh   rm   rn   Nr   rs   )r   rp   r,   create_asyncra   r   r#   rq   r(   r(   r)   rz     s    	zWebhookList.create_asyncNlimit	page_sizec                 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
        r|   r|   r{   )r,   read_limitspagestreamr%   r{   r|   limitsr   r(   r(   r)   r     s   zWebhookList.streamc                    s8   | 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
        r|   r}   Nr{   )r,   r~   
page_asyncstream_asyncr   r(   r(   r)   r     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
        r{   r|   )listr   r%   r{   r|   r(   r(   r)   r      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 rU   r(   )rI   recordr(   r(   r)   
<listcomp>-  s
    z*WebhookList.list_async.<locals>.<listcomp>r   N)r   r   r(   r(   r)   
list_async  s   
zWebhookList.list_async
page_tokenpage_numberc                 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
        	PageTokenr   PageSizerf   rd   re   params)r   rp   r,   r   ra   rr   r#   r%   r   r   r|   ro   responser(   r(   r)   r   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   rf   r   N)r   rp   r,   r   ra   rr   r#   r   r(   r(   r)   r   P  s   zWebhookList.page_async
target_urlc                 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
        rf   )r,   domaintwiliorequestrr   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
        rf   N)r,   r   r   request_asyncrr   r#   r   r(   r(   r)   get_page_asyncy  s   	zWebhookList.get_page_asyncr   c                 C      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!     ru   zWebhookList.getc                 C   r   r   r   r   r(   r(   r)   __call__  ru   zWebhookList.__call__c                 C   rv   )rB   z!<Twilio.Autopilot.V1.WebhookList>r(   r-   r(   r(   r)   rS     rw   zWebhookList.__repr__)NN) rV   rW   rX   r   rZ   r    r   r]   r   r^   r   ry   rz   r   intr   r   r	   r   r   r   r   rr   r   r   r   r   r+   r!   r   rS   r_   r(   r(   r&   r)   rx   u  s    

)

&













rx   N)rY   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r+   rr   rx   r(   r(   r(   r)   <module>   s    $  -