o
    /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*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   m/var/www/html/philips/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S )!AddressConfigurationInstance.Typesmswhatsapp	messengergbmemailN)r   r   r   SMSWHATSAPP	MESSENGERGBM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|pM| ji| _d | _d S )Nr2   account_sidtypeaddressfriendly_nameauto_creationdate_createddate_updatedurladdress_country)super__init__getr2   r3   r4   r5   r6   r7   r
   iso8601_datetimer8   r9   r:   r;   	_solution_context)selfr0   r1   r2   	__class__r   r   r=   8   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
        Nr2   r2   )rA   rF   _versionr@   rB   r   r   r   _proxyQ   s   
z#AddressConfigurationInstance._proxyc                 C   
   | j  S )w
        Deletes the AddressConfigurationInstance


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


        :returns: True if delete succeeds, False otherwise
        N)rJ   delete_asyncrI   r   r   r   rQ   i      z)AddressConfigurationInstance.delete_asyncc                 C   rK   )u
        Fetch the AddressConfigurationInstance


        :returns: The fetched AddressConfigurationInstance
        )rJ   fetchrI   r   r   r   rT   r   rN   z"AddressConfigurationInstance.fetchc                    rO   )
        Asynchronous coroutine to fetch the AddressConfigurationInstance


        :returns: The fetched AddressConfigurationInstance
        N)rJ   fetch_asyncrI   r   r   r   rV   {   rR   z(AddressConfigurationInstance.fetch_asyncr6   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
        	r6   rW   rX   rY   rZ   r[   r\   r]   r^   )rJ   update
rB   r6   rW   rX   rY   rZ   r[   r\   r]   r^   r   r   r   ra      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
        r`   N)rJ   update_asyncrb   r   r   r   rd      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 {}>joinr@   itemsrk   rB   contextr   r   r   __repr__      z%AddressConfigurationInstance.__repr__N)rE   rF   )rE   r   )r   r   r   objectr   r#   r/   r   r   strr   r   r=   propertyrJ   boolrM   rQ   rT   rV   r   unsetr   r   intra   rd   rw   __classcell__r   r   rC   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 )rF   r0   r2   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
        r2   z/Configuration/Addresses/{sid}Nr   )r<   r=   r@   rk   _uri)rB   r0   r2   rC   r   r   r=      s   z$AddressConfigurationContext.__init__rE   c                 C   s   | j jd| jdS )rL   DELETEmethoduri)rH   rM   r   rI   r   r   r   rM      s   z"AddressConfigurationContext.deletec                    s   | j jd| jdI dH S )rP   r   r   N)rH   rQ   r   rI   r   r   r   rQ     s
   z(AddressConfigurationContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )rS   r!   r   r2   rG   )rH   rT   r   r   r@   rB   r1   r   r   r   rT     s   z!AddressConfigurationContext.fetchc                    s0   | j jd| jdI dH }t| j || jd dS )rU   r!   r   Nr2   rG   )rH   rV   r   r   r@   r   r   r   r   rV   !  s   z'AddressConfigurationContext.fetch_asyncr6   rW   rX   r   rY   rZ   r[   r    r\   r]   r^   c
                 C   sT   t ||||||t|dd ||	d	}
| jjd| j|
d}t| j|| jd dS )r_   c                 S      | S ry   r   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"   r   r   datar2   rG   )	r   ofr   maprH   ra   r   r   r@   rB   r6   rW   rX   rY   rZ   r[   r\   r]   r^   r   r1   r   r   r   ra   4  s,   z"AddressConfigurationContext.updatec
                    s\   t ||||||t|dd ||	d	}
| jjd| j|
dI dH }t| j|| jd dS )	rc   c                 S   r   ry   r   r   r   r   r   r     r   z:AddressConfigurationContext.update_async.<locals>.<lambda>r   r"   r   Nr2   rG   )	r   r   r   r   rH   rd   r   r   r@   r   r   r   r   rd   m  s.   z(AddressConfigurationContext.update_asyncc                 C   re   )rf   rg   c                 s   rh   ri   rj   rl   r   r   r   rp     rq   z7AddressConfigurationContext.__repr__.<locals>.<genexpr>z8<Twilio.Conversations.V1.AddressConfigurationContext {}>rr   ru   r   r   r   rw     rx   z$AddressConfigurationContext.__repr__)r   r   r   r   r{   r=   r}   rM   rQ   r   rT   rV   r   r~   r   rz   r   r   ra   rd   rw   r   r   r   rC   r   rF      s    



	


;



	


9rF   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 )AddressConfigurationPager1   rE   c                 C   s   t | j|S )zz
        Build an instance of AddressConfigurationInstance

        :param payload: Payload response from the API
        )r   rH   r   r   r   r   get_instance  s   z%AddressConfigurationPage.get_instancec                 C      dS )rf   z2<Twilio.Conversations.V1.AddressConfigurationPage>r   rI   r   r   r   rw        z!AddressConfigurationPage.__repr__N)	r   r   r   r   r{   r   r   r   rw   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AddressConfigurationListr0   c                    s   t  | d| _dS )zv
        Initialize the AddressConfigurationList

        :param version: Version that contains the resource

        z/Configuration/AddressesN)r<   r=   r   )rB   r0   rC   r   r   r=     s   
z!AddressConfigurationList.__init__r4   r$   r5   r6   rW   rX   r   rY   rZ   r[   r    r\   r]   r^   r;   rE   c                 C   sP   t ||||||||t|	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   ry   r   r   r   r   r   r      r   z1AddressConfigurationList.create.<locals>.<lambda>r/   Addressr   r   r   r   r   r   r   r   r   AddressCountryr"   r   )r   r   r   r   rH   creater   r   rB   r4   r5   r6   rW   rX   rY   rZ   r[   r\   r]   r^   r;   r   r1   r   r   r   r     s.   %zAddressConfigurationList.createc                    sX   t ||||||||t|	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   ry   r   r   r   r   r   r   @  r   z7AddressConfigurationList.create_async.<locals>.<lambda>r   r"   r   N)r   r   r   r   rH   create_asyncr   r   r   r   r   r   r     s0   %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   r4   r   r   )rH   read_limitspagestreamrB   r4   r   r   limitsr   r   r   r   r   P  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   )rH   r   
page_asyncstream_asyncr   r   r   r   r   k  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
        r4   r   r   )listr   rB   r4   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 ry   r   )rm   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   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/   	PageTokenr   PageSizer!   r   r   params)r   r   rH   r   r   r   rB   r4   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   rH   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!   )rH   domaintwiliorequestr   rB   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)rH   r   r   request_asyncr   r   r   r   r   get_page_async  s   	z'AddressConfigurationList.get_page_asyncr2   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
        rG   rF   rH   rB   r2   r   r   r   r>        zAddressConfigurationList.getc                 C   r   r   r   r   r   r   r   __call__  r   z!AddressConfigurationList.__call__c                 C   r   )rf   z2<Twilio.Conversations.V1.AddressConfigurationList>r   rI   r   r   r   rw   '  r   z!AddressConfigurationList.__repr__)!r   r   r   r   r=   r   r~   r{   r   rz   r}   r   r   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   rF   r>   r   rw   r   r   r   rC   r   r     sN   


	

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





B







 




 




 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   rF   r   r   r   r   r   r   <module>   s    $ M M