o
    f>hZ                     @   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d
efddZ  ZS )InviteInstanceaG  
    :ivar sid: The unique string that we created to identify the Invite resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Invite resource.
    :ivar channel_sid: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Invite resource belongs to.
    :ivar service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) the Invite resource is associated with.
    :ivar identity: The application-defined string that uniquely identifies the resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info.
    :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar role_sid: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the resource.
    :ivar created_by: The `identity` of the User that created the invite.
    :ivar url: The absolute URL of the Invite resource.
    Nversionpayloadservice_sidchannel_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _t	|d| _
t	|d| _|d| _|d	| _|d
| _|||pN| jd| _d | _d S )Nr   account_sidr   r   identitydate_createddate_updatedrole_sid
created_byurlr   r   r   )super__init__getr   r   r   r   r   r
   iso8601_datetimer   r   r   r   r   	_solution_context)selfr   r   r   r   r   	__class__ ]/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/chat/v2/service/channel/invite.pyr!   '   s(   
zInviteInstance.__init__returnInviteContextc                 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: InviteContext for this InviteInstance
        Nr   r   r   r   )r%   r,   _versionr$   r&   r)   r)   r*   _proxyG   s   
zInviteInstance._proxyc                 C   
   | j  S )i
        Deletes the InviteInstance


        :returns: True if delete succeeds, False otherwise
        )r/   deleter.   r)   r)   r*   r2   X      
zInviteInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the InviteInstance


        :returns: True if delete succeeds, False otherwise
        N)r/   delete_asyncr.   r)   r)   r*   r6   a      zInviteInstance.delete_asyncc                 C   r0   )Y
        Fetch the InviteInstance


        :returns: The fetched InviteInstance
        )r/   fetchr.   r)   r)   r*   r9   j   r3   zInviteInstance.fetchc                    r4   )s
        Asynchronous coroutine to fetch the InviteInstance


        :returns: The fetched InviteInstance
        N)r/   fetch_asyncr.   r)   r)   r*   r;   s   r7   zInviteInstance.fetch_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*InviteInstance.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V2.InviteInstance {}>joinr$   itemsrB   r&   contextr)   r)   r*   __repr__|      
zInviteInstance.__repr__N)r+   r,   )r+   r   )__name__
__module____qualname____doc__r   r   strr   r   r!   propertyr/   boolr2   r6   r9   r;   rN   __classcell__r)   r)   r'   r*   r      s*    
 	
	
		r   c                       st   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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 InviteContext

        :param version: Version that contains the resource
        :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the Invite resource from.
        :param channel_sid: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Invite resource to fetch belongs to. This value can be the Channel resource's `sid` or `unique_name`.
        :param sid: The SID of the Invite resource to fetch.
        r   z</Services/{service_sid}/Channels/{channel_sid}/Invites/{sid}Nr)   r    r!   r$   rB   _uri)r&   r   r   r   r   r'   r)   r*   r!      s   	zInviteContext.__init__r+   c                 C   s   t i }| jjd| j|dS )r1   DELETEmethoduriheaders)r   ofr-   r2   rZ   r&   r_   r)   r)   r*   r2      s   
zInviteContext.deletec                    s&   t i }| jjd| j|dI dH S )r5   r[   r\   N)r   r`   r-   r6   rZ   ra   r)   r)   r*   r6      s
   
zInviteContext.delete_asyncc                 C   sL   t i }d|d< | jjd| j|d}t| j|| jd | jd | jd dS )	r8   application/jsonAcceptGETr\   r   r   r   r   )r   r`   r-   r9   rZ   r   r$   r&   r_   r   r)   r)   r*   r9      s   
zInviteContext.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:   rb   rc   rd   r\   Nr   r   r   r   )r   r`   r-   r;   rZ   r   r$   re   r)   r)   r*   r;      s   
zInviteContext.fetch_asyncc                 C   r<   )r=   r>   c                 s   r?   r@   rA   rC   r)   r)   r*   rG      rH   z)InviteContext.__repr__.<locals>.<genexpr>z!<Twilio.Chat.V2.InviteContext {}>rI   rL   r)   r)   r*   rN      rO   zInviteContext.__repr__)rQ   rR   rS   r   rU   r!   rW   r2   r6   r   r9   r;   rN   rX   r)   r)   r'   r*   r,      s    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 )
InvitePager   r+   c                 C   s   t | j|| jd | jd dS )zl
        Build an instance of InviteInstance

        :param payload: Payload response from the API
        r   r   r   r   )r   r-   r$   )r&   r   r)   r)   r*   get_instance   s   zInvitePage.get_instancec                 C      dS )r=   z<Twilio.Chat.V2.InvitePage>r)   r.   r)   r)   r*   rN         zInvitePage.__repr__N)	rQ   rR   rS   r   rU   r   r   rh   rN   r)   r)   r)   r*   rf      s    rf   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 )*
InviteListr   r   r   c                    s0   t  | ||d| _djdi | j| _dS )a  
        Initialize the InviteList

        :param version: Version that contains the resource
        :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the Invite resources from.
        :param channel_sid: The SID of the [Channel](https://www.twilio.com/docs/chat/channels) the Invite resources to read belong to. This value can be the Channel resource's `sid` or `unique_name`.

        rg   z6/Services/{service_sid}/Channels/{channel_sid}/InvitesNr)   rY   )r&   r   r   r   r'   r)   r*   r!     s   	zInviteList.__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 )a  
        Create the InviteInstance

        :param identity: The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info.
        :param role_sid: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the new member.

        :returns: The created InviteInstance
        IdentityRoleSidContent-Type!application/x-www-form-urlencodedrb   rc   POSTr]   r^   datar_   r   r   rg   )r   r`   r-   createrZ   r   r$   r&   r   r   rs   r_   r   r)   r)   r*   rt     s"   
