B
    `I8                 @   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 )PhoneNumberListzk 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 )ak  
        Initialize the PhoneNumberList

        :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.phone_number.PhoneNumberList
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberList
        service_sidz$/Services/{service_sid}/PhoneNumbersN)superr   __init__	_solutionformat_uri)selfversionr	   )	__class__ \/home/dcms/DCMS/lib/python3.7/site-packages/twilio/rest/messaging/v1/service/phone_number.pyr      s    

zPhoneNumberList.__init__c             C   s8   t d|i}| jjd| j|d}t| j|| jd dS )a  
        Create the PhoneNumberInstance

        :param unicode phone_number_sid: The SID of the Phone Number being added to the Service

        :returns: The created PhoneNumberInstance
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance
        ZPhoneNumberSidPOST)methoduridatar	   )r	   )r   of_versioncreater   PhoneNumberInstancer   )r   Zphone_number_sidr   payloadr   r   r   r   %   s    	zPhoneNumberList.createNc             C   s0   | j ||}| j|d d}| j ||d S )a  
        Streams PhoneNumberInstance 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.phone_number.PhoneNumberInstance]
        	page_size)r   limit)r   Zread_limitspagestream)r   r   r   Zlimitsr   r   r   r   r    4   s    zPhoneNumberList.streamc             C   s   t | j||dS )aq  
        Lists PhoneNumberInstance 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.phone_number.PhoneNumberInstance]
        )r   r   )listr    )r   r   r   r   r   r   r!   K   s    zPhoneNumberList.listc             C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of PhoneNumberInstance 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 PhoneNumberInstance
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage
        )Z	PageTokenr   ZPageSizeGET)r   r   params)r   r   r   r   r   PhoneNumberPager   )r   Z
page_tokenZpage_numberr   r   responser   r   r   r   ]   s    zPhoneNumberList.pagec             C   s"   | j jjd|}t| j || jS )aM  
        Retrieve a specific page of PhoneNumberInstance records from the API.
        Request is executed immediately

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

        :returns: Page of PhoneNumberInstance
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage
        r"   )r   domainZtwiliorequestr$   r   )r   
target_urlr%   r   r   r   get_pagep   s    

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

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

        :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext
        r	   )r	   sid)PhoneNumberContextr   r   )r   r*   r   r   r   get   s    	zPhoneNumberList.getc             C   s   t | j| jd |dS )a  
        Constructs a PhoneNumberContext

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

        :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext
        r	   )r	   r*   )r+   r   r   )r   r*   r   r   r   __call__   s    	zPhoneNumberList.__call__c             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z%<Twilio.Messaging.V1.PhoneNumberList>r   )r   r   r   r   __repr__   s    zPhoneNumberList.__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 PhoneNumberPage

        :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.phone_number.PhoneNumberPage
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberPage
        N)r
   r$   r   r   )r   r   r%   Zsolution)r   r   r   r      s    zPhoneNumberPage.__init__c             C   s   t | j|| jd dS )a  
        Build an instance of PhoneNumberInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance
        r	   )r	   )r   r   r   )r   r   r   r   r   get_instance   s    	zPhoneNumberPage.get_instancec             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z%<Twilio.Messaging.V1.PhoneNumberPage>r   )r   r   r   r   r.      s    zPhoneNumberPage.__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 PhoneNumberContext

        :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.phone_number.PhoneNumberContext
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext
        )r	   r*   z*/Services/{service_sid}/PhoneNumbers/{sid}N)r
   r+   r   r   r   r   )r   r   r	   r*   )r   r   r   r      s    zPhoneNumberContext.__init__c             C   s   | j jd| jdS )z
        Deletes the PhoneNumberInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETE)r   r   )r   deleter   )r   r   r   r   r6      s    zPhoneNumberContext.deletec             C   s0   | j jd| jd}t| j || jd | jd dS )z
        Fetch the PhoneNumberInstance

        :returns: The fetched PhoneNumberInstance
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance
        r"   )r   r   r	   r*   )r	   r*   )r   fetchr   r   r   )r   r   r   r   r   r7      s    zPhoneNumberContext.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.PhoneNumberContext.__repr__.<locals>.<genexpr>z+<Twilio.Messaging.V1.PhoneNumberContext {}>)joinr   itemsr   )r   contextr   r   r   r.      s    zPhoneNumberContext.__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 PhoneNumberInstance

        :returns: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance
        r*   account_sidr	   date_createddate_updatedphone_number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PhoneNumberInstance.__init__c             C   s.   | j dkr(t| j| jd | jd d| _ | j S )aC  
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: PhoneNumberContext for this PhoneNumberInstance
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberContext
        Nr	   r*   )r	   r*   )rI   r+   r   r   )r   r   r   r   _proxy!  s    	
zPhoneNumberInstance._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PhoneNumberInstance.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PhoneNumberInstance.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PhoneNumberInstance.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 PhoneNumberInstance.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 PhoneNumberInstance.date_updatedc             C   s
   | j d S )zT
        :returns: The phone number in E.164 format
        :rtype: unicode
        rC   )rH   )r   r   r   r   rC   Z  s    z PhoneNumberInstance.phone_numberc             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 PhoneNumberInstance.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 PhoneNumberInstance.capabilitiesc             C   s
   | j d S )z`
        :returns: The absolute URL of the PhoneNumber resource
        :rtype: unicode
        rF   )rH   )r   r   r   r   rF   r  s    zPhoneNumberInstance.urlc             C   s
   | j  S )z
        Deletes the PhoneNumberInstance

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

        :returns: The fetched PhoneNumberInstance
        :rtype: twilio.rest.messaging.v1.service.phone_number.PhoneNumberInstance
        )rJ   r7   )r   r   r   r   r7     s    zPhoneNumberInstance.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/PhoneNumberInstance.__repr__.<locals>.<genexpr>z,<Twilio.Messaging.V1.PhoneNumberInstance {}>)r=   r   r>   r   )r   r?   r   r   r   r.     s    zPhoneNumberInstance.__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