o
    e0F                     @   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 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)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd ZdZ fddZejejejejejfddZejddfddZejddfd	d
Z	ejejejejfddZ
dd Zdd Zdd Zdd Z  ZS )
DeviceList PLEASE NOTE that this class contains preview products that are subject
    to change. Use them with caution. If you currently do not have developer
    preview access, please contact help@twilio.com. c                    s2   t t| | d|i| _djdi | j| _dS )aJ  
        Initialize the DeviceList

        :param Version version: Version that contains the resource
        :param fleet_sid: The unique identifier of the Fleet.

        :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceList
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceList
        	fleet_sidz/Fleets/{fleet_sid}/DevicesN )superr   __init__	_solutionformat_uri)selfversionr
   	__class__r   d/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/preview/deployed_devices/fleet/device.pyr      s   

zDeviceList.__init__c                 C   s@   t |||||d}| jjd| j|d}t| j|| jd dS )a	  
        Create the DeviceInstance

        :param unicode unique_name: A unique, addressable name of this Device.
        :param unicode friendly_name: A human readable description for this Device.
        :param unicode identity: An identifier of the Device user.
        :param unicode deployment_sid: The unique SID of the Deployment group.
        :param bool enabled: The enabled

        :returns: The created DeviceInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance
        )
UniqueNameFriendlyNameIdentityDeploymentSidEnabledPOSTmethoduridatar
   r
   )r   of_versioncreater   DeviceInstancer   )r   unique_namefriendly_nameidentitydeployment_sidenabledr   payloadr   r   r   r#   &   s   zDeviceList.createNc                 C   s2   | j ||}| j||d d}| j ||d S )a+  
        Streams DeviceInstance 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 unicode deployment_sid: Find all Devices grouped under the specified Deployment.
        :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.preview.deployed_devices.fleet.device.DeviceInstance]
        	page_size)r(   r+   limit)r"   read_limitspagestream)r   r(   r,   r+   limitsr.   r   r   r   r/   A   s   zDeviceList.streamc                 C   s   t | j|||dS )a  
        Lists DeviceInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param unicode deployment_sid: Find all Devices grouped under the specified Deployment.
        :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.preview.deployed_devices.fleet.device.DeviceInstance]
        )r(   r,   r+   )listr/   )r   r(   r,   r+   r   r   r   r1   Y   s   zDeviceList.listc                 C   s8   t ||||d}| jjd| j|d}t| j|| jS )a*  
        Retrieve a single page of DeviceInstance records from the API.
        Request is executed immediately

        :param unicode deployment_sid: Find all Devices grouped under the specified Deployment.
        :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 DeviceInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage
        )r   	PageTokenr   PageSizeGET)r   r   params)r   r!   r"   r.   r   
DevicePager   )r   r(   
page_tokenpage_numberr+   r   responser   r   r   r.   l   s   zDeviceList.pagec                 C   s"   | j jjd|}t| j || jS )aB  
        Retrieve a specific page of DeviceInstance records from the API.
        Request is executed immediately

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

        :returns: Page of DeviceInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage
        r4   )r"   domaintwiliorequestr6   r   )r   
target_urlr9   r   r   r   get_page   s
   

zDeviceList.get_pagec                 C      t | j| jd |dS a  
        Constructs a DeviceContext

        :param sid: A string that uniquely identifies the Device.

        :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext
        r
   r
   sidDeviceContextr"   r   r   rB   r   r   r   get      	zDeviceList.getc                 C   r?   r@   rC   rE   r   r   r   __call__   rG   zDeviceList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z+<Twilio.Preview.DeployedDevices.DeviceList>r   r   r   r   r   __repr__      zDeviceList.__repr__)__name__
__module____qualname____doc__r   r   unsetr#   r/   r1   r.   r>   rF   rH   rL   __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 )r6   r	   c                    s   t t| || || _dS )a  
        Initialize the DevicePage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param fleet_sid: The unique identifier of the Fleet.

        :returns: twilio.rest.preview.deployed_devices.fleet.device.DevicePage
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DevicePage
        N)r   r6   r   r   )r   r   r9   solutionr   r   r   r      s   
zDevicePage.__init__c                 C   s   t | j|| jd dS )a  
        Build an instance of DeviceInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance
        r
   r    )r$   r"   r   r   r*   r   r   r   get_instance   rG   zDevicePage.get_instancec                 C   rI   )rJ   z+<Twilio.Preview.DeployedDevices.DevicePage>r   rK   r   r   r   rL      rM   zDevicePage.__repr__)rN   rO   rP   rQ   r   rV   rL   rS   r   r   r   r   r6      s
    r6   c                       sR   e Zd ZdZ fddZdd Zdd Zejejejejfdd	Z	d
