o
    e_                     @   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                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the ParticipantList

        :param Version version: Version that contains the resource
        :param chat_service_sid: The SID of the Conversation Service that the resource is associated with.
        :param conversation_sid: The unique ID of the Conversation for this participant.

        :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantList
        :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantList
        chat_service_sidconversation_sidzJ/Services/{chat_service_sid}/Conversations/{conversation_sid}/ParticipantsN )superr	   __init__	_solutionformat_uri)selfversionr   r   	__class__r   p/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/service/conversation/participant.pyr      s   zParticipantList.__init__c
                 C   sj   t |||t|t||||d}
t d|	i}| jjd| j|
|d}t| j|| jd | 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.service.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
   )	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.service.conversation.participant.ParticipantInstance]
        	page_size)r5   limit)r(   read_limitspagestream)r   r6   r5   limitsr8   r   r   r   r9   P   s   zParticipantList.streamc                 C   s   t | j||dS )a  
        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.service.conversation.participant.ParticipantInstance]
        )r6   r5   )listr9   )r   r6   r5   r   r   r   r;   g   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.service.conversation.participant.ParticipantPage
        )	PageTokenr   PageSizeGET)r"   r#   params)r   r&   r(   r8   r   ParticipantPager   )r   
page_tokenpage_numberr5   r$   responser   r   r   r8   y   s   zParticipantList.pagec                 C   s"   | j jjd|}t| j || jS )a]  
        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.service.conversation.participant.ParticipantPage
        r>   )r(   domaintwiliorequestr@   r   )r   
target_urlrC   r   r   r   get_page   s
   

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

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

        :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext
        :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext
        r   r   r   r   sidParticipantContextr(   r   r   rL   r   r   r   get      	zParticipantList.getc                 C   rI   rJ   rM   rO   r   r   r   __call__   rQ   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)   r9   r;   r8   rH   rP   rR   rV   __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 chat_service_sid: The SID of the Conversation Service that the resource is associated with.
        :param conversation_sid: The unique ID of the Conversation for this participant.

        :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantPage
        :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantPage
        N)r   r@   r   r   )r   r   rC   solutionr   r   r   r      s   
zParticipantPage.__init__c                 C   s   t | j|| jd | jd dS )a=  
        Build an instance of ParticipantInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance
        :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance
        r   r   r
   )r*   r(   r   r   r4   r   r   r   get_instance   s   	zParticipantPage.get_instancec                 C   rS   )rT   z)<Twilio.Conversations.V1.ParticipantPage>r   rU   r   r   r   rV      rW   zParticipantPage.__repr__)rX   rY   rZ   r   r_   rV   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 )rN   c                    s6   t t| | |||d| _djdi | j| _dS )aR  
        Initialize the ParticipantContext

        :param Version version: Version that contains the resource
        :param chat_service_sid: The SID of the Conversation Service that the resource is associated with.
        :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.service.conversation.participant.ParticipantContext
        :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantContext
        rK   zP/Services/{chat_service_sid}/Conversations/{conversation_sid}/Participants/{sid}Nr   )r   rN   r   r   r   r   )r   r   r   r   rL   r   r   r   r      s   zParticipantContext.__init__c                 C   st   t t|t||||||||	d	}t d|
i}| jjd| j||d}t| j|| jd | 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 identity: A unique string identifier for the conversation participant as Conversation User.
        :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 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.service.conversation.participant.ParticipantInstance
        )	r   r   r   r   r   r   r   LastReadMessageIndexLastReadTimestampr   r    r!   r   r   rL   rK   )	r   r&   r   r'   r(   updater   r*   r   )r   r.   r/   r+   r0   r2   r-   r1   last_read_message_indexlast_read_timestampr3   r$   r%   r4   r   r   r   rc     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   r3   r%   r   r   r   rh   ;  s   	zParticipantContext.deletec                 C   s8   | j jd| jd}t| j || jd | jd | jd dS )
        Fetch the ParticipantInstance

        :returns: The fetched ParticipantInstance
        :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance
        r>   )r"   r#   r   r   rL   rK   )r(   fetchr   r*   r   r^   r   r   r   rj   H  s   zParticipantContext.fetchc                 C   $   d dd | j D }d|S )rT    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>`      z.ParticipantContext.__repr__.<locals>.<genexpr>z/<Twilio.Conversations.V1.ParticipantContext {}>joinr   itemsr   r   contextr   r   r   rV   Y     
