o
    f>he                     @   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fdedef deeef deeef dd f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dZdefd d!Z  ZS )%UserConversationInstancec                   @   s   e Zd ZdZdZdS )*UserConversationInstance.NotificationLeveldefaultmutedN)__name__
__module____qualname__DEFAULTMUTED r   r   f/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/user/user_conversation.pyNotificationLevel   s    r   c                   @   s   e Zd ZdZdZdZdS )zUserConversationInstance.StateinactiveactiveclosedN)r   r   r   INACTIVEACTIVECLOSEDr   r   r   r   State   s    r$   Nversionpayloaduser_sidconversation_sidc                    s  t  | |d| _|d| _|d| _t|d| _t|d| _	|d| _
|d| _|d| _|d	| _|d
| _|d| _t|d| _t|d| _|d| _|d| _|d| _|d| _|d| _||p| jd| _d | _d S )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__getr)   r*   r(   r
   integerr+   r,   r-   r'   r.   r/   r0   r1   iso8601_datetimer2   r3   r4   r5   r6   r7   r8   	_solution_context)selfr%   r&   r'   r(   	__class__r   r   r;   9   sB   
z!UserConversationInstance.__init__returnUserConversationContextc                 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: UserConversationContext for this UserConversationInstance
        Nr'   r(   r9   )r@   rE   _versionr?   rA   r   r   r   _proxyg   s   
zUserConversationInstance._proxyc                 C   
   | j  S )s
        Deletes the UserConversationInstance


        :returns: True if delete succeeds, False otherwise
        )rH   deleterG   r   r   r   rK   w      
zUserConversationInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the UserConversationInstance


        :returns: True if delete succeeds, False otherwise
        N)rH   delete_asyncrG   r   r   r   rO         z%UserConversationInstance.delete_asyncc                 C   rI   )m
        Fetch the UserConversationInstance


        :returns: The fetched UserConversationInstance
        )rH   fetchrG   r   r   r   rR      rL   zUserConversationInstance.fetchc                    rM   )
        Asynchronous coroutine to fetch the UserConversationInstance


        :returns: The fetched UserConversationInstance
        N)rH   fetch_asyncrG   r   r   r   rT      rP   z$UserConversationInstance.fetch_asyncr5   r   last_read_timestampr,   c                 C   s   | j j|||d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
        r5   rU   r,   )rH   updaterA   r5   rU   r,   r   r   r   rX      s
   zUserConversationInstance.updatec                    s   | j j|||dI dH S )  
        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
        rW   N)rH   update_asyncrY   r   r   r   r[      s   z%UserConversationInstance.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>       z4UserConversationInstance.__repr__.<locals>.<genexpr>z5<Twilio.Conversations.V1.UserConversationInstance {}>joinr?   itemsrb   rA   contextr   r   r   __repr__      
z!UserConversationInstance.__repr__N)rD   rE   )rD   r   )r   r   r   objectr   r$   r   r   strr   r   r;   propertyrH   boolrK   rO   rR   rT   r   unsetr   r   intrX   r[   rn   __classcell__r   r   rB   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fded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d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 )rE   r%   r'   r(   c                    s0   t  | ||d| _djdi | j| _dS )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).
        r9   z2/Users/{user_sid}/Conversations/{conversation_sid}Nr   r:   r;   r?   rb   _uri)rA   r%   r'   r(   rB   r   r   r;      s   z UserConversationContext.__init__rD   c                 C   s   t i }| jjd| j|dS )rJ   DELETEmethoduriheaders)r   ofrF   rK   ry   rA   r~   r   r   r   rK      s   
zUserConversationContext.deletec                    s&   t i }| jjd| j|dI dH S )rN   rz   r{   N)r   r   rF   rO   ry   r   r   r   r   rO      s
   
