
    pie                         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            
           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(                  fdedef   deeef   deeef   d
d fdZej(                  ej(                  ej(                  fdedef   deeef   deeef   d
d fdZd
efdZ xZS )UserConversationInstancec                       e Zd ZdZdZy)*UserConversationInstance.NotificationLeveldefaultmutedN)__name__
__module____qualname__DEFAULTMUTED     u/opt/services/ai/voice_agent/venv/lib/python3.12/site-packages/twilio/rest/conversations/v1/user/user_conversation.pyNotificationLevelr      s    r   r!   c                       e Zd ZdZdZdZy)UserConversationInstance.StateinactiveactiveclosedN)r   r   r   INACTIVEACTIVECLOSEDr   r   r    Stater#      s    r   r*   versionpayloaduser_sidconversation_sidc                    t         |   |       |j                  d      | _        |j                  d      | _        |j                  d      | _        t        j                  |j                  d            | _        t        j                  |j                  d            | _	        |j                  d      | _
        |j                  d      | _        |j                  d      | _        |j                  d	      | _        |j                  d
      | _        |j                  d      | _        t        j                   |j                  d            | _        t        j                   |j                  d            | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        |j                  d      | _        ||xs | j
                  d| _        d | _        y )Naccount_sidchat_service_sidr.   unread_messages_countlast_read_message_indexparticipant_sidr-   friendly_nameconversation_statetimers
attributesdate_createddate_updated
created_bynotification_levelunique_nameurllinksr-   r.   )super__init__getr0   r1   r.   r   integerr2   r3   r4   r-   r5   r6   r7   r8   iso8601_datetimer9   r:   r;   r<   r=   r>   r?   	_solution_context)selfr+   r,   r-   r.   	__class__s        r    rB   z!UserConversationInstance.__init__9   s    	!*1++m*D/6{{;M/N/6{{;M/N4?4G4GKK/05
" 7B6I6IKK127
$ /6kk:K.L'.{{:'>,3KK,HKK,- 	 4;;;x3H)0\)B0;0L0LKK'1
 1<0L0LKK'1
 *1\)B KK,- 	 +2++m*D")++e"429++g2F
 ! 0 ID4I4I
 <@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: UserConversationContext for this UserConversationInstance
        r-   r.   r@   )rG   UserConversationContext_versionrF   rH   s    r    _proxyzUserConversationInstance._proxyg   sF     == 3
3!%0B!CDM
 }}r   c                 6    | j                   j                         S )s
        Deletes the UserConversationInstance


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


        :returns: True if delete succeeds, False otherwise
        N)rO   delete_asyncrN   s    r    rU   z%UserConversationInstance.delete_async   s!      [[--////   '%'c                 6    | j                   j                         S )m
        Fetch the UserConversationInstance


        :returns: The fetched UserConversationInstance
        )rO   fetchrN   s    r    rY   zUserConversationInstance.fetch   s     {{  ""r   c                 R   K   | j                   j                          d{   S 7 w)
        Asynchronous coroutine to fetch the UserConversationInstance


        :returns: The fetched UserConversationInstance
        N)rO   fetch_asyncrN   s    r    r\   z$UserConversationInstance.fetch_async   s!      [[,,....rV   r<   r   last_read_timestampr3   c                 >    | j                   j                  |||      S )  
        Update the UserConversationInstance

        :param notification_level:
        :param last_read_timestamp: The date of the last message read in conversation by the user, given in ISO 8601 format.
        :param last_read_message_index: The index of the last Message in the Conversation that the Participant has read.

        :returns: The updated UserConversationInstance
        r<   r]   r3   )rO   updaterH   r<   r]   r3   s       r    ra   zUserConversationInstance.update   s)    " {{!!1 3$; " 
 	
