a
    !f                     @   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jejejejejejejejejejf
eeef eeef eeef eeef eeef eeef eeef eeef eeef eeef d dddZejejejejejejejejejejf
eeef eeef eeef eeef eeef eeef eeef eeef eeef eeef d dddZedddZ  ZS )ByocTrunkInstancea  
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the BYOC Trunk resource.
    :ivar sid: The unique string that that we created to identify the BYOC Trunk resource.
    :ivar friendly_name: The string that you assigned to describe the resource.
    :ivar voice_url: The URL we call using the `voice_method` when the BYOC Trunk receives a call.
    :ivar voice_method: The HTTP method we use to call `voice_url`. Can be: `GET` or `POST`.
    :ivar voice_fallback_url: The URL that we call when an error occurs while retrieving or executing the TwiML requested from `voice_url`.
    :ivar voice_fallback_method: The HTTP method we use to call `voice_fallback_url`. Can be: `GET` or `POST`.
    :ivar status_callback_url: The URL that we call to pass status parameters (such as call ended) to your application.
    :ivar status_callback_method: The HTTP method we use to call `status_callback_url`. Either `GET` or `POST`.
    :ivar cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
    :ivar connection_policy_sid: The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.
    :ivar from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to "call back" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to "sip.twilio.com".
    :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                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
|d	| _|d
| _|d| _|d| _t|d| _t|d| _|d| _d|p| ji| _d | _d S )Naccount_sidr   friendly_name	voice_urlvoice_methodvoice_fallback_urlvoice_fallback_methodstatus_callback_urlstatus_callback_methodcnam_lookup_enabledconnection_policy_sidfrom_domain_siddate_createddate_updatedurl)super__init__getr   r   r   r   r   r   r   r   r   r   r   r   r
   iso8601_datetimer    r!   r"   	_solution_context)selfr   r   r   	__class__ `/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/voice/v1/byoc_trunk.pyr$   .   s2    
zByocTrunkInstance.__init__ByocTrunkContextreturnc                 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: ByocTrunkContext for this ByocTrunkInstance
        Nr   r   )r(   r.   _versionr'   r)   r,   r,   r-   _proxyN   s    
zByocTrunkInstance._proxyc                 C   s
   | j  S )l
        Deletes the ByocTrunkInstance


        :returns: True if delete succeeds, False otherwise
        )r4   deleter3   r,   r,   r-   r6   ]   s    zByocTrunkInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the ByocTrunkInstance


        :returns: True if delete succeeds, False otherwise
        N)r4   delete_asyncr3   r,   r,   r-   r8   f   s    zByocTrunkInstance.delete_asyncc                 C   s
   | j  S )_
        Fetch the ByocTrunkInstance


        :returns: The fetched ByocTrunkInstance
        )r4   fetchr3   r,   r,   r-   r:   o   s    zByocTrunkInstance.fetchc                    s   | j  I dH S )y
        Asynchronous coroutine to fetch the ByocTrunkInstance


        :returns: The fetched ByocTrunkInstance
        N)r4   fetch_asyncr3   r,   r,   r-   r<   x   s    zByocTrunkInstance.fetch_asyncr   r   r   r   r   r   r   r   r   r   r0   c                 C   s    | j j|||||||||	|
d
S )9  
        Update the ByocTrunkInstance

        :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.
        :param voice_url: The URL we should call when the BYOC Trunk receives a call.
        :param voice_method: The HTTP method we should use to call `voice_url`
        :param voice_fallback_url: The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`.
        :param voice_fallback_method: The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`.
        :param status_callback_url: The URL that we should call to pass status parameters (such as call ended) to your application.
        :param status_callback_method: The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`.
        :param cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
        :param connection_policy_sid: The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.
        :param from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\".

        :returns: The updated ByocTrunkInstance
        
r   r   r   r   r   r   r   r   r   r   )r4   updater)   r   r   r   r   r   r   r   r   r   r   r,   r,   r-   r@      s    zByocTrunkInstance.updatec                    s&   | j j|||||||||	|
d
I dH S )S  
        Asynchronous coroutine to update the ByocTrunkInstance

        :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.
        :param voice_url: The URL we should call when the BYOC Trunk receives a call.
        :param voice_method: The HTTP method we should use to call `voice_url`
        :param voice_fallback_url: The URL that we should call when an error occurs while retrieving or executing the TwiML requested by `voice_url`.
        :param voice_fallback_method: The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`.
        :param status_callback_url: The URL that we should call to pass status parameters (such as call ended) to your application.
        :param status_callback_method: The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`.
        :param cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
        :param connection_policy_sid: The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.
        :param from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\".

        :returns: The updated ByocTrunkInstance
        r?   N)r4   update_asyncrA   r,   r,   r-   rC      s    zByocTrunkInstance.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>       z-ByocTrunkInstance.__repr__.<locals>.<genexpr>z&<Twilio.Voice.V1.ByocTrunkInstance {}>joinr'   itemsrH   r)   contextr,   r,   r-   __repr__   s    zByocTrunkInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r$   propertyr4   boolr6   r8   r:   r<   r   unsetr   objectr@   rC   rT   __classcell__r,   r,   r*   r-   r      st     			









,









*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jejejejejejejejejejf
eeef eeef eeef eeef eeef eeef eeef eeef eeef eeef e	dddZejejejejejejejejejejf
eeef eeef eeef eeef eeef eeef eeef eeef eeef eeef e	dddZedddZ  ZS )r.   )r   r   c                    s.   t  | d|i| _djf i | j| _dS )z
        Initialize the ByocTrunkContext

        :param version: Version that contains the resource
        :param sid: The Twilio-provided string that uniquely identifies the BYOC Trunk resource to update.
        r   z/ByocTrunks/{sid}N)r#   r$   r'   rH   _uri)r)   r   r   r*   r,   r-   r$      s    zByocTrunkContext.__init__r/   c                 C   s   | j jd| jdS )r5   DELETEmethoduri)r2   r6   r_   r3   r,   r,   r-   r6      s    zByocTrunkContext.deletec                    s   | j jd| jdI dH S )r7   r`   ra   N)r2   r8   r_   r3   r,   r,   r-   r8      s    zByocTrunkContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )r9   GETra   r   r1   )r2   r:   r_   r   r'   r)   r   r,   r,   r-   r:     s    zByocTrunkContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )r;   rd   ra   Nr   r1   )r2   r<   r_   r   r'   re   r,   r,   r-   r<     s    zByocTrunkContext.fetch_asyncr=   c                 C   sJ   t |||||||||	|
