o
    f>hZN                     @   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 - Ip_messaging
    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dedeeef 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e d
d fddZdee d
d fddZd
efddZ  ZS ) RoleInstancec                   @   s   e Zd ZdZdZdS )RoleInstance.RoleTypechannel
deploymentN)__name__
__module____qualname__CHANNEL
DEPLOYMENT r   r   [/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/ip_messaging/v1/service/role.pyRoleType   s    r   Nversionpayloadservice_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _t	
|d| _|d	| _||pG| jd
| _d | _d S )Nr!   account_sidr    friendly_nametypepermissionsdate_createddate_updatedurlr    r!   )super__init__getr!   r"   r    r#   r$   r%   r
   iso8601_datetimer&   r'   r(   	_solution_context)selfr   r   r    r!   	__class__r   r   r+   +   s$   
zRoleInstance.__init__returnRoleContextc                 C   s.   | j du rt| j| 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: RoleContext for this RoleInstance
        Nr    r!   r)   )r/   r4   _versionr.   r0   r   r   r   _proxyH   s   
zRoleInstance._proxyc                 C   
   | j  S )g
        Deletes the RoleInstance


        :returns: True if delete succeeds, False otherwise
        )r7   deleter6   r   r   r   r:   X      
zRoleInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the RoleInstance


        :returns: True if delete succeeds, False otherwise
        N)r7   delete_asyncr6   r   r   r   r>   a      zRoleInstance.delete_asyncc                 C   r8   )U
        Fetch the RoleInstance


        :returns: The fetched RoleInstance
        )r7   fetchr6   r   r   r   rA   j   r;   zRoleInstance.fetchc                    r<   )o
        Asynchronous coroutine to fetch the RoleInstance


        :returns: The fetched RoleInstance
        N)r7   fetch_asyncr6   r   r   r   rC   s   r?   zRoleInstance.fetch_async
permissionc                 C   s   | j j|dS )q
        Update the RoleInstance

        :param permission:

        :returns: The updated RoleInstance
        rD   )r7   updater0   rD   r   r   r   rG   |   s   zRoleInstance.updatec                    s   | j j|dI dH S )
        Asynchronous coroutine to update the RoleInstance

        :param permission:

        :returns: The updated RoleInstance
        rF   N)r7   update_asyncrH   r   r   r   rJ      s   zRoleInstance.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(RoleInstance.__repr__.<locals>.<genexpr>z'<Twilio.IpMessaging.V1.RoleInstance {}>joinr.   itemsrQ   r0   contextr   r   r   __repr__      
zRoleInstance.__repr__N)r3   r4   )r3   r   )r   r   r   objectr   r   r   strr   r   r+   propertyr7   boolr:   r>   rA   rC   r   rG   rJ   r]   __classcell__r   r   r1   r   r      s,    
	
	
		r   c                       s   e Zd Z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e de	fddZdee de	fddZdefddZ  ZS )r4   r   r    r!   c                    s0   t  | ||d| _djdi | j| _dS )z
        Initialize the RoleContext

        :param version: Version that contains the resource
        :param service_sid:
        :param sid:
        r)   z#/Services/{service_sid}/Roles/{sid}Nr   r*   r+   r.   rQ   _uri)r0   r   r    r!   r1   r   r   r+      s
   zRoleContext.__init__r3   c                 C   s   t i }| jjd| j|dS )r9   DELETEmethoduriheaders)r   ofr5   r:   rf   r0   rk   r   r   r   r:      s   
zRoleContext.deletec                    s&   t i }| jjd| j|dI dH S )r=   rg   rh   N)r   rl   r5   r>   rf   rm   r   r   r   r>      s
   
zRoleContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r@   application/jsonAcceptGETrh   r    r!   r)   )r   rl   r5   rA   rf   r   r.   r0   rk   r   r   r   r   rA      s   
zRoleContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rB   rn   ro   rp   rh   Nr    r!   r)   )r   rl   r5   rC   rf   r   r.   rq   r   r   r   rC      s   
zRoleContext.fetch_asyncrD   c                 C   sh   t dt|dd i}t i }d|d< d|d< | jjd| j||d	}t| j|| jd
 | jd dS )rE   
Permissionc                 S      | S r_   r   er   r   r   <lambda>      z$RoleContext.update.<locals>.<lambda>!application/x-www-form-urlencodedContent-Typern   ro   POSTri   rj   datark   r    r!   r)   )	r   rl   r   mapr5   rG   rf   r   r.   r0   rD   r|   rk   r   r   r   r   rG      s    	

zRoleContext.updatec                    sp   t dt|dd i}t i }d|d< d|d< | jjd| j||d	I d
H }t| j|| jd | jd dS )rI   rr   c                 S   rs   r_   r   rt   r   r   r   rv   !  rw   z*RoleContext.update_async.<locals>.<lambda>rx   ry   rn   ro   rz   r{   Nr    r!   r)   )	r   rl   r   r}   r5   rJ   rf   r   r.   r~   r   r   r   rJ     s"   	

