U
    iRf                     @   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 - 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	serialize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__ C/tmp/pip-unpacked-wheel-74se_viw/twilio/rest/voice/v1/byoc_trunk.pyr%   ,   s4     zByocTrunkInstance.__init__ByocTrunkContext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: ByocTrunkContext for this ByocTrunkInstance
        Nr   r   )r)   r/   _versionr(   r*   r-   r-   r.   _proxyL   s    
zByocTrunkInstance._proxyc                 C   s
   | j  S )l
        Deletes the ByocTrunkInstance


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


        :returns: True if delete succeeds, False otherwise
        N)r5   delete_asyncr4   r-   r-   r.   r9   d   s    zByocTrunkInstance.delete_asyncc                 C   s
   | j  S )_
        Fetch the ByocTrunkInstance


        :returns: The fetched ByocTrunkInstance
        )r5   fetchr4   r-   r-   r.   r;   m   s    zByocTrunkInstance.fetchc                    s   | j  I dH S )y
        Asynchronous coroutine to fetch the ByocTrunkInstance


        :returns: The fetched ByocTrunkInstance
        N)r5   fetch_asyncr4   r-   r-   r.   r=   v   s    zByocTrunkInstance.fetch_asyncr   r   r   r   r   r   r   r   r   r    r1   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    )r5   updater*   r   r   r   r   r   r   r   r   r   r    r-   r-   r.   rA      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)r5   update_asyncrB   r-   r-   r.   rD      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>   s     z-ByocTrunkInstance.__repr__.<locals>.<genexpr>z&<Twilio.Voice.V1.ByocTrunkInstance {}>joinr(   itemsrI   r*   contextr-   r-   r.   __repr__   s    zByocTrunkInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r%   propertyr5   boolr7   r9   r;   r=   r   unsetr   objectrA   rD   rT   __classcell__r-   r-   r+   r.   r      sx     
  			









,









*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 | 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(   rI   _uri)r*   r   r   r+   r-   r.   r%      s
     zByocTrunkContext.__init__r0   c                 C   s   | j jd| jdS )r6   DELETEmethoduri)r3   r7   r_   r4   r-   r-   r.   r7      s    zByocTrunkContext.deletec                    s   | j jd| jdI dH S )r8   r`   ra   N)r3   r9   r_   r4   r-   r-   r.   r9      s    zByocTrunkContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )r:   GETra   r   r2   )r3   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   r2   )r3   r=   r_   r   r(   re   r-   r-   r.   r=     s    zByocTrunkContext.fetch_asyncr>   c                 C   sP   t |||||||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   r2   )	r   ofr   boolean_to_stringr3   rA   r_   r   r(   r*   r   r   r   r   r   r   r   r   r   r    ri   r   r-   r-   r.   rA   ,  s&    zByocTrunkContext.updatec                    sV   t |||||||t||	|
d
}| jjd| j|dI dH }t| j|| jd dS )rC   rf   rg   rh   Nr   r2   )	r   rj   r   rk   r3   rD   r_   r   r(   rl   r-   r-   r.   rD   `  s&    zByocTrunkContext.update_asyncc                 C   s$   d dd | j D }d|S )rE   rF   c                 s   s   | ]\}}d  ||V  qdS rG   rH   rJ   r-   r-   r.   rN     s     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[   r7   r9   r   r;   r=   r   r\   r   r]   rA   rD   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   r1   c                 C   s   t | j|S )zo
        Build an instance of ByocTrunkInstance

        :param payload: Payload response from the API
        )r   r3   re   r-   r-   r.   get_instance  s    zByocTrunkPage.get_instancer0   c                 C   s   dS )rE   z<Twilio.Voice.V1.ByocTrunkPage>r-   r4   r-   r-   r.   rT     s    zByocTrunkPage.__repr__N)	rU   rV   rW   r   rY   r   r   rn   rT   r-   r-   r-   r.   rm     s   rm   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   sV   t |||||||t||	|
d
}t ddi}| 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   Content-Type!application/x-www-form-urlencodedrg   rb   rc   ri   headers)r   rj   r   rk   r3   creater_   r   r*   r   r   r   r   r   r   r   r   r   r    ri   rs   r   r-   r-   r.   rt     s*       zByocTrunkList.createc                    s\   t |||||||t||	|
d
}t ddi}| 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   rp   rq   rg   rr   N)r   rj   r   rk   r3   create_asyncr_   r   ru   r-   r-   r.   rv     s*       zByocTrunkList.create_asyncN)limit	page_sizer1   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
        rx   rx   rw   )r3   read_limitspagestreamr*   rw   rx   Zlimitsr{   r-   r-   r.   r|   &  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
        rx   ry   Nrw   )r3   rz   
page_asyncstream_asyncr}   r-   r-   r.   r   ?  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
        rw   rx   )listr|   r*   rw   rx   r-   r-   r.   r   X  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-   )rK   recordr-   r-   r.   
<listcomp>  s   z,ByocTrunkList.list_async.<locals>.<listcomp>r   N)r   r   r-   r-   r.   
list_asyncr  s    
zByocTrunkList.list_async)
page_tokenpage_numberrx   r1   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   r3   r{   r_   rm   r*   r   r   rx   ri   responser-   r-   r.   r{     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   r3   r~   r_   rm   r   r-   r-   r.   r~     s      zByocTrunkList.page_async)
target_urlr1   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   )r3   domaintwiliorequestrm   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)r3   r   r   Zrequest_asyncrm   r   r-   r-   r.   get_page_async  s    	zByocTrunkList.get_page_async)r   r1   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.
        r2   r/   r3   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__r0   c                 C   s   dS )rE   z<Twilio.Voice.V1.ByocTrunkList>r-   r4   r-   r-   r.   rT     s    zByocTrunkList.__repr__)NN)NN)NN)NN)!rU   rV   rW   r   r%   r   r\   r   rY   r]   r[   r   rt   rv   r   intr   r|   r	   r   r   r   r   rm   r{   r~   r   r   r/   r&   r   rT   r^   r-   r-   r+   r.   ro     s   









6









6        





ro   N)rX   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/   rm   ro   r-   r-   r-   r.   <module>   s   $ E B