B
    `|k                 @   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 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)Page)AlphaSenderList)PhoneNumberList)ShortCodeListc                   s   e Zd 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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 )ServiceListzk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c                s*   t t| | i | _djf | j| _dS )z
        Initialize the ServiceList

        :param Version version: Version that contains the resource

        :returns: twilio.rest.messaging.v1.service.ServiceList
        :rtype: twilio.rest.messaging.v1.service.ServiceList
        z	/ServicesN)superr   __init__	_solutionformat_uri)selfversion)	__class__ X/home/dcms/DCMS/lib/python3.7/site-packages/twilio/rest/messaging/v1/service/__init__.pyr      s    	zServiceList.__init__c             C   sH   t |||||||||	|
||||d}| jjd| j|d}t| j|S )af  
        Create the ServiceInstance

        :param unicode friendly_name: A string to describe the resource
        :param unicode inbound_request_url: The URL we call using inbound_method when a message is received by any phone number or short code in the Service
        :param unicode inbound_method: The HTTP method we should use to call inbound_request_url
        :param unicode fallback_url: The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL
        :param unicode fallback_method: The HTTP method we should use to call fallback_url
        :param unicode status_callback: The URL we should call to pass status updates about message delivery
        :param bool sticky_sender: Whether to enable Sticky Sender on the Service instance
        :param bool mms_converter: Whether to enable the MMS Converter for messages sent through the Service instance
        :param bool smart_encoding: Whether to enable Encoding for messages sent through the Service instance
        :param ServiceInstance.ScanMessageContent scan_message_content: Reserved
        :param bool fallback_to_long_code: Whether to enable Fallback to Long Code for messages sent through the Service instance
        :param bool area_code_geomatch: Whether to enable Area Code Geomatch on the Service Instance
        :param unicode validity_period: How long, in seconds, messages sent from the Service are valid
        :param bool synchronous_validation: Reserved

        :returns: The created ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServiceInstance
        )FriendlyNameInboundRequestUrlInboundMethodFallbackUrlFallbackMethodStatusCallbackStickySenderMmsConverterSmartEncodingScanMessageContentFallbackToLongCodeAreaCodeGeomatchValidityPeriodSynchronousValidationPOST)methoduridata)r   of_versioncreater   ServiceInstance)r   friendly_nameinbound_request_urlinbound_methodfallback_urlfallback_methodstatus_callbacksticky_sendermms_convertersmart_encodingscan_message_contentfallback_to_long_codearea_code_geomatchvalidity_periodsynchronous_validationr'   payloadr   r   r   r*   '   s"    
zServiceList.createNc             C   s0   | j ||}| j|d d}| j ||d S )a  
        Streams ServiceInstance 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.messaging.v1.service.ServiceInstance]
        	page_size)r;   limit)r)   Zread_limitspagestream)r   r<   r;   Zlimitsr=   r   r   r   r>   X   s    zServiceList.streamc             C   s   t | j||dS )a\  
        Lists ServiceInstance 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.messaging.v1.service.ServiceInstance]
        )r<   r;   )listr>   )r   r<   r;   r   r   r   r?   o   s    zServiceList.listc             C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of ServiceInstance 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 ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServicePage
        )Z	PageTokenr   ZPageSizeGET)r%   r&   params)r   r(   r)   r=   r   ServicePager   )r   Z
page_tokenZpage_numberr;   r'   responser   r   r   r=      s    zServiceList.pagec             C   s"   | j jjd|}t| j || jS )a4  
        Retrieve a specific page of ServiceInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServicePage
        r@   )r)   domainZtwiliorequestrB   r   )r   
target_urlrC   r   r   r   get_page   s    

zServiceList.get_pagec             C   s   t | j|dS )z
        Constructs a ServiceContext

        :param sid: The SID that identifies the resource to fetch

        :returns: twilio.rest.messaging.v1.service.ServiceContext
        :rtype: twilio.rest.messaging.v1.service.ServiceContext
        )sid)ServiceContextr)   )r   rH   r   r   r   get   s    	zServiceList.getc             C   s   t | j|dS )z
        Constructs a ServiceContext

        :param sid: The SID that identifies the resource to fetch

        :returns: twilio.rest.messaging.v1.service.ServiceContext
        :rtype: twilio.rest.messaging.v1.service.ServiceContext
        )rH   )rI   r)   )r   rH   r   r   r   __call__   s    	zServiceList.__call__c             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z!<Twilio.Messaging.V1.ServiceList>r   )r   r   r   r   __repr__   s    zServiceList.__repr__)NN)NN)__name__
__module____qualname____doc__r   r   unsetr*   r>   r?   r=   rG   rJ   rK   rL   __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 )rB   zk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c                s   t t| || || _dS )a%  
        Initialize the ServicePage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API

        :returns: twilio.rest.messaging.v1.service.ServicePage
        :rtype: twilio.rest.messaging.v1.service.ServicePage
        N)r   rB   r   r   )r   r   rC   Zsolution)r   r   r   r      s    
zServicePage.__init__c             C   s   t | j|S )z
        Build an instance of ServiceInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.messaging.v1.service.ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServiceInstance
        )r+   r)   )r   r:   r   r   r   get_instance   s    	zServicePage.get_instancec             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z!<Twilio.Messaging.V1.ServicePage>r   )r   r   r   r   rL      s    zServicePage.__repr__)rM   rN   rO   rP   r   rS   rL   rR   r   r   )r   r   rB      s   rB   c                   s   e Zd 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fddZdd Zdd	 Z	e
d
d Ze
dd Ze
dd Zdd Z  ZS )rI   zk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c                s@   t t| | d|i| _djf | j| _d| _d| _d| _dS )a8  
        Initialize the ServiceContext

        :param Version version: Version that contains the resource
        :param sid: The SID that identifies the resource to fetch

        :returns: twilio.rest.messaging.v1.service.ServiceContext
        :rtype: twilio.rest.messaging.v1.service.ServiceContext
        rH   z/Services/{sid}N)	r   rI   r   r   r   r   _phone_numbers_short_codes_alpha_senders)r   r   rH   )r   r   r   r      s    

zServiceContext.__init__c             C   sR   t |||||||||	|
||||d}| jjd| j|d}t| j|| jd dS )af  
        Update the ServiceInstance

        :param unicode friendly_name: A string to describe the resource
        :param unicode inbound_request_url: The URL we call using inbound_method when a message is received by any phone number or short code in the Service
        :param unicode inbound_method: The HTTP method we should use to call inbound_request_url
        :param unicode fallback_url: The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL
        :param unicode fallback_method: The HTTP method we should use to call fallback_url
        :param unicode status_callback: The URL we should call to pass status updates about message delivery
        :param bool sticky_sender: Whether to enable Sticky Sender on the Service instance
        :param bool mms_converter: Whether to enable the MMS Converter for messages sent through the Service instance
        :param bool smart_encoding: Whether to enable Encoding for messages sent through the Service instance
        :param ServiceInstance.ScanMessageContent scan_message_content: Reserved
        :param bool fallback_to_long_code: Whether to enable Fallback to Long Code for messages sent through the Service instance
        :param bool area_code_geomatch: Whether to enable Area Code Geomatch on the Service Instance
        :param unicode validity_period: How long, in seconds, messages sent from the Service are valid
        :param bool synchronous_validation: Reserved

        :returns: The updated ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServiceInstance
        )r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   )r%   r&   r'   rH   )rH   )r   r(   r)   updater   r+   r   )r   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r'   r:   r   r   r   rW     s"    
zServiceContext.updatec             C   s(   | j jd| jd}t| j || jd dS )z
        Fetch the ServiceInstance

        :returns: The fetched ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServiceInstance
        r@   )r%   r&   rH   )rH   )r)   fetchr   r+   r   )r   r:   r   r   r   rX   7  s    zServiceContext.fetchc             C   s   | j jd| jdS )z~
        Deletes the ServiceInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETE)r%   r&   )r)   deleter   )r   r   r   r   rZ   B  s    zServiceContext.deletec             C   s&   | j dkr t| j| jd d| _ | j S )z
        Access the phone_numbers

        :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList
        NrH   )service_sid)rT   r	   r)   r   )r   r   r   r   phone_numbersK  s    
zServiceContext.phone_numbersc             C   s&   | j dkr t| j| jd d| _ | j S )z
        Access the short_codes

        :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList
        NrH   )r[   )rU   r
   r)   r   )r   r   r   r   short_codesW  s    
zServiceContext.short_codesc             C   s&   | j dkr t| j| jd d| _ | j S )z
        Access the alpha_senders

        :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList
        :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList
        NrH   )r[   )rV   r   r)   r   )r   r   r   r   alpha_sendersc  s    
zServiceContext.alpha_sendersc             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>v  s    z*ServiceContext.__repr__.<locals>.<genexpr>z'<Twilio.Messaging.V1.ServiceContext {}>)joinr   itemsr   )r   contextr   r   r   rL   o  s    zServiceContext.__repr__)rM   rN   rO   rP   r   r   rQ   rW   rX   rZ   propertyr\   r]   r^   rL   rR   r   r   )r   r   rI      s   +	rI   c                   s  e Zd ZdZG dd de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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/d0 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fd1d2Zd3d4 Z d5d6 Z!ed7d8 Z"ed9d: Z#ed;d< Z$d=d> Z%  Z&S )@r+   zk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c               @   s   e Zd ZdZdZdZdS )z"ServiceInstance.ScanMessageContentZinheritenabledisableN)rM   rN   rO   ZINHERITZENABLEZDISABLEr   r   r   r   r   ~  s   r   Nc                s   t t| | |d|d|dt|dt|d|d|d|d|d	|d
|d|d|d|d|d|d|dt|d|d|dd| _d| _d|p| jd i| _	dS )z
        Initialize the ServiceInstance

        :returns: twilio.rest.messaging.v1.service.ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServiceInstance
        rH   account_sidr,   date_createddate_updatedr-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r9   r8   urllinks)rH   rj   r,   rk   rl   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r9   r8   rm   rn   N)
r   r+   r   rJ   r   iso8601_datetimeinteger_properties_contextr   )r   r   r:   rH   )r   r   r   r     s.    zServiceInstance.__init__c             C   s&   | j dkr t| j| 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: ServiceContext for this ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServiceContext
        NrH   )rH   )rr   rI   r)   r   )r   r   r   r   _proxy  s    	
zServiceInstance._proxyc             C   s
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rH   )rq   )r   r   r   r   rH     s    zServiceInstance.sidc             C   s
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        rj   )rq   )r   r   r   r   rj     s    zServiceInstance.account_sidc             C   s
   | j d S )zi
        :returns: The string that you assigned to describe the resource
        :rtype: unicode
        r,   )rq   )r   r   r   r   r,     s    zServiceInstance.friendly_namec             C   s
   | j d S )zt
        :returns: The ISO 8601 date and time in GMT when the resource was created
        :rtype: datetime
        rk   )rq   )r   r   r   r   rk     s    zServiceInstance.date_createdc             C   s
   | j d S )zy
        :returns: The ISO 8601 date and time in GMT when the resource was last updated
        :rtype: datetime
        rl   )rq   )r   r   r   r   rl     s    zServiceInstance.date_updatedc             C   s
   | j d S )z
        :returns: The URL we call using inbound_method when a message is received by any phone number or short code in the Service
        :rtype: unicode
        r-   )rq   )r   r   r   r   r-     s    z#ServiceInstance.inbound_request_urlc             C   s
   | j d S )zf
        :returns: The HTTP method we use to call inbound_request_url
        :rtype: unicode
        r.   )rq   )r   r   r   r   r.     s    zServiceInstance.inbound_methodc             C   s
   | j d S )z
        :returns: The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL
        :rtype: unicode
        r/   )rq   )r   r   r   r   r/     s    zServiceInstance.fallback_urlc             C   s
   | j d S )z_
        :returns: The HTTP method we use to call fallback_url
        :rtype: unicode
        r0   )rq   )r   r   r   r   r0     s    zServiceInstance.fallback_methodc             C   s
   | j d S )zq
        :returns: The URL we call to pass status updates about message delivery
        :rtype: unicode
        r1   )rq   )r   r   r   r   r1     s    zServiceInstance.status_callbackc             C   s
   | j d S )zh
        :returns: Whether to enable Sticky Sender on the Service instance
        :rtype: bool
        r2   )rq   )r   r   r   r   r2     s    zServiceInstance.sticky_senderc             C   s
   | j d S )z
        :returns: Whether to enable the MMS Converter for messages sent through the Service instance
        :rtype: bool
        r3   )rq   )r   r   r   r   r3     s    zServiceInstance.mms_converterc             C   s
   | j d S )zz
        :returns: Whether to enable Encoding for messages sent through the Service instance
        :rtype: bool
        r4   )rq   )r   r   r   r   r4     s    zServiceInstance.smart_encodingc             C   s
   | j d S )zW
        :returns: Reserved
        :rtype: ServiceInstance.ScanMessageContent
        r5   )rq   )r   r   r   r   r5     s    z$ServiceInstance.scan_message_contentc             C   s
   | j d S )z
        :returns: Whether to enable Fallback to Long Code for messages sent through the Service instance
        :rtype: bool
        r6   )rq   )r   r   r   r   r6   %  s    z%ServiceInstance.fallback_to_long_codec             C   s
   | j d S )zm
        :returns: Whether to enable Area Code Geomatch on the Service Instance
        :rtype: bool
        r7   )rq   )r   r   r   r   r7   -  s    z"ServiceInstance.area_code_geomatchc             C   s
   | j d S )z9
        :returns: Reserved
        :rtype: bool
        r9   )rq   )r   r   r   r   r9   5  s    z&ServiceInstance.synchronous_validationc             C   s
   | j d S )zr
        :returns: How long, in seconds, messages sent from the Service are valid
        :rtype: unicode
        r8   )rq   )r   r   r   r   r8   =  s    zServiceInstance.validity_periodc             C   s
   | j d S )z\
        :returns: The absolute URL of the Service resource
        :rtype: unicode
        rm   )rq   )r   r   r   r   rm   E  s    zServiceInstance.urlc             C   s
   | j d S )zZ
        :returns: The absolute URLs of related resources
        :rtype: unicode
        rn   )rq   )r   r   r   r   rn   M  s    zServiceInstance.linksc             C   s(   | j j|||||||||	|
||||dS )af  
        Update the ServiceInstance

        :param unicode friendly_name: A string to describe the resource
        :param unicode inbound_request_url: The URL we call using inbound_method when a message is received by any phone number or short code in the Service
        :param unicode inbound_method: The HTTP method we should use to call inbound_request_url
        :param unicode fallback_url: The URL that we call using fallback_method if an error occurs while retrieving or executing the TwiML from the Inbound Request URL
        :param unicode fallback_method: The HTTP method we should use to call fallback_url
        :param unicode status_callback: The URL we should call to pass status updates about message delivery
        :param bool sticky_sender: Whether to enable Sticky Sender on the Service instance
        :param bool mms_converter: Whether to enable the MMS Converter for messages sent through the Service instance
        :param bool smart_encoding: Whether to enable Encoding for messages sent through the Service instance
        :param ServiceInstance.ScanMessageContent scan_message_content: Reserved
        :param bool fallback_to_long_code: Whether to enable Fallback to Long Code for messages sent through the Service instance
        :param bool area_code_geomatch: Whether to enable Area Code Geomatch on the Service Instance
        :param unicode validity_period: How long, in seconds, messages sent from the Service are valid
        :param bool synchronous_validation: Reserved

        :returns: The updated ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServiceInstance
        )r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   )rs   rW   )r   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r   r   r   rW   U  s    zServiceInstance.updatec             C   s
   | j  S )z
        Fetch the ServiceInstance

        :returns: The fetched ServiceInstance
        :rtype: twilio.rest.messaging.v1.service.ServiceInstance
        )rs   rX   )r   r   r   r   rX     s    zServiceInstance.fetchc             C   s
   | j  S )z~
        Deletes the ServiceInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        )rs   rZ   )r   r   r   r   rZ     s    zServiceInstance.deletec             C   s   | j jS )z
        Access the phone_numbers

        :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList
        )rs   r\   )r   r   r   r   r\     s    zServiceInstance.phone_numbersc             C   s   | j jS )z
        Access the short_codes

        :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList
        )rs   r]   )r   r   r   r   r]     s    zServiceInstance.short_codesc             C   s   | j jS )z
        Access the alpha_senders

        :returns: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList
        :rtype: twilio.rest.messaging.v1.service.alpha_sender.AlphaSenderList
        )rs   r^   )r   r   r   r   r^     s    zServiceInstance.alpha_sendersc             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        r_   c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   )r`   ra   rb   r   r   r   rc     s    z+ServiceInstance.__repr__.<locals>.<genexpr>z(<Twilio.Messaging.V1.ServiceInstance {}>)rd   r   re   r   )r   rf   r   r   r   rL     s    zServiceInstance.__repr__)N)'rM   rN   rO   rP   objectr   r   rg   rs   rH   rj   r,   rk   rl   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r9   r8   rm   rn   r   rQ   rW   rX   rZ   r\   r]   r^   rL   rR   r   r   )r   r   r+   z  sJ   %'		


r+   N)rP   Ztwilio.baser   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.pager   Z-twilio.rest.messaging.v1.service.alpha_senderr   Z-twilio.rest.messaging.v1.service.phone_numberr	   Z+twilio.rest.messaging.v1.service.short_coder
   r   rB   rI   r+   r   r   r   r   <module>   s    2( 