o
    e+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                    s2   t t| | d|i| _djdi | 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__r
   \/var/www/html/venv/lib/python3.10/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)r<   r>   limit)r+   read_limitspagestream)r   r<   r?   r>   limitsrA   r
   r
   r   rB   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]
        )r<   r?   r>   )listrB   )r   r<   r?   r>   r
   r
   r   rD   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#   	PageTokenr   PageSizeGET)r&   r'   params)r   r*   r+   rA   r   ApplicationPager   )r   r<   
page_tokenpage_numberr>   r(   responser
   r
   r   rA      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
        rG   )r+   domaintwiliorequestrI   r   )r   
target_urlrL   r
   r
   r   get_page   s
   

zApplicationList.get_pagec                 C      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   rU   r
   r
   r   get      	zApplicationList.getc                 C   rR   rS   rV   rX   r
   r
   r   __call__   rZ   zApplicationList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z"<Twilio.Api.V2010.ApplicationList>r
   r   r
   r
   r   __repr__      zApplicationList.__repr__)__name__
__module____qualname__r   r   unsetr,   rB   rD   rA   rQ   rY   r[   r_   __classcell__r
   r
   r   r   r      s(    
4
r   c                       s,   e Zd Z fddZdd Zdd Z  ZS )rI   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   rI   r   r   )r   r   rL   solutionr   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   rZ   zApplicationPage.get_instancec                 C   r\   )r]   z"<Twilio.Api.V2010.ApplicationPage>r
   r^   r
   r
   r   r_      r`   zApplicationPage.__repr__)ra   rb   rc   r   rh   r_   re   r
   r
   r   r   rI      s    rI   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 )rW   c                    s4   t t| | ||d| _djdi | 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
        rT   z//Accounts/{account_sid}/Applications/{sid}.jsonNr
   )r   rW   r   r   r   r   )r   r   r	   rU   r   r
   r   r      s   zApplicationContext.__init__c                 C   s   | j jd| jdS )
        Deletes the ApplicationInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETEr&   r'   )r+   deleter   r^   r
   r
   r   rl     s   zApplicationContext.deletec                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the ApplicationInstance

        :returns: The fetched ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationInstance
        rG   rk   r	   rU   rT   )r+   fetchr   r-   r   rg   r
   r
   r   rn     s   zApplicationContext.fetchc                 C   s\   t |||||||||	|
|||||d}| jjd| j|d}t| j|| jd | jd dS )#  
        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	   rU   rT   )r   r*   r+   updater   r-   r   )r   r<   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r(   r=   r
   r
   r   rp     s0   zApplicationContext.updatec                 C   $   d dd | j D }d|S )r]    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr
   r
   r   	<genexpr>_      z.ApplicationContext.__repr__.<locals>.<genexpr>z(<Twilio.Api.V2010.ApplicationContext {}>joinr   itemsr   r   contextr
   r
   r   r_   X     
zApplicationContext.__repr__)ra   rb   rc   r   rl   rn   r   rd   rp   r_   re   r
   r
   r   r   rW      s    	
9rW   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| | i d|dd|ddt|ddt|dd|dd|dd|dd|dd	|d	d
|d
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_updatedr<   r;   rU   r9   r8   r7   r:   r6   r3   r4   r'   r5   r2   r1   r0   r/   )r1   r0   r/   NrT   )	r   r-   r   rY   r   rfc2822_datetime_properties_contextr   )r   r   r=   r	   rU   r   r
   r   r   e  sT   






	









zApplicationInstance.__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: ApplicationContext for this ApplicationInstance
        :rtype: twilio.rest.api.v2010.account.application.ApplicationContext
        Nr	   rU   rT   )r   rW   r+   r   r^   r
   r
   r   _proxy  s   
	zApplicationInstance._proxyc                 C   
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        r	   r   r^   r
   r
   r   r	        
zApplicationInstance.account_sidc                 C   r   )ze
        :returns: The API version used to start a new TwiML session
        :rtype: unicode
        r.   r   r^   r
   r
   r   r.     r   zApplicationInstance.api_versionc                 C   r   )zt
        :returns: The RFC 2822 date and time in GMT that the resource was created
        :rtype: datetime
        r   r   r^   r
   r
   r   r     r   z ApplicationInstance.date_createdc                 C   r   )zy
        :returns: The RFC 2822 date and time in GMT that the resource was last updated
        :rtype: datetime
        r   r   r^   r
   r
   r   r     r   z ApplicationInstance.date_updatedc                 C   r   )zi
        :returns: The string that you assigned to describe the resource
        :rtype: unicode
        r<   r   r^   r
   r
   r   r<     r   z!ApplicationInstance.friendly_namec                 C   r   )zr
        :returns: The URL to send message status information to your application
        :rtype: unicode
        r;   r   r^   r
   r
   r   r;     r   z+ApplicationInstance.message_status_callbackc                 C   r   )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rU   r   r^   r
   r
   r   rU     r   zApplicationInstance.sidc                 C   r   )z^
        :returns: The HTTP method used with sms_fallback_url
        :rtype: unicode
        r9   r   r^   r
   r
   r   r9     r   z'ApplicationInstance.sms_fallback_methodc                 C   r   )z
        :returns: The URL that we call when an error occurs while retrieving or executing the TwiML
        :rtype: unicode
        r8   r   r^   r
   r
   r   r8     r   z$ApplicationInstance.sms_fallback_urlc                 C   r   )zW
        :returns: The HTTP method to use with sms_url
        :rtype: unicode
        r7   r   r^   r
   r
   r   r7     r   zApplicationInstance.sms_methodc                 C   r   )j
        :returns: The URL to send status information to your application
        :rtype: unicode
        r:   r   r^   r
   r
   r   r:     r   z'ApplicationInstance.sms_status_callbackc                 C   r   )zz
        :returns: The URL we call when the phone number receives an incoming SMS message
        :rtype: unicode
        r6   r   r^   r
   r
   r   r6     r   zApplicationInstance.sms_urlc                 C   r   )r   r3   r   r^   r
   r
   r   r3     r   z#ApplicationInstance.status_callbackc                 C   r   )zb
        :returns: The HTTP method we use to call status_callback
        :rtype: unicode
        r4   r   r^   r
   r
   r   r4     r   z*ApplicationInstance.status_callback_methodc                 C   r   )zq
        :returns: The URI of the resource, relative to `https://api.twilio.com`
        :rtype: unicode
        r'   r   r^   r
   r
   r   r'     r   zApplicationInstance.uric                 C   r   )zT
        :returns: Whether to lookup the caller's name
        :rtype: bool
        r5   r   r^   r
   r
   r   r5     r   z*ApplicationInstance.voice_caller_id_lookupc                 C   r   )z`
        :returns: The HTTP method used with voice_fallback_url
        :rtype: unicode
        r2   r   r^   r
   r
   r   r2     r   z)ApplicationInstance.voice_fallback_methodc                 C   r   )z]
        :returns: The URL we call when a TwiML error occurs
        :rtype: unicode
        r1   r   r^   r
   r
   r   r1   #  r   z&ApplicationInstance.voice_fallback_urlc                 C   r   )z[
        :returns: The HTTP method used with the voice_url
        :rtype: unicode
        r0   r   r^   r
   r
   r   r0   +  r   z ApplicationInstance.voice_methodc                 C   r   )zi
        :returns: The URL we call when the phone number receives a call
        :rtype: unicode
        r/   r   r^   r
   r
   r   r/   3  r   zApplicationInstance.voice_urlc                 C   
   | j  S )ri   )r   rl   r^   r
   r
   r   rl   ;     
zApplicationInstance.deletec                 C   r   )rm   )r   rn   r^   r
   r
   r   rn   D  r   zApplicationInstance.fetchc                 C   s*   | j j|||||||||	|
|||||dS )ro   )r<   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   )r   rp   )r   r<   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r
   r
   r   rp   M  s"   zApplicationInstance.updatec                 C   rq   )r]   rr   c                 s   rs   rt   ru   rv   r
   r
   r   rz     r{   z/ApplicationInstance.__repr__.<locals>.<genexpr>z)<Twilio.Api.V2010.ApplicationInstance {}>r|   r   r
   r
   r   r_   }  r   zApplicationInstance.__repr__)N)!ra   rb   rc   r   propertyr   r	   r.   r   r   r<   r;   rU   r9   r8   r7   r:   r6   r3   r4   r'   r5   r2   r1   r0   r/   rl   rn   r   rd   rp   r_   re   r
   r
   r   r   r-   c  sp    %




















		
0r-   N)__doc__twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   rI   rW   r-   r
   r
   r
   r   <module>   s    <'p