a
    !f                     @   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   s/var/www/html/python-backend/venv/lib/python3.9/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S )!AddressConfigurationInstance.TypeZsmsZwhatsappZ	messengerZgbmN)r   r   r   ZSMSZWHATSAPPZ	MESSENGERZGBMr   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   r/   7   s$    
z%AddressConfigurationInstance.__init__AddressConfigurationContextreturnc                 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
        Nr$   r$   )r3   r7   _versionr2   r4   r   r   r   _proxyP   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   rA   h   s    z)AddressConfigurationInstance.delete_asyncc                 C   s
   | j  S )u
        Fetch the AddressConfigurationInstance


        :returns: The fetched AddressConfigurationInstance
        )r=   fetchr<   r   r   r   rC   q   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   rE   z   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_countr9   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(   rG   rH   rI   rJ   rK   rL   rM   rN   )r=   update
r4   r(   rG   rH   rI   rJ   rK   rL   rM   rN   r   r   r   rQ      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
        rP   N)r=   update_asyncrR   r   r   r   rT      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>       z8AddressConfigurationInstance.__repr__.<locals>.<genexpr>z9<Twilio.Conversations.V1.AddressConfigurationInstance {}>joinr2   itemsrY   r4   contextr   r   r   __repr__   s    z%AddressConfigurationInstance.__repr__)N)r   r   r   objectr   r   r!   r   r   strr   r   r/   propertyr=   boolr?   rA   rC   rE   r   unsetr   r   intrQ   rT   re   __classcell__r   r   r5   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 )r7   )r"   r$   c                    s.   t  | d|i| _djf 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
        r$   z/Configuration/Addresses/{sid}N)r.   r/   r2   rY   _uri)r4   r"   r$   r5   r   r   r/      s    z$AddressConfigurationContext.__init__r8   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 )r@   rn   ro   N)r;   rA   rm   r<   r   r   r   rA     s    z(AddressConfigurationContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )rB   r   ro   r$   r:   )r;   rC   rm   r   r2   r4   r#   r   r   r   rC     s    z!AddressConfigurationContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )rD   r   ro   Nr$   r:   )r;   rE   rm   r   r2   rr   r   r   r   rE      s    z'AddressConfigurationContext.fetch_asyncr   r   rF   c
                 C   sT   t ||||||t|dd ||	d	}
| jjd| j|
d}t| j|| jd dS )rO   c                 S   s   | S Nr   er   r   r   <lambda>[  r_   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   mapr;   rQ   rm   r   r2   r4   r(   rG   rH   rI   rJ   rK   rL   rM   rN   r   r#   r   r   r   rQ   3  s,    z"AddressConfigurationContext.updatec
                    sZ   t ||||||t|dd ||	d	}
| jjd| j|
dI dH }t| j|| jd dS )	rS   c                 S   s   | S rs   r   rt   r   r   r   rv     r_   z:AddressConfigurationContext.update_async.<locals>.<lambda>rw   r   r   Nr$   r:   )	r   r   r   r   r;   rT   rm   r   r2   r   r   r   r   rT   l  s,    z(AddressConfigurationContext.update_asyncc                 C   s$   d dd | j D }d|S )rU   rV   c                 s   s   | ]\}}d  ||V  qdS rW   rX   rZ   r   r   r   r^     r_   z7AddressConfigurationContext.__repr__.<locals>.<genexpr>z8<Twilio.Conversations.V1.AddressConfigurationContext {}>r`   rc   r   r   r   re     s    z$AddressConfigurationContext.__repr__)r   r   r   r   rg   r/   ri   r?   rA   r   rC   rE   r   rj   r   rf   r   rk   rQ   rT   re   rl   r   r   r5   r   r7      sp   





;





9r7   c                   @   s2   e Zd Zeeef edddZedddZdS )AddressConfigurationPage)r#   r9   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_instancer8   c                 C   s   dS )rU   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.   r/   rm   )r4   r"   r5   r   r   r/     s    z!AddressConfigurationList.__init__r    r   r   )r&   r'   r(   rG   rH   rI   rJ   rK   rL   rM   rN   r-   r9   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   s   | S rs   r   rt   r   r   r   rv     r_   z1AddressConfigurationList.create.<locals>.<lambda>r!   ZAddressrx   ry   rz   r{   r|   r}   r~   r   r   ZAddressCountryr   r   )r   r   r   r   r;   createrm   r   r4   r&   r'   r(   rG   rH   rI   rJ   rK   rL   rM   rN   r-   r   r#   r   r   r   r     s.    %zAddressConfigurationList.createc                    sV   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   s   | S rs   r   rt   r   r   r   rv   ?  r_   z7AddressConfigurationList.create_async.<locals>.<lambda>r   r   r   N)r   r   r   r   r;   create_asyncrm   r   r   r   r   r   r     s.    %z%AddressConfigurationList.create_asyncN)r&   limit	page_sizer9   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r4   r&   r   r   Zlimitsr   r   r   r   r   O  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   j  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   r4   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   r9   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   r4   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_urlr9   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   r4   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$   r9   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:   r7   r;   r4   r$   r   r   r   r0     s    zAddressConfigurationList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__  s    z!AddressConfigurationList.__call__r8   c                 C   s   dS )rU   z2<Twilio.Conversations.V1.AddressConfigurationList>r   r<   r   r   r   re   &  s    z!AddressConfigurationList.__repr__)!r   r   r   r   r/   r   rj   rg   r   rf   ri   r   rk   r   r   r   r   r   r   r	   r   r   r   r   r   r   r   r   r7   r0   r   re   rl   r   r   r5   r   r     s   






D






B



 



 



 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   r7   r   r   r   r   r   r   <module>   s   $ L M