o
    f>ho                     @   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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 - Conversations
    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	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s|  e Zd ZG dd deZG dd de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ejfdeeef dedef deee ef deee ef deeef dd fddZejejejejejfdeeef dedef deee ef deee ef deeef dd fd d!Zdefd"d#Z  ZS )'WebhookInstancec                   @   s   e Zd ZdZdZdS )WebhookInstance.MethodGETPOSTN)__name__
__module____qualname__r   r    r   r   d/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/conversation/webhook.pyMethod   s    r   c                   @   s   e Zd ZdZdZdZdS )WebhookInstance.TargetwebhooktriggerstudioN)r   r   r   WEBHOOKTRIGGERSTUDIOr   r   r   r   Target   s    r#   Nversionpayloadconversation_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _t	
|d| _||pA| jd	| _d | _d S )
Nr'   account_sidr&   targeturlconfigurationdate_createddate_updatedr&   r'   )super__init__getr'   r(   r&   r)   r*   r+   r
   iso8601_datetimer,   r-   	_solution_context)selfr$   r%   r&   r'   	__class__r   r   r0   /   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.   )r4   r9   _versionr3   r5   r   r   r   _proxyK   s   
zWebhookInstance._proxyc                 C   
   | j  S )j
        Deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        )r<   deleter;   r   r   r   r?   [      
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   rC   d      zWebhookInstance.delete_asyncc                 C   r=   )[
        Fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        )r<   fetchr;   r   r   r   rF   m   r@   zWebhookInstance.fetchc                    rA   )u
        Asynchronous coroutine to fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        N)r<   fetch_asyncr;   r   r   r   rH   v   rD   zWebhookInstance.fetch_asyncconfiguration_urlconfiguration_methodr   configuration_filtersconfiguration_triggersconfiguration_flow_sidc                 C   s   | j j|||||dS )  
        Update the WebhookInstance

        :param configuration_url: The absolute url the webhook request should be sent to.
        :param configuration_method:
        :param configuration_filters: The list of events, firing webhook event for this Conversation.
        :param configuration_triggers: The list of keywords, firing webhook event for this Conversation.
        :param configuration_flow_sid: The studio flow SID, where the webhook should be sent to.

        :returns: The updated WebhookInstance
        rI   rJ   rK   rL   rM   )r<   updater5   rI   rJ   rK   rL   rM   r   r   r   rP      s   zWebhookInstance.updatec                    s   | j j|||||dI dH S )%  
        Asynchronous coroutine to update the WebhookInstance

        :param configuration_url: The absolute url the webhook request should be sent to.
        :param configuration_method:
        :param configuration_filters: The list of events, firing webhook event for this Conversation.
        :param configuration_triggers: The list of keywords, firing webhook event for this Conversation.
        :param configuration_flow_sid: The studio flow SID, where the webhook should be sent to.

        :returns: The updated WebhookInstance
        rO   N)r<   update_asyncrQ   r   r   r   rS      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.Conversations.V1.WebhookInstance {}>joinr3   itemsrZ   r5   contextr   r   r   __repr__      
zWebhookInstance.__repr__N)r8   r9   )r8   r   )r   r   r   objectr   r#   r   r   strr   r   r0   propertyr<   boolr?   rC   rF   rH   r   unsetr   r   rP   rS   rf   __classcell__r   r   r6   r   r      sr    
	
	
	







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ejfdeeef dedef deee ef deee ef deeef de	fddZejejejejejfdeeef dedef deee ef deee ef deeef de	fddZdefddZ  ZS )r9   r$   r&   r'   c                    s0   t  | ||d| _djdi | j| _dS )aY  
        Initialize the WebhookContext

        :param version: Version that contains the resource
        :param conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook.
        :param sid: A 34 character string that uniquely identifies this resource.
        r.   z0/Conversations/{conversation_sid}/Webhooks/{sid}Nr   r/   r0   r3   rZ   _uri)r5   r$   r&   r'   r6   r   r   r0      s   zWebhookContext.__init__r8   c                 C   s   t i }| jjd| j|dS )r>   DELETEmethoduriheaders)r   ofr:   r?   rp   r5   ru   r   r   r   r?      s   
zWebhookContext.deletec                    s&   t i }| jjd| j|dI dH S )rB   rq   rr   N)r   rv   r:   rC   rp   rw   r   r   r   rC      s
   
zWebhookContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rE   application/jsonAcceptr   rr   r&   r'   r.   )r   rv   r:   rF   rp   r   r3   r5   ru   r%   r   r   r   rF      s   
zWebhookContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rG   rx   ry   r   rr   Nr&   r'   r.   )r   rv   r:   rH   rp   r   r3   rz   r   r   r   rH     s   
zWebhookContext.fetch_asyncrI   rJ   r   rK   rL   rM   c           	   
   C   s|   t ||t|dd t|dd |d}t i }d|d< d|d< | jjd	| j||d
}t| j|| jd | jd dS )rN   c                 S      | S rh   r   er   r   r   <lambda>3      z'WebhookContext.update.<locals>.<lambda>c                 S   r{   rh   r   r|   r   r   r   r~   6  r   Configuration.UrlConfiguration.MethodConfiguration.FiltersConfiguration.TriggersConfiguration.FlowSid!application/x-www-form-urlencodedContent-Typerx   ry   r   rs   rt   dataru   r&   r'   r.   )	r   rv   r   mapr:   rP   rp   r   r3   	r5   rI   rJ   rK   rL   rM   r   ru   r%   r   r   r   rP     s0   

zWebhookContext.updatec           	   
      s   t ||t|dd t|dd |d}t i }d|d< d|d< | jjd	| j||d
