U
    ^g%iN[                     @   s   d Z ddlmZ ddlmZmZmZmZmZmZm	Z	 ddl
mZ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 )a  
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Trunking
    This is the public Twilio REST API.

    NOTE: This class is auto generated by OpenAPI Generator.
    https://openapi-generator.tech
    Do not edit the class manually.
    )datetime)AnyDictListOptionalUnionIteratorAsyncIterator)deserializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s   e Zd ZG dd deZdeeeef ee	e d fddZ
eddd	d
ZedddZedddZd dddZd dddZedddZ  ZS )PhoneNumberInstancec                   @   s   e Zd ZdZdZdZdZdS )z&PhoneNumberInstance.AddressRequirementnoneanylocalZforeignN)__name__
__module____qualname__NONEANYZLOCALZFOREIGN r   r   i/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/trunking/v1/trunk/phone_number.pyAddressRequirement   s   r   N)versionpayload	trunk_sidsidc                    sn  t  | |d| _|d| _|d| _|d| _|d| _t	|d| _
t	|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 )Naccount_sidaddress_requirementsapi_versionbetacapabilitiesdate_createddate_updatedfriendly_namelinksphone_numberr    sms_application_sidsms_fallback_methodsms_fallback_url
sms_methodsms_urlstatus_callbackstatus_callback_methodr   urlvoice_application_sidvoice_caller_id_lookupvoice_fallback_methodvoice_fallback_urlvoice_method	voice_urlr   r    )!super__init__getr!   r"   r#   r$   r%   r
   Ziso8601_datetimer&   r'   r(   r)   r*   r    r+   r,   r-   r.   r/   r0   r1   r   r2   r3   r4   r5   r6   r7   r8   	_solution_context)selfr   r   r   r    	__class__r   r   r;   >   sP    
zPhoneNumberInstance.__init__PhoneNumberContextreturnc                 C   s.   | j dkr(t| j| jd | jd d| _ | j S )z
        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
        Nr   r    r9   )r>   rB   _versionr=   r?   r   r   r   _proxyr   s    
zPhoneNumberInstance._proxyc                 C   s
   | j  S )n
        Deletes the PhoneNumberInstance


        :returns: True if delete succeeds, False otherwise
        )rG   deleterF   r   r   r   rI      s    zPhoneNumberInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the PhoneNumberInstance


        :returns: True if delete succeeds, False otherwise
        N)rG   delete_asyncrF   r   r   r   rK      s    z PhoneNumberInstance.delete_asyncc                 C   s
   | j  S )c
        Fetch the PhoneNumberInstance


        :returns: The fetched PhoneNumberInstance
        )rG   fetchrF   r   r   r   rM      s    zPhoneNumberInstance.fetchc                    s   | j  I dH S )}
        Asynchronous coroutine to fetch the PhoneNumberInstance


        :returns: The fetched PhoneNumberInstance
        N)rG   fetch_asyncrF   r   r   r   rO      s    zPhoneNumberInstance.fetch_asyncc                 C   s$   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s   s   | ]\}}d  ||V  qdS z{}={}Nformat.0kvr   r   r   	<genexpr>   s     z/PhoneNumberInstance.__repr__.<locals>.<genexpr>z+<Twilio.Trunking.V1.PhoneNumberInstance {}>joinr=   itemsrT   r?   contextr   r   r   __repr__   s    zPhoneNumberInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r;   propertyrG   boolrI   rK   rM   rO   r_   __classcell__r   r   r@   r   r      s   ( 
4				r   c                       sl   e Zd Zeeed fddZedddZedddZe	dd	d
Z
e	dddZedddZ  ZS )rB   )r   r   r    c                    s,   t  | ||d| _djf | j| _dS )a1  
        Initialize the PhoneNumberContext

        :param version: Version that contains the resource
        :param trunk_sid: The SID of the Trunk from which to fetch the PhoneNumber resource.
        :param sid: The unique string that we created to identify the PhoneNumber resource to fetch.
        r9   z&/Trunks/{trunk_sid}/PhoneNumbers/{sid}Nr:   r;   r=   rT   _uri)r?   r   r   r    r@   r   r   r;      s
    zPhoneNumberContext.__init__rC   c                 C   s   t i }| jjd| j|dS )rH   DELETEmethoduriheaders)r   ofrE   rI   rf   r?   rk   r   r   r   rI      s    
zPhoneNumberContext.deletec                    s$   t i }| jjd| j|dI dH S )rJ   rg   rh   N)r   rl   rE   rK   rf   rm   r   r   r   rK      s    
  zPhoneNumberContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rL   application/jsonAcceptGETrh   r   r    r9   )r   rl   rE   rM   rf   r   r=   r?   rk   r   r   r   r   rM      s    
zPhoneNumberContext.fetchc                    sJ   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rN   rn   ro   rp   rh   Nr   r    r9   )r   rl   rE   rO   rf   r   r=   rq   r   r   r   rO      s    
  zPhoneNumberContext.fetch_asyncc                 C   s$   d dd | j D }d|S )rP   rQ   c                 s   s   | ]\}}d  ||V  qdS rR   rS   rU   r   r   r   rY     s     z.PhoneNumberContext.__repr__.<locals>.<genexpr>z*<Twilio.Trunking.V1.PhoneNumberContext {}>rZ   r]   r   r   r   r_   	  s    zPhoneNumberContext.__repr__)r   r   r   r   ra   r;   rc   rI   rK   r   rM   rO   r_   rd   r   r   r@   r   rB      s   rB   c                   @   s2   e Zd Zeeef edddZedddZdS )PhoneNumberPage)r   rD   c                 C   s   t | j|| jd dS )zq
        Build an instance of PhoneNumberInstance

        :param payload: Payload response from the API
        r   r   )r   rE   r=   )r?   r   r   r   r   get_instance  s
      zPhoneNumberPage.get_instancerC   c                 C   s   dS )rP   z$<Twilio.Trunking.V1.PhoneNumberPage>r   rF   r   r   r   r_     s    zPhoneNumberPage.__repr__N)	r   r   r   r   ra   r   r   rt   r_   r   r   r   r   rr     s   