zInviteList.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 InviteInstance

        :param identity: The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/chat/rest/service-resource). See [access tokens](https://www.twilio.com/docs/chat/create-tokens) for more info.
        :param role_sid: The SID of the [Role](https://www.twilio.com/docs/chat/rest/role-resource) assigned to the new member.

        :returns: The created InviteInstance
        rl   ro   rp   rb   rc   rq   rr   Nr   r   rg   )r   r`   r-   create_asyncrZ   r   r$   ru   r)   r)   r*   rv   B  s$   
zInviteList.create_asyncNlimit	page_sizec                 C   s2   | j ||}| j||d d}| j ||d S )aB  
        Streams InviteInstance 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/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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
        rx   r   rx   rw   )r-   read_limitspagestreamr&   r   rw   rx   limitsr{   r)   r)   r*   r|   e  s   zInviteList.streamc                    s:   | j ||}| j||d dI dH }| j ||d S )aQ  
        Asynchronously streams InviteInstance 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/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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
        rx   ry   Nrw   )r-   rz   
page_asyncstream_asyncr}   r)   r)   r*   r     s   zInviteList.stream_asyncc                 C   s   t | j|||dS )a  
        Lists InviteInstance 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/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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   rw   rx   )listr|   r&   r   rw   rx   r)   r)   r*   r     s   zInviteList.listc                    s(   dd | j |||dI dH 2 I dH S )a  
        Asynchronously lists InviteInstance 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/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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 rP   r)   )rD   recordr)   r)   r*   
<listcomp>  s
    z)InviteList.list_async.<locals>.<listcomp>r   N)r   r   r)   r)   r*   
list_async  s   
zInviteList.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 )
aM  
        Retrieve a single page of InviteInstance records from the API.
        Request is executed immediately

        :param identity: The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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 InviteInstance
        c                 S      | S rP   r)   er)   r)   r*   <lambda>      z!InviteList.page.<locals>.<lambda>rm   	PageTokenr   PageSizero   rp   rb   rc   rd   r]   r^   paramsr_   )	r   r`   r   mapr-   r{   rZ   rf   r$   r&   r   r   r   rx   rs   r_   responser)   r)   r*   r{     s   	
zInviteList.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 )a\  
        Asynchronously retrieve a single page of InviteInstance records from the API.
        Request is executed immediately

        :param identity: The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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 InviteInstance
        c                 S   r   rP   r)   r   r)   r)   r*   r     r   z'InviteList.page_async.<locals>.<lambda>r   ro   rp   rb   rc   rd   r   N)	r   r`   r   r   r-   r   rZ   rf   r$   r   r)   r)   r*   r     s   	
zInviteList.page_async
target_urlc                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of InviteInstance records from the API.
        Request is executed immediately

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

        :returns: Page of InviteInstance
        rd   )r-   domaintwiliorequestrf   r$   r&   r   r   r)   r)   r*   get_page  s   	zInviteList.get_pagec                    s*   | j jjd|I dH }t| j || jS )a   
        Asynchronously retrieve a specific page of InviteInstance records from the API.
        Request is executed immediately

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

        :returns: Page of InviteInstance
        rd   N)r-   r   r   request_asyncrf   r$   r   r)   r)   r*   get_page_async*  s   	zInviteList.get_page_asyncr   c                 C      t | j| jd | jd |dS zj
        Constructs a InviteContext

        :param sid: The SID of the Invite resource to fetch.
        r   r   r   r,   r-   r$   r&   r   r)   r)   r*   r"   6     zInviteList.getc                 C   r   r   r   r   r)   r)   r*   __call__C  r   zInviteList.__call__c                 C   ri   )r=   z<Twilio.Chat.V2.InviteList>r)   r.   r)   r)   r*   rN   P  rj   zInviteList.__repr__) rQ   rR   rS   r   rU   r!   r   unsetr   objectr   rt   rv   r   r   intr   r|   r	   r   r   r   rf   r{   r   r   r   r,   r"   r   rN   rX   r)   r)   r'   r*   rk   	  s    

$

%



 



&



$rk   N)rT   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,   rf   rk   r)   r)   r)   r*   <module>   s    $mk