U
    ^g%ia                     @   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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 - Proxy
    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	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s   e Zd Zd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jfeeef d dddZejfeeef d dddZedddZ  ZS )PhoneNumberInstancea  
    :ivar sid: The unique string that we created to identify the PhoneNumber resource.
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the PhoneNumber resource.
    :ivar service_sid: The SID of the PhoneNumber resource's parent [Service](https://www.twilio.com/docs/proxy/api/service) resource.
    :ivar date_created: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was created.
    :ivar date_updated: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time in GMT when the resource was last updated.
    :ivar phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number.
    :ivar friendly_name: The string that you assigned to describe the resource.
    :ivar iso_country: The ISO Country Code for the phone number.
    :ivar capabilities:
    :ivar url: The absolute URL of the PhoneNumber resource.
    :ivar is_reserved: Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information.
    :ivar in_use: The number of open session assigned to the number. See the [How many Phone Numbers do I need?](https://www.twilio.com/docs/proxy/phone-numbers-needed) guide for more information.
    N)versionpayloadservice_sidsidc                    s   t  | |d| _|d| _|d| _t|d| _t|d| _	|d| _
|d| _|d| _|d	| _|d
| _|d| _t|d| _||p| jd| _d | _d S )Nr   account_sidr   date_createddate_updatedphone_numberfriendly_nameiso_countrycapabilitiesurlis_reservedin_user   r   )super__init__getr   r   r   r
   Ziso8601_datetimer   r   r   r   r   r   r   r   integerr    	_solution_context)selfr   r   r   r   	__class__ h/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/proxy/v1/service/phone_number.pyr#   )   s*    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   r!   )r'   r-   _versionr&   r(   r+   r+   r,   _proxyI   s    
zPhoneNumberInstance._proxyc                 C   s
   | j  S )n
        Deletes the PhoneNumberInstance


        :returns: True if delete succeeds, False otherwise
        )r2   deleter1   r+   r+   r,   r4   Y   s    zPhoneNumberInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the PhoneNumberInstance


        :returns: True if delete succeeds, False otherwise
        N)r2   delete_asyncr1   r+   r+   r,   r6   b   s    z PhoneNumberInstance.delete_asyncc                 C   s
   | j  S )c
        Fetch the PhoneNumberInstance


        :returns: The fetched PhoneNumberInstance
        )r2   fetchr1   r+   r+   r,   r8   k   s    zPhoneNumberInstance.fetchc                    s   | j  I dH S )}
        Asynchronous coroutine to fetch the PhoneNumberInstance


        :returns: The fetched PhoneNumberInstance
        N)r2   fetch_asyncr1   r+   r+   r,   r:   t   s    zPhoneNumberInstance.fetch_asyncr   r/   c                 C   s   | j j|dS )V  
        Update the PhoneNumberInstance

        :param is_reserved: Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information.

        :returns: The updated PhoneNumberInstance
        r   )r2   updater(   r   r+   r+   r,   r>   }   s    
zPhoneNumberInstance.updatec                    s   | j j|dI dH S )p  
        Asynchronous coroutine to update the PhoneNumberInstance

        :param is_reserved: Whether the phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information.

        :returns: The updated PhoneNumberInstance
        r=   N)r2   update_asyncr?   r+   r+   r,   rA      s    
z PhoneNumberInstance.update_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.Proxy.V1.PhoneNumberInstance {}>joinr&   itemsrF   r(   contextr+   r+   r,   __repr__   s    zPhoneNumberInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r#   propertyr2   boolr4   r6   r8   r:   r   unsetr   objectr>   rA   rQ   __classcell__r+   r+   r)   r,   r      s2    
 			


r   c                       s   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jfeeef e	dddZejfeeef e	dddZedddZ  ZS )r-   )r   r   r   c                    s,   t  | ||d| _djf | j| _dS )am  
        Initialize the PhoneNumberContext

        :param version: Version that contains the resource
        :param service_sid: The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) of the PhoneNumber resource to update.
        :param sid: The Twilio-provided string that uniquely identifies the PhoneNumber resource to update.
        r!   z*/Services/{service_sid}/PhoneNumbers/{sid}Nr"   r#   r&   rF   _uri)r(   r   r   r   r)   r+   r,   r#      s    zPhoneNumberContext.__init__r.   c                 C   s   t i }| jjd| j|dS )r3   DELETEmethoduriheaders)r   ofr0   r4   r]   r(   rb   r+   r+   r,   r4      s    
zPhoneNumberContext.deletec                    s$   t i }| jjd| j|dI dH S )r5   r^   r_   N)r   rc   r0   r6   r]   rd   r+   r+   r,   r6      s    
  zPhoneNumberContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r7   application/jsonAcceptGETr_   r   r   r!   )r   rc   r0   r8   r]   r   r&   r(   rb   r   r+   r+   r,   r8      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 )	r9   re   rf   rg   r_   Nr   r   r!   )r   rc   r0   r:   r]   r   r&   rh   r+   r+   r,   r:      s    
  zPhoneNumberContext.fetch_asyncr;   c                 C   sb   t dt|i}t i }d|d< d|d< | jjd| j||d}t| j|| jd | jd	 d