d Z
  ZS )rD   r	   c                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the DeviceContext

        :param Version version: Version that contains the resource
        :param fleet_sid: The fleet_sid
        :param sid: A string that uniquely identifies the Device.

        :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext
        rA   z!/Fleets/{fleet_sid}/Devices/{sid}Nr   )r   rD   r   r   r   r   )r   r   r
   rB   r   r   r   r      s   zDeviceContext.__init__c                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the DeviceInstance

        :returns: The fetched DeviceInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance
        r4   r   r   r
   rB   rA   )r"   fetchr   r$   r   rU   r   r   r   rY      s   zDeviceContext.fetchc                 C   s   | j jd| jdS )}
        Deletes the DeviceInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErX   )r"   deleter   rK   r   r   r   r\     s   zDeviceContext.deletec                 C   sF   t ||||d}| jjd| j|d}t| j|| jd | jd dS )  
        Update the DeviceInstance

        :param unicode friendly_name: A human readable description for this Device.
        :param unicode identity: An identifier of the Device user.
        :param unicode deployment_sid: The unique SID of the Deployment group.
        :param bool enabled: The enabled

        :returns: The updated DeviceInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance
        )r   r   r   r   r   r   r
   rB   rA   )r   r!   r"   updater   r$   r   )r   r&   r'   r(   r)   r   r*   r   r   r   r^     s   zDeviceContext.updatec                 C   $   d dd | j D }d|S )rJ    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>3      z)DeviceContext.__repr__.<locals>.<genexpr>z1<Twilio.Preview.DeployedDevices.DeviceContext {}>joinr   itemsr   r   contextr   r   r   rL   ,     
zDeviceContext.__repr__)rN   rO   rP   rQ   r   rY   r\   r   rR   r^   rL   rS   r   r   r   r   rD      s    	
rD   c                       s   e Zd Zd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edd Zedd Zedd Zdd  Zd!d" Zejejejejfd#d$Zd%d& Z  ZS )(r$   r	   Nc                    s   t t| | |d|d|d|d|d|d|d|d|d	t|d
t|dt|dd| _d| _||pO| jd d| _dS )z
        Initialize the DeviceInstance

        :returns: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceInstance
        rB   urlr%   r&   r
   r)   account_sidr'   r(   date_createddate_updateddate_authenticated)rB   rp   r%   r&   r
   r)   rq   r'   r(   rr   rs   rt   NrA   )	r   r$   r   rF   r   iso8601_datetime_properties_contextr   )r   r   r*   r
   rB   r   r   r   r   <  s    zDeviceInstance.__init__c                 C   s.   | j du rt| j| jd | jd d| _ | j S )a8  
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: DeviceContext for this DeviceInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.device.DeviceContext
        Nr
   rB   rA   )rw   rD   r"   r   rK   r   r   r   _proxyY  s   
	zDeviceInstance._proxyc                 C   
   | j d S )zb
        :returns: A string that uniquely identifies this Device.
        :rtype: unicode
        rB   rv   rK   r   r   r   rB   j     
zDeviceInstance.sidc                 C   ry   )zG
        :returns: URL of this Device.
        :rtype: unicode
        rp   rz   rK   r   r   r   rp   r  r{   zDeviceInstance.urlc                 C   ry   )z^
        :returns: A unique, addressable name of this Device.
        :rtype: unicode
        r%   rz   rK   r   r   r   r%   z  r{   zDeviceInstance.unique_namec                 C   ry   )z`
        :returns: A human readable description for this Device
        :rtype: unicode
        r&   rz   rK   r   r   r   r&     r{   zDeviceInstance.friendly_namec                 C   ry   )zW
        :returns: The unique identifier of the Fleet.
        :rtype: unicode
        r
   rz   rK   r   r   r   r
     r{   zDeviceInstance.fleet_sidc                 C   ry   )zE
        :returns: Device enabled flag.
        :rtype: bool
        r)   rz   rK   r   r   r   r)     r{   zDeviceInstance.enabledc                 C   ry   )z`
        :returns: The unique SID that identifies this Account.
        :rtype: unicode
        rq   rz   rK   r   r   r   rq     r{   zDeviceInstance.account_sidc                 C   ry   )zU
        :returns: An identifier of the Device user.
        :rtype: unicode
        r'   rz   rK   r   r   r   r'     r{   zDeviceInstance.identityc                 C   ry   )z[
        :returns: The unique SID of the Deployment group.
        :rtype: unicode
        r(   rz   rK   r   r   r   r(     r{   zDeviceInstance.deployment_sidc                 C   ry   )zV
        :returns: The date this Device was created.
        :rtype: datetime
        rr   rz   rK   r   r   r   rr     r{   zDeviceInstance.date_createdc                 C   ry   )zV
        :returns: The date this Device was updated.
        :rtype: datetime
        rs   rz   rK   r   r   r   rs     r{   zDeviceInstance.date_updatedc                 C   ry   )z\
        :returns: The date this Device was authenticated.
        :rtype: datetime
        rt   rz   rK   r   r   r   rt     r{   z!DeviceInstance.date_authenticatedc                 C   
   | j  S )rW   )rx   rY   rK   r   r   r   rY        
zDeviceInstance.fetchc                 C   r|   )rZ   )rx   r\   rK   r   r   r   r\     r}   zDeviceInstance.deletec                 C   s   | j j||||dS )r]   )r&   r'   r(   r)   )rx   r^   )r   r&   r'   r(   r)   r   r   r   r^     s   zDeviceInstance.updatec                 C   r_   )rJ   r`   c                 s   ra   rb   rc   rd   r   r   r   rh     ri   z*DeviceInstance.__repr__.<locals>.<genexpr>z2<Twilio.Preview.DeployedDevices.DeviceInstance {}>rj   rm   r   r   r   rL     ro   zDeviceInstance.__repr__)N)rN   rO   rP   rQ   r   propertyrx   rB   rp   r%   r&   r
   r)   rq   r'   r(   rr   rs   rt   rY   r\   r   rR   r^   rL   rS   r   r   r   r   r$   7  sF    












		
r$   N)rQ   twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r6   rD   r$   r   r   r   r   <module>   s    &*W