o
    e5                     @   s   d 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 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 )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)	serialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       sn   e Zd Z fddZdd ZdddZddd	Zejejejfd
dZ	dd Z
dd Zdd Zdd Z  ZS )RoleListc                    s.   t t| | i | _djdi | j| _dS )z
        Initialize the RoleList

        :param Version version: Version that contains the resource

        :returns: twilio.rest.conversations.v1.role.RoleList
        :rtype: twilio.rest.conversations.v1.role.RoleList
        z/RolesN )superr	   __init__	_solutionformat_uri)selfversion	__class__r
   T/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/role.pyr      s   	zRoleList.__init__c              	   C   s>   t ||t|dd d}| jjd| j|d}t| j|S )ah  
        Create the RoleInstance

        :param unicode friendly_name: A string to describe the new resource
        :param RoleInstance.RoleType type: The type of role
        :param list[unicode] permission: A permission the role should have

        :returns: The created RoleInstance
        :rtype: twilio.rest.conversations.v1.role.RoleInstance
        c                 S      | S Nr
   er
   r
   r   <lambda>1       z!RoleList.create.<locals>.<lambda>)FriendlyNameType
PermissionPOSTmethoduridata)r   ofr   map_versioncreater   RoleInstance)r   friendly_nametype
permissionr"   payloadr
   r
   r   r&   #   s   zRoleList.createNc                 C   s0   | j ||}| j|d d}| j ||d S )a  
        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 int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int 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
        :rtype: list[twilio.rest.conversations.v1.role.RoleInstance]
        	page_size)r,   limit)r%   read_limitspagestream)r   r-   r,   limitsr/   r
   r
   r   r0   8   s   zRoleList.streamc                 C   s   t | j||dS )aW  
        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 int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int 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: Generator that will yield up to limit results
        :rtype: list[twilio.rest.conversations.v1.role.RoleInstance]
        )r-   r,   )listr0   )r   r-   r,   r
   r
   r   r2   O   s   zRoleList.listc                 C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of RoleInstance records from the API.
        Request is executed immediately

        :param str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of RoleInstance
        :rtype: twilio.rest.conversations.v1.role.RolePage
        )	PageTokenr   PageSizeGET)r    r!   params)r   r#   r%   r/   r   RolePager   )r   
page_tokenpage_numberr,   r"   responser
   r
   r   r/   a   s   zRoleList.pagec                 C   s"   | j jjd|}t| j || jS )a,  
        Retrieve a specific page of RoleInstance records from the API.
        Request is executed immediately

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

        :returns: Page of RoleInstance
        :rtype: twilio.rest.conversations.v1.role.RolePage
        r5   )r%   domaintwiliorequestr7   r   )r   
target_urlr:   r
   r
   r   get_paget   s
   

zRoleList.get_pagec                 C      t | j|dS z
        Constructs a RoleContext

        :param sid: The SID of the Role resource to fetch

        :returns: twilio.rest.conversations.v1.role.RoleContext
        :rtype: twilio.rest.conversations.v1.role.RoleContext
        sidRoleContextr%   r   rC   r
   r
   r   get      	zRoleList.getc                 C   r@   rA   rD   rF   r
   r
   r   __call__   rH   zRoleList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z"<Twilio.Conversations.V1.RoleList>r
   r   r
   r
   r   __repr__      zRoleList.__repr__)NN)__name__
__module____qualname__r   r&   r0   r2   r   unsetr/   r?   rG   rI   rM   __classcell__r
   r
   r   r   r	      s    


r	   c                       s,   e Zd Z fddZdd Zdd Z  ZS )r7   c                    s   t t| || || _dS )a  
        Initialize the RolePage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API

        :returns: twilio.rest.conversations.v1.role.RolePage
        :rtype: twilio.rest.conversations.v1.role.RolePage
        N)r   r7   r   r   )r   r   r:   solutionr   r
   r   r      s   

zRolePage.__init__c                 C   s   t | j|S )z
        Build an instance of RoleInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.conversations.v1.role.RoleInstance
        :rtype: twilio.rest.conversations.v1.role.RoleInstance
        )r'   r%   r   r+   r
   r
   r   get_instance      	zRolePage.get_instancec                 C   rJ   )rK   z"<Twilio.Conversations.V1.RolePage>r
   rL   r
   r
   r   rM      rN   zRolePage.__repr__)rO   rP   rQ   r   rV   rM   rS   r
   r
   r   r   r7      s    r7   c                       s<   e Zd Z fddZdd Zdd Zdd Zd	d
 Z  ZS )rE   c                    s2   t t| | d|i| _djdi | j| _dS )a)  
        Initialize the RoleContext

        :param Version version: Version that contains the resource
        :param sid: The SID of the Role resource to fetch

        :returns: twilio.rest.conversations.v1.role.RoleContext
        :rtype: twilio.rest.conversations.v1.role.RoleContext
        rC   z/Roles/{sid}Nr
   )r   rE   r   r   r   r   )r   r   rC   r   r
   r   r      s   

