a
    !f                     @   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deeeef ee	e d fddZ
eddd	d
Zejfedef edddZejfedef edddZd dddZd dddZejejejejejejejejejejf
edef eeef eeef eeef eeef eeef eeef eeef eeef eeef d dddZejejejejejejejejejejf
edef eeef eeef eeef eeef eeef eeef eeef eeef eeef d dddZedddZ  ZS )ParticipantInstancec                   @   s   e Zd ZdZdZdS )&ParticipantInstance.WebhookEnabledTypetruefalseN)__name__
__module____qualname__TRUEFALSE r   r   v/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/conversations/v1/conversation/participant.pyWebhookEnabledType   s   r   N)versionpayloadconversation_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	t
|d| _t
|d	| _|d
| _t
|d| _|d| _||p| jd| _d | _d S )Naccount_sidr    r!   identity
attributesmessaging_bindingrole_siddate_createddate_updatedurllast_read_message_indexlast_read_timestampr    r!   )super__init__getr"   r    r!   r#   r$   r%   r&   r
   iso8601_datetimer'   r(   r)   integerr*   r+   	_solution_context)selfr   r   r    r!   	__class__r   r   r.   .   s2    zParticipantInstance.__init__ParticipantContextreturnc                 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: ParticipantContext for this ParticipantInstance
        Nr    r!   r,   )r3   r7   _versionr2   r4   r   r   r   _proxyR   s    
zParticipantInstance._proxyr   x_twilio_webhook_enabledr9   c                 C   s   | j j|dS )
        Deletes the ParticipantInstance

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

        :returns: True if delete succeeds, False otherwise
        r>   )r<   deleter4   r>   r   r   r   rA   b   s    zParticipantInstance.deletec                    s   | j j|dI dH S )
        Asynchronous coroutine that deletes the ParticipantInstance

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

        :returns: True if delete succeeds, False otherwise
        r@   N)r<   delete_asyncrB   r   r   r   rD   s   s    z ParticipantInstance.delete_asyncc                 C   s
   | j  S )c
        Fetch the ParticipantInstance


        :returns: The fetched ParticipantInstance
        )r<   fetchr;   r   r   r   rF      s    zParticipantInstance.fetchc                    s   | j  I dH S )}
        Asynchronous coroutine to fetch the ParticipantInstance


        :returns: The fetched ParticipantInstance
        N)r<   fetch_asyncr;   r   r   r   rH      s    zParticipantInstance.fetch_asyncr>   r'   r(   r$   r&   messaging_binding_proxy_address#messaging_binding_projected_addressr#   r*   r+   r9   c                 C   s    | j j|||||||||	|
d
S )  
        Update the ParticipantInstance

        :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header
        :param date_created: The date that this resource was created.
        :param date_updated: The date that this resource was last updated.
        :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified.  **Note** that if the attributes are not set \"{}\" will be returned.
        :param role_sid: The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant.
        :param messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it.
        :param messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it.
        :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters.
        :param last_read_message_index: Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.
        :param last_read_timestamp: Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.

        :returns: The updated ParticipantInstance
        
r>   r'   r(   r$   r&   rJ   rK   r#   r*   r+   )r<   updater4   r>   r'   r(   r$   r&   rJ   rK   r#   r*   r+   r   r   r   rN      s    zParticipantInstance.updatec                    s&   | j j|||||||||	|
d
I dH S )  
        Asynchronous coroutine to update the ParticipantInstance

        :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header
        :param date_created: The date that this resource was created.
        :param date_updated: The date that this resource was last updated.
        :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified.  **Note** that if the attributes are not set \"{}\" will be returned.
        :param role_sid: The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant.
        :param messaging_binding_proxy_address: The address of the Twilio phone number that the participant is in contact with. 'null' value will remove it.
        :param messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. 'null' value will remove it.
        :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters.
        :param last_read_message_index: Index of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.
        :param last_read_timestamp: Timestamp of last “read” message in the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for the Participant.

        :returns: The updated ParticipantInstance
        rM   N)r<   update_asyncrO   r   r   r   rQ      s    z ParticipantInstance.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>       z/ParticipantInstance.__repr__.<locals>.<genexpr>z0<Twilio.Conversations.V1.ParticipantInstance {}>joinr2   itemsrV   r4   contextr   r   r   __repr__   s    zParticipantInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r.   propertyr<   r   unsetr   boolrA   rD   rF   rH   r   intrN   rQ   rb   __classcell__r   r   r5   r   r      s    
$	








0








