U
    ^g%i'Q                     @   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 - 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	serialize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
   Ziso8601_datetimer   r   	_solution_context)selfr   r   r   	__class__ ^/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/flex_api/v1/channel.pyr   %   s"     zChannelInstance.__init__ChannelContextreturnc                 C   s&   | j dk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/   K   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   T   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   f   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>u   s     z+ChannelInstance.__repr__.<locals>.<genexpr>z&<Twilio.FlexApi.V1.ChannelInstance {}>joinr    itemsr:   r"   contextr%   r%   r&   __repr__o   s    zChannelInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr/   r1   r3   r5   rE   __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 | 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   t i }| jjd| j|dS )r.   DELETEmethoduriheaders)r   ofr+   r/   rN   r"   rS   r%   r%   r&   r/      s    
zChannelContext.deletec                    s$   t i }| jjd| j|dI dH S )r0   rO   rP   N)r   rT   r+   r1   rN   rU   r%   r%   r&   r1      s    
  zChannelContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r2   application/jsonAcceptGETrP   r   r*   )r   rT   r+   r3   rN   r   r    r"   rS   r   r%   r%   r&   r3      s    
zChannelContext.fetchc                    sB   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r4   rV   rW   rX   rP   Nr   r*   )r   rT   r+   r5   rN   r   r    rY   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?      s     z*ChannelContext.__repr__.<locals>.<genexpr>z%<Twilio.FlexApi.V1.ChannelContext {}>r@   rC   r%   r%   r&   rE      s    zChannelContext.__repr__)rF   rG   rH   r   rJ   r   rL   r/   r1   r   r3   r5   rE   rM   r%   r%   r#   r&   r'   y   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+   )r"   r   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&   rE      s    zChannelPage.__repr__N)	rF   rG   rH   r   rJ   r   r   r[   rE   r%   r%   r%   r&   rZ      s   rZ   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   rN   )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   sf   t |||||||||	t|
d
}t ddi}d|d< d|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Content-Type!application/x-www-form-urlencodedrV   rW   POSTrQ   rR   datarS   )r   rT   r   boolean_to_stringr+   createrN   r   r"   r   r]   r^   r_   r`   ra   rb   r   rc   rd   rj   rS   r   r%   r%   r&   rl      s.       zChannelList.createc                    sl   t |||||||||	t|
d
}t ddi}d|d< d|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
        re   rf   rg   rV   rW   rh   ri   N)r   rT   r   rk   r+   create_asyncrN   r   rm   r%   r%   r&   rn   0  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
        rp   rp   ro   )r+   read_limitspagestreamr"   ro   rp   Zlimitsrs   r%   r%   r&   rt   h  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
        rp   rq   Nro   )r+   rr   
page_asyncstream_asyncru   r%   r%   r&   rw     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
        ro   rp   )listrt   r"   ro   rp   r%   r%   r&   ry     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>rx   N)rw   rz   r%   r%   r&   
list_async  s    
zChannelList.list_async)
page_tokenpage_numberrp   r)   c                 C   sJ   t |||d}t ddi}d|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PageSizerf   rg   rV   rW   rX   rQ   rR   paramsrS   )r   rT   r+   rs   rN   rZ   r"   r~   r   rp   rj   rS   responser%   r%   r&   rs     s       zChannelList.pagec                    sP   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 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
        r   rf   rg   rV   rW   rX   r   N)r   rT   r+   rv   rN   rZ   r   r%   r%   r&   rv     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
        rX   )r+   domaintwiliorequestrZ   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
        rX   N)r+   r   r   Zrequest_asyncrZ   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__1  s    zChannelList.__call__r(   c                 C   s   dS )r6   z<Twilio.FlexApi.V1.ChannelList>r%   r,   r%   r%   r&   rE   9  s    zChannelList.__repr__)NN)NN)NN)NN)!rF   rG   rH   r   r   r   unsetrJ   r   objectrL   r   rl   rn   r   intr   rt   r	   rw   r   ry   r}   rZ   rs   rv   r   r   r'   r   r   rE   rM   r%   r%   r#   r&   r\      s   





>





:        


#


!r\   N)rI   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   r'   rZ   r\   r%   r%   r%   r&   <module>   s   $`_