a
    !fQM                     @   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 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 - Flex
    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values)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s   e Zd Zd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dddZ  ZS )ChannelInstanceak  
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Channel resource and owns this Workflow.
    :ivar flex_flow_sid: The SID of the Flex Flow.
    :ivar sid: The unique string that we created to identify the Channel resource.
    :ivar user_sid: The SID of the chat user.
    :ivar task_sid: The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external`
    :ivar url: The absolute URL of the Flex chat channel resource.
    :ivar date_created: The date and time in GMT when the Flex chat channel was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar date_updated: The date and time in GMT when the Flex chat channel was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    N)versionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _t	
|d| _t	
|d| _d|p| ji| _d | _d S )	Naccount_sidflex_flow_sidr   user_sidtask_sidurldate_createddate_updated)super__init__getr   r   r   r   r   r   r
   iso8601_datetimer   r   	_solution_context)selfr   r   r   	__class__ `/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/flex_api/v1/channel.pyr   '   s     
zChannelInstance.__init__ChannelContextreturnc                 C   s&   | j du r t| j| jd d| _ | j S )z
        Generate an instance context for the instance, the context is capable of
        performing various actions. All instance actions are proxied to the context

        :returns: ChannelContext for this ChannelInstance
        Nr   r   )r!   r'   _versionr    r"   r%   r%   r&   _proxy>   s    
zChannelInstance._proxyc                 C   s
   | j  S )j
        Deletes the ChannelInstance


        :returns: True if delete succeeds, False otherwise
        )r-   deleter,   r%   r%   r&   r/   M   s    zChannelInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the ChannelInstance


        :returns: True if delete succeeds, False otherwise
        N)r-   delete_asyncr,   r%   r%   r&   r1   V   s    zChannelInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the ChannelInstance


        :returns: The fetched ChannelInstance
        )r-   fetchr,   r%   r%   r&   r3   _   s    zChannelInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the ChannelInstance


        :returns: The fetched ChannelInstance
        N)r-   fetch_asyncr,   r%   r%   r&   r5   h   s    zChannelInstance.fetch_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>w       z+ChannelInstance.__repr__.<locals>.<genexpr>z&<Twilio.FlexApi.V1.ChannelInstance {}>joinr    itemsr:   r"   contextr%   r%   r&   __repr__q   s    zChannelInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr/   r1   r3   r5   rF   __classcell__r%   r%   r#   r&   r      s    				r   c                       sj   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dddZ  ZS )r'   )r   r   c                    s.   t  | d|i| _djf i | j| _dS )z
        Initialize the ChannelContext

        :param version: Version that contains the resource
        :param sid: The SID of the Flex chat channel resource to fetch.
        r   z/Channels/{sid}N)r   r   r    r:   _uri)r"   r   r   r#   r%   r&   r   |   s    zChannelContext.__init__r(   c                 C   s   | j jd| jdS )r.   DELETEmethoduri)r+   r/   rO   r,   r%   r%   r&   r/      s    zChannelContext.deletec                    s   | j jd| jdI dH S )r0   rP   rQ   N)r+   r1   rO   r,   r%   r%   r&   r1      s    zChannelContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )r2   GETrQ   r   r*   )r+   r3   rO   r   r    r"   r   r%   r%   r&   r3      s    zChannelContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )r4   rT   rQ   Nr   r*   )r+   r5   rO   r   r    rU   r%   r%   r&   r5      s    zChannelContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r6   r7   c                 s   s   | ]\}}d  ||V  qdS r8   r9   r;   r%   r%   r&   r?      r@   z*ChannelContext.__repr__.<locals>.<genexpr>z%<Twilio.FlexApi.V1.ChannelContext {}>rA   rD   r%   r%   r&   rF      s    zChannelContext.__repr__)rG   rH   rI   r   rK   r   rM   r/   r1   r   r3   r5   rF   rN   r%   r%   r#   r&   r'   {   s   r'   c                   @   s2   e Zd Zeeef edddZedddZdS )ChannelPage)r   r)   c                 C   s   t | j|S )zm
        Build an instance of ChannelInstance

        :param payload: Payload response from the API
        )r   r+   rU   r%   r%   r&   get_instance   s    zChannelPage.get_instancer(   c                 C   s   dS )r6   z<Twilio.FlexApi.V1.ChannelPage>r%   r,   r%   r%   r&   rF      s    zChannelPage.__repr__N)	rG   rH   rI   r   rK   r   r   rW   rF   r%   r%   r%   r&   rV      s   rV   c                       s<  e Zd Zed fddZejejejejejejfeeeeeee	f eee	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ejejfeeeeeee	f eee	f eee	f eee	f eee	f ee
e	f edddZd%ee ee ee d
ddZd&ee ee ee d
ddZd'ee ee ee d
ddZd(ee ee ee d
ddZejejejfeee	f eee	f eee	f edddZejejej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 ))ChannelList)r   c                    s   t  | d| _dS )zi
        Initialize the ChannelList

        :param version: Version that contains the resource

        z	/ChannelsN)r   r   rO   )r"   r   r#   r%   r&   r      s    zChannelList.__init__)r   identitychat_user_friendly_namechat_friendly_nametargetchat_unique_namepre_engagement_datar   task_attributes
