o
    f>h                     @   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*ded	ee	e
f d
ee	 f fddZed+ddZdefddZdefddZd,ddZd,ddZejejejejejejejejejf	dee	ef deeef dedef dee	ef dee	ef ded ef d!eee	 ef d"ee	ef d#eeef dd fd$d%Zejejejejejejejejejf	dee	ef deeef dedef dee	ef dee	ef ded ef d!eee	 ef d"ee	ef d#eeef dd fd&d'Zde	fd(d)Z  ZS )-AddressConfigurationInstancec                   @   s   e Zd ZdZdZdZdS )-AddressConfigurationInstance.AutoCreationTypewebhookstudiodefaultN)__name__
__module____qualname__WEBHOOKSTUDIODEFAULT r   r   e/var/www/html/venv/lib/python3.10/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   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ZdZ	dZ
d	S )
!AddressConfigurationInstance.Typesmswhatsapp	messengergbmemailrcsapplechatN)r   r   r   SMSWHATSAPP	MESSENGERGBMEMAILRCSAPPLECHATr   r   r   r   Type$   s    r5   Nversionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _t	
|d| _|d	| _|d
| _d|pM| ji| _d | _d S )Nr8   account_sidtypeaddressfriendly_nameauto_creationdate_createddate_updatedurladdress_country)super__init__getr8   r9   r:   r;   r<   r=   r
   iso8601_datetimer>   r?   r@   rA   	_solution_context)selfr6   r7   r8   	__class__r   r   rC   ;   s$   

z%AddressConfigurationInstance.__init__returnAddressConfigurationContextc                 C   s&   | j du 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
        Nr8   r8   )rG   rL   _versionrF   rH   r   r   r   _proxyT   s   
z#AddressConfigurationInstance._proxyc                 C   
   | j  S )w
        Deletes the AddressConfigurationInstance


        :returns: True if delete succeeds, False otherwise
        )rP   deleterO   r   r   r   rS   c      
z#AddressConfigurationInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the AddressConfigurationInstance


        :returns: True if delete succeeds, False otherwise
        N)rP   delete_asyncrO   r   r   r   rW   l      z)AddressConfigurationInstance.delete_asyncc                 C   rQ   )u
        Fetch the AddressConfigurationInstance


        :returns: The fetched AddressConfigurationInstance
        )rP   fetchrO   r   r   r   rZ   u   rT   z"AddressConfigurationInstance.fetchc                    rU   )
        Asynchronous coroutine to fetch the AddressConfigurationInstance


        :returns: The fetched AddressConfigurationInstance
        N)rP   fetch_asyncrO   r   r   r   r\   ~   rX   z(AddressConfigurationInstance.fetch_asyncr<   auto_creation_enabledauto_creation_typer   &auto_creation_conversation_service_sidauto_creation_webhook_urlauto_creation_webhook_methodr    auto_creation_webhook_filtersauto_creation_studio_flow_sid auto_creation_studio_retry_countc
           
      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<   r]   r^   r_   r`   ra   rb   rc   rd   )rP   update
rH   r<   r]   r^   r_   r`   ra   rb   rc   rd   r   r   r   rg      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
        rf   N)rP   update_asyncrh   r   r   r   rj      s   z)AddressConfigurationInstance.update_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr   r   r   	<genexpr>       z8AddressConfigurationInstance.__repr__.<locals>.<genexpr>z9<Twilio.Conversations.V1.AddressConfigurationInstance {}>joinrF   itemsrq   rH   contextr   r   r   __repr__      z%AddressConfigurationInstance.__repr__N)rK   rL   )rK   r   )r   r   r   objectr   r#   r5   r   r   strr   r   rC   propertyrP   boolrS   rW   rZ   r\   r   unsetr   r   intrg   rj   r}   __classcell__r   r   rI   r   r      s    

	
	
	



	


-



	


+r   c                       s  e Zd Zdedef fddZdefddZdefdd	Zde	fd
dZ
de	fddZejejejejejejejejejf	deeef deeef dedef deeef deeef dedef deee ef deeef deeef de	fddZejejejejejejejejejf	deeef deeef dedef deeef deeef dedef deee ef deeef deeef de	fddZdefddZ  ZS )rL   r6   r8   c                    s.   t  | d|i| _djdi | 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
        r8   z/Configuration/Addresses/{sid}Nr   )rB   rC   rF   rq   _uri)rH   r6   r8   rI   r   r   rC      s   z$AddressConfigurationContext.__init__rK   c                 C   s   t i }| jjd| j|dS )rR   DELETEmethoduriheaders)r   ofrN   rS   r   rH   r   r   r   r   rS      s   
z"AddressConfigurationContext.deletec                    s&   t i }| jjd| j|dI dH S )rV   r   r   N)r   r   rN   rW   r   r   r   r   r   rW     s
   
