U
    ^g%iP                     @   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eeeef 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dZed dddZed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|pj| ji| _d | _d S )Nr   ip_record_sidsip_domain_siddate_createddate_updatedurl)super__init__getr   r   r   r
   Ziso8601_datetimer   r   r   	_solution_context)selfr   r   r   	__class__ e/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/voice/v1/source_ip_mapping.pyr   #   s     z SourceIpMappingInstance.__init__SourceIpMappingContextreturnc                 C   s&   | j dk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   s
   | j  S )r
        Deletes the SourceIpMappingInstance


        :returns: True if delete succeeds, False otherwise
        )r*   deleter)   r"   r"   r#   r,   G   s    zSourceIpMappingInstance.deletec                    s   | 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#   r.   P   s    z$SourceIpMappingInstance.delete_asyncc                 C   s
   | j  S )k
        Fetch the SourceIpMappingInstance


        :returns: The fetched SourceIpMappingInstance
        )r*   fetchr)   r"   r"   r#   r0   Y   s    zSourceIpMappingInstance.fetchc                    s   | j  I dH S )
        Asynchronous coroutine to fetch the SourceIpMappingInstance


        :returns: The fetched SourceIpMappingInstance
        N)r*   fetch_asyncr)   r"   r"   r#   r2   b   s    z#SourceIpMappingInstance.fetch_asyncr   r&   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#   r6   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
        r5   N)r*   update_asyncr7   r"   r"   r#   r9   w   s    z$SourceIpMappingInstance.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     z3SourceIpMappingInstance.__repr__.<locals>.<genexpr>z,<Twilio.Voice.V1.SourceIpMappingInstance {}>joinr   itemsr>   r   contextr"   r"   r#   __repr__   s    z SourceIpMappingInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr*   boolr,   r.   r0   r2   r6   r9   rI   __classcell__r"   r"   r    r#   r      s    
  
 				r   c                       s   e Zd Z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e	dddZee	dddZedddZ  ZS )r$   )r   r   c                    s*   t  | d|i| _djf | 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}N)r   r   r   r>   _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,   rR   r   rW   r"   r"   r#   r,      s    
zSourceIpMappingContext.deletec                    s$   t i }| jjd| j|dI dH S )r-   rS   rT   N)r   rX   r(   r.   rR   rY   r"   r"   r#   r.      s    
  z#SourceIpMappingContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r/   application/jsonAcceptGETrT   r   r'   )r   rX   r(   r0   rR   r   r   r   rW   r   r"   r"   r#   r0      s    
zSourceIpMappingContext.fetchc                    sB   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r1   rZ   r[   r\   rT   Nr   r'   )r   rX   r(   r2   rR   r   r   r]   r"   r"   r#   r2      s    
  z"SourceIpMappingContext.fetch_asyncr3   c                 C   sT   t d|i}t i }d|d< d|d< | jjd| j||d}t| j|| jd d	S )
r4   SipDomainSid!application/x-www-form-urlencodedContent-TyperZ   r[   POSTrU   rV   datarW   r   r'   )r   rX   r(   r6   rR   r   r   r   r   rc   rW   r   r"   r"   r#   r6      s&    	 
     zSourceIpMappingContext.updatec                    sZ   t d|i}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )r8   r^   r_   r`   rZ   r[   ra   rb   Nr   r'   )r   rX   r(   r9   rR   r   r   rd   r"   r"   r#   r9      s&    	 
     z#SourceIpMappingContext.update_asyncc                 C   s$   d dd | j D }d|S )r:   r;   c                 s   s   | ]\}}d  ||V  qdS r<   r=   r?   r"   r"   r#   rC      s     z2SourceIpMappingContext.__repr__.<locals>.<genexpr>z+<Twilio.Voice.V1.SourceIpMappingContext {}>rD   rG   r"   r"   r#   rI     s    zSourceIpMappingContext.__repr__)rJ   rK   rL   r   rN   r   rP   r,   r.   r   r0   r2   r6   r9   rI   rQ   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 )SourceIpMappingPage)r   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_instancer%   c                 C   s   dS )r:   z%<Twilio.Voice.V1.SourceIpMappingPage>r"   r)   r"   r"   r#   rI   .  s    zSourceIpMappingPage.__repr__N)	rJ   rK   rL   r   rN   r   r   rf   rI   r"   r"   r"   r#   re   $  s   re   c                       s  e Zd Zed fddZeeedddZ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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 ))SourceIpMappingList)r   c                    s   t  | d| _dS )zq
        Initialize the SourceIpMappingList

        :param version: Version that contains the resource

        z/SourceIpMappingsN)r   r   rR   )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
        ZIpRecordSidr^   r`   r_   rZ   r[   ra   rb   )r   rX   r(   createrR   r   r   r   r   rc   rW   r   r"   r"   r#   ri   D  s       zSourceIpMappingList.createc                    sV   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
        rh   r`   r_   rZ   r[   ra   rb   N)r   rX   r(   create_asyncrR   r   rj   r"   r"   r#   rk   b  s       z SourceIpMappingList.create_asyncN)limit	page_sizer&   c                 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
        rm   rm   rl   )r(   read_limitspagestreamr   rl   rm   Zlimitsrp   r"   r"   r#   rq     s    zSourceIpMappingList.streamc                    s6   | 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
        rm   rn   Nrl   )r(   ro   
page_asyncstream_asyncrr   r"   r"   r#   rt     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
        rl   rm   )listrq   r   rl   rm   r"   r"   r#   rv     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 )Nr"   )r@   recordr"   r"   r#   
<listcomp>  s   z2SourceIpMappingList.list_async.<locals>.<listcomp>ru   N)rt   rw   r"   r"   r#   
list_async  s    
zSourceIpMappingList.list_async)
page_tokenpage_numberrm   r&   c                 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
        Z	PageTokenr   ZPageSizer`   r_   rZ   r[   r\   rU   rV   paramsrW   )r   rX   r(   rp   rR   re   r   r{   r|   rm   rc   rW   responser"   r"   r#   rp     s       zSourceIpMappingList.pagec                    sP   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}   r`   r_   rZ   r[   r\   r~   N)r   rX   r(   rs   rR   re   r   r"   r"   r#   rs     s       zSourceIpMappingList.page_async)
target_urlr&   c                 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
        r\   )r(   domaintwiliorequestre   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
        r\   N)r(   r   r   Zrequest_asyncre   r   r"   r"   r#   get_page_async5  s    	z"SourceIpMappingList.get_page_async)r   r&   c                 C   s   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  s    zSourceIpMappingList.getc                 C   s   t | j|dS r   r   r   r"   r"   r#   __call__I  s    zSourceIpMappingList.__call__r%   c                 C   s   dS )r:   z%<Twilio.Voice.V1.SourceIpMappingList>r"   r)   r"   r"   r#   rI   Q  s    zSourceIpMappingList.__repr__)NN)NN)NN)NN) rJ   rK   rL   r   r   rN   r   ri   rk   r   intr   rq   r	   rt   r   rv   rz   r   unsetr   objectre   rp   rs   r   r   r$   r   r   rI   rQ   r"   r"   r    r#   rg   7  sx              


#


!rg   N)rM   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   r$   re   rg   r"   r"   r"   r#   <module>   s   $t 