o
    e6                     @   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                    s2   t t| | d|i| _djdi | j| _dS )a   
        Initialize the RoleList

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

        :returns: twilio.rest.ip_messaging.v1.service.role.RoleList
        :rtype: twilio.rest.ip_messaging.v1.service.role.RoleList
        service_sidz/Services/{service_sid}/RolesN )superr	   __init__	_solutionformat_uri)selfversionr
   	__class__r   [/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/ip_messaging/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 )a@  
        Create the RoleInstance

        :param unicode friendly_name: The friendly_name
        :param RoleInstance.RoleType type: The type
        :param list[unicode] permission: The permission

        :returns: The created RoleInstance
        :rtype: twilio.rest.ip_messaging.v1.service.role.RoleInstance
        c                 S      | S Nr   er   r   r   <lambda>2       z!RoleList.create.<locals>.<lambda>)FriendlyNameType
PermissionPOSTmethoduridatar
   r
   )	r   ofr   map_versioncreater   RoleInstancer   )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.ip_messaging.v1.service.role.RoleInstance]
        	page_size)r.   limit)r'   read_limitspagestream)r   r/   r.   limitsr1   r   r   r   r2   9   s   zRoleList.streamc                 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 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.ip_messaging.v1.service.role.RoleInstance]
        )r/   r.   )listr2   )r   r/   r.   r   r   r   r4   P   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.ip_messaging.v1.service.role.RolePage
        )	PageTokenr   PageSizeGET)r!   r"   params)r   r%   r'   r1   r   RolePager   )r   
page_tokenpage_numberr.   r#   responser   r   r   r1   b   s   zRoleList.pagec                 C   s"   | j jjd|}t| j || jS )a3  
        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.ip_messaging.v1.service.role.RolePage
        r7   )r'   domaintwiliorequestr9   r   )r   
target_urlr<   r   r   r   get_pageu   s
   

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

        :param sid: The sid

        :returns: twilio.rest.ip_messaging.v1.service.role.RoleContext
        :rtype: twilio.rest.ip_messaging.v1.service.role.RoleContext
        r
   r
   sidRoleContextr'   r   r   rE   r   r   r   get      	zRoleList.getc                 C   rB   rC   rF   rH   r   r   r   __call__   rJ   zRoleList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z <Twilio.IpMessaging.V1.RoleList>r   r   r   r   r   __repr__      zRoleList.__repr__)NN)__name__
__module____qualname__r   r(   r2   r4   r   unsetr1   rA   rI   rK   rO   __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 )r9   c                    s   t t| || || _dS )aX  
        Initialize the RolePage

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

        :returns: twilio.rest.ip_messaging.v1.service.role.RolePage
        :rtype: twilio.rest.ip_messaging.v1.service.role.RolePage
        N)r   r9   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.ip_messaging.v1.service.role.RoleInstance
        :rtype: twilio.rest.ip_messaging.v1.service.role.RoleInstance
        r
   r$   )r)   r'   r   r   r-   r   r   r   get_instance   rJ   zRolePage.get_instancec                 C   rL   )rM   z <Twilio.IpMessaging.V1.RolePage>r   rN   r   r   r   rO      rP   zRolePage.__repr__)rQ   rR   rS   r   rX   rO   rU   r   r   r   r   r9      s    r9   c                       s<   e Zd Z fddZdd Zdd Zdd Zd	d
 Z  ZS )rG   c                    s4   t t| | ||d| _djdi | j| _dS )aE  
        Initialize the RoleContext

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

        :returns: twilio.rest.ip_messaging.v1.service.role.RoleContext
        :rtype: twilio.rest.ip_messaging.v1.service.role.RoleContext
        rD   z#/Services/{service_sid}/Roles/{sid}Nr   )r   rG   r   r   r   r   )r   r   r
   rE   r   r   r   r      s   zRoleContext.__init__c                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the RoleInstance

        :returns: The fetched RoleInstance
        :rtype: twilio.rest.ip_messaging.v1.service.role.RoleInstance
        r7   r!   r"   r
   rE   rD   )r'   fetchr   r)   r   rW   r   r   r   r[      s   zRoleContext.fetchc                 C   s   | j jd| jdS ){
        Deletes the RoleInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErZ   )r'   deleter   rN   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 list[unicode] permission: The permission

        :returns: The updated RoleInstance
        :rtype: twilio.rest.ip_messaging.v1.service.role.RoleInstance
        r   c                 S   r   r   r   r   r   r   r   r     r   z$RoleContext.update.<locals>.<lambda>r   r    r
   rE   rD   )	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 )rM    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>      z'RoleContext.__repr__.<locals>.<genexpr>z&<Twilio.IpMessaging.V1.RoleContext {}>joinr   itemsr   r   contextr   r   r   rO        