zParticipantContext.__repr__)rX   rY   rZ   r   r   r[   rc   rh   rj   rV   r\   r   r   r   r   rN      s    
/rN   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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)rX   rY   rZ   TRUEFALSEr   r   r   r   WebhookEnabledTypef  s    r   Nc                    s   t t| | |d|d|d|d|d|d|d|dt|d	t|d
|dt|d|dd| _d| _|||pT| jd d| _	dS )z
        Initialize the ParticipantInstance

        :returns: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance
        :rtype: twilio.rest.conversations.v1.service.conversation.participant.ParticipantInstance
        account_sidr   r   rL   r+   r0   messaging_bindingr2   r.   r/   urlrd   re   )r   r   r   rL   r+   r0   r   r2   r.   r/   r   rd   re   NrK   )
r   r*   r   rP   r   r'   integer_properties_contextr   )r   r   r4   r   r   rL   r   r   r   r   j  s(   zParticipantInstance.__init__c                 C   s6   | j du rt| j| jd | jd | jd d| _ | j S )aS  
        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.service.conversation.participant.ParticipantContext
        Nr   r   rL   rK   )r   rN   r(   r   rU   r   r   r   _proxy  s   
	zParticipantInstance._proxyc                 C   
   | j d S )zr
        :returns: The unique ID of the Account responsible for this participant.
        :rtype: unicode
        r   r   rU   r   r   r   r        
zParticipantInstance.account_sidc                 C   r   )z}
        :returns: The SID of the Conversation Service that the resource is associated with.
        :rtype: unicode
        r   r   rU   r   r   r   r     r   z$ParticipantInstance.chat_service_sidc                 C   r   )zk
        :returns: The unique ID of the Conversation for this participant.
        :rtype: unicode
        r   r   rU   r   r   r   r     r   z$ParticipantInstance.conversation_sidc                 C   r   )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rL   r   rU   r   r   r   rL     r   zParticipantInstance.sidc                 C   r   )z
        :returns: A unique string identifier for the conversation participant as Conversation User.
        :rtype: unicode
        r+   r   rU   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
        r0   r   rU   r   r   r   r0     r   zParticipantInstance.attributesc                 C   r   )z
        :returns: Information about how this participant exchanges messages with the conversation.
        :rtype: dict
        r   r   rU   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
        r2   r   rU   r   r   r   r2     r   zParticipantInstance.role_sidc                 C   r   )z]
        :returns: The date that this resource was created.
        :rtype: datetime
        r.   r   rU   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   rU   r   r   r   r/     r   z ParticipantInstance.date_updatedc                 C   r   )zY
        :returns: An absolute URL for this participant.
        :rtype: unicode
        r   r   rU   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
        rd   r   rU   r   r   r   rd     r   z+ParticipantInstance.last_read_message_indexc                 C   r   )u   
        :returns: Timestamp of last “read” message in the Conversation for the Participant.
        :rtype: unicode
        re   r   rU   r   r   r   re     r   z'ParticipantInstance.last_read_timestampc                 C   s    | j j|||||||||	|
d
S )r`   )
r.   r/   r+   r0   r2   r-   r1   rd   re   r3   )r   rc   )r   r.   r/   r+   r0   r2   r-   r1   rd   re   r3   r   r   r   rc     s   zParticipantInstance.updatec                 C   s   | j j|dS )rf   )r3   )r   rh   )r   r3   r   r   r   rh   ,  s   	zParticipantInstance.deletec                 C   s
   | j  S )ri   )r   rj   rU   r   r   r   rj   7  s   
zParticipantInstance.fetchc                 C   rk   )rT   rl   c                 s   rm   rn   ro   rp   r   r   r   rt   G  ru   z/ParticipantInstance.__repr__.<locals>.<genexpr>z0<Twilio.Conversations.V1.ParticipantInstance {}>rv   ry   r   r   r   rV   @  r{   zParticipantInstance.__repr__)N)rX   rY   rZ   objectr   r   propertyr   r   r   r   rL   r+   r0   r   r2   r.   r/   r   rd   re   r   r[   rc   rh   rj   rV   r\   r   r   r   r   r*   d  sV    #














%	r*   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r@   rN   r*   r   r   r   r   <module>   s    6-p