d
}| jjd| j|d}t| j|| jd dS )r>   
ZFriendlyNameZVoiceUrlZVoiceMethodZVoiceFallbackUrlZVoiceFallbackMethodZStatusCallbackUrlZStatusCallbackMethodZCnamLookupEnabledZConnectionPolicySidZFromDomainSidPOSTrb   rc   datar   r1   )r   ofr2   r@   r_   r   r'   r)   r   r   r   r   r   r   r   r   r   r   ri   r   r,   r,   r-   r@   -  s&    zByocTrunkContext.updatec                    sP   t |||||||||	|
d
}| jjd| j|dI dH }t| j|| jd dS )rB   rf   rg   rh   Nr   r1   )r   rj   r2   rC   r_   r   r'   rk   r,   r,   r-   rC   a  s&    zByocTrunkContext.update_asyncc                 C   s$   d dd | j D }d|S )rD   rE   c                 s   s   | ]\}}d  ||V  qdS rF   rG   rI   r,   r,   r-   rM     rN   z,ByocTrunkContext.__repr__.<locals>.<genexpr>z%<Twilio.Voice.V1.ByocTrunkContext {}>rO   rR   r,   r,   r-   rT     s    zByocTrunkContext.__repr__)rU   rV   rW   r   rY   r$   r[   r6   r8   r   r:   r<   r   r\   r   r]   r@   rC   rT   r^   r,   r,   r*   r-   r.      sh   









6









4r.   c                   @   s2   e Zd Zeeef edddZedddZdS )ByocTrunkPage)r   r0   c                 C   s   t | j|S )zo
        Build an instance of ByocTrunkInstance

        :param payload: Payload response from the API
        )r   r2   re   r,   r,   r-   get_instance  s    zByocTrunkPage.get_instancer/   c                 C   s   dS )rD   z<Twilio.Voice.V1.ByocTrunkPage>r,   r3   r,   r,   r-   rT     s    zByocTrunkPage.__repr__N)	rU   rV   rW   r   rY   r   r   rm   rT   r,   r,   r,   r-   rl     s   rl   c                       s  e Zd Zed fddZejejejejejejejejejejf
eee	f eee	f eee	f eee	f eee	f eee	f eee	f ee
e	f eee	f eee	f edddZejejejejejejejejejejf
eee	f eee	f eee	f eee	f eee	f eee	f eee	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 ))ByocTrunkList)r   c                    s   t  | d| _dS )zk
        Initialize the ByocTrunkList

        :param version: Version that contains the resource

        z/ByocTrunksN)r#   r$   r_   )r)   r   r*   r,   r-   r$     s    zByocTrunkList.__init__r=   c                 C   s@   t |||||||||	|
d
}| jjd| j|d}t| j|S )aK  
        Create the ByocTrunkInstance

        :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.
        :param voice_url: The URL we should call when the BYOC Trunk receives a call.
        :param voice_method: The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`.
        :param voice_fallback_url: The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`.
        :param voice_fallback_method: The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`.
        :param status_callback_url: The URL that we should call to pass status parameters (such as call ended) to your application.
        :param status_callback_method: The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`.
        :param cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
        :param connection_policy_sid: The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.
        :param from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\".

        :returns: The created ByocTrunkInstance
        rf   rg   rh   )r   rj   r2   creater_   r   rk   r,   r,   r-   ro     s&    zByocTrunkList.createc                    sF   t |||||||||	|