zRoleContext.__repr__)	rQ   rR   rS   r   r[   r^   r`   rO   rU   r   r   r   r   rG      s    	rG   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channel
deploymentN)rQ   rR   rS   CHANNEL
DEPLOYMENTr   r   r   r   RoleType  s    rv   Nc                    s   t t| | |d|d|d|d|d|dt|dt|d|d	d
	| _d| _||p@| jd d| _dS )z
        Initialize the RoleInstance

        :returns: twilio.rest.ip_messaging.v1.service.role.RoleInstance
        :rtype: twilio.rest.ip_messaging.v1.service.role.RoleInstance
        rE   account_sidr
   r*   r+   permissionsdate_createddate_updatedurl)	rE   rw   r
   r*   r+   rx   ry   rz   r{   NrD   )	r   r)   r   rI   r   iso8601_datetime_properties_contextr   )r   r   r-   r
   rE   r   r   r   r     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.ip_messaging.v1.service.role.RoleContext
        Nr
   rE   rD   )r~   rG   r'   r   rN   r   r   r   _proxy8  s   
	zRoleInstance._proxyc                 C   
   | j d S )z;
        :returns: The sid
        :rtype: unicode
        rE   r}   rN   r   r   r   rE   I     
zRoleInstance.sidc                 C   r   )zC
        :returns: The account_sid
        :rtype: unicode
        rw   r   rN   r   r   r   rw   Q  r   zRoleInstance.account_sidc                 C   r   )zC
        :returns: The service_sid
        :rtype: unicode
        r
   r   rN   r   r   r   r
   Y  r   zRoleInstance.service_sidc                 C   r   )zE
        :returns: The friendly_name
        :rtype: unicode
        r*   r   rN   r   r   r   r*   a  r   zRoleInstance.friendly_namec                 C   r   )zJ
        :returns: The type
        :rtype: RoleInstance.RoleType
        r+   r   rN   r   r   r   r+   i  r   zRoleInstance.typec                 C   r   )zI
        :returns: The permissions
        :rtype: list[unicode]
        rx   r   rN   r   r   r   rx   q  r   zRoleInstance.permissionsc                 C   r   )zE
        :returns: The date_created
        :rtype: datetime
        ry   r   rN   r   r   r   ry   y  r   zRoleInstance.date_createdc                 C   r   )zE
        :returns: The date_updated
        :rtype: datetime
        rz   r   rN   r   r   r   rz     r   zRoleInstance.date_updatedc                 C   r   )z;
        :returns: The url
        :rtype: unicode
        r{   r   rN   r   r   r   r{     r   zRoleInstance.urlc                 C   
   | j  S )rY   )r   r[   rN   r   r   r   r[        
zRoleInstance.fetchc                 C   r   )r\   )r   r^   rN   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   ra   )rM   rb   c                 s   rc   rd   re   rf   r   r   r   rj     rk   z(RoleInstance.__repr__.<locals>.<genexpr>z'<Twilio.IpMessaging.V1.RoleInstance {}>rl   ro   r   r   r   rO     rq   zRoleInstance.__repr__r   )rQ   rR   rS   objectrv   r   propertyr   rE   rw   r
   r*   r+   rx   ry   rz   r{   r[   r^   r`   rO   rU   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	   r9   rG   r)   r   r   r   r   <module>   s    'K