o
    �¨ÊhS>  ã                   @   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   ú`/var/www/html/env/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 )aM  
        Create a new 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: Newly created KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        ©ÚFriendlyNameÚ	DeviceSidÚPOST©Údatar
   ©r
   )r   ÚofÚ_versionÚcreater   ÚKeyInstancer   ©r   Úfriendly_nameÚ
device_sidr   Úpayloadr   r   r   r   &   s   
ýzKeyList.createNc                 C   s8   | j  ||¡}| j||d d�}| j  ||d |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Ú
page_limit)r   Úread_limitsÚpageÚstream)r   r#   r&   r%   Úlimitsr)   r   r   r   r*   :   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,   R   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©Úparams)r   r   r   r)   r   ÚKeyPager   )r   r#   Ú
page_tokenÚpage_numberr%   r1   Úresponser   r   r   r)   e   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
        r/   )r   ÚdomainÚtwilioÚrequestr2   r   )r   Ú
target_urlr5   r   r   r   Úget_page‚   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   rQ   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   s<   t  i ¡}| jjd| j|d�}t| j|| jd | jd d�S )ú—
        Fetch a KeyInstance

        :returns: Fetched KeyInstance
        :rtype: twilio.rest.preview.deployed_devices.fleet.key.KeyInstance
        r/   r0   r
   r>   r=   )r   r   r   Úfetchr   r    r   )r   r1   r$   r   r   r   rS   ó   s   
ýüzKeyContext.fetchc                 C   s   | j  d| j¡S )úz
        Deletes the KeyInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        Údelete)r   rU   r   rG   r   r   r   rU   	  s   zKeyContext.deletec                 C   sB   t  ||dœ¡}| jjd| j|d�}t| j|| jd | jd d�S )áE  
        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: 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   rW     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>2  ó   € 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   rS   rU   r   rN   rW   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                    sz   t t| ƒ |¡ |d |d |d |d |d |d |d t |d ¡t |d	 ¡d
œ	| _d| _||p7| 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>   ri   r"   r
   rj   r#   rk   rl   rm   Nr=   )r   r    r   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=   )rp   r@   r   r   rG   r   r   r   Ú_proxyU  s   
	ýzKeyInstance._proxyc                 C   ó
   | j d S )z_
        :returns: A string that uniquely identifies this Key.
        :rtype: unicode
        r>   ©ro   rG   r   r   r   r>   f  ó   
zKeyInstance.sidc                 C   rr   )zD
        :returns: URL of this Key.
        :rtype: unicode
        ri   rs   rG   r   r   r   ri   n  rt   zKeyInstance.urlc                 C   rr   )z^
        :returns: A human readable description for this Key.
        :rtype: unicode
        r"   rs   rG   r   r   r   r"   v  rt   zKeyInstance.friendly_namec                 C   rr   )zW
        :returns: The unique identifier of the Fleet.
        :rtype: unicode
        r
   rs   rG   r   r   r   r
   ~  rt   zKeyInstance.fleet_sidc                 C   rr   )z`
        :returns: The unique SID that identifies this Account.
        :rtype: unicode
        rj   rs   rG   r   r   r   rj   †  rt   zKeyInstance.account_sidc                 C   rr   )z]
        :returns: The unique identifier of a mapped Device.
        :rtype: unicode
        r#   rs   rG   r   r   r   r#   Ž  rt   zKeyInstance.device_sidc                 C   rr   )zC
        :returns: The key secret.
        :rtype: unicode
        rk   rs   rG   r   r   r   rk   –  rt   zKeyInstance.secretc                 C   rr   )z^
        :returns: The date this Key credential was created.
        :rtype: datetime
        rl   rs   rG   r   r   r   rl   ž  rt   zKeyInstance.date_createdc                 C   rr   )z^
        :returns: The date this Key credential was updated.
        :rtype: datetime
        rm   rs   rG   r   r   r   rm   ¦  rt   zKeyInstance.date_updatedc                 C   ó
   | j  ¡ S )rR   )rq   rS   rG   r   r   r   rS   ®  ó   
zKeyInstance.fetchc                 C   ru   )rT   )rq   rU   rG   r   r   r   rU   ·  rv   zKeyInstance.deletec                 C   s   | j j||d�S )rV   )r"   r#   )rq   rW   )r   r"   r#   r   r   r   rW   À  s   
zKeyInstance.updatec                 C   rX   )rF   rY   c                 s   rZ   r[   r\   r]   r   r   r   ra   Ó  rb   z'KeyInstance.__repr__.<locals>.<genexpr>z/<Twilio.Preview.DeployedDevices.KeyInstance {}>rc   rf   r   r   r   rH   Ì  rh   zKeyInstance.__repr__)N)rJ   rK   rL   rM   r   Úpropertyrq   r>   ri   r"   r
   rj   r#   rk   rl   rm   rS   rU   r   rN   rW   rH   rO   r   r   r   r   r    6  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    #*Y