U
    ^g%ip                     @   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 - Chat
    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dZdeeeef eeee d fddZ	e
dddd	Zedd
dZedddZd dddZd dddZejejfeeef eeef d dddZejejfeeef eeef d dddZedddZ  ZS )MemberInstancea  
    :ivar sid: The unique string that we created to identify the Member resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/api/rest/account) that created the Member resource.
    :ivar channel_sid: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) for the member.
    :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) the resource is associated with.
    :ivar identity: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/api/chat/rest/users) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more info.
    :ivar date_created: The date and time in GMT when the resource was created specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar date_updated: The date and time in GMT when the resource was last updated specified in [RFC 2822](http://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar role_sid: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) assigned to the member.
    :ivar last_consumed_message_index: The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) in the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) that the Member has read.
    :ivar last_consumption_timestamp: The ISO 8601 timestamp string that represents the date-time of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) read event for the Member within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels).
    :ivar url: The absolute URL of the Member resource.
    N)versionpayloadservice_sidchannel_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _t	|d| _
t	|d| _|d| _t|d	| _t	|d
| _|d| _|||p| jd| _d | _d S )Nr   account_sidr   r   identitydate_createddate_updatedrole_sidlast_consumed_message_indexlast_consumption_timestampurlr   r   r   )super__init__getr   r   r   r   r   r
   Ziso8601_datetimer   r   r   integerr   r   r   	_solution_context)selfr   r   r   r   r   	__class__ i/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/chat/v1/service/channel/member.pyr"   (   s0    zMemberInstance.__init__MemberContextreturnc                 C   s6   | j dkr0t| j| jd | 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: MemberContext for this MemberInstance
        Nr   r   r   r    )r&   r,   _versionr%   r'   r*   r*   r+   _proxyM   s    
zMemberInstance._proxyc                 C   s
   | j  S )i
        Deletes the MemberInstance


        :returns: True if delete succeeds, False otherwise
        )r1   deleter0   r*   r*   r+   r3   ^   s    zMemberInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the MemberInstance


        :returns: True if delete succeeds, False otherwise
        N)r1   delete_asyncr0   r*   r*   r+   r5   g   s    zMemberInstance.delete_asyncc                 C   s
   | j  S )Y
        Fetch the MemberInstance


        :returns: The fetched MemberInstance
        )r1   fetchr0   r*   r*   r+   r7   p   s    zMemberInstance.fetchc                    s   | j  I dH S )s
        Asynchronous coroutine to fetch the MemberInstance


        :returns: The fetched MemberInstance
        N)r1   fetch_asyncr0   r*   r*   r+   r9   y   s    zMemberInstance.fetch_asyncr   r   r.   c                 C   s   | j j||dS )  
        Update the MemberInstance

        :param role_sid: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services).
        :param last_consumed_message_index: The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) that the Member has read within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels).

        :returns: The updated MemberInstance
        r   r   )r1   updater'   r   r   r*   r*   r+   r=      s    zMemberInstance.updatec                    s   | j j||dI dH S )7  
        Asynchronous coroutine to update the MemberInstance

        :param role_sid: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services).
        :param last_consumed_message_index: The index of the last [Message](https://www.twilio.com/docs/api/chat/rest/messages) that the Member has read within the [Channel](https://www.twilio.com/docs/api/chat/rest/channels).

        :returns: The updated MemberInstance
        r<   N)r1   update_asyncr>   r*   r*   r+   r@      s    zMemberInstance.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>   s     z*MemberInstance.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V1.MemberInstance {}>joinr%   itemsrE   r'   contextr*   r*   r+   __repr__   s    zMemberInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r"   propertyr1   boolr3   r5   r7   r9   r   unsetr   objectintr=   r@   rP   __classcell__r*   r*   r(   r+   r      s<    
%			



r   c                       s   e Zd Zeeeed fddZedddZedddZe	dd	d
Z
e	dddZejejfeeef eeef e	dddZejejfeeef eeef e	dddZedddZ  ZS )r,   )r   r   r   r   c                    s.   t  | |||d| _djf | j| _dS )a  
        Initialize the MemberContext

        :param version: Version that contains the resource
        :param service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) to update the resource from.
        :param channel_sid: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the member to update belongs to. Can be the Channel resource's `sid` or `unique_name`.
        :param sid: The Twilio-provided string that uniquely identifies the Member resource to update.
        r    z</Services/{service_sid}/Channels/{channel_sid}/Members/{sid}Nr!   r"   r%   rE   _uri)r'   r   r   r   r   r(   r*   r+   r"      s    	zMemberContext.__init__r-   c                 C   s   t i }| jjd| j|dS )r2   DELETEmethoduriheaders)r   ofr/   r3   r]   r'   rb   r*   r*   r+   r3      s    
