B
    `+f                 @   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 fddZejejejejejejejejejej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 )ApplicationListc                s.   t t| | d|i| _djf | j| _dS )aX  
        Initialize the ApplicationList

        :param Version version: Version that contains the resource
        :param account_sid: The SID of the Account that created the resource

        :returns: twilio.rest.api.v2010.account.application.ApplicationList
        :rtype: twilio.rest.api.v2010.account.application.ApplicationList
        account_sidz)/Accounts/{account_sid}/Applications.jsonN)superr   __init__	_solutionformat_uri)selfversionr	   )	__class__ X/home/dcms/DCMS/lib/python3.7/site-packages/twilio/rest/api/v2010/account/application.pyr      s    

zApplicationList.__init__c             C   sT   t |||||||||	|
|||||d}| jjd| j|d}t| j|| jd dS )a  
        Create the ApplicationInstance

        :param unicode api_version: The API version to use to start a new TwiML session
        :param unicode voice_url: The URL to call when the phone number receives a call
        :param unicode voice_method: The HTTP method to use with the voice_url
        :param unicode voice_fallback_url: The URL to call when a TwiML error occurs
        :param unicode voice_fallback_method: The HTTP method to use with voice_fallback_url
        :param unicode status_callback: The URL to send status information to your application
        :param unicode status_callback_method: The HTTP method to use to call status_callback
        :param bool voice_caller_id_lookup: Whether to lookup the caller's name
        :param unicode sms_url: The URL to call when the phone number receives an incoming SMS message
        :param unicode sms_method: The HTTP method to use with sms_url
        :param unicode sms_fallback_url: The URL to call when an error occurs while retrieving or executing the TwiML
        :param unicode sms_fallback_method: The HTTP method to use with sms_fallback_url
        :param unicode sms_status_callback: The URL to send status information to your application
        :param unicode message_status_callback: The URL to send message status information to your application
        :param unicode friendly_name: A string to describe the new resource

        :returns: The created ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance
        )
ApiVersionVoiceUrlVoiceMethodVoiceFallbackUrlVoiceFallbackMethodStatusCallbackStatusCallbackMethodVoiceCallerIdLookupSmsUrl	SmsMethodSmsFallbackUrlSmsFallbackMethodSmsStatusCallbackMessageStatusCallbackFriendlyNamePOST)methoduridatar	   )r	   )r   of_versioncreater   ApplicationInstancer   )r   api_version	voice_urlvoice_methodvoice_fallback_urlvoice_fallback_methodstatus_callbackstatus_callback_methodvoice_caller_id_lookupsms_url
sms_methodsms_fallback_urlsms_fallback_methodsms_status_callbackmessage_status_callbackfriendly_namer&   payloadr   r   r   r)   #   s$    
zApplicationList.createNc             C   s2   | j ||}| j||d d}| j ||d S )a0  
        Streams ApplicationInstance 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 friendly_name: The string that identifies the Application resources to read
        :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.application.ApplicationInstance]
        	page_size)r9   r;   limit)r(   Zread_limitspagestream)r   r9   r<   r;   Zlimitsr=   r   r   r   r>   W   s    zApplicationList.streamc             C   s   t | j|||dS )a  
        Lists ApplicationInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param unicode friendly_name: The string that identifies the Application resources to read
        :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.application.ApplicationInstance]
        )r9   r<   r;   )listr>   )r   r9   r<   r;   r   r   r   r?   o   s    zApplicationList.listc             C   s8   t ||||d}| jjd| j|d}t| j|| jS )a4  
        Retrieve a single page of ApplicationInstance records from the API.
        Request is executed immediately

        :param unicode friendly_name: The string that identifies the Application resources to read
        :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 ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationPage
        )r"   Z	PageTokenr   ZPageSizeGET)r$   r%   params)r   r'   r(   r=   r   ApplicationPager   )r   r9   Z
page_tokenZpage_numberr;   r&   responser   r   r   r=      s    
zApplicationList.pagec             C   s"   | j jjd|}t| j || jS )aI  
        Retrieve a specific page of ApplicationInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationPage
        r@   )r(   domainZtwiliorequestrB   r   )r   
target_urlrC   r   r   r   get_page   s    

zApplicationList.get_pagec             C   s   t | j| jd |dS )a  
        Constructs a ApplicationContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.application.ApplicationContext
        :rtype: twilio.rest.api.v2010.account.application.ApplicationContext
        r	   )r	   sid)ApplicationContextr(   r   )r   rH   r   r   r   get   s    	zApplicationList.getc             C   s   t | j| jd |dS )a  
        Constructs a ApplicationContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.application.ApplicationContext
        :rtype: twilio.rest.api.v2010.account.application.ApplicationContext
        r	   )r	   rH   )rI   r(   r   )r   rH   r   r   r   __call__   s    	zApplicationList.__call__c             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z"<Twilio.Api.V2010.ApplicationList>r   )r   r   r   r   __repr__   s    zApplicationList.__repr__)__name__
__module____qualname__r   r   unsetr)   r>   r?   r=   rG   rJ   rK   rL   __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 )rB   c                s   t t| || || _dS )a  
        Initialize the ApplicationPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param account_sid: The SID of the Account that created the resource

        :returns: twilio.rest.api.v2010.account.application.ApplicationPage
        :rtype: twilio.rest.api.v2010.account.application.ApplicationPage
        N)r
   rB   r   r   )r   r   rC   Zsolution)r   r   r   r      s    zApplicationPage.__init__c             C   s   t | j|| jd dS )a  
        Build an instance of ApplicationInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.api.v2010.account.application.ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance
        r	   )r	   )r*   r(   r   )r   r:   r   r   r   get_instance   s    	zApplicationPage.get_instancec             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z"<Twilio.Api.V2010.ApplicationPage>r   )r   r   r   r   rL      s    zApplicationPage.__repr__)rM   rN   rO   r   rR   rL   rQ   r   r   )r   r   rB      s   rB   c                   sz   e Zd Z fddZdd Zdd ZejejejejejejejejejejejejejejejfddZd	d
 Z	  Z
S )rI   c                s0   t t| | ||d| _djf | j| _dS )a  
        Initialize the ApplicationContext

        :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.application.ApplicationContext
        :rtype: twilio.rest.api.v2010.account.application.ApplicationContext
        )r	   rH   z//Accounts/{account_sid}/Applications/{sid}.jsonN)r
   rI   r   r   r   r   )r   r   r	   rH   )r   r   r   r      s    zApplicationContext.__init__c             C   s   | j jd| jdS )z
        Deletes the ApplicationInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETE)r$   r%   )r(   deleter   )r   r   r   r   rT     s    zApplicationContext.deletec             C   s0   | j jd| jd}t| j || jd | jd dS )z
        Fetch the ApplicationInstance

        :returns: The fetched ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance
        r@   )r$   r%   r	   rH   )r	   rH   )r(   fetchr   r*   r   )r   r:   r   r   r   rU     s    zApplicationContext.fetchc             C   s\   t |||||||||	|
|||||d}| jjd| j|d}t| j|| jd | jd dS )a#  
        Update the ApplicationInstance

        :param unicode friendly_name: A string to describe the resource
        :param unicode api_version: The API version to use to start a new TwiML session
        :param unicode voice_url: The URL to call when the phone number receives a call
        :param unicode voice_method: The HTTP method to use with the voice_url
        :param unicode voice_fallback_url: The URL to call when a TwiML error occurs
        :param unicode voice_fallback_method: The HTTP method to use with voice_fallback_url
        :param unicode status_callback: The URL to send status information to your application
        :param unicode status_callback_method: The HTTP method to use to call status_callback
        :param bool voice_caller_id_lookup: Whether to lookup the caller's name
        :param unicode sms_url: The URL to call when the phone number receives an incoming SMS message
        :param unicode sms_method: The HTTP method to use with sms_url
        :param unicode sms_fallback_url: The URL to call when an error occurs while retrieving or executing the TwiML
        :param unicode sms_fallback_method: The HTTP method to use with sms_fallback_url
        :param unicode sms_status_callback: Same as message_status_callback. Deprecated, included for backwards compatibility.
        :param unicode message_status_callback: The URL to send message status information to your application

        :returns: The updated ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance
        )r"   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r#   )r$   r%   r&   r	   rH   )r	   rH   )r   r'   r(   updater   r*   r   )r   r9   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r&   r:   r   r   r   rV     s,    
zApplicationContext.updatec             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.ApplicationContext.__repr__.<locals>.<genexpr>z(<Twilio.Api.V2010.ApplicationContext {}>)joinr   itemsr   )r   contextr   r   r   rL   X  s    zApplicationContext.__repr__)rM   rN   rO   r   rT   rU   r   rP   rV   rL   rQ   r   r   )r   r   rI      s   	2rI   c                   sx  e Zd Zd6 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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d0d1 Zejejejejejejejejejejejejejejejfd2d3Zd4d5 Z  Z S )7r*   Nc                s   t t| | |d|dt|dt|d|d|d|d|d|d	|d
|d|d|d|d|d|d|d|d|d|dd| _d| _||p| jd d| _dS )z
        Initialize the ApplicationInstance

        :returns: twilio.rest.api.v2010.account.application.ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance
        r	   r+   date_createddate_updatedr9   r8   rH   r6   r5   r4   r7   r3   r0   r1   r%   r2   r/   r.   r-   r,   )r	   r+   r_   r`   r9   r8   rH   r6   r5   r4   r7   r3   r0   r1   r%   r2   r/   r.   r-   r,   N)r	   rH   )	r
   r*   r   rJ   r   Zrfc2822_datetime_properties_contextr   )r   r   r:   r	   rH   )r   r   r   r   e  s.    zApplicationInstance.__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: ApplicationContext for this ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationContext
        Nr	   rH   )r	   rH   )rb   rI   r(   r   )r   r   r   r   _proxy  s    	