r   c                 Z   K   | j                   j                  |||       d{   S 7 w)  
        Asynchronous coroutine to update the UserConversationInstance

        :param notification_level:
        :param last_read_timestamp: The date of the last message read in conversation by the user, given in ISO 8601 format.
        :param last_read_message_index: The index of the last Message in the Conversation that the Participant has read.

        :returns: The updated UserConversationInstance
        r`   N)rO   update_asyncrb   s       r    re   z%UserConversationInstance.update_async   s7     " [[--1 3$; . 
 
 	
 
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>z4UserConversationInstance.__repr__.<locals>.<genexpr>        SDAq7>>!Q/S   !z5<Twilio.Conversations.V1.UserConversationInstance {}>joinrF   itemsrl   rH   contexts     r    __repr__z!UserConversationInstance.__repr__   s6     ((SDNN<P<P<RSSFMMgVVr   )N)rJ   rL   )rJ   r   )r   r   r   objectr!   r*   r   r   strr   r   rB   propertyrO   boolrR   rU   rY   r\   r   unsetr   r   intra   re   ry   __classcell__rI   s   @r    r   r      sj   F  
4 +/,@,@ c3h,@ 	,@
 #3-,@\  $ $0D 0#/ LL7=||6<ll
!8&@


 #8V#34
 "'sF{!3
 
$
6 LL7=||6<ll
!8&@


 #8V#34
 "'sF{!3
 
$
.W# W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                  fd
ed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def   deeef   deeef   de	fdZdefdZ xZS )rL   r+   r-   r.   c                 z    t         |   |       ||d| _         dj                  di | j                  | _        y)a4  
        Initialize the UserConversationContext

        :param version: Version that contains the resource
        :param user_sid: The unique SID identifier of the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.
        :param conversation_sid: The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource).
        r@   z2/Users/{user_sid}/Conversations/{conversation_sid}Nr   rA   rB   rF   rl   _uri)rH   r+   r-   r.   rI   s       r    rB   z UserConversationContext.__init__   sG     	! ! 0
 PHOO 
nn
	r   rJ   c                 |    t        j                  i       }| j                  j                  d| j                  |      S )rQ   DELETEmethoduriheaders)r   ofrM   rR   r   rH   r   s     r    rR   zUserConversationContext.delete   s1     ))B-}}##8G#TTr   c                    K   t        j                  i       }| j                  j                  d| j                  |       d{   S 7 w)rT   r   r   N)r   r   rM   rU   r   r   s     r    rU   z$UserConversationContext.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 )rX   application/jsonAcceptGETr   r-   r.   r@   )r   r   rM   rY   r   r   rF   rH   r   r,   s      r    rY   zUserConversationContext.fetch  sj     ))B-.--%%U		7%S'MM^^J/!^^,>?	
 	
r   c                   K   t        j                  i       }d|d<   | j                  j                  d| j                  |       d{   }t        | j                  || j                  d   | j                  d         S 7 7w)	r[   r   r   r   r   Nr-   r.   r@   )r   r   rM   r\   r   r   rF   r   s      r    r\   z#UserConversationContext.fetch_async  s      ))B-.11dii 2 
 
 (MM^^J/!^^,>?	
 	
	
s   ABB 	8Br<   r   r]   r3   c                 P   t        j                  |t        j                  |      |d      }t        j                  i       }d|d<   d|d<   | j                  j                  d| j                  ||      }t        | j                  || j                  d   | j                  d	   
      S )r_   r!   LastReadTimestampLastReadMessageIndex!application/x-www-form-urlencodedContent-Typer   r   POSTr   r   datar   r-   r.   r@   )	r   r   r   rE   rM   ra   r   r   rF   rH   r<   r]   r3   r   r   r,   s          r    ra   zUserConversationContext.update.  s    $ yy%7%.%?%?@S%T(?
 ))B-"E.--&&tyytW ' 
 (MM^^J/!^^,>?	
 	
r   c                 l  K   t        j                  |t        j                  |      |d      }t        j                  i       }d|d<   d|d<   | j                  j                  d| j                  ||       d{   }t        | j                  || j                  d	   | j                  d
         S 7 7w)rd   r   r   r   r   r   r   r   Nr-   r.   r@   )	r   r   r   rE   rM   re   r   r   rF   r   s          r    re   z$UserConversationContext.update_asyncX  s     $ yy%7%.%?%?@S%T(?
 ))B-"E.22tyytW 3 
 
 (MM^^J/!^^,>?	
 	
	
s   A8B4:B2;8B4c                     dj                  d | j                  j                         D              }dj                  |      S )rg   rh   c              3   F   K   | ]  \  }}d j                  ||        ywrj   rk   rm   s      r    rq   z3UserConversationContext.__repr__.<locals>.<genexpr>  rr   rs   z4<Twilio.Conversations.V1.UserConversationContext {}>rt   rw   s     r    ry   z UserConversationContext.__repr__  s6     ((SDNN<P<P<RSSELLWUUr   )r   r   r   r   r{   rB   r}   rR   rU   r   rY   r\   r   r~   r   rz   r   r   ra   re   ry   r   r   s   @r    rL   rL      s%   
 
3 
# 
&
U 
U
D 

/ 
*
#; 
6 LL7=||6<ll(
!8&@
(

 #8V#34(
 "'sF{!3(
 
"(
\ LL7=||6<ll(
!8&@
(

 #8V#34(
 "'sF{!3(
 
"(
TV# Vr   rL   c                   2    e Zd Zdeeef   defdZdefdZy)UserConversationPager,   rJ   c                 L    t        | j                  || j                  d         S )zv
        Build an instance of UserConversationInstance

        :param payload: Payload response from the API
        r-   )r-   )r   rM   rF   )rH   r,   s     r    get_instancez!UserConversationPage.get_instance  s%     (MM7T^^J-G
 	
r   c                      y)rg   z.<Twilio.Conversations.V1.UserConversationPage>r   rN   s    r    ry   zUserConversationPage.__repr__       @r   N)	r   r   r   r   r{   r   r   r   ry   r   r   r    r   r     s,    
DcN 
7O 
@# @r   r   c            	           e Zd Zdedef 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 )UserConversationListr+   r-   c                 x    t         |   |       d|i| _         dj                  di | j                  | _        y)aE  
        Initialize the UserConversationList

        :param version: Version that contains the resource
        :param user_sid: The unique SID identifier of the [User resource](https://www.twilio.com/docs/conversations/api/user-resource). This value can be either the `sid` or the `identity` of the User resource.

        r-   z/Users/{user_sid}/ConversationsNr   r   )rH   r+   r-   rI   s      r    rB   zUserConversationList.__init__  s@     	! 
 =5<<Nt~~N	r   limit	page_sizerJ   c                     | j                   j                  ||      }| j                  |d         }| j                   j                  ||d         S )af  
        Streams UserConversationInstance 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   )rM   read_limitspagestreamrH   r   r   limitsr   s        r    r   zUserConversationList.stream  sJ    ( **5)<yy6+#6y7}}##D&/::r   c                    K   | j                   j                  ||      }| j                  |d          d{   }| j                   j                  ||d         S 7 #w)au  
        Asynchronously streams UserConversationInstance 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   )rM   r   
page_asyncstream_asyncr   s        r    r   z!UserConversationList.stream_async  sW     ( **5)<__vk/B_CC}}))$w@@ Ds   5AA$Ac                 :    t        | j                  ||            S )a  
        Lists UserConversationInstance 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   )rH   r   r   s      r    r   zUserConversationList.list  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 UserConversationInstance 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   )rH   r   r   records       r    
list_asynczUserConversationList.list_async  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 )a  
        Retrieve a single page of UserConversationInstance 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 UserConversationInstance
        	PageTokenr   PageSizer   r   r   r   r   r   r   paramsr   )r   r   rM   r   r   r   rF   rH   r   r   r   r   r   responses          r    r   zUserConversationList.page  s      yy'#%
 ))^-PQR.==%%diig & 
 $DMM8T^^LLr   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 UserConversationInstance 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 UserConversationInstance
        r   r   r   r   r   r   r   N)r   r   rM   r   r   r   rF   r   s          r    r   zUserConversationList.page_async;  s       yy'#%
 ))^-PQR.11diig 2 
 
 $DMM8T^^LL
s   A"B$B
%&B
target_urlc                     | j                   j                  j                  j                  d|      }t	        | j                   || j
                        S )a  
        Retrieve a specific page of UserConversationInstance records from the API.
        Request is executed immediately

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

        :returns: Page of UserConversationInstance
        r   )rM   domaintwiliorequestr   rF   rH   r   r   s      r    get_pagezUserConversationList.get_page\  s=     ==''..66ujI#DMM8T^^LLr   c                    K   | j                   j                  j                  j                  d|       d{   }t	        | j                   || j
                        S 7 %w)a  
        Asynchronously retrieve a specific page of UserConversationInstance records from the API.
        Request is executed immediately

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

        :returns: Page of UserConversationInstance
        r   N)rM   r   r   request_asyncr   rF   r   s      r    get_page_asyncz#UserConversationList.get_page_asynch  sJ      --44BB5*UU#DMM8T^^LL Vs   4AA&Ar.   c                 L    t        | j                  | j                  d   |      S a$  
        Constructs a UserConversationContext

        :param conversation_sid: The unique SID identifier of the Conversation. This value can be either the `sid` or the `unique_name` of the [Conversation resource](https://www.twilio.com/docs/conversations/api/conversation-resource).
        r-   r@   rL   rM   rF   rH   r.   s     r    rC   zUserConversationList.gett  '     'MM^^J/-
 	
r   c                 L    t        | j                  | j                  d   |      S r   r   r   s     r    __call__zUserConversationList.__call__  r   r   c                      y)rg   z.<Twilio.Conversations.V1.UserConversationList>r   rN   s    r    ry   zUserConversationList.__repr__  r   r   )NN)r   r   r   r   r{   rB   r   r   r	   r   r   r
   r   r   r   r   r   r~   r   rz   r   r   r   r   r   rL   rC   r   ry   r   r   s   @r    r   r     s#   O O3 O$  $#';}; C=; 
*	+	;6  $#'A}A C=A 
/	0	A6  $#'
}
 C=
 
&	'	
8  $#'
}
 C=
 
&	'	
: *0*0,,(.	M#v+&M 3;'M f%	M
 
MF *0*0,,(.	M#v+&M 3;'M f%	M
 
MB
M3 
M+? 
M
Ms 
M7K 
M

C 

,C 



 

1H 

@# @r   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   rL   r   r   r   r   r    <module>r      sn     L L L 6 6 8 : 2 ' !wW/ wWtvVo vVr@4 @*q@< q@r   