o
    f>hp                     @   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dedeeef dededee f
 fdd	Z	e
dddZd
efddZd
efddZd ddZd ddZejejfdeeef deeef d
d fddZejejfdeeef deeef d
d fddZd
ef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| _|||pZ| 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
   iso8601_datetimer   r   r   integerr   r   r   	_solution_context)selfr   r   r   r   r   	__class__ ]/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/chat/v1/service/channel/member.pyr"   (   s0   
zMemberInstance.__init__returnMemberContextc                 C   s6   | j du rt| 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   
   | j  S )i
        Deletes the MemberInstance


        :returns: True if delete succeeds, False otherwise
        )r1   deleter0   r+   r+   r,   r4   ^      
zMemberInstance.deletec                       | 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,   r8   g      zMemberInstance.delete_asyncc                 C   r2   )Y
        Fetch the MemberInstance


        :returns: The fetched MemberInstance
        )r1   fetchr0   r+   r+   r,   r;   p   r5   zMemberInstance.fetchc                    r6   )s
        Asynchronous coroutine to fetch the MemberInstance


        :returns: The fetched MemberInstance
        N)r1   fetch_asyncr0   r+   r+   r,   r=   y   r9   zMemberInstance.fetch_asyncr   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_asyncrA   r+   r+   r,   rC      s
   zMemberInstance.update_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr+   r+   r,   	<genexpr>       z*MemberInstance.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V1.MemberInstance {}>joinr&   itemsrJ   r(   contextr+   r+   r,   __repr__      
zMemberInstance.__repr__N)r-   r.   )r-   r   )__name__
__module____qualname____doc__r   r   strr   r   r"   propertyr1   boolr4   r8   r;   r=   r   unsetr   objectintr@   rC   rV   __classcell__r+   r+   r)   r,   r      sN    
%	
	
	





r   c                       s   e Zd Zdedededef fddZdefdd	Zdefd
dZde	fddZ
de	fddZejejfdeeef deeef de	fddZejejfdeeef deeef de	fddZdefddZ  ZS )r.   r   r   r   r   c                    s2   t  | |||d| _djdi | 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}Nr+   r!   r"   r&   rJ   _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 )r3   DELETEmethoduriheaders)r   ofr/   r4   re   r(   rj   r+   r+   r,   r4      s   
zMemberContext.deletec                    s&   t i }| jjd| j|dI dH S )r7   rf   rg   N)r   rk   r/   r8   re   rl   r+   r+   r,   r8      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 )	r:   application/jsonAcceptGETrg   r   r   r   r    )r   rk   r/   r;   re   r   r&   r(   rj   r   r+   r+   r,   r;      s   
zMemberContext.fetchc                    sT   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r<   rm   rn   ro   rg   Nr   r   r   r    )r   rk   r/   r=   re   r   r&   rp   r+   r+   r,   r=      s   
zMemberContext.fetch_asyncr   r   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>   RoleSidLastConsumedMessageIndex!application/x-www-form-urlencodedContent-Typerm   rn   POSTrh   ri   datarj   r   r   r   r    )r   rk   r/   r@   re   r   r&   r(   r   r   rx   rj   r   r+   r+   r,   r@     s$   

zMemberContext.updatec                    sn   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 )rB   rq   rt   ru   rm   rn   rv   rw   Nr   r   r   r    )r   rk   r/   rC   re   r   r&   ry   r+   r+   r,   rC   7  s&   

zMemberContext.update_asyncc                 C   rD   )rE   rF   c                 s   rG   rH   rI   rK   r+   r+   r,   rO   c  rP   z)MemberContext.__repr__.<locals>.<genexpr>z!<Twilio.Chat.V1.MemberContext {}>rQ   rT   r+   r+   r,   rV   ]  rW   zMemberContext.__repr__)rY   rZ   r[   r   r]   r"   r_   r4   r8   r   r;   r=   r   r`   r   ra   rb   r@   rC   rV   rc   r+   r+   r)   r,   r.      s2    


(


&r.   c                   @   s4   e Zd Zdeeef defddZdefddZdS )
MemberPager   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_instancec                 C      dS )rE   z<Twilio.Chat.V1.MemberPage>r+   r0   r+   r+   r,   rV   v     zMemberPage.__repr__N)	rY   rZ   r[   r   r]   r   r   r|   rV   r+   r+   r+   r,   rz   g  s    rz   c                       s`  e Zd Zdededef fddZejfdedeee	f de
fd	d
Zejfdedeee	f de
fddZejddfdeee e	f dee dee dee
 fddZejddfdeee e	f dee dee dee
 fddZejddfdeee e	f dee dee dee
 fddZejddfdeee e	f dee dee dee
 fddZejejejejfdeee e	f deee	f deee	f deee	f def
ddZejejejejfdeee e	f deee	f deee	f deee	f def
ddZdedefdd Zdedefd!d"Zd#edefd$d%Zd#edefd&d'Zdefd(d)Z  ZS )*
MemberListr   r   r   c                    s0   t  | ||d| _djdi | 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.

        r{   z6/Services/{service_sid}/Channels/{channel_sid}/MembersNr+   rd   )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
        Identityrr   ru   rt   rm   rn   rv   rw   r   r   r{   )r   rk   r/   createre   r   r&   r(   r   r   rx   rj   r   r+   r+   r,   r     s"   
zMemberList.createc                    sj   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
        r   ru   rt   rm   rn   rv   rw   Nr   r   r{   )r   rk   r/   create_asyncre   r   r&   r   r+   r+   r,   r     s$   
zMemberList.create_asyncNlimit	page_sizec                 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   r   )r/   read_limitspagestreamr(   r   r   r   limitsr   r+   r+   r,   r     s   zMemberList.streamc                    s:   | 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   Nr   )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   r   r   )listr   r(   r   r   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 rX   r+   )rL   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
page_tokenpage_numberc                 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 rX   r+   er+   r+   r,   <lambda>`      z!MemberList.page.<locals>.<lambda>r   	PageTokenr   PageSizeru   rt   rm   rn   ro   rh   ri   paramsrj   )	r   rk   r   mapr/   r   re   rz   r&   r(   r   r   r   r   rx   rj   responser+   r+   r,   r   L  s   	
zMemberList.pagec                    sd   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   r   rX   r+   r   r+   r+   r,   r     r   z'MemberList.page_async.<locals>.<lambda>r   ru   rt   rm   rn   ro   r   N)	r   rk   r   r   r/   r   re   rz   r&   r   r+   r+   r,   r   p  s   	
zMemberList.page_async
target_urlc                 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
        ro   )r/   domaintwiliorequestrz   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
        ro   N)r/   r   r   request_asyncrz   r&   r   r+   r+   r,   get_page_async  s   	zMemberList.get_page_asyncr   c                 C      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#        zMemberList.getc                 C   r   r   r   r   r+   r+   r,   __call__  r   zMemberList.__call__c                 C   r}   )rE   z<Twilio.Chat.V1.MemberList>r+   r0   r+   r+   r,   rV     r~   zMemberList.__repr__) rY   rZ   r[   r   r]   r"   r   r`   r   ra   r   r   r   r   r   rb   r   r   r	   r   r   r   rz   r   r   r   r   r.   r#   r   rV   rc   r+   r+   r)   r,   r     s    

$

%



 



&



$r   N)r\   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r.   rz   r   r+   r+   r+   r,   <module>   s    $  8