o
    f>hP                     @   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 - Voice
    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dZ	ddedeeef 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dedd fddZdedd fddZdefddZ  ZS )SourceIpMappingInstancea  
    :ivar sid: The unique string that we created to identify the IP Record resource.
    :ivar ip_record_sid: The Twilio-provided string that uniquely identifies the IP Record resource to map from.
    :ivar sip_domain_sid: The SID of the SIP Domain that the IP Record is mapped to.
    :ivar date_created: The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar date_updated: The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar url: The absolute URL of the resource.
    Nversionpayloadsidc                    sz   t  | |d| _|d| _|d| _t|d| _t|d| _	|d| _
d|p5| ji| _d | _d S )Nr   ip_record_sidsip_domain_siddate_createddate_updatedurl)super__init__getr   r   r   r
   iso8601_datetimer   r   r   	_solution_context)selfr   r   r   	__class__ Y/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/voice/v1/source_ip_mapping.pyr   #   s   

z SourceIpMappingInstance.__init__returnSourceIpMappingContextc                 C   s&   | j du rt| j| 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: SourceIpMappingContext for this SourceIpMappingInstance
        Nr   r   )r   r&   _versionr   r    r#   r#   r$   _proxy8   s   
zSourceIpMappingInstance._proxyc                 C   
   | j  S )r
        Deletes the SourceIpMappingInstance


        :returns: True if delete succeeds, False otherwise
        )r*   deleter)   r#   r#   r$   r-   G      
zSourceIpMappingInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the SourceIpMappingInstance


        :returns: True if delete succeeds, False otherwise
        N)r*   delete_asyncr)   r#   r#   r$   r1   P      z$SourceIpMappingInstance.delete_asyncc                 C   r+   )k
        Fetch the SourceIpMappingInstance


        :returns: The fetched SourceIpMappingInstance
        )r*   fetchr)   r#   r#   r$   r4   Y   r.   zSourceIpMappingInstance.fetchc                    r/   )
        Asynchronous coroutine to fetch the SourceIpMappingInstance


        :returns: The fetched SourceIpMappingInstance
        N)r*   fetch_asyncr)   r#   r#   r$   r6   b   r2   z#SourceIpMappingInstance.fetch_asyncr   c                 C   s   | j j|dS )
        Update the SourceIpMappingInstance

        :param sip_domain_sid: The SID of the SIP Domain that the IP Record should be mapped to.

        :returns: The updated SourceIpMappingInstance
        r   )r*   updater    r   r#   r#   r$   r9   k   s   zSourceIpMappingInstance.updatec                    s   | j j|dI dH S )
        Asynchronous coroutine to update the SourceIpMappingInstance

        :param sip_domain_sid: The SID of the SIP Domain that the IP Record should be mapped to.

        :returns: The updated SourceIpMappingInstance
        r8   N)r*   update_asyncr:   r#   r#   r$   r<   w   s   z$SourceIpMappingInstance.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>       z3SourceIpMappingInstance.__repr__.<locals>.<genexpr>z,<Twilio.Voice.V1.SourceIpMappingInstance {}>joinr   itemsrC   r    contextr#   r#   r$   __repr__      
z SourceIpMappingInstance.__repr__N)r%   r&   )r%   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr*   boolr-   r1   r4   r6   r9   r<   rO   __classcell__r#   r#   r!   r$   r      s&    

	
	
		r   c                       s   e Zd Z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dede	fddZdede	fddZdefddZ  ZS )r&   r   r   c                    s.   t  | d|i| _djdi | j| _dS )z
        Initialize the SourceIpMappingContext

        :param version: Version that contains the resource
        :param sid: The Twilio-provided string that uniquely identifies the IP Record resource to update.
        r   z/SourceIpMappings/{sid}Nr#   )r   r   r   rC   _uri)r    r   r   r!   r#   r$   r      s   zSourceIpMappingContext.__init__r%   c                 C   s   t i }| jjd| j|dS )r,   DELETEmethoduriheaders)r   ofr(   r-   rZ   r    r_   r#   r#   r$   r-      s   
zSourceIpMappingContext.deletec                    s&   t i }| jjd| j|dI dH S )r0   r[   r\   N)r   r`   r(   r1   rZ   ra   r#   r#   r$   r1      s
   
z#SourceIpMappingContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r3   application/jsonAcceptGETr\   r   r'   )r   r`   r(   r4   rZ   r   r   r    r_   r   r#   r#   r$   r4      s   
zSourceIpMappingContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r5   rb   rc   rd   r\   Nr   r'   )r   r`   r(   r6   rZ   r   r   re   r#   r#   r$   r6      s   
z"SourceIpMappingContext.fetch_asyncr   c                 C   sT   t d|i}t i }d|d< d|d< | jjd| j||d}t| j|| jd d	S )
r7   SipDomainSid!application/x-www-form-urlencodedContent-Typerb   rc   POSTr]   r^   datar_   r   r'   )r   r`   r(   r9   rZ   r   r   r    r   rk   r_   r   r#   r#   r$   r9      s   	

zSourceIpMappingContext.updatec                    s\   t d|i}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )r;   rf   rg   rh   rb   rc   ri   rj   Nr   r'   )r   r`   r(   r<   rZ   r   r   rl   r#   r#   r$   r<      s   	

