B
    `/                 @   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                   sf   e Zd Z f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 )KeyListc                s.   t t| | d|i| _djf | j| _dS )a=  
        Initialize the KeyList

        :param Version version: Version that contains the resource
        :param account_sid: A 34 character string that uniquely identifies this resource.

        :returns: twilio.rest.api.v2010.account.key.KeyList
        :rtype: twilio.rest.api.v2010.account.key.KeyList
        account_sidz!/Accounts/{account_sid}/Keys.jsonN)superr   __init__	_solutionformat_uri)selfversionr	   )	__class__ P/home/dcms/DCMS/lib/python3.7/site-packages/twilio/rest/api/v2010/account/key.pyr      s    

zKeyList.__init__Nc             C   s0   | 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 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.api.v2010.account.key.KeyInstance]
        	page_size)r   limit)_versionZread_limitspagestream)r   r   r   Zlimitsr   r   r   r   r   #   s    zKeyList.streamc             C   s   t | j||dS )aU  
        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 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.api.v2010.account.key.KeyInstance]
        )r   r   )listr   )r   r   r   r   r   r   r   :   s    zKeyList.listc             C   s6   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 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.api.v2010.account.key.KeyPage
        )Z	PageTokenr   ZPageSizeGET)methoduriparams)r   ofr   r   r   KeyPager   )r   Z
page_tokenZpage_numberr   dataresponser   r   r   r   L   s    zKeyList.pagec             C   s"   | j jjd|}t| j || jS )a)  
        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.api.v2010.account.key.KeyPage
        r   )r   domainZtwiliorequestr   r   )r   
target_urlr!   r   r   r   get_page_   s    

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

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.key.KeyContext
        :rtype: twilio.rest.api.v2010.account.key.KeyContext
        r	   )r	   sid)
KeyContextr   r   )r   r&   r   r   r   getp   s    	zKeyList.getc             C   s   t | j| jd |dS )z
        Constructs a KeyContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.key.KeyContext
        :rtype: twilio.rest.api.v2010.account.key.KeyContext
        r	   )r	   r&   )r'   r   r   )r   r&   r   r   r   __call__{   s    	zKeyList.__call__c             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Api.V2010.KeyList>r   )r   r   r   r   __repr__   s    zKeyList.__repr__)NN)NN)__name__
__module____qualname__r   r   r   r   unsetr   r%   r(   r)   r*   __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 )r   c                s   t t| || || _dS )au  
        Initialize the KeyPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param account_sid: A 34 character string that uniquely identifies this resource.

        :returns: twilio.rest.api.v2010.account.key.KeyPage
        :rtype: twilio.rest.api.v2010.account.key.KeyPage
        N)r
   r   r   r   )r   r   r!   Zsolution)r   r   r   r      s    zKeyPage.__init__c             C   s   t | j|| jd dS )z
        Build an instance of KeyInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.api.v2010.account.key.KeyInstance
        :rtype: twilio.rest.api.v2010.account.key.KeyInstance
        r	   )r	   )KeyInstancer   r   )r   payloadr   r   r   get_instance   s    	zKeyPage.get_instancec             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Api.V2010.KeyPage>r   )r   r   r   r   r*      s    zKeyPage.__repr__)r+   r,   r-   r   r2   r*   r/   r   r   )r   r   r      s   r   c                   sB   e Zd Z fddZdd ZejfddZdd Zd	d
 Z	  Z
S )r'   c                s0   t t| | ||d| _djf | j| _dS )a  
        Initialize the KeyContext

        :param Version version: Version that contains the resource
        :param account_sid: The SID of the Account that created the resource to fetch
        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.key.KeyContext
        :rtype: twilio.rest.api.v2010.account.key.KeyContext
        )r	   r&   z'/Accounts/{account_sid}/Keys/{sid}.jsonN)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 )z
        Fetch the KeyInstance

        :returns: The fetched KeyInstance
        :rtype: twilio.rest.api.v2010.account.key.KeyInstance
        r   )r   r   r	   r&   )r	   r&   )r   fetchr   r0   r   )r   r1   r   r   r   r3      s    zKeyContext.fetchc             C   s@   t d|i}| jjd| j|d}t| j|| jd | jd dS )z
        Update the KeyInstance

        :param unicode friendly_name: A string to describe the resource

        :returns: The updated KeyInstance
        :rtype: twilio.rest.api.v2010.account.key.KeyInstance
        ZFriendlyNamePOST)r   r   r    r	   r&   )r	   r&   )r   r   r   updater   r0   r   )r   friendly_namer    r1   r   r   r   r5      s    	zKeyContext.updatec             C   s   | j jd| jdS )zz
        Deletes the KeyInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETE)r   r   )r   deleter   )r   r   r   r   r8      s    zKeyContext.deletec             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
         c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   ).0kvr   r   r   	<genexpr>   s    z&KeyContext.__repr__.<locals>.<genexpr>z <Twilio.Api.V2010.KeyContext {}>)joinr   itemsr   )r   contextr   r   r   r*      s    zKeyContext.__repr__)r+   r,   r-   r   r3   r   r.   r5   r8   r*   r/   r   r   )r   r   r'      s
   	r'   c                   s   e 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	dd Z
ejfddZdd Zdd Z  ZS )r0   Nc                sd   t t| | |d|dt|dt|dd| _d| _||pX| jd d| _dS )z
        Initialize the KeyInstance

        :returns: twilio.rest.api.v2010.account.key.KeyInstance
        :rtype: twilio.rest.api.v2010.account.key.KeyInstance
        r&   r6   date_createddate_updated)r&   r6   rA   rB   N)r	   r&   )	r
   r0   r   r(   r   Zrfc2822_datetime_properties_contextr   )r   r   r1   r	   r&   )r   r   r   r     s    zKeyInstance.__init__c             C   s.   | j dk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.api.v2010.account.key.KeyContext
        Nr	   r&   )r	   r&   )rD   r'   r   r   )r   r   r   r   _proxy  s    	
zKeyInstance._proxyc             C   s
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        r&   )rC   )r   r   r   r   r&   *  s    zKeyInstance.sidc             C   s
   | j d S )zi
        :returns: The string that you assigned to describe the resource
        :rtype: unicode
        r6   )rC   )r   r   r   r   r6   2  s    zKeyInstance.friendly_namec             C   s
   | j d S )zt
        :returns: The RFC 2822 date and time in GMT that the resource was created
        :rtype: datetime
        rA   )rC   )r   r   r   r   rA   :  s    zKeyInstance.date_createdc             C   s
   | j d S )zy
        :returns: The RFC 2822 date and time in GMT that the resource was last updated
        :rtype: datetime
        rB   )rC   )r   r   r   r   rB   B  s    zKeyInstance.date_updatedc             C   s
   | j  S )z
        Fetch the KeyInstance

        :returns: The fetched KeyInstance
        :rtype: twilio.rest.api.v2010.account.key.KeyInstance
        )rE   r3   )r   r   r   r   r3   J  s    zKeyInstance.fetchc             C   s   | j j|dS )z
        Update the KeyInstance

        :param unicode friendly_name: A string to describe the resource

        :returns: The updated KeyInstance
        :rtype: twilio.rest.api.v2010.account.key.KeyInstance
        )r6   )rE   r5   )r   r6   r   r   r   r5   S  s    	zKeyInstance.updatec             C   s
   | j  S )zz
        Deletes the KeyInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        )rE   r8   )r   r   r   r   r8   ^  s    zKeyInstance.deletec             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        r9   c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   )r:   r;   r<   r   r   r   r=   n  s    z'KeyInstance.__repr__.<locals>.<genexpr>z!<Twilio.Api.V2010.KeyInstance {}>)r>   r   r?   r   )r   r@   r   r   r   r*   g  s    zKeyInstance.__repr__)N)r+   r,   r-   r   propertyrE   r&   r6   rA   rB   r3   r   r.   r5   r8   r*   r/   r   r   )r   r   r0     s   		r0   N)__doc__Ztwilio.baser   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.pager   r   r   r'   r0   r   r   r   r   <module>   s   'K