U
    hRf                     @   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 - Conversations
    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G dd deZG dd deZG dd de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f	ee	ef eeef edef ee	ef ee	ef edef e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f	ee	ef eeef edef ee	ef ee	ef edef eee	 ef ee	ef eeef d d
ddZe	dddZ  ZS )!AddressConfigurationInstancec                   @   s   e Zd ZdZdZdZdS )-AddressConfigurationInstance.AutoCreationTypeZwebhookZstudiodefaultN)__name__
__module____qualname__ZWEBHOOKZSTUDIODEFAULT r   r   V/tmp/pip-unpacked-wheel-74se_viw/twilio/rest/conversations/v1/address_configuration.pyAutoCreationType   s   r   c                   @   s   e Zd ZdZdZdS )#AddressConfigurationInstance.MethodGETPOSTN)r   r   r   r   r   r   r   r   r   Method    s   r   c                   @   s    e Zd ZdZdZdZdZdZdS )!AddressConfigurationInstance.TypeZsmsZwhatsappZ	messengerZgbmemailN)r   r   r   ZSMSZWHATSAPPZ	MESSENGERZGBMZEMAILr   r   r   r   Type$   s
   r"   N)versionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _t	
|d| _|d	| _|d
| _d|p| ji| _d | _d S )Nr%   account_sidtypeaddressfriendly_nameauto_creationdate_createddate_updatedurladdress_country)super__init__getr%   r&   r'   r(   r)   r*   r
   iso8601_datetimer+   r,   r-   r.   	_solution_context)selfr#   r$   r%   	__class__r   r   r0   8   s&     z%AddressConfigurationInstance.__init__AddressConfigurationContextreturnc                 C   s&   | j dkr t| j| jd d| _ | j S )a  
        Generate an instance context for the instance, the context is capable of
        performing various actions. All instance actions are proxied to the context

        :returns: AddressConfigurationContext for this AddressConfigurationInstance
        Nr%   r%   )r4   r8   _versionr3   r5   r   r   r   _proxyQ   s    
z#AddressConfigurationInstance._proxyc                 C   s
   | j  S )w
        Deletes the AddressConfigurationInstance


        :returns: True if delete succeeds, False otherwise
        )r>   deleter=   r   r   r   r@   `   s    z#AddressConfigurationInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the AddressConfigurationInstance


        :returns: True if delete succeeds, False otherwise
        N)r>   delete_asyncr=   r   r   r   rB   i   s    z)AddressConfigurationInstance.delete_asyncc                 C   s
   | j  S )u
        Fetch the AddressConfigurationInstance


        :returns: The fetched AddressConfigurationInstance
        )r>   fetchr=   r   r   r   rD   r   s    z"AddressConfigurationInstance.fetchc                    s   | j  I dH S )
        Asynchronous coroutine to fetch the AddressConfigurationInstance


        :returns: The fetched AddressConfigurationInstance
        N)r>   fetch_asyncr=   r   r   r   rF   {   s    z(AddressConfigurationInstance.fetch_asyncr   r   
r)   auto_creation_enabledauto_creation_type&auto_creation_conversation_service_sidauto_creation_webhook_urlauto_creation_webhook_methodauto_creation_webhook_filtersauto_creation_studio_flow_sid auto_creation_studio_retry_countr:   c
           
      C   s   | j j|||||||||	d	S )  
        Update the AddressConfigurationInstance

        :param friendly_name: The human-readable name of this configuration, limited to 256 characters. Optional.
        :param auto_creation_enabled: Enable/Disable auto-creating conversations for messages to this address
        :param auto_creation_type:
        :param auto_creation_conversation_service_sid: Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service.
        :param auto_creation_webhook_url: For type `webhook`, the url for the webhook request.
        :param auto_creation_webhook_method:
        :param auto_creation_webhook_filters: The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated`
        :param auto_creation_studio_flow_sid: For type `studio`, the studio flow SID where the webhook should be sent to.
        :param auto_creation_studio_retry_count: For type `studio`, number of times to retry the webhook request

        :returns: The updated AddressConfigurationInstance
        	r)   rH   rI   rJ   rK   rL   rM   rN   rO   )r>   update
