
    pio                         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e      Z G d de      Z G d de      Z G d de      Zy)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                   T    e Zd Z G d de      Z G d de      Z	 	 ddedeee	f   dede
e   f fd	Zedd       Zd
efdZd
efdZddZ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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Zd
efdZ xZS )WebhookInstancec                       e Zd ZdZdZy)WebhookInstance.MethodgetpostN)__name__
__module____qualname__GETPOST     s/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/twilio/rest/conversations/v1/conversation/webhook.pyMethodr      s    r   r!   c                       e Zd ZdZdZdZy)WebhookInstance.TargetwebhooktriggerstudioN)r   r   r   WEBHOOKTRIGGERSTUDIOr   r   r    Targetr#      s    r   r*   versionpayloadconversation_sidsidc                    t         |   |       |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        t        j                  |j                  d            | _        t        j                  |j                  d            | _        ||xs | j                  d	| _        d | _        y )
Nr.   account_sidr-   targeturlconfigurationdate_createddate_updatedr-   r.   )super__init__r   r.   r0   r-   r1   r2   r3   r   iso8601_datetimer4   r5   	_solution_context)selfr+   r,   r-   r.   	__class__s        r    r8   zWebhookInstance.__init__/   s     	!")++e"4*1++m*D/6{{;M/N%,[[%:")++e"4:A++o:V0;0L0LKK'1
 1<0L0LKK'1

 !1?$((
 37r   returnc                     | j                   7t        | j                  | j                  d   | j                  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
        r-   r.   r6   )r;   WebhookContext_versionr:   r<   s    r    _proxyzWebhookInstance._proxyK   sF     == *!%0B!CNN5)DM
 }}r   c                 6    | j                   j                         S )j
        Deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        )rC   deleterB   s    r    rF   zWebhookInstance.delete[   s     {{!!##r   c                 R   K   | j                   j                          d{   S 7 w)
        Asynchronous coroutine that deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        N)rC   delete_asyncrB   s    r    rI   zWebhookInstance.delete_asyncd   s!      [[--////   '%'c                 6    | j                   j                         S )[
        Fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        )rC   fetchrB   s    r    rM   zWebhookInstance.fetchm   s     {{  ""r   c                 R   K   | j                   j                          d{   S 7 w)u
        Asynchronous coroutine to fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        N)rC   fetch_asyncrB   s    r    rP   zWebhookInstance.fetch_asyncv   s!      [[,,....rJ   configuration_urlconfiguration_methodr   configuration_filtersconfiguration_triggersconfiguration_flow_sidc                 B    | j                   j                  |||||      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
        rQ   rR   rS   rT   rU   )rC   updater<   rQ   rR   rS   rT   rU   s         r    rY   zWebhookInstance.update   s/    & {{!!/!5"7#9#9 " 
 	
r   c                 ^   K   | j                   j                  |||||       d{   S 7 w)%  
        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
        rX   N)rC   update_asyncrZ   s         r    r]   zWebhookInstance.update_async   s=     & [[--/!5"7#9#9 . 
 
 	
 
s   $-+-c                     dj                  d | j                  j                         D              }dj                  |      S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c              3   F   K   | ]  \  }}d j                  ||        ywz{}={}Nformat.0kvs      r    	<genexpr>z+WebhookInstance.__repr__.<locals>.<genexpr>        SDAq7>>!Q/S   !z,<Twilio.Conversations.V1.WebhookInstance {}>joinr:   itemsrd   r<   contexts     r    __repr__zWebhookInstance.__repr__   s6     ((SDNN<P<P<RSS=DDWMMr   N)r>   r@   )r>   r   )r   r   r   objectr!   r*   r   r   strr   r   r8   propertyrC   boolrF   rI   rM   rP   r   unsetr   r   rY   r]   rq   __classcell__r=   s   @r    r   r      s     
	  "77 c3h7 	7
 c]78  $ $0D 0#/ 17HN:@,,;A<<5;\\
 f-
 $$<f$DE
  %T#Y%67	

 !&d3i&7 8
 !&c6k 2
 

