o
    eC                     @   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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 unique ID of the Channel for the member

        :returns: twilio.rest.chat.v1.service.channel.member.MemberList
        :rtype: twilio.rest.chat.v1.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/v1/service/channel/member.pyr      s   zMemberList.__init__c                 C   sB   t ||d}| jjd| j|d}t| j|| jd | jd dS )aO  
        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

        :returns: The created MemberInstance
        :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance
        )IdentityRoleSidPOSTmethoduridatar   r   r
   )r   of_versioncreater   MemberInstancer   )r   identityrole_sidr   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.v1.service.channel.member.MemberInstance]
        	page_size)r#   r&   limit)r    read_limitspagestream)r   r#   r'   r&   limitsr)   r   r   r   r*   :   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.v1.service.channel.member.MemberInstance]
        )r#   r'   r&   )listr*   )r   r#   r'   r&   r   r   r   r,   R   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.v1.service.channel.member.MemberPage
        c                 S   s   | S Nr   )er   r   r   <lambda>t   s    z!MemberList.page.<locals>.<lambda>)r   	PageTokenr   PageSizeGET)r   r   params)	r   r   r   mapr    r)   r   
MemberPager   )r   r#   
page_tokenpage_numberr&   r   responser   r   r   r)   e   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.v1.service.channel.member.MemberPage
        r2   )r    domaintwiliorequestr5   r   )r   
target_urlr8   r   r   r   get_page~   s
   

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

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.chat.v1.service.channel.member.MemberContext
        :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext
        r   r   r   r   sidMemberContextr    r   r   rA   r   r   r   get      	zMemberList.getc                 C   r>   r?   rB   rD   r   r   r   __call__   rF   zMemberList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Chat.V1.MemberList>r   r   r   r   r   __repr__      zMemberList.__repr__)__name__
__module____qualname__r   r   unsetr!   r*   r,   r)   r=   rE   rG   rK   __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 )r5   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 unique ID of the Channel for the member

        :returns: twilio.rest.chat.v1.service.channel.member.MemberPage
        :rtype: twilio.rest.chat.v1.service.channel.member.MemberPage
        N)r   r5   r   r   )r   r   r8   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.v1.service.channel.member.MemberInstance
        :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance
        r   r   r
   )r"   r    r   r   r%   r   r   r   get_instance   s   	zMemberPage.get_instancec                 C   rH   )rI   z<Twilio.Chat.V1.MemberPage>r   rJ   r   r   r   rK      rL   zMemberPage.__repr__)rM   rN   rO   r   rT   rK   rQ   r   r   r   r   r5      s    r5   c                       sF   e Zd Z fddZdd Zdd ZejejfddZd	d
 Z	  Z
S )rC   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 unique ID of the channel the member belongs to
        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.chat.v1.service.channel.member.MemberContext
        :rtype: twilio.rest.chat.v1.service.channel.member.MemberContext
        r@   z</Services/{service_sid}/Channels/{channel_sid}/Members/{sid}Nr   )r   rC   r   r   r   r   )r   r   r   r   rA   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.v1.service.channel.member.MemberInstance
        r2   r   r   r   r   rA   r@   )r    fetchr   r"   r   rS   r   r   r   rW      s   zMemberContext.fetchc                 C   s   | j jd| jdS )}
        Deletes the MemberInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErV   )r    deleter   rJ   r   r   r   rZ     s   zMemberContext.deletec                 C   sJ   t ||d}| jjd| j|d}t| j|| jd | jd | jd dS )k  
        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

        :returns: The updated MemberInstance
        :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance
        )r   LastConsumedMessageIndexr   r   r   r   rA   r@   )r   r   r    updater   r"   r   )r   r$   last_consumed_message_indexr   r%   r   r   r   r]     s   zMemberContext.updatec                 C   $   d dd | j D }d|S )rI    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>2      z)MemberContext.__repr__.<locals>.<genexpr>z!<Twilio.Chat.V1.MemberContext {}>joinr   itemsr   r   contextr   r   r   rK   +     
