o
    e=                     @   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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 )KeyList 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 )a;  
        Initialize the KeyList

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

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

zKeyList.__init__c                 C   s:   t ||d}| jjd| j|d}t| j|| jd dS )aI  
        Create the KeyInstance

        :param unicode friendly_name: The human readable description for this Key.
        :param unicode device_sid: The unique identifier of a Key to be authenticated.

        :returns: The created KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        FriendlyName	DeviceSidPOSTmethoduridatar
   r
   )r   of_versioncreater   KeyInstancer   r   friendly_name
device_sidr   payloadr   r   r   r!   &   s   
zKeyList.createNc                 C   s2   | j ||}| j||d d}| j ||d S )a  
        Streams KeyInstance 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 device_sid: Find all Keys authenticating specified Device.
        :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.key.KeyInstance]
        	page_size)r%   r'   limit)r    read_limitspagestream)r   r%   r(   r'   limitsr*   r   r   r   r+   6   s   zKeyList.streamc                 C   s   t | j|||dS )a  
        Lists KeyInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param unicode device_sid: Find all Keys authenticating specified Device.
        :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.key.KeyInstance]
        )r%   r(   r'   )listr+   )r   r%   r(   r'   r   r   r   r-   N   s   zKeyList.listc                 C   s8   t ||||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of KeyInstance records from the API.
        Request is executed immediately

        :param unicode device_sid: Find all Keys authenticating specified Device.
        :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 KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage
        )r   	PageTokenr   PageSizeGET)r   r   params)r   r   r    r*   r   KeyPager   )r   r%   
page_tokenpage_numberr'   r   responser   r   r   r*   a   s   zKeyList.pagec                 C   s"   | j jjd|}t| j || jS )a6  
        Retrieve a specific page of KeyInstance records from the API.
        Request is executed immediately

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

        :returns: Page of KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage
        r0   )r    domaintwiliorequestr2   r   )r   
target_urlr5   r   r   r   get_pagez   s
   

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

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

        :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyContext
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext
        r
   r
   sid
KeyContextr    r   r   r>   r   r   r   get      	zKeyList.getc                 C   r;   r<   r?   rA   r   r   r   __call__   rC   zKeyList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z(<Twilio.Preview.DeployedDevices.KeyList>r   r   r   r   r   __repr__      zKeyList.__repr__)__name__
__module____qualname____doc__r   r   unsetr!   r+   r-   r*   r:   rB   rD   rH   __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 )r2   r	   c                    s   t t| || || _dS )as  
        Initialize the KeyPage

        :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.key.KeyPage
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyPage
        N)r   r2   r   r   )r   r   r5   solutionr   r   r   r      s   
zKeyPage.__init__c                 C   s   t | j|| jd dS )a  
        Build an instance of KeyInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        r
   r   )r"   r    r   r   r&   r   r   r   get_instance   rC   zKeyPage.get_instancec                 C   rE   )rF   z(<Twilio.Preview.DeployedDevices.KeyPage>r   rG   r   r   r   rH      rI   zKeyPage.__repr__)rJ   rK   rL   rM   r   rR   rH   rO   r   r   r   r   r2      s
    r2   c                       sJ   e Zd ZdZ fddZdd Zdd Zejejfdd	Z	d
d Z
  ZS )r@   r	   c                    s4   t t| | ||d| _djdi | j| _dS )am  
        Initialize the KeyContext

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

        :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyContext
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext
        r=   z/Fleets/{fleet_sid}/Keys/{sid}Nr   )r   r@   r   r   r   r   )r   r   r
   r>   r   r   r   r      s   zKeyContext.__init__c                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the KeyInstance

        :returns: The fetched KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        r0   r   r   r
   r>   r=   )r    fetchr   r"   r   rQ   r   r   r   rU      s   zKeyContext.fetchc                 C   s   | j jd| jdS )z
        Deletes the KeyInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErT   )r    deleter   rG   r   r   r   rX      s   zKeyContext.deletec                 C   sB   t ||d}| jjd| j|d}t| j|| jd | jd dS )I  
        Update the KeyInstance

        :param unicode friendly_name: The human readable description for this Key.
        :param unicode device_sid: The unique identifier of a Key to be authenticated.

        :returns: The updated KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        r   r   r   r
   r>   r=   )r   r   r    updater   r"   r   r#   r   r   r   rZ     s   