,r   c                       s  e Zd Zeeed fddZejfede	f e
dddZejfede	f e
ddd	Zed
ddZed
ddZejejejejejejejejejejf
ede	f eee	f eee	f eee	f eee	f eee	f eee	f eee	f eee	f eee	f edddZejejejejejejejejejejf
ede	f eee	f eee	f eee	f eee	f eee	f eee	f eee	f eee	f eee	f edddZed
ddZ  ZS )r7   )r   r    r!   c                    s0   t  | ||d| _djf i | j| _dS )aa  
        Initialize the ParticipantContext

        :param version: Version that contains the resource
        :param conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for this participant.
        :param sid: A 34 character string that uniquely identifies this resource.
        r,   z4/Conversations/{conversation_sid}/Participants/{sid}Nr-   r.   r2   rV   _uri)r4   r   r    r!   r5   r   r   r.      s    zParticipantContext.__init__r   r=   c                 C   s"   t d|i}| jjd| j|dS )r?   X-Twilio-Webhook-EnabledDELETEmethoduriheaders)r   ofr:   rA   rk   r4   r>   rq   r   r   r   rA     s
    zParticipantContext.deletec                    s(   t d|i}| jjd| j|dI dH S )rC   rl   rm   rn   N)r   rr   r:   rD   rk   rs   r   r   r   rD   !  s    zParticipantContext.delete_asyncr8   c                 C   s0   | j jd| jd}t| j || jd | jd dS )rE   GETro   rp   r    r!   r,   )r:   rF   rk   r   r2   r4   r   r   r   r   rF   8  s    zParticipantContext.fetchc                    s6   | j jd| jdI dH }t| j || jd | jd dS )rG   rt   ru   Nr    r!   r,   )r:   rH   rk   r   r2   rv   r   r   r   rH   L  s    zParticipantContext.fetch_asyncrI   c                 C   sl   t t|t|||||||	|
