o
    eJ                     @   s   d 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 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 )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)	serialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       sf   e Zd Z fddZdddZdddZejejejfdd	Zd
d Z	dd Z
dd Zdd Z  ZS )UserConversationListc                    s2   t t| | d|i| _djdi | j| _dS )ac  
        Initialize the UserConversationList

        :param Version version: Version that contains the resource
        :param user_sid: The unique ID for the User.

        :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationList
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationList
        user_sidz/Users/{user_sid}/ConversationsN )superr	   __init__	_solutionformat_uri)selfversionr
   	__class__r   f/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/user/user_conversation.pyr      s   

zUserConversationList.__init__Nc                 C   s0   | j ||}| j|d d}| j ||d S )a  
        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 int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int 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
        :rtype: list[twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance]
        	page_size)r   limit)_versionread_limitspagestream)r   r   r   limitsr   r   r   r   r   $   s   zUserConversationList.streamc                 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 int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int 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: Generator that will yield up to limit results
        :rtype: list[twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance]
        )r   r   )listr   )r   r   r   r   r   r   r   ;   s   zUserConversationList.listc                 C   s6   t |||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 str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of UserConversationInstance
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationPage
        )	PageTokenr   PageSizeGET)methoduriparams)r   ofr   r   r   UserConversationPager   )r   
page_tokenpage_numberr   dataresponser   r   r   r   M   s   zUserConversationList.pagec                 C   s"   | j jjd|}t| j || jS )ab  
        Retrieve a specific page of UserConversationInstance records from the API.
        Request is executed immediately

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

        :returns: Page of UserConversationInstance
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationPage
        r    )r   domaintwiliorequestr%   r   )r   
