o
    eY                     @   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                	       s   e Zd Z fddZejejejejejejejejej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 )ParticipantListc                    s2   t t| | d|i| _djdi | j| _dS )a|  
        Initialize the ParticipantList

        :param Version version: Version that contains the resource
        :param conversation_sid: The unique ID of the Conversation for this participant.

        :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantList
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantList
        conversation_sidz./Conversations/{conversation_sid}/ParticipantsN )superr	   __init__	_solutionformat_uri)selfversionr
   	__class__r   h/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/conversation/participant.pyr      s   

zParticipantList.__init__c
                 C   sb   t |||t|t||||d}
t d|	i}| jjd| j|
|d}t| j|| jd dS )a  
        Create the ParticipantInstance

        :param unicode identity: A unique string identifier for the conversation participant as Conversation User.
        :param unicode messaging_binding_address: The address of the participant's device.
        :param unicode messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with.
        :param datetime date_created: The date that this resource was created.
        :param datetime date_updated: The date that this resource was last updated.
        :param unicode attributes: An optional string metadata field you can use to store any data you wish.
        :param unicode messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS.
        :param unicode role_sid: The SID of a conversation-level Role to assign to the participant
        :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header

        :returns: The created ParticipantInstance
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance
        )IdentityzMessagingBinding.AddressMessagingBinding.ProxyAddressDateCreatedDateUpdated
Attributes!MessagingBinding.ProjectedAddressRoleSidX-Twilio-Webhook-EnabledPOSTmethoduridataheadersr
   r
   )	r   ofr   iso8601_datetime_versioncreater   ParticipantInstancer   )r   identitymessaging_binding_addressmessaging_binding_proxy_addressdate_createddate_updated
attributes#messaging_binding_projected_addressrole_sidx_twilio_webhook_enabledr"   r#   payloadr   r   r   r(   $   s"   
zParticipantList.createNc                 C   s0   | j ||}| j|d d}| j ||d S )a  
        Streams ParticipantInstance 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.conversation.participant.ParticipantInstance]
        	page_size)r4   limit)r'   read_limitspagestream)r   r5   r4   limitsr7   r   r   r   r8   N   s   zParticipantList.streamc                 C   s   t | j||dS )ay  
        Lists ParticipantInstance 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.conversation.participant.ParticipantInstance]
        )r5   r4   )listr8   )r   r5   r4   r   r   r   r:   e   s   zParticipantList.listc                 C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of ParticipantInstance 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 ParticipantInstance
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantPage
        )	PageTokenr   PageSizeGET)r    r!   params)r   r%   r'   r7   r   ParticipantPager   )r   
page_tokenpage_numberr4   r"   responser   r   r   r7   w   s   zParticipantList.pagec                 C   s"   | j jjd|}t| j || jS )aU  
        Retrieve a specific page of ParticipantInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ParticipantInstance
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantPage
        r=   )r'   domaintwiliorequestr?   r   )r   
target_urlrB   r   r   r   get_page   s
   

zParticipantList.get_pagec                 C      t | j| jd |dS a9  
        Constructs a ParticipantContext

        :param sid: A 34 character string that uniquely identifies this resource.

        :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantContext
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantContext
        r
   r
   sidParticipantContextr'   r   r   rK   r   r   r   get   
   	zParticipantList.getc                 C   rH   rI   rL   rN   r   r   r   __call__   rP   zParticipantList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z)<Twilio.Conversations.V1.ParticipantList>r   r   r   r   r   __repr__      zParticipantList.__repr__)NN)__name__
__module____qualname__r   r   unsetr(   r8   r:   r7   rG   rO   rQ   rU   __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 ParticipantPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param conversation_sid: The unique ID of the Conversation for this participant.

        :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantPage
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantPage
        N)r   r?   r   r   )r   r   rB   solutionr   r   r   r      s   
