o
    e_                     @   s   d 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	 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 )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd Z fddZejddfddZejddfddZejejejejfdd	Zd
d Z	ejejejejejejejejejejejejejejfddZ
dd Zdd Zdd Z  ZS )FlexFlowListc                    s.   t t| | i | _djdi | j| _dS )z
        Initialize the FlexFlowList

        :param Version version: Version that contains the resource

        :returns: twilio.rest.flex_api.v1.flex_flow.FlexFlowList
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowList
        z
/FlexFlowsN )superr   __init__	_solutionformat_uri)selfversion	__class__r	   T/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/flex_api/v1/flex_flow.pyr      s   	zFlexFlowList.__init__Nc                 C   s2   | j ||}| j||d d}| j ||d S )a  
        Streams FlexFlowInstance 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 unicode friendly_name: The `friendly_name` of the Flex Flow resources to read
        :param int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int 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
        :rtype: list[twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance]
        	page_size)friendly_namer   limit)_versionread_limitspagestream)r   r   r   r   limitsr   r	   r	   r   r   "   s   zFlexFlowList.streamc                 C   s   t | j|||dS )a  
        Lists FlexFlowInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param unicode friendly_name: The `friendly_name` of the Flex Flow resources to read
        :param int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int 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: Generator that will yield up to limit results
        :rtype: list[twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance]
        )r   r   r   )listr   )r   r   r   r   r	   r	   r   r   :   s   zFlexFlowList.listc                 C   s8   t ||||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of FlexFlowInstance records from the API.
        Request is executed immediately

        :param unicode friendly_name: The `friendly_name` of the Flex Flow resources to read
        :param str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of FlexFlowInstance
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowPage
        )FriendlyName	PageTokenr   PageSizeGET)methoduriparams)r   ofr   r   r   FlexFlowPager   )r   r   
page_tokenpage_numberr   dataresponser	   r	   r   r   M   s   zFlexFlowList.pagec                 C   s"   | j jjd|}t| j || jS )a8  
        Retrieve a specific page of FlexFlowInstance records from the API.
        Request is executed immediately

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

        :returns: Page of FlexFlowInstance
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowPage
        r    )r   domaintwiliorequestr%   r   )r   
target_urlr)   r	   r	   r   get_pagef   s
   

zFlexFlowList.get_pagec                 C   s   t i d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|}| jjd| j|d}t| j|S )a@  
        Create the FlexFlowInstance

        :param unicode friendly_name: A string to describe the resource
        :param unicode chat_service_sid: The SID of the chat service
        :param FlexFlowInstance.ChannelType channel_type: The channel type
        :param unicode contact_identity: The channel contact's Identity
        :param bool enabled: Whether the new Flex Flow is enabled
        :param FlexFlowInstance.IntegrationType integration_type: The software that will handle inbound messages.
        :param unicode integration_flow_sid: The SID of the Studio Flow
        :param unicode integration_url: The External Webhook URL
        :param unicode integration_workspace_sid: The Workspace SID for a new Task
        :param unicode integration_workflow_sid: The Workflow SID for a new Task
        :param unicode integration_channel: The Task Channel for a new Task
        :param unicode integration_timeout: The Task timeout in seconds for a new Task
        :param unicode integration_priority: The Task priority of a new Task
        :param bool integration_creation_on_message: Whether to create a Task when the first message arrives
        :param bool long_lived: Reuse this chat channel for future interactions with a contact
        :param bool janitor_enabled: Remove active Proxy sessions if the corresponding Task is deleted
        :param unicode integration_retry_count: The number of times to retry the Studio Flow or webhook in case of failure

        :returns: The created FlexFlowInstance
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance
        r   ChatServiceSidChannelTypeContactIdentityEnabledIntegrationTypeIntegration.FlowSidIntegration.UrlIntegration.WorkspaceSidIntegration.WorkflowSidIntegration.ChannelIntegration.TimeoutIntegration.PriorityIntegration.CreationOnMessage	LongLivedJanitorEnabledIntegration.RetryCountPOSTr!   r"   r(   )r   r$   r   creater   FlexFlowInstancer   r   chat_service_sidchannel_typecontact_identityenabledintegration_typeintegration_flow_sidintegration_urlintegration_workspace_sidintegration_workflow_sidintegration_channelintegration_timeoutintegration_priorityintegration_creation_on_message
long_livedjanitor_enabledintegration_retry_countr(   payloadr	   r	   r   rA   w   sJ   "	
zFlexFlowList.createc                 C      t | j|dS z
        Constructs a FlexFlowContext

        :param sid: The SID that identifies the resource to fetch

        :returns: twilio.rest.flex_api.v1.flex_flow.FlexFlowContext
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowContext
        sidFlexFlowContextr   r   rX   r	   r	   r   get      	zFlexFlowList.getc                 C   rU   rV   rY   r[   r	   r	   r   __call__   r]   zFlexFlowList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z <Twilio.FlexApi.V1.FlexFlowList>r	   r   r	   r	   r   __repr__      zFlexFlowList.__repr__)__name__