zRoleContext.update_asyncc                 C   rK   )rL   rM   c                 s   rN   rO   rP   rR   r   r   r   rV   ;  rW   z'RoleContext.__repr__.<locals>.<genexpr>z&<Twilio.IpMessaging.V1.RoleContext {}>rX   r[   r   r   r   r]   5  r^   zRoleContext.__repr__)r   r   r   r   ra   r+   rc   r:   r>   r   rA   rC   r   rG   rJ   r]   rd   r   r   r1   r   r4      s    r4   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 )RolePager   r3   c                 C   s   t | j|| jd dS )zj
        Build an instance of RoleInstance

        :param payload: Payload response from the API
        r    r    )r   r5   r.   )r0   r   r   r   r   get_instanceA     zRolePage.get_instancec                 C      dS )rL   z <Twilio.IpMessaging.V1.RolePage>r   r6   r   r   r   r]   K     zRolePage.__repr__N)	r   r   r   r   ra   r   r   r   r]   r   r   r   r   r   ?  s    
r   c                	       s  e Zd Zdedef fddZdedddee d	efd
dZdedddee d	efddZ			d+de
e de
e d	ee fddZ		d+de
e de
e d	ee fddZ		d+de
e de
e d	ee fddZ		d+de
e de
e d	ee fddZejejej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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 ),RoleListr   r    c                    s.   t  | d|i| _djdi | j| _dS )z
        Initialize the RoleList

        :param version: Version that contains the resource
        :param service_sid:

        r    z/Services/{service_sid}/RolesNr   re   )r0   r   r    r1   r   r   r+   V  s   zRoleList.__init__r#   r$   r   rD   r3   c              	   C   sh   t ||t|dd d}t ddi}d|d< d|d< | jjd| j||d	}t| j|| jd
 dS )z
        Create the RoleInstance

        :param friendly_name:
        :param type:
        :param permission:

        :returns: The created RoleInstance
        c                 S   rs   r_   r   rt   r   r   r   rv   w  rw   z!RoleList.create.<locals>.<lambda>FriendlyNameTyperr   ry   rx   rn   ro   rz   r{   r    r   )	r   rl   r   r}   r5   createrf   r   r.   r0   r#   r$   rD   r|   rk   r   r   r   r   r   f  s   
zRoleList.createc              	      sp   t ||t|dd d}t ddi}d|d< d|d< | jjd| j||d	I d
H }t| j|| jd dS )z
        Asynchronously create the RoleInstance

        :param friendly_name:
        :param type:
        :param permission:

        :returns: The created RoleInstance
        c                 S   rs   r_   r   rt   r   r   r   rv     rw   z'RoleList.create_async.<locals>.<lambda>r   ry   rx   rn   ro   rz   r{   Nr    r   )	r   rl   r   r}   r5   create_asyncrf   r   r.   r   r   r   r   r     s    
zRoleList.create_asyncNlimit	page_sizec                 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
        r   r   r   )r5   read_limitspagestreamr0   r   r   limitsr   r   r   r   r     s   zRoleList.streamc                    s8   | 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
        r   r   Nr   )r5   r   
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
        r   r   )listr   r0   r   r   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 r_   r   )rS   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_numberc                 C   sN   t |||d}t ddi}d|d< | jjd| j||d}t| j|| 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
        	PageTokenr   PageSizery   rx   rn   ro   rp   ri   rj   paramsrk   )r   rl   r5   r   rf   r   r.   r0   r   r   r   r|   rk   responser   r   r   r     s   
zRoleList.pagec                    sV   t |||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 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   ry   rx   rn   ro   rp   r   N)r   rl   r5   r   rf   r   r.   r   r   r   r   r   2  s   
zRoleList.page_async
target_urlc                 C   s"   | j jjd|}t| j || 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
        rp   )r5   domaintwiliorequestr   r.   r0   r   r   r   r   r   get_pageS  s   	zRoleList.get_pagec                    s*   | j jjd|I dH }t| j || 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
        rp   N)r5   r   r   request_asyncr   r.   r   r   r   r   get_page_async_  s   	zRoleList.get_page_asyncr!   c                 C      t | j| jd |dS z?
        Constructs a RoleContext

        :param sid:
        r    r)   r4   r5   r.   r0   r!   r   r   r   r,   k  r   zRoleList.getc                 C   r   r   r   r   r   r   r   __call__u  r   zRoleList.__call__c                 C   r   )rL   z <Twilio.IpMessaging.V1.RoleList>r   r6   r   r   r   r]     r   zRoleList.__repr__)NN) r   r   r   r   ra   r+   r   r   r   r   r   intr   r   r	   r   r   r   r   unsetr   r`   r   r   r   r   r   r4   r,   r   r]   rd   r   r   r1   r   r   T  s    
"
$







#



!

r   N)__doc__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   r4   r   r   r   r   r   r   <module>   s    $  "