zParticipantPage.__init__c                 C   s   t | j|| jd dS )a-  
        Build an instance of ParticipantInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance
        r
   r$   )r)   r'   r   r   r3   r   r   r   get_instance   s
   	zParticipantPage.get_instancec                 C   rR   )rS   z)<Twilio.Conversations.V1.ParticipantPage>r   rT   r   r   r   rU      rV   zParticipantPage.__repr__)rW   rX   rY   r   r^   rU   r[   r   r   r   r   r?      s    r?   c                
       sl   e Zd Z fddZejejejejejejejejejejf
ddZejfddZdd Zd	d
 Z	  Z
S )rM   c                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the ParticipantContext

        :param Version version: Version that contains the resource
        :param conversation_sid: The unique ID of the Conversation for this participant.
        :param sid: A 34 character string that uniquely identifies this resource.

        :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantContext
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantContext
        rJ   z4/Conversations/{conversation_sid}/Participants/{sid}Nr   )r   rM   r   r   r   r   )r   r   r
   rK   r   r   r   r      s   zParticipantContext.__init__c                 C   sl   t t|t||||||||	d	}t d|
i}| jjd| j||d}t| j|| jd | jd dS )  
        Update the ParticipantInstance

        :param datetime date_created: The date that this resource was created.
        :param datetime date_updated: The date that this resource was last updated.
        :param unicode attributes: An optional string metadata field you can use to store any data you wish.
        :param unicode role_sid: The SID of a conversation-level Role to assign to the participant
        :param unicode messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with.
        :param unicode messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS.
        :param unicode identity: A unique string identifier for the conversation participant as Conversation User.
        :param unicode last_read_message_index: Index of last “read” message in the Conversation for the Participant.
        :param unicode last_read_timestamp: Timestamp of last “read” message in the Conversation for the Participant.
        :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header

        :returns: The updated ParticipantInstance
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance
        )	r   r   r   r   r   r   r   LastReadMessageIndexLastReadTimestampr   r   r   r
   rK   rJ   )	r   r%   r   r&   r'   updater   r)   r   )r   r-   r.   r/   r1   r,   r0   r*   last_read_message_indexlast_read_timestampr2   r"   r#   r3   r   r   r   rb     s&   zParticipantContext.updatec                 C   s"   t d|i}| jjd| j|dS )  
        Deletes the ParticipantInstance

        :param ParticipantInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        r   DELETE)r    r!   r#   )r   r%   r'   deleter   )r   r2   r#   r   r   r   rg   /  s   	zParticipantContext.deletec                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the ParticipantInstance

        :returns: The fetched ParticipantInstance
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance
        r=   )r    r!   r
   rK   rJ   )r'   fetchr   r)   r   r]   r   r   r   ri   <  s   zParticipantContext.fetchc                 C   $   d dd | j D }d|S )rS    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>S      z.ParticipantContext.__repr__.<locals>.<genexpr>z/<Twilio.Conversations.V1.ParticipantContext {}>joinr   itemsr   r   contextr   r   r   rU   L     
zParticipantContext.__repr__)rW   rX   rY   r   r   rZ   rb   rg   ri   rU   r[   r   r   r   r   rM      s    
.rM   c                
       s  e Zd ZG dd deZd( 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jejejejejejejejejejf
d d!Zejfd"d#Zd$d% Zd&d' Z  ZS ))r)   c                   @   s   e Zd ZdZdZdS )z&ParticipantInstance.WebhookEnabledTypetruefalseN)rW   rX   rY   TRUEFALSEr   r   r   r   WebhookEnabledTypeY  s    r   Nc                    s   t t| | |d|d|d|d|d|d|dt|dt|d	|d
t|d|dd| _d| _||pO| jd d| _	dS )z
        Initialize the ParticipantInstance

        :returns: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantInstance
        account_sidr
   rK   r*   r/   messaging_bindingr1   r-   r.   urlrc   rd   )r   r
   rK   r*   r/   r   r1   r-   r.   r   rc   rd   NrJ   )