long_livedr)   c                 C   s@   t |||||||||	|
d
}| jjd| j|d}t| j|S )a  
        Create the ChannelInstance

        :param flex_flow_sid: The SID of the Flex Flow.
        :param identity: The `identity` value that uniquely identifies the new resource's chat User.
        :param chat_user_friendly_name: The chat participant's friendly name.
        :param chat_friendly_name: The chat channel's friendly name.
        :param target: The Target Contact Identity, for example the phone number of an SMS.
        :param chat_unique_name: The chat channel's unique name.
        :param pre_engagement_data: The pre-engagement data.
        :param task_sid: The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external`
        :param task_attributes: The Task attributes to be added for the TaskRouter Task.
        :param long_lived: Whether to create the channel as long-lived.

        :returns: The created ChannelInstance
        
ZFlexFlowSidZIdentityZChatUserFriendlyNameZChatFriendlyNameZTargetZChatUniqueNameZPreEngagementDataZTaskSidZTaskAttributesZ	LongLivedPOSTrR   rS   data)r   ofr+   createrO   r   r"   r   rY   rZ   r[   r\   r]   r^   r   r_   r`   rd   r   r%   r%   r&   rf      s&    zChannelList.createc                    sF   t |||||||||	|
d
}| jjd| j|dI dH }t| j|S )a  
        Asynchronously create the ChannelInstance

        :param flex_flow_sid: The SID of the Flex Flow.
        :param identity: The `identity` value that uniquely identifies the new resource's chat User.
        :param chat_user_friendly_name: The chat participant's friendly name.
        :param chat_friendly_name: The chat channel's friendly name.
        :param target: The Target Contact Identity, for example the phone number of an SMS.
        :param chat_unique_name: The chat channel's unique name.
        :param pre_engagement_data: The pre-engagement data.
        :param task_sid: The SID of the TaskRouter Task. Only valid when integration type is `task`. `null` for integration types `studio` & `external`
        :param task_attributes: The Task attributes to be added for the TaskRouter Task.
        :param long_lived: Whether to create the channel as long-lived.

        :returns: The created ChannelInstance
        ra   rb   rc   N)r   re   r+   create_asyncrO   r   rg   r%   r%   r&   rh   %  s&    zChannelList.create_asyncN)limit	page_sizer)   c                 C   s0   | j ||}| j|d d}| j ||d S )a]  
        Streams ChannelInstance 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 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
        rj   rj   ri   )r+   read_limitspagestreamr"   ri   rj   Zlimitsrm   r%   r%   r&   rn   Y  s    zChannelList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )al  
        Asynchronously streams ChannelInstance 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 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
        rj   rk   Nri   )r+   rl   
page_asyncstream_asyncro   r%   r%   r&   rq   r  s    zChannelList.stream_asyncc                 C   s   t | j||dS )a  
        Lists ChannelInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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
        ri   rj   )listrn   r"   ri   rj   r%   r%   r&   rs     s    zChannelList.listc                    s$   dd | j ||dI dH 2 I dH S )a	  
        Asynchronously lists ChannelInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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 )Nr%   )r<   recordr%   r%   r&   
<listcomp>  s   z*ChannelList.list_async.<locals>.<listcomp>rr   N)rq   rt   r%   r%   r&   
list_async  s    
zChannelList.list_async)
page_tokenpage_numberrj   r)   c                 C   s2   t |||d}| jjd| j|d}t| j|S )as  
        Retrieve a single page of ChannelInstance records from the API.
        Request is executed immediately

        :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 ChannelInstance
        Z	PageTokenr   ZPageSizerT   rR   rS   params)r   re   r+   rm   rO   rV   r"   rx   ry   rj   rd   responser%   r%   r&   rm     s    zChannelList.pagec                    s8   t |||d}| jjd| j|dI dH }t| j|S )a  
        Asynchronously retrieve a single page of ChannelInstance records from the API.
        Request is executed immediately

        :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 ChannelInstance
        rz   rT   r{   N)r   re   r+   rp   rO   rV   r}   r%   r%   r&   rp     s    zChannelList.page_async)
target_urlr)   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of ChannelInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ChannelInstance
        rT   )r+   domaintwiliorequestrV   r"   r   r~   r%   r%   r&   get_page  s    	zChannelList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of ChannelInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ChannelInstance
        rT   N)r+   r   r   Zrequest_asyncrV   r   r%   r%   r&   get_page_async  s    	zChannelList.get_page_async)r   r)   c                 C   s   t | j|dS zv
        Constructs a ChannelContext

        :param sid: The SID of the Flex chat channel resource to fetch.
        r*   r'   r+   r"   r   r%   r%   r&   r     s    zChannelList.getc                 C   s   t | j|dS r   r   r   r%   r%   r&   __call__  s    zChannelList.__call__r(   c                 C   s   dS )r6   z<Twilio.FlexApi.V1.ChannelList>r%   r,   r%   r%   r&   rF      s    zChannelList.__repr__)NN)NN)NN)NN)!rG   rH   rI   r   r   r   unsetrK   r   objectrM   r   rf   rh   r   intr   rn   r	   rq   r   rs   rw   rV   rm   rp   r   r   r'   r   r   rF   rN   r%   r%   r#   r&   rX      s   





:





6        





rX   N)rJ   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   r'   rV   rX   r%   r%   r%   r&   <module>   s   $aX