__module____qualname__r   r   unsetr   r   r   r.   rA   r\   r^   rb   __classcell__r	   r	   r   r   r      s*    

:r   c                       s,   e Zd Z fddZdd Zdd Z  ZS )r%   c                    s   t t| || || _dS )a*  
        Initialize the FlexFlowPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API

        :returns: twilio.rest.flex_api.v1.flex_flow.FlexFlowPage
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowPage
        N)r
   r%   r   r   )r   r   r)   solutionr   r	   r   r      s   

zFlexFlowPage.__init__c                 C   s   t | j|S )z
        Build an instance of FlexFlowInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance
        )rB   r   r   rT   r	   r	   r   get_instance   s   	zFlexFlowPage.get_instancec                 C   r_   )r`   z <Twilio.FlexApi.V1.FlexFlowPage>r	   ra   r	   r	   r   rb      rc   zFlexFlowPage.__repr__)rd   re   rf   r   rk   rb   rh   r	   r	   r   r   r%      s    r%   c                       s   e Zd Z fddZdd ZejejejejejejejejejejejejejejejejejfddZdd Zd	d
 Z	  Z
S )rZ   c                    s2   t t| | d|i| _djdi | j| _dS )a=  
        Initialize the FlexFlowContext

        :param Version version: Version that contains the resource
        :param sid: The SID that identifies the resource to fetch

        :returns: twilio.rest.flex_api.v1.flex_flow.FlexFlowContext
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowContext
        rX   z/FlexFlows/{sid}Nr	   )r
   rZ   r   r   r   r   )r   r   rX   r   r	   r   r      s   

zFlexFlowContext.__init__c                 C   s(   | j jd| jd}t| j || jd dS )
        Fetch the FlexFlowInstance

        :returns: The fetched FlexFlowInstance
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance
        r    r!   r"   rX   rW   )r   fetchr   rB   r   rj   r	   r	   r   rn   	  s   zFlexFlowContext.fetchc                 C   s   t i d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|}| jjd| j|d}t| j|| jd dS )@  
        Update the FlexFlowInstance

        :param unicode friendly_name: A string to describe the resource
        :param unicode chat_service_sid: The SID of the chat service
        :param FlexFlowInstance.ChannelType channel_type: The channel type
        :param unicode contact_identity: The channel contact's Identity
        :param bool enabled: Whether the new Flex Flow is enabled
        :param FlexFlowInstance.IntegrationType integration_type: The software that will handle inbound messages.
        :param unicode integration_flow_sid: The SID of the Studio Flow
        :param unicode integration_url: The External Webhook URL
        :param unicode integration_workspace_sid: The Workspace SID for a new Task
        :param unicode integration_workflow_sid: The Workflow SID for a new Task
        :param unicode integration_channel: The Task Channel for a new Task
        :param unicode integration_timeout: The Task timeout in seconds for a new Task
        :param unicode integration_priority: The Task priority of a new Task
        :param bool integration_creation_on_message: Whether to create a Task when the first message arrives
        :param bool long_lived: Reuse this chat channel for future interactions with a contact
        :param bool janitor_enabled: Remove active Proxy sessions if the corresponding Task is deleted
        :param unicode integration_retry_count: The number of times to retry the Studio Flow or webhook in case of failure

        :returns: The updated FlexFlowInstance
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance
        r   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rX   rW   )r   r$   r   updater   rB   r   rC   r	   r	   r   rp     sJ   #	
zFlexFlowContext.updatec                 C   s   | j jd| jdS )
        Deletes the FlexFlowInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErm   )r   deleter   ra   r	   r	   r   rs   O  s   zFlexFlowContext.deletec                 C   $   d dd | j D }d|S )r`    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr	   r	   r   	<genexpr>_      z+FlexFlowContext.__repr__.<locals>.<genexpr>z&<Twilio.FlexApi.V1.FlexFlowContext {}>joinr   itemsr   r   contextr	   r	   r   rb   X     
