o
    f>ha                     @   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dedeeef dedee f fddZ	e
dddZd	efddZd	efddZdddZdddZejfdeeef d	d fddZejfdeeef d	d fddZd	ef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
   iso8601_datetimer   r   r   r   r   r   r   r   integerr    	_solution_context)selfr   r   r   r   	__class__ \/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/proxy/v1/service/phone_number.pyr#   )   s*   
zPhoneNumberInstance.__init__returnPhoneNumberContextc                 C   s.   | j du 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   
   | j  S )n
        Deletes the PhoneNumberInstance


        :returns: True if delete succeeds, False otherwise
        )r2   deleter1   r,   r,   r-   r5   Y      
zPhoneNumberInstance.deletec                       | 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-   r9   b      z PhoneNumberInstance.delete_asyncc                 C   r3   )c
        Fetch the PhoneNumberInstance


        :returns: The fetched PhoneNumberInstance
        )r2   fetchr1   r,   r,   r-   r<   k   r6   zPhoneNumberInstance.fetchc                    r7   )}
        Asynchronous coroutine to fetch the PhoneNumberInstance


        :returns: The fetched PhoneNumberInstance
        N)r2   fetch_asyncr1   r,   r,   r-   r>   t   r:   zPhoneNumberInstance.fetch_asyncr   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-   rA   }   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_asyncrB   r,   r,   r-   rD      s   
z PhoneNumberInstance.update_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr,   r,   r-   	<genexpr>       z/PhoneNumberInstance.__repr__.<locals>.<genexpr>z(<Twilio.Proxy.V1.PhoneNumberInstance {}>joinr'   itemsrK   r)   contextr,   r,   r-   __repr__      
zPhoneNumberInstance.__repr__N)r.   r/   )r.   r   )__name__
__module____qualname____doc__r   r   strr   r   r#   propertyr2   boolr5   r9   r<   r>   r   unsetr   objectrA   rD   rW   __classcell__r,   r,   r*   r-   r      s>    
 	
	
	




r   c                       s   e Zd Zdededef fddZdefddZdefd	d
Zde	fddZ
de	fddZejfdeeef de	fddZejfdeeef de	fddZdefddZ  ZS )r/   r   r   r   c                    s0   t  | ||d| _djdi | 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}Nr,   r"   r#   r'   rK   _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 )r4   DELETEmethoduriheaders)r   ofr0   r5   re   r)   rj   r,   r,   r-   r5      s   
zPhoneNumberContext.deletec                    s&   t i }| jjd| j|dI dH S )r8   rf   rg   N)r   rk   r0   r9   re   rl   r,   r,   r-   r9      s
   
zPhoneNumberContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r;   application/jsonAcceptGETrg   r   r   r!   )r   rk   r0   r<   re   r   r'   r)   rj   r   r,   r,   r-   r<      s   
zPhoneNumberContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	r=   rm   rn   ro   rg   Nr   r   r!   )r   rk   r0   r>   re   r   r'   rp   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-Typerm   rn   POSTrh   ri   datarj   r   r   r!   )	r   rk   r   boolean_to_stringr0   rA   re   r   r'   r)   r   rv   rj   r   r,   r,   r-   rA      s    


zPhoneNumberContext.updatec                    sj   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 )rC   rq   rr   rs   rm   rn   rt   ru   Nr   r   r!   )	r   rk   r   rw   r0   rD   re   r   r'   rx   r,   r,   r-   rD     s"   


zPhoneNumberContext.update_asyncc                 C   rE   )rF   rG   c                 s   rH   rI   rJ   rL   r,   r,   r-   rP   F  rQ   z.PhoneNumberContext.__repr__.<locals>.<genexpr>z'<Twilio.Proxy.V1.PhoneNumberContext {}>rR   rU   r,   r,   r-   rW   @  rX   zPhoneNumberContext.__repr__)rZ   r[   r\   r   r^   r#   r`   r5   r9   r   r<   r>   r   ra   r   rb   rA   rD   rW   rc   r,   r,   r*   r-   r/      s&    

"

!r/   c                   @   s4   e Zd Zdeeef defddZdefddZdS )PhoneNumberPager   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     zPhoneNumberPage.get_instancec                 C      dS )rF   z!<Twilio.Proxy.V1.PhoneNumberPage>r,   r1   r,   r,   r-   rW   V     zPhoneNumberPage.__repr__N)	rZ   r[   r\   r   r^   r   r   r{   rW   r,   r,   r,   r-   ry   J  s    
ry   c                	       s  e Zd Zdedef fddZejejejfdeee	f deee	f dee
e	f defd	d
Zejejejfdeee	f deee	f dee
e	f defddZ		d)dee dee dee fddZ		d)dee dee dee fddZ		d)dee dee dee fddZ		d)dee dee dee fddZejejejfdeee	f deee	f deee	f defddZejejejfdeee	f deee	f deee	f defddZdedefdd Zdedefd!d"Zdedefd#d$Zdedefd%d&Zdefd'd(Z  Z S )*PhoneNumberListr   r   c                    s.   t  | d|i| _djdi | 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,   rd   )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
        SidPhoneNumberrq   rs   rr   rm   rn   rt   ru   r   rz   )	r   rk   r   rw   r0   createre   r   r'   r)   r   r   r   rv   rj   r   r,   r,   r-   r   q  s   
zPhoneNumberList.createc                    sj   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
        r   rs   rr   rm   rn   rt   ru   Nr   rz   )	r   rk   r   rw   r0   create_asyncre   r   r'   r   r,   r,   r-   r     s    
zPhoneNumberList.create_asyncNlimit	page_sizec                 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   )r0   read_limitspagestreamr)   r   r   limitsr   r,   r,   r-   r     s   zPhoneNumberList.streamc                    s8   | 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   )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
        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 rY   r,   )rM   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_numberc                 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
        	PageTokenr   PageSizers   rr   rm   rn   ro   rh   ri   paramsrj   )r   rk   r0   r   re   ry   r'   r)   r   r   r   rv   rj   responser,   r,   r-   r   "  s   
zPhoneNumberList.pagec                    sV   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   rs   rr   rm   rn   ro   r   N)r   rk   r0   r   re   ry   r'   r   r,   r,   r-   r   C  s   
zPhoneNumberList.page_async
target_urlc                 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
        ro   )r0   domaintwiliorequestry   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
        ro   N)r0   r   r   request_asyncry   r'   r   r,   r,   r-   get_page_asyncp  s   	zPhoneNumberList.get_page_asyncc                 C      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$   |  r|   zPhoneNumberList.getc                 C   r   r   r   r   r,   r,   r-   __call__  r|   zPhoneNumberList.__call__c                 C   r}   )rF   z!<Twilio.Proxy.V1.PhoneNumberList>r,   r1   r,   r,   r-   rW     r~   zPhoneNumberList.__repr__)NN)!rZ   r[   r\   r   r^   r#   r   ra   r   rb   r`   r   r   r   r   intr   r   r	   r   r   r   r   ry   r   r   r   r   r/   r$   r   rW   rc   r,   r,   r*   r-   r   _  s    



'



'







#



!

r   N)r]   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r/   ry   r   r,   r,   r,   r-   <module>   s    $  (