r   r)   r   rO   r   r&   integer_properties_contextr   )r   r   r3   r
   rK   r   r   r   r   ]  s    zParticipantInstance.__init__c                 C   s.   | j du rt| j| jd | jd d| _ | j S )aK  
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: ParticipantContext for this ParticipantInstance
        :rtype: twilio.rest.conversations.v1.conversation.participant.ParticipantContext
        Nr
   rK   rJ   )r   rM   r'   r   rT   r   r   r   _proxyz  s   
	zParticipantInstance._proxyc                 C   
   | j d S )zr
        :returns: The unique ID of the Account responsible for this participant.
        :rtype: unicode
        r   r   rT   r   r   r   r        
zParticipantInstance.account_sidc                 C   r   )zk
        :returns: The unique ID of the Conversation for this participant.
        :rtype: unicode
        r
   r   rT   r   r   r   r
     r   z$ParticipantInstance.conversation_sidc                 C   r   )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rK   r   rT   r   r   r   rK     r   zParticipantInstance.sidc                 C   r   )z
        :returns: A unique string identifier for the conversation participant as Conversation User.
        :rtype: unicode
        r*   r   rT   r   r   r   r*     r   zParticipantInstance.identityc                 C   r   )z}
        :returns: An optional string metadata field you can use to store any data you wish.
        :rtype: unicode
        r/   r   rT   r   r   r   r/     r   zParticipantInstance.attributesc                 C   r   )z
        :returns: Information about how this participant exchanges messages with the conversation.
        :rtype: dict
        r   r   rT   r   r   r   r     r   z%ParticipantInstance.messaging_bindingc                 C   r   )zu
        :returns: The SID of a conversation-level Role to assign to the participant
        :rtype: unicode
        r1   r   rT   r   r   r   r1     r   zParticipantInstance.role_sidc                 C   r   )z]
        :returns: The date that this resource was created.
        :rtype: datetime
        r-   r   rT   r   r   r   r-     r   z ParticipantInstance.date_createdc                 C   r   )zb
        :returns: The date that this resource was last updated.
        :rtype: datetime
        r.   r   rT   r   r   r   r.     r   z ParticipantInstance.date_updatedc                 C   r   )zY
        :returns: An absolute URL for this participant.
        :rtype: unicode
        r   r   rT   r   r   r   r     r   zParticipantInstance.urlc                 C   r   )u}   
        :returns: Index of last “read” message in the Conversation for the Participant.
        :rtype: unicode
        rc   r   rT   r   r   r   rc     r   z+ParticipantInstance.last_read_message_indexc                 C   r   )u   
        :returns: Timestamp of last “read” message in the Conversation for the Participant.
        :rtype: unicode
        rd   r   rT   r   r   r   rd     r   z'ParticipantInstance.last_read_timestampc                 C   s    | j j|||||||||	|
d
S )r_   )
r-   r.   r/   r1   r,   r0   r*   rc   rd   r2   )r   rb   )r   r-   r.   r/   r1   r,   r0   r*   rc   rd   r2   r   r   r   rb     s   zParticipantInstance.updatec                 C   s   | j j|dS )re   )r2   )r   rg   )r   r2   r   r   r   rg     s   	zParticipantInstance.deletec                 C   s
   | j  S )rh   )r   ri   rT   r   r   r   ri     s   
zParticipantInstance.fetchc                 C   rj   )rS   rk   c                 s   rl   rm   rn   ro   r   r   r   rs   +  rt   z/ParticipantInstance.__repr__.<locals>.<genexpr>z0<Twilio.Conversations.V1.ParticipantInstance {}>ru   rx   r   r   r   rU   $  rz   zParticipantInstance.__repr__)N)rW   rX   rY   objectr   r   propertyr   r   r
   rK   r*   r/   r   r1   r-   r.   r   rc   rd   r   rZ   rb   rg   ri   rU   r[   r   r   r   r   r)   W  sP    













%	r)   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r?   rM   r)   r   r   r   r   <module>   s    2+i