o
    ePU                     @   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fddZejddfddZejddfdd	Zejejejejfd
dZ	dd Z
dd Zdd Zdd Z  ZS )
MemberListc                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the MemberList

        :param Version version: Version that contains the resource
        :param service_sid: The SID of the Service that the resource is associated with
        :param channel_sid: The SID of the Channel for the member

        :returns: twilio.rest.chat.v2.service.channel.member.MemberList
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberList
        service_sidchannel_sidz6/Services/{service_sid}/Channels/{channel_sid}/MembersN )superr	   __init__	_solutionformat_uri)selfversionr   r   	__class__r   ]/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/chat/v2/service/channel/member.pyr      s   zMemberList.__init__c	              
   C   sn   t |||t|t|t||d}	t d|i}
| jjd| j|	|
d}t| j|| jd | jd dS )a  
        Create the MemberInstance

        :param unicode identity: The `identity` value that identifies the new resource's User
        :param unicode role_sid: The SID of the Role to assign to the member
        :param unicode last_consumed_message_index: The index of the last Message in the Channel the Member has read
        :param datetime last_consumption_timestamp: The ISO 8601 based timestamp string representing the datetime of the last Message read event for the member within the Channel
        :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created
        :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated
        :param unicode attributes: A valid JSON string that contains application-specific data
        :param MemberInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header

        :returns: The created MemberInstance
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance
        )IdentityRoleSidLastConsumedMessageIndexLastConsumptionTimestampDateCreatedDateUpdated
AttributesX-Twilio-Webhook-EnabledPOSTmethoduridataheadersr   r   r
   )	r   ofr   iso8601_datetime_versioncreater   MemberInstancer   )r   identityrole_sidlast_consumed_message_indexlast_consumption_timestampdate_createddate_updated
attributesx_twilio_webhook_enabledr$   r%   payloadr   r   r   r)   %   s"   	zMemberList.createNc                 C   s2   | j ||}| j||d d}| j ||d S )a  
        Streams MemberInstance 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 list[unicode] identity: The `identity` value of the resources to read
        :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.chat.v2.service.channel.member.MemberInstance]
        	page_size)r+   r4   limit)r(   read_limitspagestream)r   r+   r5   r4   limitsr7   r   r   r   r8   M   s   zMemberList.streamc                 C   s   t | j|||dS )a  
        Lists MemberInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param list[unicode] identity: The `identity` value of the resources to read
        :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.chat.v2.service.channel.member.MemberInstance]
        )r+   r5   r4   )listr8   )r   r+   r5   r4   r   r   r   r:   e   s   zMemberList.listc                 C   sD   t t|dd |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of MemberInstance records from the API.
        Request is executed immediately

        :param list[unicode] identity: The `identity` value of the resources to read
        :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 MemberInstance
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage
        c                 S   s   | S Nr   )er   r   r   <lambda>   s    z!MemberList.page.<locals>.<lambda>)r   	PageTokenr   PageSizeGET)r"   r#   params)	r   r&   r   mapr(   r7   r   
MemberPager   )r   r+   
page_tokenpage_numberr4   r$   responser   r   r   r7   x   s   zMemberList.pagec                 C   s"   | j jjd|}t| j || jS )a;  
        Retrieve a specific page of MemberInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MemberInstance
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage
        r@   )r(   domaintwiliorequestrC   r   )r   
target_urlrF   r   r   r   get_page   s
   

zMemberList.get_pagec                 C      t | j| jd | jd |dS z
        Constructs a MemberContext

        :param sid: The SID of the Member resource to fetch

        :returns: twilio.rest.chat.v2.service.channel.member.MemberContext
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext
        r   r   r   r   sidMemberContextr(   r   r   rO   r   r   r   get      	zMemberList.getc                 C   rL   rM   rP   rR   r   r   r   __call__   rT   zMemberList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Chat.V2.MemberList>r   r   r   r   r   __repr__      zMemberList.__repr__)__name__
