B
    `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                   s   e Zd Z fddZejejddfddZejejddfddZej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 )ShortCodeListc                s.   t t| | d|i| _djf | j| _dS )aQ  
        Initialize the ShortCodeList

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

        :returns: twilio.rest.api.v2010.account.short_code.ShortCodeList
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeList
        account_sidz+/Accounts/{account_sid}/SMS/ShortCodes.jsonN)superr   __init__	_solutionformat_uri)selfversionr	   )	__class__ W/home/dcms/DCMS/lib/python3.7/site-packages/twilio/rest/api/v2010/account/short_code.pyr      s    

zShortCodeList.__init__Nc             C   s4   | j ||}| j|||d d}| j ||d S )a`  
        Streams ShortCodeInstance 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 ShortCode resources to read
        :param unicode short_code: Filter by ShortCode
        :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.short_code.ShortCodeInstance]
        	page_size)friendly_name
short_coder   limit)_versionZread_limitspagestream)r   r   r   r   r   Zlimitsr   r   r   r   r   #   s    zShortCodeList.streamc             C   s   t | j||||dS )a   
        Lists ShortCodeInstance 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 ShortCode resources to read
        :param unicode short_code: Filter by ShortCode
        :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.short_code.ShortCodeInstance]
        )r   r   r   r   )listr   )r   r   r   r   r   r   r   r   r   =   s
    zShortCodeList.listc             C   s:   t |||||d}| jjd| j|d}t| j|| jS )ab  
        Retrieve a single page of ShortCodeInstance records from the API.
        Request is executed immediately

        :param unicode friendly_name: The string that identifies the ShortCode resources to read
        :param unicode short_code: Filter by ShortCode
        :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 ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage
        )FriendlyNameZ	ShortCodeZ	PageTokenr   ZPageSizeGET)methoduriparams)r   ofr   r   r   ShortCodePager   )r   r   r   Z
page_tokenZpage_numberr   dataresponser   r   r   r   W   s    
zShortCodeList.pagec             C   s"   | j jjd|}t| j || jS )aB  
        Retrieve a specific page of ShortCodeInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodePage
        r   )r   domainZtwiliorequestr"   r   )r   
target_urlr$   r   r   r   get_pages   s    

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

        :param sid: The unique string that identifies this resource

        :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext
        r	   )r	   sid)ShortCodeContextr   r   )r   r)   r   r   r   get   s    	zShortCodeList.getc             C   s   t | j| jd |dS )a  
        Constructs a ShortCodeContext

        :param sid: The unique string that identifies this resource

        :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext
        r	   )r	   r)   )r*   r   r   )r   r)   r   r   r   __call__   s    	zShortCodeList.__call__c             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z <Twilio.Api.V2010.ShortCodeList>r   )r   r   r   r   __repr__   s    zShortCodeList.__repr__)__name__
__module____qualname__r   r   unsetr   r   r   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 )a  
        Initialize the ShortCodePage

        :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 this resource

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

        :param dict payload: Payload response from the API

        :returns: twilio.rest.api.v2010.account.short_code.ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance
        r	   )r	   )ShortCodeInstancer   r   )r   payloadr   r   r   get_instance   s    	zShortCodePage.get_instancec             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z <Twilio.Api.V2010.ShortCodePage>r   )r   r   r   r   r-      s    zShortCodePage.__repr__)r.   r/   r0   r   r5   r-   r2   r   r   )r   r   r"      s   r"   c                   sN   e Zd Z fddZdd ZejejejejejejfddZdd Z  Z	S )	r*   c                s0   t t| | ||d| _djf | j| _dS )a  
        Initialize the ShortCodeContext

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

        :returns: twilio.rest.api.v2010.account.short_code.ShortCodeContext
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext
        )r	   r)   z1/Accounts/{account_sid}/SMS/ShortCodes/{sid}.jsonN)r
   r*   r   r   r   r   )r   r   r	   r)   )r   r   r   r      s    zShortCodeContext.__init__c             C   s0   | j jd| jd}t| j || jd | jd dS )z
        Fetch the ShortCodeInstance

        :returns: The fetched ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance
        r   )r   r   r	   r)   )r	   r)   )r   fetchr   r3   r   )r   r4   r   r   r   r6      s    zShortCodeContext.fetchc       	   	   C   sJ   t ||||||d}| jjd| j|d}t| j|| jd | jd dS )a  
        Update the ShortCodeInstance

        :param unicode friendly_name: A string to describe this resource
        :param unicode api_version: The API version to use to start a new TwiML session
        :param unicode sms_url: URL Twilio will request when receiving an SMS
        :param unicode sms_method: HTTP method to use when requesting the sms url
        :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML
        :param unicode sms_fallback_method: HTTP method Twilio will use with sms_fallback_url

        :returns: The updated ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance
        )r   Z
