B
    `7                 @   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                   sr   e Zd ZdZ fddZ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 )ShortCodeListzk 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S )aa  
        Initialize the ShortCodeList

        :param Version version: Version that contains the resource
        :param service_sid: The SID of the Service that the resource is associated with

        :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeList
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeList
        service_sidz"/Services/{service_sid}/ShortCodesN)superr   __init__	_solutionformat_uri)selfversionr	   )	__class__ Z/home/dcms/DCMS/lib/python3.7/site-packages/twilio/rest/messaging/v1/service/short_code.pyr      s    

zShortCodeList.__init__c             C   s8   t d|i}| jjd| j|d}t| j|| jd dS )a	  
        Create the ShortCodeInstance

        :param unicode short_code_sid: The SID of the ShortCode being added to the Service

        :returns: The created ShortCodeInstance
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance
        ZShortCodeSidPOST)methoduridatar	   )r	   )r   of_versioncreater   ShortCodeInstancer   )r   Zshort_code_sidr   payloadr   r   r   r   %   s    	zShortCodeList.createNc             C   s0   | 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 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.short_code.ShortCodeInstance]
        	page_size)r   limit)r   Zread_limitspagestream)r   r   r   Zlimitsr   r   r   r   r    4   s    zShortCodeList.streamc             C   s   t | j||dS )ak  
        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 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.short_code.ShortCodeInstance]
        )r   r   )listr    )r   r   r   r   r   r   r!   K   s    zShortCodeList.listc             C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of ShortCodeInstance 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 ShortCodeInstance
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodePage
        )Z	PageTokenr   ZPageSizeGET)r   r   params)r   r   r   r   r   ShortCodePager   )r   Z
page_tokenZpage_numberr   r   responser   r   r   r   ]   s    zShortCodeList.pagec             C   s"   | j jjd|}t| j || jS )aE  
        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.messaging.v1.service.short_code.ShortCodePage
        r"   )r   domainZtwiliorequestr$   r   )r   
target_urlr%   r   r   r   get_pagep   s    

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

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

        :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext
        :rtype: twilio.rest.messaging.v1.service.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 SID that identifies the resource to fetch

        :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext
        :rtype: twilio.rest.messaging.v1.service.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.Messaging.V1.ShortCodeList>r   )r   r   r   r   __repr__   s    zShortCodeList.__repr__)NN)NN)__name__
__module____qualname____doc__r   r   r    r!   r   Zunsetr   r)   r,   r-   r.   __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 )r$   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 ShortCodePage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param service_sid: The SID of the Service that the resource is associated with

        :returns: twilio.rest.messaging.v1.service.short_code.ShortCodePage
        :rtype: twilio.rest.messaging.v1.service.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.messaging.v1.service.short_code.ShortCodeInstance
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance
        r	   )r	   )r   r   r   )r   r   r   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.Messaging.V1.ShortCodePage>r   )r   r   r   r   r.      s    zShortCodePage.__repr__)r/   r0   r1   r2   r   r4   r.   r3   r   r   )r   r   r$      s   r$   c                   s8   e Zd ZdZ fddZdd Z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                s0   t t| | ||d| _djf | j| _dS )a  
        Initialize the ShortCodeContext

        :param Version version: Version that contains the resource
        :param service_sid: The SID of the Service to fetch the resource from
        :param sid: The SID that identifies the resource to fetch

        :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeContext
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeContext
        )r	   r*   z(/Services/{service_sid}/ShortCodes/{sid}N)r
   r+   r   r   r   r   )r   r   r	   r*   )r   r   r   r      s    zShortCodeContext.__init__c             C   s   | j jd| jdS )z
        Deletes the ShortCodeInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETE)r   r   )r   deleter   )r   r   r   r   r6      s    zShortCodeContext.deletec             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.messaging.v1.service.short_code.ShortCodeInstance
        r"   )r   r   r	   r*   )r	   r*   )r   fetchr   r   r   )r   r   r   r   r   r7      s    zShortCodeContext.fetchc             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.Messaging.V1.ShortCodeContext {}>)joinr   itemsr   )r   contextr   r   r   r.      s    zShortCodeContext.__repr__)	r/   r0   r1   r2   r   r6   r7   r.   r3   r   r   )r   r   r+      s
   	r+   c                   s   e Zd 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dd Z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. Nc                s   t t| | |d|d|dt|dt|d|d|d|d|d	d
	| _d| _||p| jd d| _dS )z
        Initialize the ShortCodeInstance

        :returns: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance
        r*   account_sidr	   date_createddate_updated
short_codecountry_codecapabilitiesurl)	r*   r@   r	   rA   rB   rC   rD   rE   rF   N)r	   r*   )	r
   r   r   r,   r   iso8601_datetime_properties_contextr   )r   r   r   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 )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: ShortCodeContext for this ShortCodeInstance
        :rtype: twilio.rest.messaging.v1.service.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 )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        r*   )rH   )r   r   r   r   r*   2  s    zShortCodeInstance.sidc             C   s
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        r@   )rH   )r   r   r   r   r@   :  s    zShortCodeInstance.account_sidc             C   s
   | j d S )zo
        :returns: The SID of the Service that the resource is associated with
        :rtype: unicode
        r	   )rH   )r   r   r   r   r	   B  s    zShortCodeInstance.service_sidc             C   s
   | j d S )zt
        :returns: The ISO 8601 date and time in GMT when the resource was created
        :rtype: datetime
        rA   )rH   )r   r   r   r   rA   J  s    zShortCodeInstance.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
        rB   )rH   )r   r   r   r   rB   R  s    zShortCodeInstance.date_updatedc             C   s
   | j d S )zV
        :returns: The E.164 format of the short code
        :rtype: unicode
        rC   )rH   )r   r   r   r   rC   Z  s    zShortCodeInstance.short_codec             C   s
   | j d S )zb
        :returns: The 2-character ISO Country Code of the number
        :rtype: unicode
        rD   )rH   )r   r   r   r   rD   b  s    zShortCodeInstance.country_codec             C   s
   | j d S )z
        :returns: An array of values that describe whether the number can receive calls or messages
        :rtype: unicode
        rE   )rH   )r   r   r   r   rE   j  s    zShortCodeInstance.capabilitiesc             C   s
   | j d S )z^
        :returns: The absolute URL of the ShortCode resource
        :rtype: unicode
        rF   )rH   )r   r   r   r   rF   r  s    zShortCodeInstance.urlc             C   s
   | j  S )z
        Deletes the ShortCodeInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        )rJ   r6   )r   r   r   r   r6   z  s    zShortCodeInstance.deletec             C   s
   | j  S )z
        Fetch the ShortCodeInstance

        :returns: The fetched ShortCodeInstance
        :rtype: twilio.rest.messaging.v1.service.short_code.ShortCodeInstance
        )rJ   r7   )r   r   r   r   r7     s    zShortCodeInstance.fetchc             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        r8   c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   )r9   r:   r;   r   r   r   r<     s    z-ShortCodeInstance.__repr__.<locals>.<genexpr>z*<Twilio.Messaging.V1.ShortCodeInstance {}>)r=   r   r>   r   )r   r?   r   r   r   r.     s    zShortCodeInstance.__repr__)N)r/   r0   r1   r2   r   propertyrJ   r*   r@   r	   rA   rB   rC   rD   rE   rF   r6   r7   r.   r3   r   r   )r   r   r     s   		r   N)r2   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+   r   r   r   r   r   <module>   s    )9