__module____qualname__r   r   unsetr)   r8   r:   r7   rK   rS   rU   rY   __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 )rC   c                    s   t t| || || _dS )a  
        Initialize the MemberPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param service_sid: The SID of the Service that the resource is associated with
        :param channel_sid: The SID of the Channel for the member

        :returns: twilio.rest.chat.v2.service.channel.member.MemberPage
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberPage
        N)r   rC   r   r   )r   r   rF   solutionr   r   r   r      s   
zMemberPage.__init__c                 C   s   t | j|| jd | jd dS )a  
        Build an instance of MemberInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.chat.v2.service.channel.member.MemberInstance
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance
        r   r   r
   )r*   r(   r   r   r3   r   r   r   get_instance   s   	zMemberPage.get_instancec                 C   rV   )rW   z<Twilio.Chat.V2.MemberPage>r   rX   r   r   r   rY      rZ   zMemberPage.__repr__)r[   r\   r]   r   rb   rY   r_   r   r   r   r   rC      s    rC   c                       s`   e Zd Z fddZdd ZejfddZejejejejejejejfddZd	d
 Z	  Z
S )rQ   c                    s6   t t| | |||d| _djdi | j| _dS )a  
        Initialize the MemberContext

        :param Version version: Version that contains the resource
        :param service_sid: The SID of the Service to fetch the resource from
        :param channel_sid: The SID of the channel the member belongs to
        :param sid: The SID of the Member resource to fetch

        :returns: twilio.rest.chat.v2.service.channel.member.MemberContext
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext
        rN   z</Services/{service_sid}/Channels/{channel_sid}/Members/{sid}Nr   )r   rQ   r   r   r   r   )r   r   r   r   rO   r   r   r   r      s   zMemberContext.__init__c                 C   s8   | j jd| jd}t| j || jd | jd | jd dS )
        Fetch the MemberInstance

        :returns: The fetched MemberInstance
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance
        r@   )r"   r#   r   r   rO   rN   )r(   fetchr   r*   r   ra   r   r   r   rd     s   zMemberContext.fetchc                 C   s"   t d|i}| jjd| j|dS )
        Deletes the MemberInstance

        :param MemberInstance.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MemberContext.deletec              	   C   st   t ||t|t|t||d}t d|i}	| jjd| j||	d}
t| j|
| jd | jd | jd dS )	  
        Update the MemberInstance

        :param unicode role_sid: The SID of the Role to assign to the member
        :param unicode last_consumed_message_index: The index of the last consumed Message for the Channel for the Member
        :param datetime last_consumption_timestamp: The ISO 8601 based timestamp string representing the datetime of the last Message read event for the Member within the Channel
        :param datetime date_created: The ISO 8601 date and time in GMT when the resource was created
        :param datetime date_updated: The ISO 8601 date and time in GMT when the resource was updated
        :param unicode attributes: A valid JSON string that contains application-specific data
        :param MemberInstance.WebhookEnabledType x_twilio_webhook_enabled: The X-Twilio-Webhook-Enabled HTTP request header

        :returns: The updated MemberInstance
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance
        )r   r   r   r   r   r   r   r    r!   r   r   rO   rN   )	r   r&   r   r'   r(   updater   r*   r   )r   r,   r-   r.   r/   r0   r1   r2   r$   r%   r3   r   r   r   ri   +  s"   zMemberContext.updatec                 C   $   d dd | j D }d|S )rW    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>Y      z)MemberContext.__repr__.<locals>.<genexpr>z!<Twilio.Chat.V2.MemberContext {}>joinr   itemsr   r   contextr   r   r   rY   R     
zMemberContext.__repr__)r[   r\   r]   r   rd   r   r^   rg   ri   rY   r_   r   r   r   r   rQ      s    
'rQ   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d d! Zejfd"d#Zejejejejejejejfd$d%Zd&d' Z  ZS ))r*   c                   @   s   e Zd ZdZdZdS )z!MemberInstance.WebhookEnabledTypetruefalseN)r[   r\   r]   TRUEFALSEr   r   r   r   WebhookEnabledType_  s    r   Nc                    s   t t| | |d|d|d|d|dt|dt|d|dt|d	t|d
|d|dd| _d| _|||pS| jd d| _	dS )z
        Initialize the MemberInstance

        :returns: twilio.rest.chat.v2.service.channel.member.MemberInstance
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberInstance
        rO   account_sidr   r   r+   r/   r0   r,   r-   r.   urlr1   )rO   r   r   r   r+   r/   r0   r,   r-   r.   r   r1   NrN   )
r   r*   r   rS   r   r'   integer_properties_contextr   )r   r   r3   r   r   rO   r   r   r   r   c  s&   zMemberInstance.__init__c                 C   s6   | j du rt| j| jd | jd | jd d| _ | j S )a1  
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: MemberContext for this MemberInstance
        :rtype: twilio.rest.chat.v2.service.channel.member.MemberContext
        Nr   r   rO   rN   )r   rQ   r(   r   rX   r   r   r   _proxy  s   
	zMemberInstance._proxyc                 C   
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rO   r   rX   r   r   r   rO        
zMemberInstance.sidc                 C   r   )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        r   r   rX   r   r   r   r     r   zMemberInstance.account_sidc                 C   r   )zY
        :returns: The SID of the Channel for the member
        :rtype: unicode
        r   r   rX   r   r   r   r     r   zMemberInstance.channel_sidc                 C   r   )zo
        :returns: The SID of the Service that the resource is associated with
        :rtype: unicode
        r   r   rX   r   r   r   r     r   zMemberInstance.service_sidc                 C   r   )zb
        :returns: The string that identifies the resource's User
        :rtype: unicode
        r+   r   rX   r   r   r   r+     r   zMemberInstance.identityc                 C   r   )zt
        :returns: The ISO 8601 date and time in GMT when the resource was created
        :rtype: datetime
        r/   r   rX   r   r   r   r/     r   zMemberInstance.date_createdc                 C   r   )zy
        :returns: The ISO 8601 date and time in GMT when the resource was last updated
        :rtype: datetime
        r0   r   rX   r   r   r   r0     r   zMemberInstance.date_updatedc                 C   r   )z^
        :returns: The SID of the Role assigned to the member
        :rtype: unicode
        r,   r   rX   r   r   r   r,     r   zMemberInstance.role_sidc                 C   r   )z}
        :returns: The index of the last Message that the Member has read within the Channel
        :rtype: unicode
        r-   r   rX   r   r   r   r-     r   z*MemberInstance.last_consumed_message_indexc                 C   r   )z
        :returns: The ISO 8601 based timestamp string that represents the datetime of the last Message read event for the Member within the Channel
        :rtype: datetime
        r.   r   rX   r   r   r   r.     r   z)MemberInstance.last_consumption_timestampc                 C   r   )z[
        :returns: The absolute URL of the Member resource
        :rtype: unicode
        r   r   rX   r   r   r   r     r   zMemberInstance.urlc                 C   r   )zi
        :returns: The JSON string that stores application-specific data
        :rtype: unicode
        r1   r   rX   r   r   r   r1     r   zMemberInstance.attributesc                 C   s
   | j  S )rc   )r   rd   rX   r   r   r   rd     s   
zMemberInstance.fetchc                 C   s   | j j|dS )re   )r2   )r   rg   )r   r2   r   r   r   rg     s   	zMemberInstance.deletec              	   C   s   | j j|||||||dS )rh   )r,   r-   r.   r/   r0   r1   r2   )r   ri   )r   r,   r-   r.   r/   r0   r1   r2   r   r   r   ri   
  s   zMemberInstance.updatec                 C   rj   )rW   rk   c                 s   rl   rm   rn   ro   r   r   r   rs   .  rt   z*MemberInstance.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V2.MemberInstance {}>ru   rx   r   r   r   rY   '  rz   zMemberInstance.__repr__r;   )r[   r\   r]   objectr   r   propertyr   rO   r   r   r   r+   r/   r0   r,   r-   r.   r   r1   rd   r   r^   rg   ri   rY   r_   r   r   r   r   r*   ]  sL    !












	
r*   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   rC   rQ   r*   r   r   r   r   <module>   s    ;-d