rr   c                       s  e Zd Zeed fddZeedddZeedddZd%e	e
 e	e
 ee d
ddZd&e	e
 e	e
 ee d
ddZd'e	e
 e	e
 ee d
ddZd(e	e
 e	e
 ee d
ddZejejejfeeef ee
ef ee
ef edddZejejejfeeef ee
ef ee
ef edddZeedddZeedddZeedddZeedd d!Zed"d#d$Z  ZS ))PhoneNumberList)r   r   c                    s*   t  | d|i| _djf | j| _dS )z
        Initialize the PhoneNumberList

        :param version: Version that contains the resource
        :param trunk_sid: The SID of the Trunk from which to read the PhoneNumber resources.

        r   z /Trunks/{trunk_sid}/PhoneNumbersNre   )r?   r   r   r@   r   r   r;   *  s
     zPhoneNumberList.__init__)phone_number_sidrD   c                 C   sX   t d|i}t ddi}d|d< d|d< | jjd| j||d}t| j|| jd d	S )
a#  
        Create the PhoneNumberInstance

        :param phone_number_sid: The SID of the [Incoming Phone Number](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) that you want to associate with the trunk.

        :returns: The created PhoneNumberInstance
        PhoneNumberSidContent-Type!application/x-www-form-urlencodedrn   ro   POSTri   rj   datark   r   rs   )r   rl   rE   createrf   r   r=   r?   rv   r|   rk   r   r   r   r   r}   :  s&    	      zPhoneNumberList.createc                    s^   t d|i}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )a2  
        Asynchronously create the PhoneNumberInstance

        :param phone_number_sid: The SID of the [Incoming Phone Number](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) that you want to associate with the trunk.

        :returns: The created PhoneNumberInstance
        rw   rx   ry   rn   ro   rz   r{   Nr   rs   )r   rl   rE   create_asyncrf   r   r=   r~   r   r   r   r   V  s&    	      zPhoneNumberList.create_asyncN)limit	page_sizerD   c                 C   s0   | j ||}| j|d d}| j ||d S )aa  
        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 limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param 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
        r   r   r   )rE   read_limitspagestreamr?   r   r   Zlimitsr   r   r   r   r   r  s    zPhoneNumberList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )ap  
        Asynchronously 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 limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param 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
        r   r   Nr   )rE   r   
page_asyncstream_asyncr   r   r   r   r     s    zPhoneNumberList.stream_asyncc                 C   s   t | j||dS )a  
        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 limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param 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: list that will contain up to limit results
        r   r   )listr   r?   r   r   r   r   r   r     s    zPhoneNumberList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously 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 limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param 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: list that will contain up to limit results
        c                    s   g | z3 d H W }|q6 S )Nr   )rV   recordr   r   r   
<listcomp>  s   z.PhoneNumberList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async  s    
zPhoneNumberList.list_async)
page_tokenpage_numberr   rD   c                 C   sN   t |||d}t ddi}d|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 page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of PhoneNumberInstance
        Z	PageTokenr   ZPageSizerx   ry   rn   ro   rp   ri   rj   paramsrk   )r   rl   rE   r   rf   rr   r=   r?   r   r   r   r|   rk   responser   r   r   r     s       zPhoneNumberList.pagec                    sT   t |||d}t ddi}d|d< | jjd| j||dI dH }t| j|| jS )	a  
        Asynchronously retrieve a single page of PhoneNumberInstance records from the API.
        Request is executed immediately

        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of PhoneNumberInstance
        r   rx   ry   rn   ro   rp   r   N)r   rl   rE   r   rf   rr   r=   r   r   r   r   r     s       zPhoneNumberList.page_async)
target_urlrD   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of PhoneNumberInstance records from the API.
        Request is executed immediately

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

        :returns: Page of PhoneNumberInstance
        rp   )rE   domaintwiliorequestrr   r=   r?   r   r   r   r   r   get_page  s    	zPhoneNumberList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a
  
        Asynchronously retrieve a specific page of PhoneNumberInstance records from the API.
        Request is executed immediately

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

        :returns: Page of PhoneNumberInstance
        rp   N)rE   r   r   Zrequest_asyncrr   r=   r   r   r   r   get_page_async'  s    	zPhoneNumberList.get_page_async)r    rD   c                 C   s   t | j| jd |dS z
        Constructs a PhoneNumberContext

        :param sid: The unique string that we created to identify the PhoneNumber resource to fetch.
        r   r9   rB   rE   r=   r?   r    r   r   r   r<   3  s
      zPhoneNumberList.getc                 C   s   t | j| jd |dS r   r   r   r   r   r   __call__=  s
      zPhoneNumberList.__call__rC   c                 C   s   dS )rP   z$<Twilio.Trunking.V1.PhoneNumberList>r   rF   r   r   r   r_   G  s    zPhoneNumberList.__repr__)NN)NN)NN)NN) r   r   r   r   ra   r;   r   r}   r   r   intr   r   r	   r   r   r   r   r   unsetr   r`   rr   r   r   r   r   rB   r<   r   r_   rd   r   r   r@   r   ru   (  sl           


#


!

ru   N)__doc__r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   rB   rr   ru   r   r   r   r   <module>   s   $ c