zMemberContext.deletec                    s$   t i }| jjd| j|dI dH S )r4   r^   r_   N)r   rc   r/   r5   r]   rd   r*   r*   r+   r5      s    
  zMemberContext.delete_asyncc                 C   sL   t i }d|d< | jjd| j|d}t| j|| jd | jd | jd dS )	r6   application/jsonAcceptGETr_   r   r   r   r    )r   rc   r/   r7   r]   r   r%   r'   rb   r   r*   r*   r+   r7      s    
zMemberContext.fetchc                    sR   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r8   re   rf   rg   r_   Nr   r   r   r    )r   rc   r/   r9   r]   r   r%   rh   r*   r*   r+   r9      s    
  zMemberContext.fetch_asyncr:   c                 C   sf   t ||d}t i }d|d< d|d< | jjd| j||d}t| j|| jd | jd	 | jd
 dS )r;   RoleSidZLastConsumedMessageIndex!application/x-www-form-urlencodedContent-Typere   rf   POSTr`   ra   datarb   r   r   r   r    )r   rc   r/   r=   r]   r   r%   r'   r   r   ro   rb   r   r*   r*   r+   r=     s*    
   zMemberContext.updatec                    sl   t ||d}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 | jd dS )r?   ri   rk   rl   re   rf   rm   rn   Nr   r   r   r    )r   rc   r/   r@   r]   r   r%   rp   r*   r*   r+   r@   7  s*    
   zMemberContext.update_asyncc                 C   s$   d dd | j D }d|S )rA   rB   c                 s   s   | ]\}}d  ||V  qdS rC   rD   rF   r*   r*   r+   rJ   c  s     z)MemberContext.__repr__.<locals>.<genexpr>z!<Twilio.Chat.V1.MemberContext {}>rK   rN   r*   r*   r+   rP   ]  s    zMemberContext.__repr__)rQ   rR   rS   r   rU   r"   rW   r3   r5   r   r7   r9   r   rX   r   rY   rZ   r=   r@   rP   r[   r*   r*   r(   r+   r,      s(   

(

&r,   c                   @   s2   e Zd Zeeef edddZedddZdS )
MemberPage)r   r.   c                 C   s   t | j|| jd | jd dS )zl
        Build an instance of MemberInstance

        :param payload: Payload response from the API
        r   r   r   r   )r   r/   r%   )r'   r   r*   r*   r+   get_instancei  s    zMemberPage.get_instancer-   c                 C   s   dS )rA   z<Twilio.Chat.V1.MemberPage>r*   r0   r*   r*   r+   rP   v  s    zMemberPage.__repr__N)	rQ   rR   rS   r   rU   r   r   rs   rP   r*   r*   r*   r+   rq   g  s   rq   c                       s$  e Zd Zeeed fddZejfeeee	f e
dddZejfeeee	f e
dddZejd	d	feee e	f ee ee ee
 d
ddZejd	d	feee e	f ee ee ee
 d
ddZejd	d	feee e	f ee ee ee
 d
ddZejd	d	feee e	f ee ee ee
 d
ddZejejejejfe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feee e	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 )%
MemberList)r   r   r   c                    s,   t  | ||d| _djf | j| _dS )a  
        Initialize the MemberList

        :param version: Version that contains the resource
        :param service_sid: The SID of the [Service](https://www.twilio.com/docs/api/chat/rest/services) to read the resources from.
        :param channel_sid: The unique ID of the [Channel](https://www.twilio.com/docs/api/chat/rest/channels) the members to read belong to. Can be the Channel resource's `sid` or `unique_name` value.

        rr   z6/Services/{service_sid}/Channels/{channel_sid}/MembersNr\   )r'   r   r   r   r(   r*   r+   r"     s    	zMemberList.__init__)r   r   r.   c                 C   sb   t ||d}t ddi}d|d< d|d< | jjd| j||d}t| j|| jd | jd	 d
S )ay  
        Create the MemberInstance

        :param identity: The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details.
        :param role_sid: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services).

        :returns: The created MemberInstance
        Identityrj   rl   rk   re   rf   rm   rn   r   r   rr   )r   rc   r/   creater]   r   r%   r'   r   r   ro   rb   r   r*   r*   r+   rw     s(       zMemberList.createc                    sh   t ||d}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 dS )a  
        Asynchronously create the MemberInstance

        :param identity: The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/api/chat/rest/v1/user) within the [Service](https://www.twilio.com/docs/api/chat/rest/services). See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details.
        :param role_sid: The SID of the [Role](https://www.twilio.com/docs/api/chat/rest/roles) to assign to the member. The default roles are those specified on the [Service](https://www.twilio.com/docs/chat/api/services).

        :returns: The created MemberInstance
        ru   rl   rk   re   rf   rm   rn   Nr   r   rr   )r   rc   r/   create_asyncr]   r   r%   rx   r*   r*   r+   ry     s(       zMemberList.create_asyncN)r   limit	page_sizer.   c                 C   s2   | j ||}| j||d d}| j ||d S )aK  
        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[str] identity: The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details.
        :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{   rz   )r/   read_limitspagestreamr'   r   rz   r{   Zlimitsr~   r*   r*   r+   r     s    zMemberList.streamc                    s8   | j ||}| j||d dI dH }| j ||d S )aZ  
        Asynchronously 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[str] identity: The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details.
        :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|   Nrz   )r/   r}   
page_asyncstream_asyncr   r*   r*   r+   r     s    zMemberList.stream_asyncc                 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[str] identity: The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details.
        :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   rz   r{   )listr   r'   r   rz   r{   r*   r*   r+   r     s    zMemberList.listc                    s&   dd | j |||dI dH 2 I dH S )a  
        Asynchronously 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[str] identity: The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details.
        :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*   )rG   recordr*   r*   r+   
<listcomp>C  s   z)MemberList.list_async.<locals>.<listcomp>r   N)r   r   r*   r*   r+   
list_async.  s    
zMemberList.list_async)r   
page_tokenpage_numberr{   r.   c                 C   s\   t t|dd |||d}t ddi}d|d< | jjd| j||d	}t| j|| jS )
aV  
        Retrieve a single page of MemberInstance records from the API.
        Request is executed immediately

        :param identity: The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details.
        :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 MemberInstance
        c                 S   s   | S r   r*   er*   r*   r+   <lambda>`      z!MemberList.page.<locals>.<lambda>rv   Z	PageTokenr   ZPageSizerl   rk   re   rf   rg   r`   ra   paramsrb   )	r   rc   r   mapr/   r~   r]   rq   r%   r'   r   r   r   r{   ro   rb   responser*   r*   r+   r~   L  s     	   zMemberList.pagec                    sb   t t|dd |||d}t ddi}d|d< | jjd| j||d	I d
H }t| j|| jS )ae  
        Asynchronously retrieve a single page of MemberInstance records from the API.
        Request is executed immediately

        :param identity: The [User](https://www.twilio.com/docs/api/chat/rest/v1/user)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/api/chat/guides/create-tokens) for more details.
        :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 MemberInstance
        c                 S   s   | S r   r*   r   r*   r*   r+   r     r   z'MemberList.page_async.<locals>.<lambda>r   rl   rk   re   rf   rg   r   N)	r   rc   r   r   r/   r   r]   rq   r%   r   r*   r*   r+   r   p  s     	   zMemberList.page_async)
target_urlr.   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of MemberInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MemberInstance
        rg   )r/   domaintwiliorequestrq   r%   r'   r   r   r*   r*   r+   get_page  s    	zMemberList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a   
        Asynchronously retrieve a specific page of MemberInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MemberInstance
        rg   N)r/   r   r   Zrequest_asyncrq   r%   r   r*   r*   r+   get_page_async  s    	zMemberList.get_page_async)r   r.   c                 C   s   t | j| jd | jd |dS z
        Constructs a MemberContext

        :param sid: The Twilio-provided string that uniquely identifies the Member resource to update.
        r   r   r    r,   r/   r%   r'   r   r*   r*   r+   r#     s    zMemberList.getc                 C   s   t | j| jd | jd |dS r   r   r   r*   r*   r+   __call__  s    zMemberList.__call__r-   c                 C   s   dS )rA   z<Twilio.Chat.V1.MemberList>r*   r0   r*   r*   r+   rP     s    zMemberList.__repr__) rQ   rR   rS   r   rU   r"   r   rX   r   rY   r   rw   ry   r   r   rZ   r   r   r	   r   r   r   rq   r~   r   r   r   r,   r#   r   rP   r[   r*   r*   r(   r+   rt     s    
$ 
% 


&


$rt   N)rT   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   r,   rq   rt   r*   r*   r*   r+   <module>   s   $  8