z(AddressConfigurationContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )rY   application/jsonAcceptr!   r   r8   rM   )r   r   rN   rZ   r   r   rF   rH   r   r7   r   r   r   rZ     s   
z!AddressConfigurationContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r[   r   r   r!   r   Nr8   rM   )r   r   rN   r\   r   r   rF   r   r   r   r   r\   (  s   
z'AddressConfigurationContext.fetch_asyncr<   r]   r^   r   r_   r`   ra   r    rb   rc   rd   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 )re   c                 S      | S r   r   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-Typer   r   r"   r   r   datar   r8   rM   )
r   r   r   boolean_to_stringmaprN   rg   r   r   rF   rH   r<   r]   r^   r_   r`   ra   rb   rc   rd   r   r   r7   r   r   r   rg   >  s2    

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 )ri   c                 S   r   r   r   r   r   r   r   r     r   z:AddressConfigurationContext.update_async.<locals>.<lambda>r   r   r   r   r   r"   r   Nr8   rM   )
r   r   r   r   r   rN   rj   r   r   rF   r   r   r   r   rj   }  s4    

z(AddressConfigurationContext.update_asyncc                 C   rk   )rl   rm   c                 s   rn   ro   rp   rr   r   r   r   rv     rw   z7AddressConfigurationContext.__repr__.<locals>.<genexpr>z8<Twilio.Conversations.V1.AddressConfigurationContext {}>rx   r{   r   r   r   r}     r~   z$AddressConfigurationContext.__repr__)r   r   r   r   r   rC   r   rS   rW   r   rZ   r\   r   r   r   r   r   r   rg   rj   r}   r   r   r   rI   r   rL      s    



	


A



	


?rL   c                   @   s4   e Zd Zdeeef defddZdefddZdS )AddressConfigurationPager7   rK   c                 C   s   t | j|S )zz
        Build an instance of AddressConfigurationInstance

        :param payload: Payload response from the API
        )r   rN   )rH   r7   r   r   r   get_instance  s   z%AddressConfigurationPage.get_instancec                 C      dS )rl   z2<Twilio.Conversations.V1.AddressConfigurationPage>r   rO   r   r   r   r}        z!AddressConfigurationPage.__repr__N)	r   r   r   r   r   r   r   r   r}   r   r   r   r   r     s    r   c                       sp  e Zd Zdef 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ddedeee	f dee
e	f d	ed
e	f deee	f deee	f dede	f deee e	f deee	f deee	f deee	f de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ddedeee	f dee
e	f d	ed
e	f deee	f deee	f dede	f deee e	f deee	f deee	f deee	f defddZejddfdeee	f dee dee dee fddZejddfdeee	f dee dee dee fddZejddfdeee	f dee dee dee fdd Zejddfdeee	f dee dee dee fd!d"Zejejejejfdeee	f d#eee	f d$eee	f deee	f def
d%d&Zejejejejfdeee	f d#eee	f d$eee	f deee	f def
d'd(Zd)edefd*d+Zd)edefd,d-Zd.edefd/d0Zd.edefd1d2Zdefd3d4Z  Z S )5AddressConfigurationListr6   c                    s   t  | d| _dS )zv
        Initialize the AddressConfigurationList

        :param version: Version that contains the resource

        z/Configuration/AddressesN)rB   rC   r   )rH   r6   rI   r   r   rC     s   
z!AddressConfigurationList.__init__r:   r$   r;   r<   r]   r^   r   r_   r`   ra   r    rb   rc   rd   rA   rK   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   r   r   r   r   r   r   r   r     r   z1AddressConfigurationList.create.<locals>.<lambda>r5   Addressr   r   r   r   r   r   r   r   r   AddressCountryr   r   r   r   r"   r   )	r   r   r   r   r   rN   creater   r   rH   r:   r;   r<   r]   r^   r_   r`   ra   rb   rc   rd   rA   r   r   r7   r   r   r   r     s4   &
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   r   r   r   r   r   r   r   r   a  r   z7AddressConfigurationList.create_async.<locals>.<lambda>r   r   r   r   r   r"   r   N)	r   r   r   r   r   rN   create_asyncr   r   r   r   r   r   r   .  s6   &
z%AddressConfigurationList.create_asyncNlimit	page_sizec                 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   )rN   read_limitspagestreamrH   r:   r   r   limitsr   r   r   r   r   t  s   zAddressConfigurationList.streamc                    s:   | 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   )rN   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   rH   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 r   r   )rs   recordr   r   r   
<listcomp>  s
    z7AddressConfigurationList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async  s   
z#AddressConfigurationList.list_async
page_tokenpage_numberc                 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
        r5   	PageTokenr   PageSizer   r   r   r   r!   r   r   paramsr   )r   r   rN   r   r   r   rH   r:   r   r   r   r   r   responser   r   r   r     s   	
zAddressConfigurationList.pagec                    sT   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   r   r   r!   r   N)r   r   rN   r   r   r   r   r   r   r   r   	  s   	
z#AddressConfigurationList.page_async
target_urlc                 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!   )rN   domaintwiliorequestr   rH   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)rN   r   r   request_asyncr   r   r   r   r   get_page_async9  s   	z'AddressConfigurationList.get_page_asyncr8   c                 C      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
        rM   rL   rN   rH   r8   r   r   r   rD   E     zAddressConfigurationList.getc                 C   r   r   r   r   r   r   r   __call__M  r   z!AddressConfigurationList.__call__c                 C   r   )rl   z2<Twilio.Conversations.V1.AddressConfigurationList>r   rO   r   r   r   r}   U  r   z!AddressConfigurationList.__repr__)!r   r   r   r   rC   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   rL   rD   r   r}   r   r   r   rI   r   r     sN   


	





J


	





H







 




&




$r   N)__doc__r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   rL   r   r   r   r   r   r   <module>   s    $ Q `