d	}t d|i}| jjd| j||d}t| j|| jd | jd dS )rL   	DateCreatedDateUpdated
AttributesRoleSidMessagingBinding.ProxyAddress!MessagingBinding.ProjectedAddressIdentityZLastReadMessageIndexZLastReadTimestamprl   POSTro   rp   datarq   r    r!   r,   )	r   rr   r   r0   r:   rN   rk   r   r2   r4   r>   r'   r(   r$   r&   rJ   rK   r#   r*   r+   r   rq   r   r   r   r   rN   `  s2    
zParticipantContext.updatec                    sr   t t|t|||||||	|
d	}t d|i}| jjd| j||dI dH }t| j|| jd | jd dS )	rP   rw   rl   r   r   Nr    r!   r,   )	r   rr   r   r0   r:   rQ   rk   r   r2   r   r   r   r   rQ     s2    
zParticipantContext.update_asyncc                 C   s$   d dd | j D }d|S )rR   rS   c                 s   s   | ]\}}d  ||V  qdS rT   rU   rW   r   r   r   r[     r\   z.ParticipantContext.__repr__.<locals>.<genexpr>z/<Twilio.Conversations.V1.ParticipantContext {}>r]   r`   r   r   r   rb     s    zParticipantContext.__repr__)r   r   r   r   rd   r.   r   rf   r   rc   rg   rA   rD   r   rF   rH   r   rh   rN   rQ   rb   ri   r   r   r5   r   r7      s   








A








=r7   c                   @   s2   e Zd Zeeef edddZedddZdS )ParticipantPage)r   r9   c                 C   s   t | j|| jd dS )zq
        Build an instance of ParticipantInstance

        :param payload: Payload response from the API
        r    r    )r   r:   r2   rv   r   r   r   get_instance  s    zParticipantPage.get_instancer8   c                 C   s   dS )rR   z)<Twilio.Conversations.V1.ParticipantPage>r   r;   r   r   r   rb     s    zParticipantPage.__repr__N)	r   r   r   r   rd   r   r   r   rb   r   r   r   r   r     s   
r   c                       s  e Zd Zeed fddZejejejejejejejejejf	ede	f eee	f eee	f eee	f ee
e	f ee
e	f eee	f eee	f eee	f ed
ddZejejejejejejejejejf	ede	f eee	f eee	f eee	f ee
e	f ee
e	f eee	f eee	f eee	f 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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 )*ParticipantList)r   r    c                    s.   t  | d|i| _djf i | j| _dS )a	  
        Initialize the ParticipantList

        :param version: Version that contains the resource
        :param conversation_sid: The unique ID of the [Conversation](https://www.twilio.com/docs/conversations/api/conversation-resource) for participants.

        r    z./Conversations/{conversation_sid}/ParticipantsNrj   )r4   r   r    r5   r   r   r.     s    zParticipantList.__init__r   )
r>   r#   messaging_binding_addressrJ   r'   r(   r$   rK   r&   r9   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 x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header
        :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters.
        :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field).
        :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field).
        :param date_created: The date that this resource was created.
        :param date_updated: The date that this resource was last updated.
        :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified.  **Note** that if the attributes are not set \"{}\" will be returned.
        :param messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity.
        :param role_sid: The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant.

        :returns: The created ParticipantInstance
        r~   zMessagingBinding.Addressr|   rx   ry   rz   r}   r{   rl   r   r   r    r   )	r   rr   r   r0   r:   createrk   r   r2   r4   r>   r#   r   rJ   r'   r(   r$   rK   r&   r   rq   r   r   r   r   r     s*    
zParticipantList.createc
                    sh   t |||t|t||||	d}
t d|i}| jjd| j|
|dI dH }t| j|| jd dS )a6  
        Asynchronously create the ParticipantInstance

        :param x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header
        :param identity: A unique string identifier for the conversation participant as [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource). This parameter is non-null if (and only if) the participant is using the Conversations SDK to communicate. Limited to 256 characters.
        :param messaging_binding_address: The address of the participant's device, e.g. a phone or WhatsApp number. Together with the Proxy address, this determines a participant uniquely. This field (with proxy_address) is only null when the participant is interacting from an SDK endpoint (see the 'identity' field).
        :param messaging_binding_proxy_address: The address of the Twilio phone number (or WhatsApp number) that the participant is in contact with. This field, together with participant address, is only null when the participant is interacting from an SDK endpoint (see the 'identity' field).
        :param date_created: The date that this resource was created.
        :param date_updated: The date that this resource was last updated.
        :param attributes: An optional string metadata field you can use to store any data you wish. The string value must contain structurally valid JSON if specified.  **Note** that if the attributes are not set \"{}\" will be returned.
        :param messaging_binding_projected_address: The address of the Twilio phone number that is used in Group MMS. Communication mask for the Conversation participant with Identity.
        :param role_sid: The SID of a conversation-level [Role](https://www.twilio.com/docs/conversations/api/role-resource) to assign to the participant.

        :returns: The created ParticipantInstance
        r   rl   r   r   Nr    r   )	r   rr   r   r0   r:   create_asyncrk   r   r2   r   r   r   r   r   A  s*    
zParticipantList.create_asyncN)limit	page_sizer9   c                 C   s0   | j ||}| j|d d}| j ||d S )aa  
        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 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r4   r   r   Zlimitsr   r   r   r   r   w  s    zParticipantList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )ap  
        Asynchronously 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 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ParticipantList.stream_asyncc                 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 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   r4   r   r   r   r   r   r     s    zParticipantList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously 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 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   )rX   recordr   r   r   
<listcomp>  s   z.ParticipantList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async  s    
zParticipantList.list_async)
page_tokenpage_numberr   r9   c                 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 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 ParticipantInstance
        Z	PageTokenr   ZPageSizert   ro   rp   params)r   rr   r:   r   rk   r   r2   r4   r   r   r   r   responser   r   r   r     s    zParticipantList.pagec                    s<   t |||d}| jjd| j|dI dH }t| j|| jS )a  
        Asynchronously retrieve a single page of ParticipantInstance 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 ParticipantInstance
        r   rt   r   N)r   rr   r:   r   rk   r   r2   r   r   r   r   r     s    zParticipantList.page_async)
target_urlr9   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of ParticipantInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ParticipantInstance
        rt   )r:   domaintwiliorequestr   r2   r4   r   r   r   r   r   get_page  s    	zParticipantList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a
  
        Asynchronously retrieve a specific page of ParticipantInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ParticipantInstance
        rt   N)r:   r   r   Zrequest_asyncr   r2   r   r   r   r   get_page_async"  s    	zParticipantList.get_page_async)r!   r9   c                 C   s   t | j| jd |dS z
        Constructs a ParticipantContext

        :param sid: A 34 character string that uniquely identifies this resource.
        r    r,   r7   r:   r2   r4   r!   r   r   r   r/   .  s    zParticipantList.getc                 C   s   t | j| jd |dS r   r   r   r   r   r   __call__8  s    zParticipantList.__call__r8   c                 C   s   dS )rR   z)<Twilio.Conversations.V1.ParticipantList>r   r;   r   r   r   rb   B  s    zParticipantList.__repr__)NN)NN)NN)NN)!r   r   r   r   rd   r.   r   rf   r   rc   r   r   r   r   r   rh   r   r   r	   r   r   r   r   r   r   r   r   r   r7   r/   r   rb   ri   r   r   r5   r   r     s   







:







8        







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   r7   r   r   r   r   r   r   <module>   s   $ _ m