r5   r)   rH   rI   rJ   rK   rL   rM   rN   rO   r   r   r   rR      s    z#AddressConfigurationInstance.updatec
           
         s$   | j j|||||||||	d	I dH S )/  
        Asynchronous coroutine to update the AddressConfigurationInstance

        :param friendly_name: The human-readable name of this configuration, limited to 256 characters. Optional.
        :param auto_creation_enabled: Enable/Disable auto-creating conversations for messages to this address
        :param auto_creation_type:
        :param auto_creation_conversation_service_sid: Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service.
        :param auto_creation_webhook_url: For type `webhook`, the url for the webhook request.
        :param auto_creation_webhook_method:
        :param auto_creation_webhook_filters: The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated`
        :param auto_creation_studio_flow_sid: For type `studio`, the studio flow SID where the webhook should be sent to.
        :param auto_creation_studio_retry_count: For type `studio`, number of times to retry the webhook request

        :returns: The updated AddressConfigurationInstance
        rQ   N)r>   update_asyncrS   r   r   r   rU      s    z)AddressConfigurationInstance.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     z8AddressConfigurationInstance.__repr__.<locals>.<genexpr>z9<Twilio.Conversations.V1.AddressConfigurationInstance {}>joinr3   itemsrZ   r5   contextr   r   r   __repr__   s    z%AddressConfigurationInstance.__repr__)N)r   r   r   objectr   r   r"   r   r   strr   r   r0   propertyr>   boolr@   rB   rD   rF   r   unsetr   r   intrR   rU   re   __classcell__r   r   r6   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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def eeef eeef edef e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f	eeef eeef edef eeef eeef edef eee ef eeef eeef e	d
ddZedddZ  ZS )r8   )r#   r%   c                    s*   t  | d|i| _djf | j| _dS )a  
        Initialize the AddressConfigurationContext

        :param version: Version that contains the resource
        :param sid: The SID of the Address Configuration resource. This value can be either the `sid` or the `address` of the configuration
        r%   z/Configuration/Addresses/{sid}N)r/   r0   r3   rZ   _uri)r5   r#   r%   r6   r   r   r0      s
     z$AddressConfigurationContext.__init__r9   c                 C   s   | j jd| jdS )r?   DELETEmethoduri)r<   r@   rm   r=   r   r   r   r@      s    z"AddressConfigurationContext.deletec                    s   | j jd| jdI dH S )rA   rn   ro   N)r<   rB   rm   r=   r   r   r   rB     s    z(AddressConfigurationContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )rC   r   ro   r%   r;   )r<   rD   rm   r   r3   r5   r$   r   r   r   rD     s    z!AddressConfigurationContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )rE   r   ro   Nr%   r;   )r<   rF   rm   r   r3   rr   r   r   r   rF   "  s    z'AddressConfigurationContext.fetch_asyncr   r   rG   c
                 C   sZ   t |t|||||t|dd ||	d	}
| jjd| j|
d}t| j|| j	d dS )rP   c                 S   s   | S Nr   er   r   r   <lambda>_      z4AddressConfigurationContext.update.<locals>.<lambda>	FriendlyNameAutoCreation.EnabledAutoCreation.Type#AutoCreation.ConversationServiceSidAutoCreation.WebhookUrlAutoCreation.WebhookMethodAutoCreation.WebhookFiltersAutoCreation.StudioFlowSidAutoCreation.StudioRetryCountr   rp   rq   datar%   r;   )
r   ofr   boolean_to_stringmapr<   rR   rm   r   r3   r5   r)   rH   rI   rJ   rK   rL   rM   rN   rO   r   r$   r   r   r   rR   5  s6       z"AddressConfigurationContext.updatec
                    s`   t |t|||||t|dd ||	d	}
