a
    !fQ                     @   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 - Conversations
    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G dd deZdeeeef 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e d dddZee d dddZedddZ  ZS )RoleInstancec                   @   s   e Zd ZdZdZdS )RoleInstance.RoleTypeZconversationZserviceN)__name__
__module____qualname__ZCONVERSATIONZSERVICE r   r   b/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/conversations/v1/role.pyRoleType   s   r   N)versionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _t	
|d| _|d	| _d|p| ji| _d | _d S )
Nr   account_sidchat_service_sidfriendly_nametypepermissionsdate_createddate_updatedurl)super__init__getr   r   r   r   r    r!   r
   iso8601_datetimer"   r#   r$   	_solution_context)selfr   r   r   	__class__r   r   r&   +   s"    
zRoleInstance.__init__RoleContextreturnc                 C   s&   | j du r t| j| 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: RoleContext for this RoleInstance
        Nr   r   )r*   r.   _versionr)   r+   r   r   r   _proxyC   s    
zRoleInstance._proxyc                 C   s
   | j  S )g
        Deletes the RoleInstance


        :returns: True if delete succeeds, False otherwise
        )r4   deleter3   r   r   r   r6   R   s    zRoleInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the RoleInstance


        :returns: True if delete succeeds, False otherwise
        N)r4   delete_asyncr3   r   r   r   r8   [   s    zRoleInstance.delete_asyncc                 C   s
   | j  S )U
        Fetch the RoleInstance


        :returns: The fetched RoleInstance
        )r4   fetchr3   r   r   r   r:   d   s    zRoleInstance.fetchc                    s   | j  I dH S )o
        Asynchronous coroutine to fetch the RoleInstance


        :returns: The fetched RoleInstance
        N)r4   fetch_asyncr3   r   r   r   r<   m   s    zRoleInstance.fetch_async
permissionr0   c                 C   s   | j j|dS )  
        Update the RoleInstance

        :param permission: A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's `type`.

        :returns: The updated RoleInstance
        r>   )r4   updater+   r>   r   r   r   rA   v   s    zRoleInstance.updatec                    s   | j j|dI dH S )3  
        Asynchronous coroutine to update the RoleInstance

        :param permission: A permission that you grant to the role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. Note that the update action replaces all previously assigned permissions with those defined in the update action. To remove a permission, do not include it in the subsequent update action. The values for this parameter depend on the role's `type`.

        :returns: The updated RoleInstance
        r@   N)r4   update_asyncrB   r   r   r   rD      s    zRoleInstance.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>       z(RoleInstance.__repr__.<locals>.<genexpr>z)<Twilio.Conversations.V1.RoleInstance {}>joinr)   itemsrI   r+   contextr   r   r   __repr__   s    zRoleInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r&   propertyr4   boolr6   r8   r:   r<   r   rA   rD   rU   __classcell__r   r   r,   r   r      s    				r   c                       s   e Zd Z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e e	dddZee e	dddZedddZ  ZS )r.   )r   r   c                    s.   t  | d|i| _djf i | j| _dS )z
        Initialize the RoleContext

        :param version: Version that contains the resource
        :param sid: The SID of the Role resource to update.
        r   z/Roles/{sid}N)r%   r&   r)   rI   _uri)r+   r   r   r,   r   r   r&      s    zRoleContext.__init__r/   c                 C   s   | j jd| jdS )r5   DELETEmethoduri)r2   r6   r[   r3   r   r   r   r6      s    zRoleContext.deletec                    s   | j jd| jdI dH S )r7   r\   r]   N)r2   r8   r[   r3   r   r   r   r8      s    zRoleContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )r9   GETr]   r   r1   )r2   r:   r[   r   r)   r+   r   r   r   r   r:      s    zRoleContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )r;   r`   r]   Nr   r1   )r2   r<   r[   r   r)   ra   r   r   r   r<      s    zRoleContext.fetch_asyncr=   c                 C   sD   t dt|dd i}| jjd| j|d}t| j|| jd dS )r?   
Permissionc                 S   s   | S Nr   er   r   r   <lambda>   rO   z$RoleContext.update.<locals>.<lambda>POSTr^   r_   datar   r1   )	r   ofr   mapr2   rA   r[   r   r)   r+   r>   ri   r   r   r   r   rA      s    zRoleContext.updatec                    sJ   t dt|dd i}| jjd| j|dI dH }t| j|| jd dS )	rC   rb   c                 S   s   | S rc   r   rd   r   r   r   rf     rO   z*RoleContext.update_async.<locals>.<lambda>rg   rh   Nr   r1   )	r   rj   r   rk   r2   rD   r[   r   r)   rl   r   r   r   rD      s    zRoleContext.update_asyncc                 C   s$   d dd | j D }d|S )rE   rF   c                 s   s   | ]\}}d  ||V  qdS rG   rH   rJ   r   r   r   rN     rO   z'RoleContext.__repr__.<locals>.<genexpr>z(<Twilio.Conversations.V1.RoleContext {}>rP   rS   r   r   r   rU     s    zRoleContext.__repr__)r   r   r   r   rW   r&   rY   r6   r8   r   r:   r<   r   rA   rD   rU   rZ   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 )RolePage)r   r0   c                 C   s   t | j|S )zj
        Build an instance of RoleInstance

        :param payload: Payload response from the API
        )r   r2   ra   r   r   r   get_instance  s    zRolePage.get_instancer/   c                 C   s   dS )rE   z"<Twilio.Conversations.V1.RolePage>r   r3   r   r   r   rU   %  s    zRolePage.__repr__N)	r   r   r   r   rW   r   r   rn   rU   r   r   r   r   rm     s   rm   c                       s  e Zd Zed fddZedee edddZedee eddd	Z	d&e
e e
e ee dddZd'e
e e
e ee dddZd(e
e e
e ee dddZd)e
e e
e ee dddZejejejfeeef eeef eeef edddZejejej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 )*RoleList)r   c                    s   t  | d| _dS )zf
        Initialize the RoleList

        :param version: Version that contains the resource

        z/RolesN)r%   r&   r[   )r+   r   r,   r   r   r&   /  s    zRoleList.__init__r   )r   r    r>   r0   c              	   C   s>   t ||t|dd d}| jjd| j|d}t| j|S )a  
        Create the RoleInstance

        :param friendly_name: A descriptive string that you create to describe the new resource. It can be up to 64 characters long.
        :param type:
        :param permission: A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`.

        :returns: The created RoleInstance
        c                 S   s   | S rc   r   rd   r   r   r   rf   J  rO   z!RoleList.create.<locals>.<lambda>ZFriendlyNameTyperb   rg   rh   )r   rj   r   rk   r2   creater[   r   r+   r   r    r>   ri   r   r   r   r   rr   :  s    zRoleList.createc              	      sD   t ||t|dd d}| jjd| j|dI dH }t| j|S )a	  
        Asynchronously create the RoleInstance

        :param friendly_name: A descriptive string that you create to describe the new resource. It can be up to 64 characters long.
        :param type:
        :param permission: A permission that you grant to the new role. Only one permission can be granted per parameter. To assign more than one permission, repeat this parameter for each permission value. The values for this parameter depend on the role's `type`.

        :returns: The created RoleInstance
        c                 S   s   | S rc   r   rd   r   r   r   rf   f  rO   z'RoleList.create_async.<locals>.<lambda>rp   rg   rh   N)r   rj   r   rk   r2   create_asyncr[   r   rs   r   r   r   rt   V  s    zRoleList.create_asyncN)limit	page_sizer0   c                 C   s0   | j ||}| j|d d}| j ||d S )aZ  
        Streams RoleInstance 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 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
        rv   rv   ru   )r2   read_limitspagestreamr+   ru   rv   Zlimitsry   r   r   r   rz   r  s    zRoleList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )ai  
        Asynchronously streams RoleInstance 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 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
        rv   rw   Nru   )r2   rx   