target_urlr)   r   r   r   get_page`   s
   

zUserConversationList.get_pagec                 C      t | j| jd |dS aB  
        Constructs a UserConversationContext

        :param conversation_sid: The unique SID identifier of the Conversation.

        :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext
        r
   r
   conversation_sidUserConversationContextr   r   r   r2   r   r   r   getq   
   	zUserConversationList.getc                 C   r/   r0   r3   r5   r   r   r   __call__   r7   zUserConversationList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z.<Twilio.Conversations.V1.UserConversationList>r   r   r   r   r   __repr__      zUserConversationList.__repr__)NN)__name__
__module____qualname__r   r   r   r   unsetr   r.   r6   r8   r<   __classcell__r   r   r   r   r	      s    


r	   c                       s,   e Zd Z fddZdd Zdd Z  ZS )r%   c                    s   t t| || || _dS )a  
        Initialize the UserConversationPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param user_sid: The unique ID for the User.

        :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationPage
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationPage
        N)r   r%   r   r   )r   r   r)   solutionr   r   r   r      s   
zUserConversationPage.__init__c                 C   s   t | j|| jd dS )a8  
        Build an instance of UserConversationInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance
        r
   )r
   )UserConversationInstancer   r   r   payloadr   r   r   get_instance   s   	z!UserConversationPage.get_instancec                 C   r9   )r:   z.<Twilio.Conversations.V1.UserConversationPage>r   r;   r   r   r   r<      r=   zUserConversationPage.__repr__)r>   r?   r@   r   rG   r<   rB   r   r   r   r   r%      s    r%   c                       sJ   e Zd Z fddZejejejfddZdd Zdd Zd	d
 Z	  Z
S )r4   c                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the UserConversationContext

        :param Version version: Version that contains the resource
        :param user_sid: The unique SID identifier of the User.
        :param conversation_sid: The unique SID identifier of the Conversation.

        :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext
        r1   z2/Users/{user_sid}/Conversations/{conversation_sid}Nr   )r   r4   r   r   r   r   )r   r   r
   r2   r   r   r   r      s   z UserConversationContext.__init__c                 C   sJ   t |t||d}| jjd| j|d}t| j|| jd | jd dS )  
        Update the UserConversationInstance

        :param UserConversationInstance.NotificationLevel notification_level: The Notification Level of this User Conversation.
        :param datetime last_read_timestamp: The date of the last message read in conversation by the user.
        :param unicode last_read_message_index: The index of the last read Message.

        :returns: The updated UserConversationInstance
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance
        )NotificationLevelLastReadTimestampLastReadMessageIndexPOST)r!   r"   r(   r
   r2   r1   )	r   r$   r   iso8601_datetimer   updater   rD   r   )r   notification_levellast_read_timestamplast_read_message_indexr(   rF   r   r   r   rN      s   zUserConversationContext.updatec                 C   s   | j jd| jdS )
        Deletes the UserConversationInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETEr!   r"   )r   deleter   r;   r   r   r   rU      s   zUserConversationContext.deletec                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the UserConversationInstance

        :returns: The fetched UserConversationInstance
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance
        r    rT   r
   r2   r1   )r   fetchr   rD   r   rE   r   r   r   rW      s   zUserConversationContext.fetchc                 C   $   d dd | j D }d|S )r:    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>      z3UserConversationContext.__repr__.<locals>.<genexpr>z4<Twilio.Conversations.V1.UserConversationContext {}>joinr   itemsr   r   contextr   r   r   r<        
z UserConversationContext.__repr__)r>   r?   r@   r   r   rA   rN   rU   rW   r<   rB   r   r   r   r   r4      s    
	r4   c                       sP  e Zd ZG dd deZG dd deZd6 fdd	Zedd	 Zed
d Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zed d! Zed"d# Zed$d% Zed&d' Zed(d) Zed*d+ Zed,d- Zejejejfd.d/Zd0d1 Zd2d3 Zd4d5 Z   Z!S )7rD   c                   @   s   e Zd ZdZdZdS )z*UserConversationInstance.NotificationLeveldefaultmutedN)r>   r?   r@   DEFAULTMUTEDr   r   r   r   rI     s    rI   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    rs   Nc                    s(  t t| | i d|dd|dd|ddt|ddt|dd|dd|dd|dd	|d	d
|d
d|ddt|ddt|dd|dd|dd|dd|dd|di| _d| _||p| jd d| _	dS )z
        Initialize the UserConversationInstance

        :returns: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationInstance
        account_sidchat_service_sidr2   unread_messages_countrQ   participant_sidr
   friendly_nameconversation_statetimers
attributesdate_createddate_updated
created_byrO   unique_nameurllinksNr1   )
r   rD   r   r6   r   integerrM   _properties_contextr   )r   r   rF   r
   r2   r   r   r   r     sT   






	







z!UserConversationInstance.__init__c                 C   s.   | j du rt| j| jd | jd d| _ | j S )aX  
        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
        :rtype: twilio.rest.conversations.v1.user.user_conversation.UserConversationContext
        Nr
   r2   r1   )r   r4   r   r   r;   r   r   r   _proxyD  s   
	zUserConversationInstance._proxyc                 C   
   | j d S )zs
        :returns: The unique ID of the Account responsible for this conversation.
        :rtype: unicode
        rt   r   r;   r   r   r   rt   U     
z$UserConversationInstance.account_sidc                 C   r   )z{
        :returns: The unique ID of the Conversation Service this conversation belongs to.
        :rtype: unicode
        ru   r   r;   r   r   r   ru   ]  r   z)UserConversationInstance.chat_service_sidc                 C   r   )zq
        :returns: The unique ID of the Conversation for this User Conversation.
        :rtype: unicode
        r2   r   r;   r   r   r   r2   e  r   z)UserConversationInstance.conversation_sidc                 C   r   )zf
        :returns: The number of unread Messages in the Conversation.
        :rtype: unicode
        rv   r   r;   r   r   r   rv   m  r   z.UserConversationInstance.unread_messages_countc                 C   r   )zX
        :returns: The index of the last read Message .
        :rtype: unicode
        rQ   r   r;   r   r   r   rQ   u  r   z0UserConversationInstance.last_read_message_indexc                 C   r   )zD
        :returns: Participant Sid.
        :rtype: unicode
        rw   r   r;   r   r   r   rw   }  r   z(UserConversationInstance.participant_sidc                 C   r   )zO
        :returns: The unique ID for the User.
        :rtype: unicode
        r
   r   r;   r   r   r   r
     r   z!UserConversationInstance.user_sidc                 C   r   )za
        :returns: The human-readable name of this conversation.
        :rtype: unicode
        rx   r   r;   r   r   r   rx     r   z&UserConversationInstance.friendly_namec                 C   r   )zv
        :returns: The current state of this User Conversation
        :rtype: UserConversationInstance.State
        ry   r   r;   r   r   r   ry     r   z+UserConversationInstance.conversation_statec                 C   r   )zY
        :returns: Timer date values for this conversation.
        :rtype: dict
        rz   r   r;   r   r   r   rz     r   zUserConversationInstance.timersc                 C   r   )z}
        :returns: An optional string metadata field you can use to store any data you wish.
        :rtype: unicode
        r{   r   r;   r   r   r   r{     r   z#UserConversationInstance.attributesc                 C   r   )za
        :returns: The date that this conversation was created.
        :rtype: datetime
        r|   r   r;   r   r   r   r|     r   z%UserConversationInstance.date_createdc                 C   r   )zf
        :returns: The date that this conversation was last updated.
        :rtype: datetime
        r}   r   r;   r   r   r   r}     r   z%UserConversationInstance.date_updatedc                 C   r   )zQ
        :returns: Creator of this conversation.
        :rtype: unicode
        r~   r   r;   r   r   r   r~     r   z#UserConversationInstance.created_byc                 C   r   )z
        :returns: The Notification Level of this User Conversation.
        :rtype: UserConversationInstance.NotificationLevel
        rO   r   r;   r   r   r   rO     r   z+UserConversationInstance.notification_levelc                 C   r   )z
        :returns: An application-defined string that uniquely identifies the Conversation resource.
        :rtype: unicode
        r   r   r;   r   r   r   r     r   z$UserConversationInstance.unique_namec                 C   r   )z;
        :returns: The url
        :rtype: unicode
        r   r   r;   r   r   r   r     r   zUserConversationInstance.urlc                 C   r   )z
        :returns: Absolute URLs to access the participant and conversation of this user conversation.
        :rtype: unicode
        r   r   r;   r   r   r   r     r   zUserConversationInstance.linksc                 C   s   | j j|||dS )rH   )rO   rP   rQ   )r   rN   )r   rO   rP   rQ   r   r   r   rN     s
   zUserConversationInstance.updatec                 C   
   | j  S )rR   )r   rU   r;   r   r   r   rU        
zUserConversationInstance.deletec                 C   r   )rV   )r   rW   r;   r   r   r   rW     r   zUserConversationInstance.fetchc                 C   rX   )r:   rY   c                 s   rZ   r[   r\   r]   r   r   r   ra     rb   z4UserConversationInstance.__repr__.<locals>.<genexpr>z5<Twilio.Conversations.V1.UserConversationInstance {}>rc   rf   r   r   r   r<   
  rh   z!UserConversationInstance.__repr__)N)"r>   r?   r@   objectrI   rs   r   propertyr   rt   ru   r2   rv   rQ   rw   r
   rx   ry   rz   r{   r|   r}   r~   rO   r   r   r   r   rA   rN   rU   rW   r<   rB   r   r   r   r   rD     sb    &



















		rD   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r%   r4   rD   r   r   r   r   <module>   s    'S