o
    �¨ÊhQ8  ã                   @   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                       sr   e Zd 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 )ÚRoleListú  c                    s2   t t| ƒ |¡ d|i| _djdi | j¤Ž| _dS )a3  
        Initialize the RoleList

        :param Version version: Version that contains the resource
        :param service_sid: The unique id of the Service this role belongs to.

        :returns: twilio.rest.chat.v1.service.role.RoleList
        :rtype: twilio.rest.chat.v1.service.role.RoleList
        Úservice_sidz/Services/{service_sid}/RolesN© )Úsuperr	   Ú__init__Ú	_solutionÚformatÚ_uri)ÚselfÚversionr   ©Ú	__class__r   úR/var/www/html/env/lib/python3.10/site-packages/twilio/rest/chat/v1/service/role.pyr      s   

zRoleList.__init__c              	   C   sH   t  ||t |dd„ ¡dœ¡}| jjd| j|d�}t| j|| jd d�S )aq  
        Create a new RoleInstance

        :param unicode friendly_name: The human-readable name of this role.
        :param RoleInstance.RoleType type: What kind of role this is.
        :param unicode permission: A permission this role should have.

        :returns: Newly created RoleInstance
        :rtype: twilio.rest.chat.v1.service.role.RoleInstance
        c                 S   ó   | S ©Nr   ©Úer   r   r   Ú<lambda>3   ó    z!RoleList.create.<locals>.<lambda>)ÚFriendlyNameÚTypeÚ
PermissionÚPOST©Údatar   ©r   )	r   Úofr   ÚmapÚ_versionÚcreater   ÚRoleInstancer   )r   Úfriendly_nameÚtypeÚ
permissionr"   Úpayloadr   r   r   r'   %   s   ýýzRoleList.createNc                 C   s6   | j  ||¡}| j|d d�}| j  ||d |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.chat.v1.service.role.RoleInstance]
        Ú	page_size)r-   ÚlimitÚ
page_limit)r&   Úread_limitsÚpageÚstream)r   r.   r-   Úlimitsr1   r   r   r   r2   >   s   zRoleList.streamc                 C   s   t | j||d�ƒS )aV  
        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.chat.v1.service.role.RoleInstance]
        )r.   r-   )Úlistr2   )r   r.   r-   r   r   r   r4   U   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.chat.v1.service.role.RolePage
        )Ú	PageTokenr   ÚPageSizeÚGET©Úparams)r   r$   r&   r1   r   ÚRolePager   )r   Ú
page_tokenÚpage_numberr-   r9   Úresponser   r   r   r1   g   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.chat.v1.service.role.RolePage
        r7   )r&   ÚdomainÚtwilioÚrequestr:   r   )r   Ú
target_urlr=   r   r   r   Úget_page~   s
   

þzRoleList.get_pagec                 C   ó   t | j| jd |d�S ©zÄ
        Constructs a RoleContext

        :param sid: The sid

        :returns: twilio.rest.chat.v1.service.role.RoleContext
        :rtype: twilio.rest.chat.v1.service.role.RoleContext
        r   ©r   Úsid©ÚRoleContextr&   r   ©r   rF   r   r   r   Úget�   ó   	zRoleList.getc                 C   rC   rD   rG   rI   r   r   r   Ú__call__š   rK   zRoleList.__call__c                 C   ó   dS )úz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Chat.V1.RoleList>r   ©r   r   r   r   Ú__repr__¥   ó   zRoleList.__repr__)NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r'   r2   r4   r   Úunsetr1   rB   rJ   rL   rP   Ú__classcell__r   r   r   r   r	      s    


ÿr	   c                       s0   e Zd ZdZ‡ fdd„Zdd„ Zdd„ Z‡  ZS )r:   r
   c                    s   t t| ƒ ||¡ || _dS )ak  
        Initialize the RolePage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param service_sid: The unique id of the Service this role belongs to.

        :returns: twilio.rest.chat.v1.service.role.RolePage
        :rtype: twilio.rest.chat.v1.service.role.RolePage
        N)r   r:   r   r   )r   r   r=   Úsolutionr   r   r   r   ²   s   