zRoleContext.__init__c                 C   sD   t dt|dd i}| jjd| j|d}t| j|| jd dS )
        Update the RoleInstance

        :param list[unicode] permission: A permission the role should have

        :returns: The updated RoleInstance
        :rtype: twilio.rest.conversations.v1.role.RoleInstance
        r   c                 S   r   r   r
   r   r
   r
   r   r      r   z$RoleContext.update.<locals>.<lambda>r   r   rC   rB   )	r   r#   r   r$   r%   updater   r'   r   )r   r*   r"   r+   r
   r
   r   rY      s   	zRoleContext.updatec                 C   s   | j jd| jdS ){
        Deletes the RoleInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETEr    r!   )r%   deleter   rL   r
   r
   r   r]      s   zRoleContext.deletec                 C   s(   | j jd| jd}t| j || jd dS )
        Fetch the RoleInstance

        :returns: The fetched RoleInstance
        :rtype: twilio.rest.conversations.v1.role.RoleInstance
        r5   r\   rC   rB   )r%   fetchr   r'   r   rU   r
   r
   r   r_      s   zRoleContext.fetchc                 C   $   d dd | j D }d|S )rK    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr
   r
   r   	<genexpr>      z'RoleContext.__repr__.<locals>.<genexpr>z(<Twilio.Conversations.V1.RoleContext {}>joinr   itemsr   r   contextr
   r
   r   rM         
zRoleContext.__repr__)	rO   rP   rQ   r   rY   r]   r_   rM   rS   r
   r
   r   r   rE      s    	rE   c                       s   e Zd ZG dd deZd" fdd	Zedd Zedd	 Zed
d Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zdd Zdd Zdd Zd d! Z  ZS )#r'   c                   @   s   e Zd ZdZdZdS )zRoleInstance.RoleTypeconversationserviceN)rO   rP   rQ   CONVERSATIONSERVICEr
   r
   r
   r   RoleType  s    ru   Nc                    s   t t| | |d|d|d|d|d|dt|dt|d|d	d
	| _d| _d|p@| jd i| _dS )z
        Initialize the RoleInstance

        :returns: twilio.rest.conversations.v1.role.RoleInstance
        :rtype: twilio.rest.conversations.v1.role.RoleInstance
        rC   account_sidchat_service_sidr(   r)   permissionsdate_createddate_updatedurl)	rC   rv   rw   r(   r)   rx   ry   rz   r{   N)	r   r'   r   rG   r   iso8601_datetime_properties_contextr   )r   r   r+   rC   r   r
   r   r     s   zRoleInstance.__init__c                 C   s&   | j du rt| j| jd d| _ | j S )a"  
        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
        :rtype: twilio.rest.conversations.v1.role.RoleContext
        NrC   rB   )r~   rE   r%   r   rL   r
   r
   r   _proxy+  s   
	zRoleInstance._proxyc                 C   
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rC   r}   rL   r
   r
   r   rC   8     
zRoleInstance.sidc                 C   r   )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        rv   r   rL   r
   r
   r   rv   @  r   zRoleInstance.account_sidc                 C   r   )z|
        :returns: The SID of the Conversation Service that the resource is associated with
        :rtype: unicode
        rw   r   rL   r
   r
   r   rw   H  r   zRoleInstance.chat_service_sidc                 C   r   )zi
        :returns: The string that you assigned to describe the resource
        :rtype: unicode
        r(   r   rL   r
   r
   r   r(   P  r   zRoleInstance.friendly_namec                 C   r   )zR
        :returns: The type of role
        :rtype: RoleInstance.RoleType
        r)   r   rL   r
   r
   r   r)   X  r   zRoleInstance.typec                 C   r   )zo
        :returns: An array of the permissions the role has been granted
        :rtype: list[unicode]
        rx   r   rL   r
   r
   r   rx   `  r   zRoleInstance.permissionsc                 C   r   )zt
        :returns: The ISO 8601 date and time in GMT when the resource was created
        :rtype: datetime
        ry   r   rL   r
   r
   r   ry   h  r   zRoleInstance.date_createdc                 C   r   )zy
        :returns: The ISO 8601 date and time in GMT when the resource was last updated
        :rtype: datetime
        rz   r   rL   r
   r
   r   rz   p  r   zRoleInstance.date_updatedc                 C   r   )zW
        :returns: An absolute URL for this user role.
        :rtype: unicode
        r{   r   rL   r
   r
   r   r{   x  r   zRoleInstance.urlc                 C   s   | j |S )rX   )r   rY   )r   r*   r
   r
   r   rY     rW   zRoleInstance.updatec                 C   
   | j  S )rZ   )r   r]   rL   r
   r
   r   r]        
zRoleInstance.deletec                 C   r   )r^   )r   r_   rL   r
   r
   r   r_     r   zRoleInstance.fetchc                 C   r`   )rK   ra   c                 s   rb   rc   rd   re   r
   r
   r   ri     rj   z(RoleInstance.__repr__.<locals>.<genexpr>z)<Twilio.Conversations.V1.RoleInstance {}>rk   rn   r
   r
   r   rM     rp   zRoleInstance.__repr__r   )rO   rP   rQ   objectru   r   propertyr   rC   rv   rw   r(   r)   rx   ry   rz   r{   rY   r]   r_   rM   rS   r
   r
   r   r   r'     s6    









		r'   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r7   rE   r'   r
   r
   r
   r   <module>   s    &@