U
    ^g%i                     @   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   q/var/www/html/api-medvista/venv/lib/python3.8/site-packages/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   GETPOSTr   r   r   r   Method    s   r!   c                   @   s,   e Zd ZdZdZdZdZdZdZdZ	dZ
d	S )
!AddressConfigurationInstance.TypeZsmsZwhatsappZ	messengerZgbmemailrcsappleZchatN)r   r   r   ZSMSZWHATSAPPZ	MESSENGERZGBMZEMAILZRCSZAPPLEZCHATr   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__r   r)   r*   r+   r,   r-   r.   r
   Ziso8601_datetimer/   r0   r1   r2   	_solution_context)selfr'   r(   r)   	__class__r   r   r4   ;   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)   )r6   r:   _versionr5   r7   r   r   r   _proxyT   s    
z#AddressConfigurationInstance._proxyc                 C   s
   | j  S )w
        Deletes the AddressConfigurationInstance


        :returns: True if delete succeeds, False otherwise
        )r@   deleter?   r   r   r   rB   c   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   rD   l   s    z)AddressConfigurationInstance.delete_asyncc                 C   s
   | j  S )u
        Fetch the AddressConfigurationInstance


        :returns: The fetched AddressConfigurationInstance
        )r@   fetchr?   r   r   r   rF   u   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   rH   ~   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-   rJ   rK   rL   rM   rN   rO   rP   rQ   )r@   update
r7   r-   rJ   rK   rL   rM   rN   rO   rP   rQ   r   r   r   rT      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
        rS   N)r@   update_asyncrU   r   r   r   rW      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 {}>joinr5   itemsr\   r7   contextr   r   r   __repr__   s    z%AddressConfigurationInstance.__repr__)N)r   r   r   objectr   r!   r&   r   r   strr   r   r4   propertyr@   boolrB   rD   rF   rH   r   unsetr   r   intrT   rW   rg   __classcell__r   r   r8   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 )r:   )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)r3   r4   r5   r\   _uri)r7   r'   r)   r8   r   r   r4      s
     z$AddressConfigurationContext.__init__r;   c                 C   s   t i }| jjd| j|dS )rA   DELETEmethoduriheaders)r   ofr>   rB   ro   r7   rt   r   r   r   rB      s    
z"AddressConfigurationContext.deletec                    s$   t i }| jjd| j|dI dH S )rC   rp   rq   N)r   ru   r>   rD   ro   rv   r   r   r   rD     s    
  z(AddressConfigurationContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )rE   application/jsonAcceptr   rq   r)   r=   )r   ru   r>   rF   ro   r   r5   r7   rt   r(   r   r   r   rF     s    
z!AddressConfigurationContext.fetchc                    sB   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )rG   rw   rx   r   rq   Nr)   r=   )r   ru   r>   rH   ro   r   r5   ry   r   r   r   rH   (  s    
  z'AddressConfigurationContext.fetch_asyncr   r   rI   c
                 C   sv   t |t|||||t|dd ||	d	}
t i }d|d< d|d< | jjd| j|
|d	}t| j|| j	d
 dS )rR   c                 S   s   | S Nr   er   r   r   <lambda>i      z4AddressConfigurationContext.update.<locals>.<lambda>	FriendlyNameAutoCreation.EnabledAutoCreation.Type#AutoCreation.ConversationServiceSidAutoCreation.WebhookUrlAutoCreation.WebhookMethodAutoCreation.WebhookFiltersAutoCreation.StudioFlowSidAutoCreation.StudioRetryCount!application/x-www-form-urlencodedContent-Typerw   rx   r    rr   rs   datart   r)   r=   )
r   ru   r   boolean_to_stringmapr>   rT   ro   r   r5   r7   r-   rJ   rK   rL   rM   rN   rO   rP   rQ   r   rt   r(   r   r   r   rT   >  s>      
     z"AddressConfigurationContext.updatec
                    s|   t |t|||||t|dd ||	d	}
t i }d|d< d|d< | jjd| j|
|d	I d
H }t| j|| j	d dS )rV   c                 S   s   | S rz   r   r{   r   r   r   r}     r~   z:AddressConfigurationContext.update_async.<locals>.<lambda>r   r   r   rw   rx   r    r   Nr)   r=   )
r   ru   r   r   r   r>   rW   ro   r   r5   r   r   r   r   rW   }  s>      
     z(AddressConfigurationContext.update_asyncc                 C   s$   d dd | j D }d|S )rX   rY   c                 s   s   | ]\}}d  ||V  qdS rZ   r[   r]   r   r   r   ra     s     z7AddressConfigurationContext.__repr__.<locals>.<genexpr>z8<Twilio.Conversations.V1.AddressConfigurationContext {}>rb   re   r   r   r   rg     s    z$AddressConfigurationContext.__repr__)r   r   r   r   ri   r4   rk   rB   rD   r   rF   rH   r   rl   r   rh   r   rm   rT   rW   rg   rn   r   r   r8   r   r:      sp   





A





?r:   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>   )r7   r(   r   r   r   get_instance  s    z%AddressConfigurationPage.get_instancer;   c                 C   s   dS )rX   z2<Twilio.Conversations.V1.AddressConfigurationPage>r   r?   r   r   r   rg     s    z!AddressConfigurationPage.__repr__N)	r   r   r   r   ri   r   r   r   rg   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)r3   r4   ro   )r7   r'   r8   r   r   r4     s    z!AddressConfigurationList.__init__r"   r   r   )r+   r,   r-   rJ   rK   rL   rM   rN   rO   rP   rQ   r2   r<   c                 C   sv   t |||t|||||t|	dd |
||d}t ddi}d|d< d|d< | 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 rz   r   r{   r   r   r   r}     r~   z1AddressConfigurationList.create.<locals>.<lambda>r&   ZAddressr   r   r   r   r   r   r   r   r   ZAddressCountryr   r   rw   rx   r    r   )	r   ru   r   r   r   r>   createro   r   r7   r+   r,   r-   rJ   rK   rL   rM   rN   rO   rP   rQ   r2   r   rt   r(   r   r   r   r     s<    &    zAddressConfigurationList.createc                    s|   t |||t|||||t|	dd |
||d}t ddi}d|d< d|d< | 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 rz   r   r{   r   r   r   r}   a  r~   z7AddressConfigurationList.create_async.<locals>.<lambda>r   r   r   rw   rx   r    r   N)	r   ru   r   r   r   r>   create_asyncro   r   r   r   r   r   r   .  s<    &    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r7   r+   r   r   Zlimitsr   r   r   r   r   t  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     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   r7   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 rz   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   sL   t ||||d}t ddi}d|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   r   rw   rx   r   rr   rs   paramsrt   )r   ru   r>   r   ro   r   r7   r+   r   r   r   r   rt   responser   r   r   r     s     	   zAddressConfigurationList.pagec                    sR   t ||||d}t ddi}d|d< | jjd| j||dI dH }t| j|S )	a  
        Asynchronously retrieve a single page of 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   rw   rx   r   r   N)r   ru   r>   r   ro   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   r7   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_async9  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=   r:   r>   r7   r)   r   r   r   r   E  s    zAddressConfigurationList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__M  s    z!AddressConfigurationList.__call__r;   c                 C   s   dS )rX   z2<Twilio.Conversations.V1.AddressConfigurationList>r   r?   r   r   r   rg   U  s    z!AddressConfigurationList.__repr__)!r   r   r   r   r4   r   rl   ri   r   rh   rk   r   rm   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r:   r   r   rg   rn   r   r   r8   r   r     s   






J






H



 



&



$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   r:   r   r   r   r   r   r   <module>   s   $ Q `