z$UserConversationContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rQ   application/jsonAcceptGETr{   r'   r(   r9   )r   r   rF   rR   ry   r   r?   rA   r~   r&   r   r   r   rR     s   
zUserConversationContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rS   r   r   r   r{   Nr'   r(   r9   )r   r   rF   rT   ry   r   r?   r   r   r   r   rT     s   
z#UserConversationContext.fetch_asyncr5   r   rU   r,   c                 C   sf   t |t||d}t i }d|d< d|d< | jjd| j||d}t| j|| jd | jd	 d
S )rV   r   LastReadTimestampLastReadMessageIndex!application/x-www-form-urlencodedContent-Typer   r   POSTr|   r}   datar~   r'   r(   r9   )	r   r   r   r>   rF   rX   ry   r   r?   rA   r5   rU   r,   r   r~   r&   r   r   r   rX   .  s$   

zUserConversationContext.updatec                    sn   t |t||d}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 dS )rZ   r   r   r   r   r   r   r   Nr'   r(   r9   )	r   r   r   r>   rF   r[   ry   r   r?   r   r   r   r   r[   X  s&   

z$UserConversationContext.update_asyncc                 C   r\   )r]   r^   c                 s   r_   r`   ra   rc   r   r   r   rg     rh   z3UserConversationContext.__repr__.<locals>.<genexpr>z4<Twilio.Conversations.V1.UserConversationContext {}>ri   rl   r   r   r   rn     ro   z UserConversationContext.__repr__)r   r   r   r   rr   r;   rt   rK   rO   r   rR   rT   r   ru   r   rq   r   rv   rX   r[   rn   rw   r   r   rB   r   rE      sF    


.


*rE   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 )UserConversationPager&   rD   c                 C   s   t | j|| jd dS )zv
        Build an instance of UserConversationInstance

        :param payload: Payload response from the API
        r'   )r'   )r   rF   r?   )rA   r&   r   r   r   get_instance  s   z!UserConversationPage.get_instancec                 C      dS )r]   z.<Twilio.Conversations.V1.UserConversationPage>r   rG   r   r   r   rn        zUserConversationPage.__repr__N)	r   r   r   r   rr   r   r   r   rn   r   r   r   r   r     s    
r   c                	       s  e Zd Zdedef 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 )$UserConversationListr%   r'   c                    s.   t  | d|i| _djdi | j| _dS )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   rx   )rA   r%   r'   rB   r   r   r;     s   zUserConversationList.__init__Nlimit	page_sizerD   c                 C   s0   | j ||}| j|d d}| 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   )rF   read_limitspagestreamrA   r   r   limitsr   r   r   r   r     s   zUserConversationList.streamc                    s8   | j ||}| j|d dI dH }| j ||d S )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   )rF   r   
page_asyncstream_asyncr   r   r   r   r     s   z!UserConversationList.stream_asyncc                 C   s   t | j||d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   rA   r   r   r   r   r   r     s   zUserConversationList.listc                    s&   dd | j ||dI dH 2 I dH S )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
        c                    s   g | z3 d H W }|q6 S rp   r   )rd   recordr   r   r   
<listcomp>  s
    z3UserConversationList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async  s   
zUserConversationList.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 )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   rF   r   ry   r   r?   rA   r   r   r   r   r~   responser   r   r   r     s   
zUserConversationList.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 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   rF   r   ry   r   r?   r   r   r   r   r   ;  s   
zUserConversationList.page_async
target_urlc                 C   s"   | 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   )rF   domaintwiliorequestr   r?   rA   r   r   r   r   r   get_page\  s   	zUserConversationList.get_pagec                    s*   | j jjd|I dH }t| j || jS )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)rF   r   r   request_asyncr   r?   r   r   r   r   get_page_asynch  s   	z#UserConversationList.get_page_asyncr(   c                 C      t | j| jd |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'   r9   rE   rF   r?   rA   r(   r   r   r   r<   t  
   zUserConversationList.getc                 C   r   r   r   r   r   r   r   __call__  r   zUserConversationList.__call__c                 C   r   )r]   z.<Twilio.Conversations.V1.UserConversationList>r   rG   r   r   r   rn     r   zUserConversationList.__repr__)NN)r   r   r   r   rr   r;   r   rv   r   r   r   r	   r   r   r   r   r   ru   r   rq   r   r   r   r   r   rE   r<   r   rn   rw   r   r   rB   r   r     s    







#



!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   rE   r   r   r   r   r   r   <module>   s    $ ; :