| jjd| j|
dI dH }t| j|| j	d dS )	rT   c                 S   s   | S rs   r   rt   r   r   r   rv     rw   z:AddressConfigurationContext.update_async.<locals>.<lambda>rx   r   r   Nr%   r;   )
r   r   r   r   r   r<   rU   rm   r   r3   r   r   r   r   rU   p  s6       z(AddressConfigurationContext.update_asyncc                 C   s$   d dd | j D }d|S )rV   rW   c                 s   s   | ]\}}d  ||V  qdS rX   rY   r[   r   r   r   r_     s     z7AddressConfigurationContext.__repr__.<locals>.<genexpr>z8<Twilio.Conversations.V1.AddressConfigurationContext {}>r`   rc   r   r   r   re     s    z$AddressConfigurationContext.__repr__)r   r   r   r   rg   r0   ri   r@   rB   r   rD   rF   r   rj   r   rf   r   rk   rR   rU   re   rl   r   r   r6   r   r8      sp   





=





;r8   c                   @   s2   e Zd Zeeef edddZedddZdS )AddressConfigurationPage)r$   r:   c                 C   s   t | j|S )zz
        Build an instance of AddressConfigurationInstance

        :param payload: Payload response from the API
        )r   r<   rr   r   r   r   get_instance  s    z%AddressConfigurationPage.get_instancer9   c                 C   s   dS )rV   z2<Twilio.Conversations.V1.AddressConfigurationPage>r   r=   r   r   r   re     s    z!AddressConfigurationPage.__repr__N)	r   r   r   r   rg   r   r   r   re   r   r   r   r   r     s   r   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
deeee	f ee
e	f ede	f eee	f eee	f ede	f e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
deeee	f ee
e	f ede	f eee	f eee	f ede	f eee e	f eee	f eee	f eee	f edd
dZejddfeee	f ee ee ee dddZejddfeee	f ee ee ee dddZejddfeee	f ee ee ee dddZejddfeee	f ee ee ee dddZ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dddZ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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 )(AddressConfigurationList)r#   c                    s   t  | d| _dS )zv
        Initialize the AddressConfigurationList

        :param version: Version that contains the resource

        z/Configuration/AddressesN)r/   r0   rm   )r5   r#   r6   r   r   r0     s    z!AddressConfigurationList.__init__r    r   r   )r'   r(   r)   rH   rI   rJ   rK   rL   rM   rN   rO   r.   r:   c                 C   sf   t |||t|||||t|	dd |
||d}t ddi}| jjd| j||d}t| j|S )a:  
        Create the AddressConfigurationInstance

        :param type:
        :param address: The unique address to be configured. The address can be a whatsapp address or phone number
        :param friendly_name: The human-readable name of this configuration, limited to 256 characters. Optional.
        :param auto_creation_enabled: Enable/Disable auto-creating conversations for messages to this address
        :param auto_creation_type:
        :param auto_creation_conversation_service_sid: Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service.
        :param auto_creation_webhook_url: For type `webhook`, the url for the webhook request.
        :param auto_creation_webhook_method:
        :param auto_creation_webhook_filters: The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated`
        :param auto_creation_studio_flow_sid: For type `studio`, the studio flow SID where the webhook should be sent to.
        :param auto_creation_studio_retry_count: For type `studio`, number of times to retry the webhook request
        :param address_country: An ISO 3166-1 alpha-2n country code which the address belongs to. This is currently only applicable to short code addresses.

        :returns: The created AddressConfigurationInstance
        c                 S   s   | S rs   r   rt   r   r   r   rv   
  rw   z1AddressConfigurationList.create.<locals>.<lambda>r"   ZAddressry   rz   r{   r|   r}   r~   r   r   r   ZAddressCountryContent-Type!application/x-www-form-urlencodedr   rp   rq   r   headers)	r   r   r   r   r   r<   createrm   r   r5   r'   r(   r)   rH   rI   rJ   rK   rL   rM   rN   rO   r.   r   r   r$   r   r   r   r     s8    &    zAddressConfigurationList.createc                    sl   t |||t|||||t|	dd |
||d}t ddi}| jjd| j||dI dH }t| j|S )	aI  
        Asynchronously create the AddressConfigurationInstance

        :param type:
        :param address: The unique address to be configured. The address can be a whatsapp address or phone number
        :param friendly_name: The human-readable name of this configuration, limited to 256 characters. Optional.
        :param auto_creation_enabled: Enable/Disable auto-creating conversations for messages to this address
        :param auto_creation_type:
        :param auto_creation_conversation_service_sid: Conversation Service for the auto-created conversation. If not set, the conversation is created in the default service.
        :param auto_creation_webhook_url: For type `webhook`, the url for the webhook request.
        :param auto_creation_webhook_method:
        :param auto_creation_webhook_filters: The list of events, firing webhook event for this Conversation. Values can be any of the following: `onMessageAdded`, `onMessageUpdated`, `onMessageRemoved`, `onConversationUpdated`, `onConversationStateUpdated`, `onConversationRemoved`, `onParticipantAdded`, `onParticipantUpdated`, `onParticipantRemoved`, `onDeliveryUpdated`
        :param auto_creation_studio_flow_sid: For type `studio`, the studio flow SID where the webhook should be sent to.
        :param auto_creation_studio_retry_count: For type `studio`, number of times to retry the webhook request
        :param address_country: An ISO 3166-1 alpha-2n country code which the address belongs to. This is currently only applicable to short code addresses.

        :returns: The created AddressConfigurationInstance
        c                 S   s   | S rs   r   rt   r   r   r   rv   L  rw   z7AddressConfigurationList.create_async.<locals>.<lambda>r   r   r   r   r   N)	r   r   r   r   r   r<   create_asyncrm   r   r   r   r   r   r     s8    &    z%AddressConfigurationList.create_asyncN)r'   limit	page_sizer:   c                 C   s2   | j ||}| j||d d}| j ||d S )a  
        Streams AddressConfigurationInstance 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 str type: Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`.
        :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   r   )r<   read_limitspagestreamr5   r'   r   r   Zlimitsr   r   r   r   r   [  s    zAddressConfigurationList.streamc                    s8   | j ||}| j||d dI dH }| j ||d S )a  
        Asynchronously streams AddressConfigurationInstance 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 str type: Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`.
        :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   )r<   r   