zMemberContext.__repr__)rM   rN   rO   r   rW   rZ   r   rP   r]   rK   rQ   r   r   r   r   rC      s    	
rC   c                       s   e Zd 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dd Zdd Zejejfd d!Zd"d# Z  ZS )%r"   Nc                    s   t t| | |d|d|d|d|dt|dt|d|dt|d	t|d
|dd| _d| _|||pO| jd d| _	dS )z
        Initialize the MemberInstance

        :returns: twilio.rest.chat.v1.service.channel.member.MemberInstance
        :rtype: twilio.rest.chat.v1.service.channel.member.MemberInstance
        rA   account_sidr   r   r#   date_createddate_updatedr$   r^   last_consumption_timestampurl)rA   rp   r   r   r#   rq   rr   r$   r^   rs   rt   Nr@   )
r   r"   r   rE   r   iso8601_datetimeinteger_properties_contextr   )r   r   r%   r   r   rA   r   r   r   r   8  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.v1.service.channel.member.MemberContext
        Nr   r   rA   r@   )rx   rC   r    r   rJ   r   r   r   _proxyX  s   
	zMemberInstance._proxyc                 C   
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rA   rw   rJ   r   r   r   rA   j     
zMemberInstance.sidc                 C   rz   )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        rp   r{   rJ   r   r   r   rp   r  r|   zMemberInstance.account_sidc                 C   rz   )z_
        :returns: The unique ID of the Channel for the member
        :rtype: unicode
        r   r{   rJ   r   r   r   r   z  r|   zMemberInstance.channel_sidc                 C   rz   )zo
        :returns: The SID of the Service that the resource is associated with
        :rtype: unicode
        r   r{   rJ   r   r   r   r     r|   zMemberInstance.service_sidc                 C   rz   )zb
        :returns: The string that identifies the resource's User
        :rtype: unicode
        r#   r{   rJ   r   r   r   r#     r|   zMemberInstance.identityc                 C   rz   )zt
        :returns: The RFC 2822 date and time in GMT when the resource was created
        :rtype: datetime
        rq   r{   rJ   r   r   r   rq     r|   zMemberInstance.date_createdc                 C   rz   )zy
        :returns: The RFC 2822 date and time in GMT when the resource was last updated
        :rtype: datetime
        rr   r{   rJ   r   r   r   rr     r|   zMemberInstance.date_updatedc                 C   rz   )z^
        :returns: The SID of the Role assigned to the member
        :rtype: unicode
        r$   r{   rJ   r   r   r   r$     r|   zMemberInstance.role_sidc                 C   rz   )z}
        :returns: The index of the last Message that the Member has read within the Channel
        :rtype: unicode
        r^   r{   rJ   r   r   r   r^     r|   z*MemberInstance.last_consumed_message_indexc                 C   rz   )z
        :returns: The ISO 8601 based timestamp string that represents the date-time of the last Message read event for the Member within the Channel
        :rtype: datetime
        rs   r{   rJ   r   r   r   rs     r|   z)MemberInstance.last_consumption_timestampc                 C   rz   )z[
        :returns: The absolute URL of the Member resource
        :rtype: unicode
        rt   r{   rJ   r   r   r   rt     r|   zMemberInstance.urlc                 C   
   | j  S )rU   )ry   rW   rJ   r   r   r   rW        
zMemberInstance.fetchc                 C   r}   )rX   )ry   rZ   rJ   r   r   r   rZ     r~   zMemberInstance.deletec                 C   s   | j j||dS )r[   )r$   r^   )ry   r]   )r   r$   r^   r   r   r   r]     s   zMemberInstance.updatec                 C   r_   )rI   r`   c                 s   ra   rb   rc   rd   r   r   r   rh     ri   z*MemberInstance.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V1.MemberInstance {}>rj   rm   r   r   r   rK     ro   zMemberInstance.__repr__r-   )rM   rN   rO   r   propertyry   rA   rp   r   r   r#   rq   rr   r$   r^   rs   rt   rW   rZ   r   rP   r]   rK   rQ   r   r   r   r   r"   6  s@     











		
r"   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r5   rC   r"   r   r   r   r   <module>   s    (-P