page_asyncstream_asyncr{   r   r   r   r}     s    zRoleList.stream_asyncc                 C   s   t | j||dS )a  
        Lists RoleInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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
        ru   rv   )listrz   r+   ru   rv   r   r   r   r     s    zRoleList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists RoleInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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 rc   r   )rK   recordr   r   r   
<listcomp>  s   z'RoleList.list_async.<locals>.<listcomp>r~   N)r}   r   r   r   r   
list_async  s    
zRoleList.list_async)
page_tokenpage_numberrv   r0   c                 C   s2   t |||d}| jjd| j|d}t| j|S )am  
        Retrieve a single page of RoleInstance records from the API.
        Request is executed immediately

        :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 RoleInstance
        Z	PageTokenr   ZPageSizer`   r^   r_   params)r   rj   r2   ry   r[   rm   r+   r   r   rv   ri   responser   r   r   ry     s    zRoleList.pagec                    s8   t |||d}| jjd| j|dI dH }t| j|S )a|  
        Asynchronously retrieve a single page of RoleInstance records from the API.
        Request is executed immediately

        :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 RoleInstance
        r   r`   r   N)r   rj   r2   r|   r[   rm   r   r   r   r   r|     s    zRoleList.page_async)
target_urlr0   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of RoleInstance records from the API.
        Request is executed immediately

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

        :returns: Page of RoleInstance
        r`   )r2   domaintwiliorequestrm   r+   r   r   r   r   r   get_page  s    	zRoleList.get_pagec                    s$   | j jjd|I dH }t| j |S )z
        Asynchronously retrieve a specific page of RoleInstance records from the API.
        Request is executed immediately

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

        :returns: Page of RoleInstance
        r`   N)r2   r   r   Zrequest_asyncrm   r   r   r   r   get_page_async  s    	zRoleList.get_page_async)r   r0   c                 C   s   t | j|dS zg
        Constructs a RoleContext

        :param sid: The SID of the Role resource to update.
        r1   r.   r2   r+   r   r   r   r   r'   )  s    zRoleList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__1  s    zRoleList.__call__r/   c                 C   s   dS )rE   z"<Twilio.Conversations.V1.RoleList>r   r3   r   r   r   rU   9  s    zRoleList.__repr__)NN)NN)NN)NN) r   r   r   r   r&   rW   r   r   rr   rt   r   intr   rz   r	   r}   r   r   r   unsetr   rV   rm   ry   r|   r   r   r.   r'   r   rU   rZ   r   r   r,   r   ro   .  st   

        





ro   N)__doc__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.   rm   ro   r   r   r   r   <module>   s   $~ 