zFlexFlowContext.__repr__)rd   re   rf   r   rn   r   rg   rp   rs   rb   rh   r	   r	   r   r   rZ      s"    
;	rZ   c                       sX  e Zd ZG dd deZG dd deZd. fdd	Zedd	 Zed
d Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zed d! Zed"d# Zed$d% Zd&d' Zejejejejejejejejejejejejejejejejejfd(d)Zd*d+ Zd,d- Z  ZS )/rB   c                   @   s$   e Zd ZdZdZdZdZdZdZdS )zFlexFlowInstance.ChannelTypewebsmsfacebookwhatsapplinecustomN)	rd   re   rf   WEBSMSFACEBOOKWHATSAPPLINECUSTOMr	   r	   r	   r   r0   e  s    r0   c                   @   s   e Zd ZdZdZdZdS )z FlexFlowInstance.IntegrationTypestudioexternaltaskN)rd   re   rf   STUDIOEXTERNALTASKr	   r	   r	   r   r3   m  s    r3   Nc                    s   t t| | |dt|dt|d|d|d|d|d|d|d	|d
|d|d|d|dd| _d| _d|pT| jd i| _dS )z
        Initialize the FlexFlowInstance

        :returns: twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowInstance
        account_siddate_createddate_updatedrX   r   rD   rE   rF   rG   rH   integrationrQ   rR   url)r   r   r   rX   r   rD   rE   rF   rG   rH   r   rQ   rR   r   N)	r
   rB   r   r\   r   iso8601_datetime_properties_contextr   )r   r   rT   rX   r   r	   r   r   r  s$   zFlexFlowInstance.__init__c                 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: FlexFlowContext for this FlexFlowInstance
        :rtype: twilio.rest.flex_api.v1.flex_flow.FlexFlowContext
        NrX   rW   )r   rZ   r   r   ra   r	   r	   r   _proxy  s   
	zFlexFlowInstance._proxyc                 C   
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        r   r   ra   r	   r	   r   r        
zFlexFlowInstance.account_sidc                 C   r   )zt
        :returns: The ISO 8601 date and time in GMT when the resource was created
        :rtype: datetime
        r   r   ra   r	   r	   r   r     r   zFlexFlowInstance.date_createdc                 C   r   )zy
        :returns: The ISO 8601 date and time in GMT when the resource was last updated
        :rtype: datetime
        r   r   ra   r	   r	   r   r     r   zFlexFlowInstance.date_updatedc                 C   r   )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rX   r   ra   r	   r	   r   rX     r   zFlexFlowInstance.sidc                 C   r   )zi
        :returns: The string that you assigned to describe the resource
        :rtype: unicode
        r   r   ra   r	   r	   r   r     r   zFlexFlowInstance.friendly_namec                 C   r   )zO
        :returns: The SID of the chat service
        :rtype: unicode
        rD   r   ra   r	   r	   r   rD     r   z!FlexFlowInstance.chat_service_sidc                 C   r   )zY
        :returns: The channel type
        :rtype: FlexFlowInstance.ChannelType
        rE   r   ra   r	   r	   r   rE     r   zFlexFlowInstance.channel_typec                 C   r   )zR
        :returns: The channel contact's Identity
        :rtype: unicode
        rF   r   ra   r	   r	   r   rF     r   z!FlexFlowInstance.contact_identityc                 C   r   )zQ
        :returns: Whether the Flex Flow is enabled
        :rtype: bool
        rG   r   ra   r	   r	   r   rG     r   zFlexFlowInstance.enabledc                 C   r   )z|
        :returns: The software that will handle inbound messages.
        :rtype: FlexFlowInstance.IntegrationType
        rH   r   ra   r	   r	   r   rH     r   z!FlexFlowInstance.integration_typec                 C   r   )zp
        :returns: An object that contains specific parameters for the integration
        :rtype: dict
        r   r   ra   r	   r	   r   r     r   zFlexFlowInstance.integrationc                 C   r   )zp
        :returns: Re-use this chat channel for future interactions with a contact
        :rtype: bool
        rQ   r   ra   r	   r	   r   rQ     r   zFlexFlowInstance.long_livedc                 C   r   )zs
        :returns: Remove active Proxy sessions if the corresponding Task is deleted.
        :rtype: bool
        rR   r   ra   r	   r	   r   rR     r   z FlexFlowInstance.janitor_enabledc                 C   r   )z^
        :returns: The absolute URL of the Flex Flow resource
        :rtype: unicode
        r   r   ra   r	   r	   r   r     r   zFlexFlowInstance.urlc                 C   
   | j  S )rl   )r   rn   ra   r	   r	   r   rn        
zFlexFlowInstance.fetchc                 C   st   | j jdi d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|S )ro   r   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   Nr	   )r   rp   )r   r   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   r	   r	   r   rp     sF   #	
zFlexFlowInstance.updatec                 C   r   )rq   )r   rs   ra   r	   r	   r   rs   N  r   zFlexFlowInstance.deletec                 C   rt   )r`   ru   c                 s   rv   rw   rx   ry   r	   r	   r   r}   ^  r~   z,FlexFlowInstance.__repr__.<locals>.<genexpr>z'<Twilio.FlexApi.V1.FlexFlowInstance {}>r   r   r	   r	   r   rb   W  r   zFlexFlowInstance.__repr__)N)rd   re   rf   objectr0   r3   r   propertyr   r   r   r   rX   r   rD   rE   rF   rG   rH   r   rQ   rR   r   rn   r   rg   rp   rs   rb   rh   r	   r	   r   r   rB   c  sb    














	
7	rB   N)__doc__twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r   r%   rZ   rB   r	   r	   r	   r   <module>   s    A&l