d
}| jjd| j|dI dH }t| j|S )aZ  
        Asynchronously create the ByocTrunkInstance

        :param friendly_name: A descriptive string that you create to describe the resource. It is not unique and can be up to 255 characters long.
        :param voice_url: The URL we should call when the BYOC Trunk receives a call.
        :param voice_method: The HTTP method we should use to call `voice_url`. Can be: `GET` or `POST`.
        :param voice_fallback_url: The URL that we should call when an error occurs while retrieving or executing the TwiML from `voice_url`.
        :param voice_fallback_method: The HTTP method we should use to call `voice_fallback_url`. Can be: `GET` or `POST`.
        :param status_callback_url: The URL that we should call to pass status parameters (such as call ended) to your application.
        :param status_callback_method: The HTTP method we should use to call `status_callback_url`. Can be: `GET` or `POST`.
        :param cnam_lookup_enabled: Whether Caller ID Name (CNAM) lookup is enabled for the trunk. If enabled, all inbound calls to the BYOC Trunk from the United States and Canada automatically perform a CNAM Lookup and display Caller ID data on your phone. See [CNAM Lookups](https://www.twilio.com/docs/sip-trunking#CNAM) for more information.
        :param connection_policy_sid: The SID of the Connection Policy that Twilio will use when routing traffic to your communications infrastructure.
        :param from_domain_sid: The SID of the SIP Domain that should be used in the `From` header of originating calls sent to your SIP infrastructure. If your SIP infrastructure allows users to \"call back\" an incoming call, configure this with a [SIP Domain](https://www.twilio.com/docs/voice/api/sending-sip) to ensure proper routing. If not configured, the from domain will default to \"sip.twilio.com\".

        :returns: The created ByocTrunkInstance
        rf   rg   rh   N)r   rj   r2   create_asyncr_   r   rk   r,   r,   r-   rp     s&    zByocTrunkList.create_asyncN)limit	page_sizer0   c                 C   s0   | j ||}| j|d d}| j ||d S )a_  
        Streams ByocTrunkInstance 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
        rr   rr   rq   )r2   read_limitspagestreamr)   rq   rr   Zlimitsru   r,   r,   r-   rv   %  s    zByocTrunkList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )an  
        Asynchronously streams ByocTrunkInstance 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
        rr   rs   Nrq   )r2   rt   
page_asyncstream_asyncrw   r,   r,   r-   ry   >  s    zByocTrunkList.stream_asyncc                 C   s   t | j||dS )a  
        Lists ByocTrunkInstance 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
        rq   rr   )listrv   r)   rq   rr   r,   r,   r-   r{   W  s    zByocTrunkList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists ByocTrunkInstance 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,   )rJ   recordr,   r,   r-   
<listcomp>  s   z,ByocTrunkList.list_async.<locals>.<listcomp>rz   N)ry   r|   r,   r,   r-   
list_asyncq  s    
zByocTrunkList.list_async)
page_tokenpage_numberrr   r0   c                 C   s2   t |||d}| jjd| j|d}t| j|S )aw  
        Retrieve a single page of ByocTrunkInstance 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 ByocTrunkInstance
        Z	PageTokenr   ZPageSizerd   rb   rc   params)r   rj   r2   ru   r_   rl   r)   r   r   rr   ri   responser,   r,   r-   ru     s    zByocTrunkList.pagec                    s8   t |||d}| jjd| j|dI dH }t| j|S )a  
        Asynchronously retrieve a single page of ByocTrunkInstance 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 ByocTrunkInstance
        r   rd   r   N)r   rj   r2   rx   r_   rl   r   r,   r,   r-   rx     s    zByocTrunkList.page_async)
target_urlr0   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of ByocTrunkInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ByocTrunkInstance
        rd   )r2   domaintwiliorequestrl   r)   r   r   r,   r,   r-   get_page  s    	zByocTrunkList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of ByocTrunkInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ByocTrunkInstance
        rd   N)r2   r   r   Zrequest_asyncrl   r   r,   r,   r-   get_page_async  s    	zByocTrunkList.get_page_async)r   r0   c                 C   s   t | j|dS z
        Constructs a ByocTrunkContext

        :param sid: The Twilio-provided string that uniquely identifies the BYOC Trunk resource to update.
        r1   r.   r2   r)   r   r,   r,   r-   r%     s    zByocTrunkList.getc                 C   s   t | j|dS r   r   r   r,   r,   r-   __call__  s    zByocTrunkList.__call__r/   c                 C   s   dS )rD   z<Twilio.Voice.V1.ByocTrunkList>r,   r3   r,   r,   r-   rT     s    zByocTrunkList.__repr__)NN)NN)NN)NN)!rU   rV   rW   r   r$   r   r\   r   rY   r]   r[   r   ro   rp   r   intr   rv   r	   ry   r   r{   r   rl   ru   rx   r   r   r.   r%   r   rT   r^   r,   r,   r*   r-   rn     s   









6









6        





rn   N)rX   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.   rl   rn   r,   r,   r,   r-   <module>   s   $ F A