zRolePage.__init__c                 C   s   t | j|| jd d�S )zî
        Build an instance of RoleInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.chat.v1.service.role.RoleInstance
        :rtype: twilio.rest.chat.v1.service.role.RoleInstance
        r   r#   )r(   r&   r   )r   r,   r   r   r   Úget_instanceÂ   rK   zRolePage.get_instancec                 C   rM   )rN   z<Twilio.Chat.V1.RolePage>r   rO   r   r   r   rP   Í   rQ   zRolePage.__repr__)rR   rS   rT   rU   r   rY   rP   rW   r   r   r   r   r:   ¯   s
    r:   c                       s@   e Zd ZdZ‡ fdd„Zdd„ Zdd„ Zdd	„ Zd
d„ Z‡  Z	S )rH   r
   c                    s4   t t| ƒ |¡ ||dœ| _djdi | j¤Ž| _dS )a5  
        Initialize the RoleContext

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

        :returns: twilio.rest.chat.v1.service.role.RoleContext
        :rtype: twilio.rest.chat.v1.service.role.RoleContext
        rE   z#/Services/{service_sid}/Roles/{sid}Nr   )r   rH   r   r   r   r   )r   r   r   rF   r   r   r   r   Ú   s   zRoleContext.__init__c                 C   s<   t  i ¡}| jjd| j|d�}t| j|| jd | jd d�S )úŒ
        Fetch a RoleInstance

        :returns: Fetched RoleInstance
        :rtype: twilio.rest.chat.v1.service.role.RoleInstance
        r7   r8   r   rF   rE   )r   r$   r&   Úfetchr   r(   r   )r   r9   r,   r   r   r   r[   ë   s   
ýüzRoleContext.fetchc                 C   s   | j  d| j¡S )ú{
        Deletes the RoleInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        Údelete)r&   r]   r   rO   r   r   r   r]     s   zRoleContext.deletec                 C   sL   t  dt |dd„ ¡i¡}| jjd| j|d�}t| j|| jd | jd d�S )	ú×
        Update the RoleInstance

        :param unicode permission: A permission this role should have.

        :returns: Updated RoleInstance
        :rtype: twilio.rest.chat.v1.service.role.RoleInstance
        r   c                 S   r   r   r   r   r   r   r   r     r   z$RoleContext.update.<locals>.<lambda>r    r!   r   rF   rE   )	r   r$   r   r%   r&   Úupdater   r(   r   )r   r+   r"   r,   r   r   r   r_   
  s   	ýüzRoleContext.updatec                 C   ó$   d  dd„ | j ¡ D ƒ¡}d |¡S )rN   ú c                 s   ó    � | ]\}}d   ||¡V  qdS ©z{}={}N©r   ©Ú.0ÚkÚvr   r   r   Ú	<genexpr>)  ó   € z'RoleContext.__repr__.<locals>.<genexpr>z<Twilio.Chat.V1.RoleContext {}>©Újoinr   Úitemsr   ©r   Úcontextr   r   r   rP   "  ó   
zRoleContext.__repr__)
rR   rS   rT   rU   r   r[   r]   r_   rP   rW   r   r   r   r   rH   ×   s    	rH   c                       sÊ   e Zd 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(   r
   c                   @   s   e Zd ZdZdZdS )zRoleInstance.RoleTypeÚchannelÚ