S )r<   
IsReserved!application/x-www-form-urlencodedContent-Typere   rf   POSTr`   ra   datarb   r   r   r!   )	r   rc   r   boolean_to_stringr0   r>   r]   r   r&   r(   r   rn   rb   r   r+   r+   r,   r>      s(     
   zPhoneNumberContext.updatec                    sh   t dt|i}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 dS )r@   ri   rj   rk   re   rf   rl   rm   Nr   r   r!   )	r   rc   r   ro   r0   rA   r]   r   r&   rp   r+   r+   r,   rA     s(     
   zPhoneNumberContext.update_asyncc                 C   s$   d dd | j D }d|S )rB   rC   c                 s   s   | ]\}}d  ||V  qdS rD   rE   rG   r+   r+   r,   rK   F  s     z.PhoneNumberContext.__repr__.<locals>.<genexpr>z'<Twilio.Proxy.V1.PhoneNumberContext {}>rL   rO   r+   r+   r,   rQ   @  s    zPhoneNumberContext.__repr__)rR   rS   rT   r   rV   r#   rX   r4   r6   r   r8   r:   r   rY   r   rZ   r>   rA   rQ   r[   r+   r+   r)   r,   r-      s    
"
!r-   c                   @   s2   e Zd Zeeef edddZedddZdS )PhoneNumberPage)r   r/   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   r0   r&   )r(   r   r+   r+   r,   get_instanceL  s
      zPhoneNumberPage.get_instancer.   c                 C   s   dS )rB   z!<Twilio.Proxy.V1.PhoneNumberPage>r+   r1   r+   r+   r,   rQ   V  s    zPhoneNumberPage.__repr__N)	rR   rS   rT   r   rV   r   r   rs   rQ   r+   r+   r+   r,   rq   J  s   
rq   c                       s  e Zd Zeed f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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 service_sid: The SID of the parent [Service](https://www.twilio.com/docs/proxy/api/service) of the PhoneNumber resources to read.

        r   z$/Services/{service_sid}/PhoneNumbersNr\   )r(   r   r   r)   r+   r,   r#   a  s
     zPhoneNumberList.__init__)r   r   r   r/   c                 C   sb   t ||t|d}t ddi}d|d< d|d< | jjd| j||d}t| j|| jd d	S )
aB  
        Create the PhoneNumberInstance

        :param sid: The SID of a Twilio [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the Twilio Number you would like to assign to your Proxy Service.
        :param phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.  E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234.
        :param is_reserved: Whether the new phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information.

        :returns: The created PhoneNumberInstance
        ZSidZPhoneNumberri   rk   rj   re   rf   rl   rm   r   rr   )	r   rc   r   ro   r0   creater]   r   r&   r(   r   r   r   rn   rb   r   r+   r+   r,   rv   q  s(         zPhoneNumberList.createc                    sh   t ||t|d}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )aQ  
        Asynchronously create the PhoneNumberInstance

        :param sid: The SID of a Twilio [IncomingPhoneNumber](https://www.twilio.com/docs/phone-numbers/api/incomingphonenumber-resource) resource that represents the Twilio Number you would like to assign to your Proxy Service.
        :param phone_number: The phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format.  E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234.
        :param is_reserved: Whether the new phone number should be reserved and not be assigned to a participant using proxy pool logic. See [Reserved Phone Numbers](https://www.twilio.com/docs/proxy/reserved-phone-numbers) for more information.

        :returns: The created PhoneNumberInstance
        ru   rk   rj   re   rf   rl   rm   Nr   rr   )	r   rc   r   ro   r0   create_asyncr]   r   r&   rw   r+   r+   r,   rx     s(         zPhoneNumberList.create_asyncN)limit	page_sizer/   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
        rz   rz   ry   )r0   read_limitspagestreamr(   ry   rz   Zlimitsr}   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
        rz   r{   Nry   )r0   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
        ry   rz   )listr~   r(   ry   rz   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+   )rH   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_numberrz   r/   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PageSizerk   rj   re   rf   rg   r`   ra   paramsrb   )r   rc   r0   r}   r]   rq   r&   r(   r   r   rz   rn   rb   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   rk   rj   re   rf   rg   r   N)r   rc   r0   r   r]   rq   r&   r   r+   r+   r,   r   C  s       zPhoneNumberList.page_async)
target_urlr/   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
        rg   )r0   domaintwiliorequestrq   r&   r(   r   r   r+   r+   r,   get_paged  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
        rg   N)r0   r   r   Zrequest_asyncrq   r&   r   r+   r+   r,   get_page_asyncp  s    	zPhoneNumberList.get_page_async)r   r/   c                 C   s   t | j| jd |dS z
        Constructs a PhoneNumberContext

        :param sid: The Twilio-provided string that uniquely identifies the PhoneNumber resource to update.
        r   r!   r-   r0   r&   r(   r   r+   r+   r,   r$   |  s
      zPhoneNumberList.getc                 C   s   t | j| jd |dS r   r   r   r+   r+   r,   __call__  s
      zPhoneNumberList.__call__r.   c                 C   s   dS )rB   z!<Twilio.Proxy.V1.PhoneNumberList>r+   r1   r+   r+   r,   rQ     s    zPhoneNumberList.__repr__)NN)NN)NN)NN)!rR   rS   rT   r   rV   r#   r   rY   r   rZ   rX   r   rv   rx   r   intr   r~   r	   r   r   r   r   rq   r}   r   r   r   r-   r$   r   rQ   r[   r+   r+   r)   r,   rt   _  s   


'


'        


#


!

rt   N)rU   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   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   r-   rq   rt   r+   r+   r+   r,   <module>   s   $  (