zApplicationInstance._proxyc             C   s
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        r	   )ra   )r   r   r   r   r	     s    zApplicationInstance.account_sidc             C   s
   | j d S )ze
        :returns: The API version used to start a new TwiML session
        :rtype: unicode
        r+   )ra   )r   r   r   r   r+     s    zApplicationInstance.api_versionc             C   s
   | j d S )zt
        :returns: The RFC 2822 date and time in GMT that the resource was created
        :rtype: datetime
        r_   )ra   )r   r   r   r   r_     s    z ApplicationInstance.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
        r`   )ra   )r   r   r   r   r`     s    z ApplicationInstance.date_updatedc             C   s
   | j d S )zi
        :returns: The string that you assigned to describe the resource
        :rtype: unicode
        r9   )ra   )r   r   r   r   r9     s    z!ApplicationInstance.friendly_namec             C   s
   | j d S )zr
        :returns: The URL to send message status information to your application
        :rtype: unicode
        r8   )ra   )r   r   r   r   r8     s    z+ApplicationInstance.message_status_callbackc             C   s
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rH   )ra   )r   r   r   r   rH     s    zApplicationInstance.sidc             C   s
   | j d S )z^
        :returns: The HTTP method used with sms_fallback_url
        :rtype: unicode
        r6   )ra   )r   r   r   r   r6     s    z'ApplicationInstance.sms_fallback_methodc             C   s
   | j d S )z
        :returns: The URL that we call when an error occurs while retrieving or executing the TwiML
        :rtype: unicode
        r5   )ra   )r   r   r   r   r5     s    z$ApplicationInstance.sms_fallback_urlc             C   s
   | j d S )zW
        :returns: The HTTP method to use with sms_url
        :rtype: unicode
        r4   )ra   )r   r   r   r   r4     s    zApplicationInstance.sms_methodc             C   s
   | j d S )zj
        :returns: The URL to send status information to your application
        :rtype: unicode
        r7   )ra   )r   r   r   r   r7     s    z'ApplicationInstance.sms_status_callbackc             C   s
   | j d S )zz
        :returns: The URL we call when the phone number receives an incoming SMS message
        :rtype: unicode
        r3   )ra   )r   r   r   r   r3     s    zApplicationInstance.sms_urlc             C   s
   | j d S )zj
        :returns: The URL to send status information to your application
        :rtype: unicode
        r0   )ra   )r   r   r   r   r0     s    z#ApplicationInstance.status_callbackc             C   s
   | j d S )zb
        :returns: The HTTP method we use to call status_callback
        :rtype: unicode
        r1   )ra   )r   r   r   r   r1     s    z*ApplicationInstance.status_callback_methodc             C   s
   | j d S )zq
        :returns: The URI of the resource, relative to `https://api.twilio.com`
        :rtype: unicode
        r%   )ra   )r   r   r   r   r%     s    zApplicationInstance.uric             C   s
   | j d S )zT
        :returns: Whether to lookup the caller's name
        :rtype: bool
        r2   )ra   )r   r   r   r   r2     s    z*ApplicationInstance.voice_caller_id_lookupc             C   s
   | j d S )z`
        :returns: The HTTP method used with voice_fallback_url
        :rtype: unicode
        r/   )ra   )r   r   r   r   r/     s    z)ApplicationInstance.voice_fallback_methodc             C   s
   | j d S )z]
        :returns: The URL we call when a TwiML error occurs
        :rtype: unicode
        r.   )ra   )r   r   r   r   r.   #  s    z&ApplicationInstance.voice_fallback_urlc             C   s
   | j d S )z[
        :returns: The HTTP method used with the voice_url
        :rtype: unicode
        r-   )ra   )r   r   r   r   r-   +  s    z ApplicationInstance.voice_methodc             C   s
   | j d S )zi
        :returns: The URL we call when the phone number receives a call
        :rtype: unicode
        r,   )ra   )r   r   r   r   r,   3  s    zApplicationInstance.voice_urlc             C   s
   | j  S )z
        Deletes the ApplicationInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        )rc   rT   )r   r   r   r   rT   ;  s    zApplicationInstance.deletec             C   s
   | j  S )z
        Fetch the ApplicationInstance

        :returns: The fetched ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance
        )rc   rU   )r   r   r   r   rU   D  s    zApplicationInstance.fetchc             C   s*   | j j|||||||||	|
|||||dS )a#  
        Update the ApplicationInstance

        :param unicode friendly_name: A string to describe the resource
        :param unicode api_version: The API version to use to start a new TwiML session
        :param unicode voice_url: The URL to call when the phone number receives a call
        :param unicode voice_method: The HTTP method to use with the voice_url
        :param unicode voice_fallback_url: The URL to call when a TwiML error occurs
        :param unicode voice_fallback_method: The HTTP method to use with voice_fallback_url
        :param unicode status_callback: The URL to send status information to your application
        :param unicode status_callback_method: The HTTP method to use to call status_callback
        :param bool voice_caller_id_lookup: Whether to lookup the caller's name
        :param unicode sms_url: The URL to call when the phone number receives an incoming SMS message
        :param unicode sms_method: The HTTP method to use with sms_url
        :param unicode sms_fallback_url: The URL to call when an error occurs while retrieving or executing the TwiML
        :param unicode sms_fallback_method: The HTTP method to use with sms_fallback_url
        :param unicode sms_status_callback: Same as message_status_callback. Deprecated, included for backwards compatibility.
        :param unicode message_status_callback: The URL to send message status information to your application

        :returns: The updated ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance
        )r9   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   )rc   rV   )r   r9   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r   r   r   rV   M  s     zApplicationInstance.updatec             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        rW   c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   )rX   rY   rZ   r   r   r   r[     s    z/ApplicationInstance.__repr__.<locals>.<genexpr>z)<Twilio.Api.V2010.ApplicationInstance {}>)r\   r   r]   r   )r   r^   r   r   r   rL   }  s    zApplicationInstance.__repr__)N)!rM   rN   rO   r   propertyrc   r	   r+   r_   r`   r9   r8   rH   r6   r5   r4   r7   r3   r0   r1   r%   r2   r/   r.   r-   r,   rT   rU   r   rP   rV   rL   rQ   r   r   )r   r   r*   c  sB   %		)r*   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   rB   rI   r*   r   r   r   r   <module>   s    <'p