zKeyContext.updatec                 C   $   d dd | j D }d|S )rF    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>       z&KeyContext.__repr__.<locals>.<genexpr>z.<Twilio.Preview.DeployedDevices.KeyContext {}>joinr   itemsr   r   contextr   r   r   rH        
zKeyContext.__repr__)rJ   rK   rL   rM   r   rU   rX   r   rN   rZ   rH   rO   r   r   r   r   r@      s    	r@   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dd Zdd Z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t|dt|d	d
	| _d| _||p@| jd d| _dS )z
        Initialize the KeyInstance

        :returns: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        r>   urlr$   r
   account_sidr%   secretdate_createddate_updated)	r>   rl   r$   r
   rm   r%   rn   ro   rp   Nr=   )	r   r"   r   rB   r   iso8601_datetime_properties_contextr   )r   r   r&   r
   r>   r   r   r   r   )  s   zKeyInstance.__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: KeyContext for this KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyContext
        Nr
   r>   r=   )rs   r@   r    r   rG   r   r   r   _proxyC  s   
	zKeyInstance._proxyc                 C   
   | j d S )z_
        :returns: A string that uniquely identifies this Key.
        :rtype: unicode
        r>   rr   rG   r   r   r   r>   T     
zKeyInstance.sidc                 C   ru   )zD
        :returns: URL of this Key.
        :rtype: unicode
        rl   rv   rG   r   r   r   rl   \  rw   zKeyInstance.urlc                 C   ru   )z^
        :returns: A human readable description for this Key.
        :rtype: unicode
        r$   rv   rG   r   r   r   r$   d  rw   zKeyInstance.friendly_namec                 C   ru   )zW
        :returns: The unique identifier of the Fleet.
        :rtype: unicode
        r
   rv   rG   r   r   r   r
   l  rw   zKeyInstance.fleet_sidc                 C   ru   )z`
        :returns: The unique SID that identifies this Account.
        :rtype: unicode
        rm   rv   rG   r   r   r   rm   t  rw   zKeyInstance.account_sidc                 C   ru   )z]
        :returns: The unique identifier of a mapped Device.
        :rtype: unicode
        r%   rv   rG   r   r   r   r%   |  rw   zKeyInstance.device_sidc                 C   ru   )zC
        :returns: The key secret.
        :rtype: unicode
        rn   rv   rG   r   r   r   rn     rw   zKeyInstance.secretc                 C   ru   )z^
        :returns: The date this Key credential was created.
        :rtype: datetime
        ro   rv   rG   r   r   r   ro     rw   zKeyInstance.date_createdc                 C   ru   )z^
        :returns: The date this Key credential was updated.
        :rtype: datetime
        rp   rv   rG   r   r   r   rp     rw   zKeyInstance.date_updatedc                 C   
   | j  S )rS   )rt   rU   rG   r   r   r   rU        
zKeyInstance.fetchc                 C   rx   )rV   )rt   rX   rG   r   r   r   rX     ry   zKeyInstance.deletec                 C   s   | j j||dS )rY   )r$   r%   )rt   rZ   )r   r$   r%   r   r   r   rZ     s   
zKeyInstance.updatec                 C   r[   )rF   r\   c                 s   r]   r^   r_   r`   r   r   r   rd     re   z'KeyInstance.__repr__.<locals>.<genexpr>z/<Twilio.Preview.DeployedDevices.KeyInstance {}>rf   ri   r   r   r   rH     rk   zKeyInstance.__repr__)N)rJ   rK   rL   rM   r   propertyrt   r>   rl   r$   r
   rm   r%   rn   ro   rp   rU   rX   r   rN   rZ   rH   rO   r   r   r   r   r"   $  s6    









		r"   N)rM   twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r2   r@   r"   r   r   r   r   <module>   s    *O