U
    ^g%ie                     @   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eeee	f ee
e d fddZed	d
ddZed
ddZed
ddZd d
ddZd d
ddZejejejfedef eeef eeef d dddZejejejfedef eeef eeef d dddZed
ddZ  ZS )UserConversationInstancec                   @   s   e Zd ZdZdZdS )*UserConversationInstance.NotificationLeveldefaultZmutedN)__name__
__module____qualname__DEFAULTZMUTED r   r   r/var/www/html/api-medvista/venv/lib/python3.8/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.StateZinactiveZactiveclosedN)r   r   r   ZINACTIVEZACTIVEZ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(   r)   r*   iso8601_datetimer+   r,   r-   r.   r/   r0   r1   	_solution_context)selfr   r   r    r!   	__class__r   r   r4   9   sB    
z!UserConversationInstance.__init__UserConversationContextreturnc                 C   s.   | j dk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!   r2   )r9   r=   _versionr8   r:   r   r   r   _proxyg   s    
zUserConversationInstance._proxyc                 C   s
   | j  S )s
        Deletes the UserConversationInstance


        :returns: True if delete succeeds, False otherwise
        )rB   deleterA   r   r   r   rD   w   s    zUserConversationInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the UserConversationInstance


        :returns: True if delete succeeds, False otherwise
        N)rB   delete_asyncrA   r   r   r   rF      s    z%UserConversationInstance.delete_asyncc                 C   s
   | j  S )m
        Fetch the UserConversationInstance


        :returns: The fetched UserConversationInstance
        )rB   fetchrA   r   r   r   rH      s    zUserConversationInstance.fetchc                    s   | j  I dH S )
        Asynchronous coroutine to fetch the UserConversationInstance


        :returns: The fetched UserConversationInstance
        N)rB   fetch_asyncrA   r   r   r   rJ      s    z$UserConversationInstance.fetch_asyncr   r.   last_read_timestampr%   r?   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
        r.   rL   r%   )rB   updater:   r.   rL   r%   r   r   r   rO      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
        rN   N)rB   update_asyncrP   r   r   r   rR      s
    z%UserConversationInstance.update_asyncc                 C   s$   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s   s   | ]\}}d  ||V  qdS z{}={}Nformat.0kvr   r   r   	<genexpr>   s     z4UserConversationInstance.__repr__.<locals>.<genexpr>z5<Twilio.Conversations.V1.UserConversationInstance {}>joinr8   itemsrW   r:   contextr   r   r   __repr__   s    z!UserConversationInstance.__repr__)N)r   r   r   objectr   r   r   r   strr   r   r4   propertyrB   boolrD   rF   rH   rJ   r   unsetr   r   intrO   rR   rb   __classcell__r   r   r;   r   r      sL    
.			



r   c                       s   e Zd Zeeed fddZedddZedddZe	dd	d
Z
e	dddZejejejfedef eeef eeef e	dddZejejejfedef eeef eeef e	dddZedddZ  ZS )r=   )r   r    r!   c                    s,   t  | ||d| _djf | 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).
        r2   z2/Users/{user_sid}/Conversations/{conversation_sid}Nr3   r4   r8   rW   _uri)r:   r   r    r!   r;   r   r   r4      s    z UserConversationContext.__init__r>   c                 C   s   t i }| jjd| j|dS )rC   DELETEmethoduriheaders)r   ofr@   rD   rk   r:   rp   r   r   r   rD      s    
zUserConversationContext.deletec                    s$   t i }| jjd| j|dI dH S )rE   rl   rm   N)r   rq   r@   rF   rk   rr   r   r   r   rF      s    
  z$UserConversationContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rG   application/jsonAcceptGETrm   r    r!   r2   )r   rq   r@   rH   rk   r   r8   r:   rp   r   r   r   r   rH     s    