z#SourceIpMappingContext.update_asyncc                 C   r=   )r>   r?   c                 s   r@   rA   rB   rD   r#   r#   r$   rH      rI   z2SourceIpMappingContext.__repr__.<locals>.<genexpr>z+<Twilio.Voice.V1.SourceIpMappingContext {}>rJ   rM   r#   r#   r$   rO     rP   zSourceIpMappingContext.__repr__)rR   rS   rT   r   rV   r   rX   r-   r1   r   r4   r6   r9   r<   rO   rY   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 )SourceIpMappingPager   r%   c                 C   s   t | j|S )zu
        Build an instance of SourceIpMappingInstance

        :param payload: Payload response from the API
        )r   r(   )r    r   r#   r#   r$   get_instance&  s   z SourceIpMappingPage.get_instancec                 C      dS )r>   z%<Twilio.Voice.V1.SourceIpMappingPage>r#   r)   r#   r#   r$   rO   .     zSourceIpMappingPage.__repr__N)	rR   rS   rT   r   rV   r   r   rn   rO   r#   r#   r#   r$   rm   $  s    rm   c                	       s  e Zd Zdef fddZdededefddZdede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 ))SourceIpMappingListr   c                    s   t  | d| _dS )zq
        Initialize the SourceIpMappingList

        :param version: Version that contains the resource

        z/SourceIpMappingsN)r   r   rZ   )r    r   r!   r#   r$   r   9  s   
zSourceIpMappingList.__init__r   r   r%   c                 C   sP   t ||d}t ddi}d|d< d|d< | jjd| j||d}t| j|S )aC  
        Create the SourceIpMappingInstance

        :param ip_record_sid: The Twilio-provided string that uniquely identifies the IP Record resource to map from.
        :param sip_domain_sid: The SID of the SIP Domain that the IP Record should be mapped to.

        :returns: The created SourceIpMappingInstance
        IpRecordSidrf   rh   rg   rb   rc   ri   rj   )r   r`   r(   createrZ   r   r    r   r   rk   r_   r   r#   r#   r$   rt   D  s   
zSourceIpMappingList.createc                    sX   t ||d}t ddi}d|d< d|d< | jjd| j||dI dH }t| j|S )	aR  
        Asynchronously create the SourceIpMappingInstance

        :param ip_record_sid: The Twilio-provided string that uniquely identifies the IP Record resource to map from.
        :param sip_domain_sid: The SID of the SIP Domain that the IP Record should be mapped to.

        :returns: The created SourceIpMappingInstance
        rr   rh   rg   rb   rc   ri   rj   N)r   r`   r(   create_asyncrZ   r   ru   r#   r#   r$   rv   b  s   
z SourceIpMappingList.create_asyncNlimit	page_sizec                 C   s0   | j ||}| j|d d}| j ||d S )ae  
        Streams SourceIpMappingInstance 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
        rx   rx   rw   )r(   read_limitspagestreamr    rw   rx   limitsr{   r#   r#   r$   r|     s   zSourceIpMappingList.streamc                    s8   | j ||}| j|d dI dH }| j ||d S )at  
        Asynchronously streams SourceIpMappingInstance 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
        rx   ry   Nrw   )r(   rz   
page_asyncstream_asyncr}   r#   r#   r$   r     s   z SourceIpMappingList.stream_asyncc                 C   s   t | j||dS )a  
        Lists SourceIpMappingInstance 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
        rw   rx   )listr|   r    rw   rx   r#   r#   r$   r     s   zSourceIpMappingList.listc                    s&   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists SourceIpMappingInstance 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 rQ   r#   )rE   recordr#   r#   r$   
<listcomp>  s
    z2SourceIpMappingList.list_async.<locals>.<listcomp>r   N)r   r   r#   r#   r$   
list_async  s   
zSourceIpMappingList.list_async
page_tokenpage_numberc                 C   sJ   t |||d}t ddi}d|d< | jjd| j||d}t| j|S )a  
        Retrieve a single page of SourceIpMappingInstance 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 SourceIpMappingInstance
        	PageTokenr   PageSizerh   rg   rb   rc   rd   r]   r^   paramsr_   )r   r`   r(   r{   rZ   rm   r    r   r   rx   rk   r_   responser#   r#   r$   r{     s   
zSourceIpMappingList.pagec                    sR   t |||d}t ddi}d|d< | jjd| j||dI dH }t| j|S )	a  
        Asynchronously retrieve a single page of SourceIpMappingInstance 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 SourceIpMappingInstance
        r   rh   rg   rb   rc   rd   r   N)r   r`   r(   r   rZ   rm   r   r#   r#   r$   r     s   
zSourceIpMappingList.page_async
target_urlc                 C   s   | j jjd|}t| j |S )a  
        Retrieve a specific page of SourceIpMappingInstance records from the API.
        Request is executed immediately

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

        :returns: Page of SourceIpMappingInstance
        rd   )r(   domaintwiliorequestrm   r    r   r   r#   r#   r$   get_page)  s   	zSourceIpMappingList.get_pagec                    s&   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of SourceIpMappingInstance records from the API.
        Request is executed immediately

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

        :returns: Page of SourceIpMappingInstance
        rd   N)r(   r   r   request_asyncrm   r   r#   r#   r$   get_page_async5  s   	z"SourceIpMappingList.get_page_asyncr   c                 C      t | j|dS z
        Constructs a SourceIpMappingContext

        :param sid: The Twilio-provided string that uniquely identifies the IP Record resource to update.
        r'   r&   r(   r    r   r#   r#   r$   r   A     zSourceIpMappingList.getc                 C   r   r   r   r   r#   r#   r$   __call__I  r   zSourceIpMappingList.__call__c                 C   ro   )r>   z%<Twilio.Voice.V1.SourceIpMappingList>r#   r)   r#   r#   r$   rO   Q  rp   zSourceIpMappingList.__repr__)NN) rR   rS   rT   r   r   rV   r   rt   rv   r   intr   r|   r	   r   r   r   r   r   unsetr   objectrm   r{   r   r   r   r&   r   r   rO   rY   r#   r#   r!   r$   rq   7  s    

 







#



!rq   N)rU   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r&   rm   rq   r#   r#   r#   r$   <module>   s    $t 