I dH }t| j|| jd | jd dS )rR   c                 S   r{   rh   r   r|   r   r   r   r~   e  r   z-WebhookContext.update_async.<locals>.<lambda>c                 S   r{   rh   r   r|   r   r   r   r~   h  r   r   r   r   rx   ry   r   r   Nr&   r'   r.   )	r   rv   r   r   r:   rS   rp   r   r3   r   r   r   r   rS   L  s2   

zWebhookContext.update_asyncc                 C   rT   )rU   rV   c                 s   rW   rX   rY   r[   r   r   r   r_     r`   z*WebhookContext.__repr__.<locals>.<genexpr>z+<Twilio.Conversations.V1.WebhookContext {}>ra   rd   r   r   r   rf   ~  rg   zWebhookContext.__repr__)r   r   r   r   rj   r0   rl   r?   rC   r   rF   rH   r   rm   r   ri   r   rP   rS   rf   rn   r   r   r6   r   r9      sV    



4



2r9   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%   r8   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:   r3   )r5   r%   r   r   r   get_instance     zWebhookPage.get_instancec                 C      dS )rU   z%<Twilio.Conversations.V1.WebhookPage>r   r;   r   r   r   rf        zWebhookPage.__repr__N)	r   r   r   r   rj   r   r   r   rf   r   r   r   r   r     s    
r   c                       s  e Zd Zdedef fddZejejejejejejfdddeee	f ded	e	f d
ee
e e	f de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ejejfdddeee	f ded	e	f d
ee
e e	f dee
e e	f deee	f deee	f defddZ		d0dee dee dee fddZ		d0dee dee dee fddZ		d0dee dee de
e fddZ		d0d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 )1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 conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this webhook.

        r&   z*/Conversations/{conversation_sid}/WebhooksNr   ro   )r5   r$   r&   r6   r   r   r0     s   zWebhookList.__init__r)   r   rI   rJ   r   rK   rL   rM   configuration_replay_afterr8   c                 C   s|   t |||t|dd t|dd ||d}t ddi}	d|	d< d|	d< | jjd	| j||	d
}
t| j|
| jd dS )a  
        Create the WebhookInstance

        :param target:
        :param configuration_url: The absolute url the webhook request should be sent to.
        :param configuration_method:
        :param configuration_filters: The list of events, firing webhook event for this Conversation.
        :param configuration_triggers: The list of keywords, firing webhook event for this Conversation.
        :param configuration_flow_sid: The studio flow SID, where the webhook should be sent to.
        :param configuration_replay_after: The message index for which and it's successors the webhook will be replayed. Not set by default

        :returns: The created WebhookInstance
        c                 S   r{   rh   r   r|   r   r   r   r~     r   z$WebhookList.create.<locals>.<lambda>c                 S   r{   rh   r   r|   r   r   r   r~     r   r#   r   r   r   r   r   zConfiguration.ReplayAfterr   r   rx   ry   r   r   r&   r   )	r   rv   r   r   r:   createrp   r   r3   r5   r)   rI   rJ   rK   rL   rM   r   r   ru   r%   r   r   r   r     s.   
zWebhookList.createc                    s   t |||t|dd t|dd ||d}t ddi}	d|	d< d|	d< | jjd	| j||	d
I dH }
t| j|
| jd dS )a  
        Asynchronously create the WebhookInstance

        :param target:
        :param configuration_url: The absolute url the webhook request should be sent to.
        :param configuration_method:
        :param configuration_filters: The list of events, firing webhook event for this Conversation.
        :param configuration_triggers: The list of keywords, firing webhook event for this Conversation.
        :param configuration_flow_sid: The studio flow SID, where the webhook should be sent to.
        :param configuration_replay_after: The message index for which and it's successors the webhook will be replayed. Not set by default

        :returns: The created WebhookInstance
        c                 S   r{   rh   r   r|   r   r   r   r~     r   z*WebhookList.create_async.<locals>.<lambda>c                 S   r{   rh   r   r|   r   r   r   r~     r   r   r   r   rx   ry   r   r   Nr&   r   )	r   rv   r   r   r:   create_asyncrp   r   r3   r   r   r   r   r     s0   
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r5   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   4  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   r5   r   r   r   r   r   r   M  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 rh   r   )r\   recordr   r   r   
<listcomp>z  s
    z*WebhookList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_asyncg  s   
zWebhookList.list_async
page_tokenpage_numberc                 C   sN   t |||d}t ddi}d|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   PageSizer   r   rx   ry   r   rs   rt   paramsru   )r   rv   r:   r   rp   r   r3   r5   r   r   r   r   ru   responser   r   r   r     s   
zWebhookList.pagec                    sV   t |||d}t ddi}d|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   rx   ry   r   r   N)r   rv   r:   r   rp   r   r3   r   r   r   r   r     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
        r   )r:   domaintwiliorequestr   r3   r5   r   r   r   r   r   get_page  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   request_asyncr   r3   r   r   r   r   get_page_async  s   	zWebhookList.get_page_asyncr'   c                 C      t | j| jd |dS z
        Constructs a WebhookContext

        :param sid: A 34 character string that uniquely identifies this resource.
        r&   r.   r9   r:   r3   r5   r'   r   r   r   r1     r   zWebhookList.getc                 C   r   r   r   r   r   r   r   __call__  r   zWebhookList.__call__c                 C   r   )rU   z%<Twilio.Conversations.V1.WebhookList>r   r;   r   r   r   rf     r   zWebhookList.__repr__)NN) r   r   r   r   rj   r0   r   rm   r   ri   r   intr   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r9   r1   r   rf   rn   r   r   r6   r   r     s    



	
8



	
7







#



!

r   N)__doc__r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r9   r   r   r   r   r   r   <module>   s    $ ' J