: 17HN:@,,;A<<5;\\
 f-
 $$<f$DE
  %T#Y%67	

 !&d3i&7 8
 !&c6k 2
 

6N# Nr   r   c                       e Zd Zdededef fdZdefdZdefdZde	fdZ
de	f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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ZdefdZ xZS )r@   r+   r-   r.   c                 z    t         |   |       ||d| _         dj                  di | j                  | _        y)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.
        r6   z0/Conversations/{conversation_sid}/Webhooks/{sid}Nr   r7   r8   r:   rd   _uri)r<   r+   r-   r.   r=   s       r    r8   zWebhookContext.__init__   sG     	! !1
 NFMM 
nn
	r   r>   c                 |    t        j                  i       }| j                  j                  d| j                  |      S )rE   DELETEmethoduriheaders)r   ofrA   rF   r}   r<   r   s     r    rF   zWebhookContext.delete   s1     ))B-}}##8G#TTr   c                    K   t        j                  i       }| j                  j                  d| j                  |       d{   S 7 w)rH   r   r   N)r   r   rA   rI   r}   r   s     r    rI   zWebhookContext.delete_async   sF      ))B-]]//G 0 
 
 	
 
s   AA
AA
c                     t        j                  i       }d|d<   | j                  j                  d| j                  |      }t        | j                  || j                  d   | j                  d         S )rL   application/jsonAcceptr   r   r-   r.   r6   )r   r   rA   rM   r}   r   r:   r<   r   r,   s      r    rM   zWebhookContext.fetch   sj     ))B-.--%%U		7%SMM!^^,>?u%	
 	
r   c                   K   t        j                  i       }d|d<   | j                  j                  d| j                  |       d{   }t        | j                  || j                  d   | j                  d         S 7 7w)	rO   r   r   r   r   Nr-   r.   r6   )r   r   rA   rP   r}   r   r:   r   s      r    rP   zWebhookContext.fetch_async  s      ))B-.11dii 2 
 
 MM!^^,>?u%	
 	
	
s   ABB 	8BrQ   rR   r   rS   rT   rU   c           	         t        j                  ||t        j                  |d       t        j                  |d       |d      }t        j                  i       }d|d<   d|d<   | j                  j                  d| j                  ||	      }t        | j                  || j                  d
   | j                  d         S )rW   c                     | S rr   r   es    r    <lambda>z'WebhookContext.update.<locals>.<lambda>3      Q r   c                     | S rr   r   r   s    r    r   z'WebhookContext.update.<locals>.<lambda>6      a r   Configuration.UrlConfiguration.MethodConfiguration.FiltersConfiguration.TriggersConfiguration.FlowSid!application/x-www-form-urlencodedContent-Typer   r   r   r   r   datar   r-   r.   r6   )	r   r   r   maprA   rY   r}   r   r:   	r<   rQ   rR   rS   rT   rU   r   r   r,   s	            r    rY   zWebhookContext.update  s    ( yy%6(<)2);* +4--*K+ *@

 ))B-"E.--&&tyytW ' 
 MM!^^,>?u%	
 	
r   c           	        K   t        j                  ||t        j                  |d       t        j                  |d       |d      }t        j                  i       }d|d<   d|d<   | j                  j                  d| j                  ||	       d
{   }t        | j                  || j                  d   | j                  d         S 7 7w)r\   c                     | S rr   r   r   s    r    r   z-WebhookContext.update_async.<locals>.<lambda>e  r   r   c                     | S rr   r   r   s    r    r   z-WebhookContext.update_async.<locals>.<lambda>h  r   r   r   r   r   r   r   r   r   Nr-   r.   r6   )	r   r   r   r   rA   r]   r}   r   r:   r   s	            r    r]   zWebhookContext.update_asyncL  s     ( yy%6(<)2);* +4--*K+ *@

 ))B-"E.22tyytW 3 
 
 MM!^^,>?u%	
 	
	