ApiVersionZSmsUrlZ	SmsMethodZSmsFallbackUrlZSmsFallbackMethodPOST)r   r   r#   r	   r)   )r	   r)   )r   r!   r   updater   r3   r   )	r   r   api_versionsms_url
sms_methodsms_fallback_urlsms_fallback_methodr#   r4   r   r   r   r8      s    
zShortCodeContext.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,ShortCodeContext.__repr__.<locals>.<genexpr>z&<Twilio.Api.V2010.ShortCodeContext {}>)joinr   itemsr   )r   contextr   r   r   r-     s    zShortCodeContext.__repr__)
r.   r/   r0   r   r6   r   r1   r8   r-   r2   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	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ejejejejejejfd d!Zd"d# Z  ZS )%r3   Nc                s   t t| | |d|dt|dt|d|d|d|d|d|d	|d
|d|dd| _d| _||p| jd d| _dS )z
        Initialize the ShortCodeInstance

        :returns: twilio.rest.api.v2010.account.short_code.ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance
        r	   r9   date_createddate_updatedr   r   r)   r=   r<   r;   r:   r   )r	   r9   rF   rG   r   r   r)   r=   r<   r;   r:   r   N)r	   r)   )	r
   r3   r   r+   r   Zrfc2822_datetime_properties_contextr   )r   r   r4   r	   r)   )r   r   r   r     s    zShortCodeInstance.__init__c             C   s.   | j dkr(t| j| jd | jd d| _ | j S )a8  
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: ShortCodeContext for this ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeContext
        Nr	   r)   )r	   r)   )rI   r*   r   r   )r   r   r   r   _proxy:  s    	
zShortCodeInstance._proxyc             C   s
   | j d S )ze
        :returns: The SID of the Account that created this resource
        :rtype: unicode
        r	   )rH   )r   r   r   r   r	   K  s    zShortCodeInstance.account_sidc             C   s
   | j d S )ze
        :returns: The API version used to start a new TwiML session
        :rtype: unicode
        r9   )rH   )r   r   r   r   r9   S  s    zShortCodeInstance.api_versionc             C   s
   | j d S )zu
        :returns: The RFC 2822 date and time in GMT that this resource was created
        :rtype: datetime
        rF   )rH   )r   r   r   r   rF   [  s    zShortCodeInstance.date_createdc             C   s
   | j d S )zz
        :returns: The RFC 2822 date and time in GMT that this resource was last updated
        :rtype: datetime
        rG   )rH   )r   r   r   r   rG   c  s    zShortCodeInstance.date_updatedc             C   s
   | j d S )zh
        :returns: A string that you assigned to describe this resource
        :rtype: unicode
        r   )rH   )r   r   r   r   r   k  s    zShortCodeInstance.friendly_namec             C   s
   | j d S )zQ
        :returns: The short code. e.g., 894546.
        :rtype: unicode
        r   )rH   )r   r   r   r   r   s  s    zShortCodeInstance.short_codec             C   s
   | j d S )zc
        :returns: The unique string that identifies this resource
        :rtype: unicode
        r)   )rH   )r   r   r   r   r)   {  s    zShortCodeInstance.sidc             C   s
   | j d S )zc
        :returns: HTTP method we use to call the sms_fallback_url
        :rtype: unicode
        r=   )rH   )r   r   r   r   r=     s    z%ShortCodeInstance.sms_fallback_methodc             C   s
   | j d S )zq
        :returns: URL Twilio will request if an error occurs in executing TwiML
        :rtype: unicode
        r<   )rH   )r   r   r   r   r<     s    z"ShortCodeInstance.sms_fallback_urlc             C   s
   | j d S )zb
        :returns: HTTP method to use when requesting the sms url
        :rtype: unicode
        r;   )rH   )r   r   r   r   r;     s    zShortCodeInstance.sms_methodc             C   s
   | j d S )zy
        :returns: URL we call when receiving an incoming SMS message to this short code
        :rtype: unicode
        r:   )rH   )r   r   r   r   r:     s    zShortCodeInstance.sms_urlc             C   s
   | j d S )zr
        :returns: The URI of this resource, relative to `https://api.twilio.com`
        :rtype: unicode
        r   )rH   )r   r   r   r   r     s    zShortCodeInstance.uric             C   s
   | j  S )z
        Fetch the ShortCodeInstance

        :returns: The fetched ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance
        )rJ   r6   )r   r   r   r   r6     s    zShortCodeInstance.fetchc             C   s   | j j||||||dS )a  
        Update the ShortCodeInstance

        :param unicode friendly_name: A string to describe this resource
        :param unicode api_version: The API version to use to start a new TwiML session
        :param unicode sms_url: URL Twilio will request when receiving an SMS
        :param unicode sms_method: HTTP method to use when requesting the sms url
        :param unicode sms_fallback_url: URL Twilio will request if an error occurs in executing TwiML
        :param unicode sms_fallback_method: HTTP method Twilio will use with sms_fallback_url

        :returns: The updated ShortCodeInstance
        :rtype: twilio.rest.api.v2010.account.short_code.ShortCodeInstance
        )r   r9   r:   r;   r<   r=   )rJ   r8   )r   r   r9   r:   r;   r<   r=   r   r   r   r8     s    zShortCodeInstance.updatec             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?   r@   rA   r   r   r   rB     s    z-ShortCodeInstance.__repr__.<locals>.<genexpr>z'<Twilio.Api.V2010.ShortCodeInstance {}>)rC   r   rD   r   )r   rE   r   r   r   r-     s    zShortCodeInstance.__repr__)N)r.   r/   r0   r   propertyrJ   r	   r9   rF   rG   r   r   r)   r=   r<   r;   r:   r   r6   r   r1   r8   r-   r2   r   r   )r   r   r3     s&   	r3   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*   r3   r   r   r   r   <module>   s    'P