deploymentN)rR   rS   rT   ÚCHANNELÚ
DEPLOYMENTr   r   r   r   ÚRoleType0  s    ru   Nc                    sz   t t| ƒ |¡ |d |d |d |d |d |d t |d ¡t |d ¡|d	 d
œ	| _d| _||p7| jd dœ| _dS )z¬
        Initialize the RoleInstance

        :returns: twilio.rest.chat.v1.service.role.RoleInstance
        :rtype: twilio.rest.chat.v1.service.role.RoleInstance
        rF   Úaccount_sidr   r)   r*   ÚpermissionsÚdate_createdÚdate_updatedÚurl)	rF   rv   r   r)   r*   rw   rx   ry   rz   NrE   )r   r(   r   r   Úiso8601_datetimeÚ_propertiesÚ_contextr   )r   r   r,   r   rF   r   r   r   r   4  s   ÷zRoleInstance.__init__c                 C   s.   | j du rt| j| jd | 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.chat.v1.service.role.RoleContext
        Nr   rF   rE   )r}   rH   r&   r   rO   r   r   r   Ú_proxyN  s   
	ýzRoleInstance._proxyc                 C   ó
   | j d S )zq
        :returns: A 34 character string that uniquely identifies this resource.
        :rtype: unicode
        rF   ©r|   rO   r   r   r   rF   _  ó   
zRoleInstance.sidc                 C   r   )zk
        :returns: The unique id of the Account responsible for this role.
        :rtype: unicode
        rv   r€   rO   r   r   r   rv   g  r�   zRoleInstance.account_sidc                 C   r   )zf
        :returns: The unique id of the Service this role belongs to.
        :rtype: unicode
        r   r€   rO   r   r   r   r   o  r�   zRoleInstance.service_sidc                 C   r   )zY
        :returns: The human-readable name of this role.
        :rtype: unicode
        r)   r€   rO   r   r   r   r)   w  r�   zRoleInstance.friendly_namec                 C   r   )z\
        :returns: What kind of role this is.
        :rtype: RoleInstance.RoleType
        r*   r€   rO   r   r   r   r*     r�   zRoleInstance.typec                 C   r   )zb
        :returns: A JSON array of the permissions this role has.
        :rtype: unicode
        rw   r€   rO   r   r   r   rw   ‡  r�   zRoleInstance.permissionsc                 C   r   )zp
        :returns: The date that this resource was created in ISO 8601 format.
        :rtype: datetime
        rx   r€   rO   r   r   r   rx   �  r�   zRoleInstance.date_createdc                 C   r   )zu
        :returns: The date that this resource was last updated in ISO 8601 format.
        :rtype: datetime
        ry   r€   rO   r   r   r   ry   —  r�   zRoleInstance.date_updatedc                 C   r   )zR
        :returns: An absolute URL for this role.
        :rtype: unicode
        rz   r€   rO   r   r   r   rz   Ÿ  r�   zRoleInstance.urlc                 C   ó
   | j  ¡ S )rZ   )r~   r[   rO   r   r   r   r[   §  ó   
zRoleInstance.fetchc                 C   r‚   )r\   )r~   r]   rO   r   r   r   r]   °  rƒ   zRoleInstance.deletec                 C   s   | j  |¡S )r^   )r~   r_   )r   r+   r   r   r   r_   ¹  s   	zRoleInstance.updatec                 C   r`   )rN   ra   c                 s   rb   rc   rd   re   r   r   r   ri   Ë  rj   z(RoleInstance.__repr__.<locals>.<genexpr>z <Twilio.Chat.V1.RoleInstance {}>rk   rn   r   r   r   rP   Ä  rp   zRoleInstance.__repr__r   )rR   rS   rT   rU   Úobjectru   r   Úpropertyr~   rF   rv   r   r)   r*   rw   rx   ry   rz   r[   r]   r_   rP   rW   r   r   r   r   r(   -  s8    









		r(   N)rU   Útwilio.baser   r   r   Útwilio.base.instance_contextr   Útwilio.base.instance_resourcer   Útwilio.base.list_resourcer   Útwilio.base.pager   r	   r:   rH   r(   r   r   r   r   Ú<module>   s    (V