s   BCC8Cc                     dj                  d | j                  j                         D              }dj                  |      S )r_   r`   c              3   F   K   | ]  \  }}d j                  ||        ywrb   rc   re   s      r    ri   z*WebhookContext.__repr__.<locals>.<genexpr>  rj   rk   z+<Twilio.Conversations.V1.WebhookContext {}>rl   ro   s     r    rq   zWebhookContext.__repr__~  s6     ((SDNN<P<P<RSS<CCGLLr   )r   r   r   r   rt   r8   rv   rF   rI   r   rM   rP   r   rw   r   rs   r   rY   r]   rq   rx   ry   s   @r    r@   r@      s   
 
3 
S 
&
U 
U
D 

 
*
? 
2 17HN:@,,;A<<5;\\0
 f-0
 $$<f$DE0
  %T#Y%67	0

 !&d3i&7 80
 !&c6k 20
 
0
h 17HN:@,,;A<<5;\\0
 f-0
 $$<f$DE0
  %T#Y%67	0

 !&d3i&7 80
 !&c6k 20
 
0
dM# Mr   r@   c                   2    e Zd Zdeeef   defdZdefdZy)WebhookPager,   r>   c                 L    t        | j                  || j                  d         S )zm
        Build an instance of WebhookInstance

        :param payload: Payload response from the API
        r-   r-   )r   rA   r:   )r<   r,   s     r    get_instancezWebhookPage.get_instance  s&     MM7T^^DV5W
 	
r   c                      y)r_   z%<Twilio.Conversations.V1.WebhookPage>r   rB   s    r    rq   zWebhookPage.__repr__       7r   N)	r   r   r   r   rt   r   r   r   rq   r   r   r    r   r     s)    
DcN 
 
7# 7r   r   c                       e Zd Zdedef f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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Z	 	 d!dee   dee   dee   fdZ	 	 d!dee   dee   dee   fdZ	 	 d!dee   dee   de
e   fdZ	 	 d!dee   dee   de
e   f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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ZdedefdZdedefdZdedefdZdedefdZdefd Z xZS )"WebhookListr+   r-   c                 x    t         |   |       d|i| _         dj                  di | j                  | _        y)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   r|   )r<   r+   r-   r=   s      r    r8   zWebhookList.__init__  sG     	!  0
 H@GG 
nn
	r   r1   r#   rQ   rR   r   rS   rT   rU   configuration_replay_afterr>   c           
      n   t        j                  |||t        j                  |d       t        j                  |d       ||d      }t        j                  ddi      }	d|	d<   d|	d<   | j                  j                  d| j                  ||		      }
t        | j                  |
| j                  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 rr   r   r   s    r    r   z$WebhookList.create.<locals>.<lambda>  r   r   c                     | S rr   r   r   s    r    r   z$WebhookList.create.<locals>.<lambda>  r   r   r*   r   r   r   r   r   zConfiguration.ReplayAfterr   r   r   r   r   r   r-   r   )	r   r   r   r   rA   creater}   r   r:   r<   r1   rQ   rR   rS   rT   rU   r   r   r   r,   s              r    r   zWebhookList.create  s    0 yy %6(<)2);* +4--*K+ *@-G
 ))^-PQR"E.--&&tyytW ' 
 MM7T^^DV5W
 	
r   c           
        K   t        j                  |||t        j                  |d       t        j                  |d       ||d      }t        j                  ddi      }	d|	d<   d|	d<   | j                  j                  d| j                  ||		       d
{   }
t        | j                  |
| j                  d         S 7 )w)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 rr   r   r   s    r    r   z*WebhookList.create_async.<locals>.<lambda>  r   r   c                     | S rr   r   r   s    r    r   z*WebhookList.create_async.<locals>.<lambda>  r   r   r   r   r   r   r   r   r   Nr-   r   )	r   r   r   r   rA   create_asyncr}   r   r:   r   s              r    r   zWebhookList.create_async  s     0 yy %6(<)2);* +4--*K+ *@-G
 ))^-PQR"E.22tyytW 3 
 
 MM7T^^DV5W
 	
	
s   BCC*Climit	page_sizec                     | j                   j                  ||      }| j                  |d         }| j                   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   )rA   read_limitspagestreamr<   r   r   limitsr   s        r    r   zWebhookList.stream  sJ    ( **5)<yy6+#6y7}}##D&/::r   c                    K   | j                   j                  ||      }| j                  |d          d{   }| j                   j                  ||d         S 7 #w)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   )rA   r   
page_asyncstream_asyncr   s        r    r   zWebhookList.stream_async4  sW     ( **5)<__vk/B_CC}}))$w@@ Ds   5AA$Ac                 :    t        | j                  ||            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   s      r    r   zWebhookList.listM  s(    & KK#  
 	
r   c                 z   K   | j                  ||       d{   2 cg c3 d{   }|7 7 	6 c}S c c}w w)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
        r   N)r   )r<   r   r   records       r    
list_asynczWebhookList.list_asyncg  sT     * '+&7&7# '8 ' !
 
 !
 
 	
 
s0   ;.;620
26;26;
page_tokenpage_numberc                     t        j                  |||d      }t        j                  ddi      }d|d<   | j                  j                  d| j                  ||      }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   r   r   r   r   r   paramsr   )r   r   rA   r   r}   r   r:   r<   r   r   r   r   r   responses          r    r   zWebhookList.page  s      yy'#%
 ))^-PQR.==%%diig & 
 4==(DNNCCr   c                   K   t        j                  |||d      }t        j                  ddi      }d|d<   | j                  j                  d| j                  ||       d{   }t        | j                  || j                        S 7 %w)	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   r   r   r   r   N)r   r   rA   r   r}   r   r:   r   s          r    r   zWebhookList.page_async  s       yy'#%
 ))^-PQR.11diig 2 
 
 4==(DNNCC
s   A"B$B
%&B
target_urlc                     | j                   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   )rA   domaintwiliorequestr   r:   r<   r   r   s      r    get_pagezWebhookList.get_page  s=     ==''..66ujI4==(DNNCCr   c                    K   | j                   j                  j                  j                  d|       d{   }t	        | j                   || j
                        S 7 %w)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)rA   r   r   request_asyncr   r:   r   s      r    get_page_asynczWebhookList.get_page_async  sJ      --44BB5*UU4==(DNNCC Vs   4AA&Ar.   c                 L    t        | j                  | j                  d   |      S z
        Constructs a WebhookContext

        :param sid: A 34 character string that uniquely identifies this resource.
        r-   r6   r@   rA   r:   r<   r.   s     r    r   zWebhookList.get  '     MMDNN;M,NTW
 	
r   c                 L    t        | j                  | j                  d   |      S r   r   r   s     r    __call__zWebhookList.__call__  r   r   c                      y)r_   z%<Twilio.Conversations.V1.WebhookList>r   rB   s    r    rq   zWebhookList.__repr__  r   r   )NN) r   r   r   r   rt   r8   r   rw   r   rs   r   intr   r   r   r   r	   r   r
   r   r   r   r   r   r   r   r   r@   r   r   rq   rx   ry   s   @r    r   r     s   
 
3 
* 17HN:@,,;A<<5;\\9?3
(3
 !f-3
 $$<f$DE	3

  %T#Y%673
 !&d3i&7 83
 !&c6k 23
 %*#v+$63
 
3
p 17HN:@,,;A<<5;\\9?3
(3
 !f-3
 $$<f$DE	3

  %T#Y%673
 !&d3i&7 83
 !&c6k 23
 %*#v+$63
 
3
n  $#';}; C=; 
/	"	;6  $#'A}A C=A 
	'	A6  $#'
}
 C=
 
o		
8  $#'
}
 C=
 
o		
: *0*0,,(.	D#v+&D 3;'D f%	D
 
DF *0*0,,(.	D#v+&D 3;'D f%	D
 
DB
D3 
D; 
D
Ds 
D{ 
D
s 
~ 

C 
N 
7# 7r   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   r@   r   r   r   r   r    <module>r      sj     L L L 6 6 8 : 2 ' !cN& cNLFM_ FMR7$ 7*Y7, Y7r   