page_asyncstream_asyncr   r   r   r   r   v  s    z%AddressConfigurationList.stream_asyncc                 C   s   t | j|||dS )a|  
        Lists AddressConfigurationInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str type: Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`.
        :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   r   )listr   r5   r'   r   r   r   r   r   r     s    zAddressConfigurationList.listc                    s&   dd | j |||dI dH 2 I dH S )a  
        Asynchronously lists AddressConfigurationInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str type: Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`.
        :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 rs   r   )r\   recordr   r   r   
<listcomp>  s   z7AddressConfigurationList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async  s    
z#AddressConfigurationList.list_async)r'   
page_tokenpage_numberr   r:   c                 C   s4   t ||||d}| jjd| j|d}t| j|S )a  
        Retrieve a single page of AddressConfigurationInstance records from the API.
        Request is executed immediately

        :param type: Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`.
        :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 AddressConfigurationInstance
        r"   Z	PageTokenr   ZPageSizer   rp   rq   params)r   r   r<   r   rm   r   r5   r'   r   r   r   r   responser   r   r   r     s    	zAddressConfigurationList.pagec                    s:   t ||||d}| jjd| j|dI dH }t| j|S )a  
        Asynchronously retrieve a single page of AddressConfigurationInstance records from the API.
        Request is executed immediately

        :param type: Filter the address configurations by its type. This value can be one of: `whatsapp`, `sms`.
        :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 AddressConfigurationInstance
        r   r   r   N)r   r   r<   r   rm   r   r   r   r   r   r     s    	  z#AddressConfigurationList.page_async)
target_urlr:   c                 C   s   | j jjd|}t| j |S )a  
        Retrieve a specific page of AddressConfigurationInstance records from the API.
        Request is executed immediately

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

        :returns: Page of AddressConfigurationInstance
        r   )r<   domaintwiliorequestr   r5   r   r   r   r   r   get_page
  s    	z!AddressConfigurationList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of AddressConfigurationInstance records from the API.
        Request is executed immediately

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

        :returns: Page of AddressConfigurationInstance
        r   N)r<   r   r   Zrequest_asyncr   r   r   r   r   get_page_async  s    	z'AddressConfigurationList.get_page_async)r%   r:   c                 C   s   t | j|dS z
        Constructs a AddressConfigurationContext

        :param sid: The SID of the Address Configuration resource. This value can be either the `sid` or the `address` of the configuration
        r;   r8   r<   r5   r%   r   r   r   r1   "  s    zAddressConfigurationList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__*  s    z!AddressConfigurationList.__call__r9   c                 C   s   dS )rV   z2<Twilio.Conversations.V1.AddressConfigurationList>r   r=   r   r   r   re   2  s    z!AddressConfigurationList.__repr__)!r   r   r   r   r0   r   rj   rg   r   rf   ri   r   rk   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r8   r1   r   re   rl   r   r   r6   r   r     s   






F






D



 



 



 r   N)__doc__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   r8   r   r   r   r   r   r   <module>   s   $ N R