zUserConversationContext.fetchc                    sJ   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rI   rs   rt   ru   rm   Nr    r!   r2   )r   rq   r@   rJ   rk   r   r8   rv   r   r   r   rJ     s    
  z#UserConversationContext.fetch_asyncr   rK   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 )rM   r   ZLastReadTimestampZLastReadMessageIndex!application/x-www-form-urlencodedContent-Typers   rt   POSTrn   ro   datarp   r    r!   r2   )	r   rq   r   r7   r@   rO   rk   r   r8   r:   r.   rL   r%   r|   rp   r   r   r   r   rO   .  s*    
   zUserConversationContext.updatec                    sl   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 )rQ   rw   rx   ry   rs   rt   rz   r{   Nr    r!   r2   )	r   rq   r   r7   r@   rR   rk   r   r8   r}   r   r   r   rR   X  s*    
   z$UserConversationContext.update_asyncc                 C   s$   d dd | j D }d|S )rS   rT   c                 s   s   | ]\}}d  ||V  qdS rU   rV   rX   r   r   r   r\     s     z3UserConversationContext.__repr__.<locals>.<genexpr>z4<Twilio.Conversations.V1.UserConversationContext {}>r]   r`   r   r   r   rb     s    z UserConversationContext.__repr__)r   r   r   r   rd   r4   rf   rD   rF   r   rH   rJ   r   rg   r   rc   r   rh   rO   rR   rb   ri   r   r   r;   r   r=      s8   

.

*r=   c                   @   s2   e Zd Zeeef edddZedddZdS )UserConversationPage)r   r?   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   r@   r8   )r:   r   r   r   r   get_instance  s
      z!UserConversationPage.get_instancer>   c                 C   s   dS )rS   z.<Twilio.Conversations.V1.UserConversationPage>r   rA   r   r   r   rb     s    zUserConversationPage.__repr__N)	r   r   r   r   rd   r   r   r   rb   r   r   r   r   r~     s   
r~   c                       sf  e Zd Zeed fddZd ee ee ee	 dddZ
d!ee ee ee	 ddd	Zd"ee ee ee	 dd
dZd#ee ee ee	 dddZejejejfeeef eeef eeef edddZejejejfeeef eeef eeef edddZeedddZeedddZeedddZeedddZedddZ  ZS )$UserConversationList)r   r    c                    s*   t  | d|i| _djf | 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}/ConversationsNrj   )r:   r   r    r;   r   r   r4     s
     zUserConversationList.__init__N)limit	page_sizer?   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   )r@   read_limitspagestreamr:   r   r   Zlimitsr   r   r   r   r     s    zUserConversationList.streamc                    s6   | 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   )r@   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   r:   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 )Nr   )rY   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_numberr   r?   c                 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
        Z	PageTokenr   ZPageSizery   rx   rs   rt   ru   rn   ro   paramsrp   )r   rq   r@   r   rk   r~   r8   r:   r   r   r   r|   rp   responser   r   r   r     s       zUserConversationList.pagec                    sT   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   ry   rx   rs   rt   ru   r   N)r   rq   r@   r   rk   r~   r8   r   r   r   r   r   ;  s       zUserConversationList.page_async)
target_urlr?   c                 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
        ru   )r@   domaintwiliorequestr~   r8   r:   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
        ru   N)r@   r   r   Zrequest_asyncr~   r8   r   r   r   r   get_page_asynch  s    	z#UserConversationList.get_page_async)r!   r?   c                 C   s   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    r2   r=   r@   r8   r:   r!   r   r   r   r5   t  s
    zUserConversationList.getc                 C   s   t | j| jd |dS r   r   r   r   r   r   __call__  s
    zUserConversationList.__call__r>   c                 C   s   dS )rS   z.<Twilio.Conversations.V1.UserConversationList>r   rA   r   r   r   rb     s    zUserConversationList.__repr__)NN)NN)NN)NN)r   r   r   r   rd   r4   r   rh   r   r   r   r	   r   r   r   r   r   rg   r   rc   r~   r   r   r   r   r=   r5   r   rb   ri   r   r   r;   r   r     sh           


#


!r   N)__doc__r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   r=   r~   r   r   r   r   r   <module>   s   $ ; :