U
    ^g%iV                     @   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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fedef eeef d dddZejejfedef eeef d dddZedddZ  ZS )WebChannelInstancec                   @   s   e Zd ZdZdS )WebChannelInstance.ChatStatusZinactiveN)__name__
__module____qualname__ZINACTIVE r   r   b/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/flex_api/v1/web_channel.py
ChatStatus   s   r   N)versionpayloadsidc                    sz   t  | |d| _|d| _|d| _|d| _t|d| _	t|d| _
d|pj| ji| _d | _d S )Naccount_sidflex_flow_sidr   urldate_createddate_updated)super__init__getr   r   r   r   r
   Ziso8601_datetimer   r    	_solution_context)selfr   r   r   	__class__r   r   r"   '   s     zWebChannelInstance.__init__WebChannelContext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: WebChannelContext for this WebChannelInstance
        Nr   r   )r%   r)   _versionr$   r&   r   r   r   _proxy<   s    
zWebChannelInstance._proxyc                 C   s
   | j  S )m
        Deletes the WebChannelInstance


        :returns: True if delete succeeds, False otherwise
        )r/   deleter.   r   r   r   r1   K   s    zWebChannelInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the WebChannelInstance


        :returns: True if delete succeeds, False otherwise
        N)r/   delete_asyncr.   r   r   r   r3   T   s    zWebChannelInstance.delete_asyncc                 C   s
   | j  S )a
        Fetch the WebChannelInstance


        :returns: The fetched WebChannelInstance
        )r/   fetchr.   r   r   r   r5   ]   s    zWebChannelInstance.fetchc                    s   | j  I dH S ){
        Asynchronous coroutine to fetch the WebChannelInstance


        :returns: The fetched WebChannelInstance
        N)r/   fetch_asyncr.   r   r   r   r7   f   s    zWebChannelInstance.fetch_asyncr   chat_statuspost_engagement_datar+   c                 C   s   | j j||dS )
        Update the WebChannelInstance

        :param chat_status:
        :param post_engagement_data: The post-engagement data.

        :returns: The updated WebChannelInstance
        r9   r:   )r/   updater&   r9   r:   r   r   r   r=   o   s    zWebChannelInstance.updatec                    s   | j j||dI dH S )
        Asynchronous coroutine to update the WebChannelInstance

        :param chat_status:
        :param post_engagement_data: The post-engagement data.

        :returns: The updated WebChannelInstance
        r<   N)r/   update_asyncr>   r   r   r   r@      s    zWebChannelInstance.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>   s     z.WebChannelInstance.__repr__.<locals>.<genexpr>z)<Twilio.FlexApi.V1.WebChannelInstance {}>joinr$   itemsrE   r&   contextr   r   r   __repr__   s    zWebChannelInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r"   propertyr/   boolr1   r3   r5   r7   r   unsetr   r=   r@   rP   __classcell__r   r   r'   r   r      s8     
 			



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fedef eeef e	dddZejejfedef eeef 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 WebChannelContext

        :param version: Version that contains the resource
        :param sid: The SID of the WebChannel resource to update.
        r   z/WebChannels/{sid}N)r!   r"   r$   rE   _uri)r&   r   r   r'   r   r   r"      s
     zWebChannelContext.__init__r*   c                 C   s   t i }| jjd| j|dS )r0   DELETEmethoduriheaders)r   ofr-   r1   rW   r&   r\   r   r   r   r1      s    
zWebChannelContext.deletec                    s$   t i }| jjd| j|dI dH S )r2   rX   rY   N)r   r]   r-   r3   rW   r^   r   r   r   r3      s    
  zWebChannelContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r4   application/jsonAcceptGETrY   r   r,   )r   r]   r-   r5   rW   r   r$   r&   r\   r   r   r   r   r5      s    
zWebChannelContext.fetchc                    sB   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r6   r_   r`   ra   rY   Nr   r,   )r   r]   r-   r7   rW   r   r$   rb   r   r   r   r7      s    
  zWebChannelContext.fetch_asyncr   r8   c                 C   sV   t ||d}t i }d|d< d|d< | jjd| j||d}t| j|| jd d	S )
r;   r   ZPostEngagementData!application/x-www-form-urlencodedContent-Typer_   r`   POSTrZ   r[   datar\   r   r,   )r   r]   r-   r=   rW   r   r$   r&   r9   r:   rh   r\   r   r   r   r   r=      s    
   zWebChannelContext.updatec                    s\   t ||d}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )r?   rc   rd   re   r_   r`   rf   rg   Nr   r,   )r   r]   r-   r@   rW   r   r$   ri   r   r   r   r@     s    
   zWebChannelContext.update_asyncc                 C   s$   d dd | j D }d|S )rA   rB   c                 s   s   | ]\}}d  ||V  qdS rC   rD   rF   r   r   r   rJ   8  s     z-WebChannelContext.__repr__.<locals>.<genexpr>z(<Twilio.FlexApi.V1.WebChannelContext {}>rK   rN   r   r   r   rP   2  s    zWebChannelContext.__repr__)r   r   r   r   rR   r"   rT   r1   r3   r   r5   r7   r   rU   r   rQ   r=   r@   rP   rV   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 )WebChannelPage)r   r+   c                 C   s   t | j|S )zp
        Build an instance of WebChannelInstance

        :param payload: Payload response from the API
        )r   r-   )r&   r   r   r   r   get_instance>  s    zWebChannelPage.get_instancer*   c                 C   s   dS )rA   z"<Twilio.FlexApi.V1.WebChannelPage>r   r.   r   r   r   rP   F  s    zWebChannelPage.__repr__N)	r   r   r   r   rR   r   r   rk   rP   r   r   r   r   rj   <  s   rj   c                	       s  e Zd Zed fddZejejfeeeeeee	f eee	f e
dddZejejfeeee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 ))WebChannelList)r   c                    s   t  | d| _dS )zl
        Initialize the WebChannelList

        :param version: Version that contains the resource

        z/WebChannelsN)r!   r"   rW   )r&   r   r'   r   r   r"   Q  s    zWebChannelList.__init__)r   identitycustomer_friendly_namechat_friendly_namechat_unique_namepre_engagement_datar+   c           
   	   C   sX   t ||||||d}t ddi}d|d< d|d< | jjd| j||d}	t| j|	S )a  
        Create the WebChannelInstance

        :param flex_flow_sid: The SID of the Flex Flow.
        :param identity: The chat identity.
        :param customer_friendly_name: The chat participant's friendly name.
        :param chat_friendly_name: The chat channel's friendly name.
        :param chat_unique_name: The chat channel's unique name.
        :param pre_engagement_data: The pre-engagement data.

        :returns: The created WebChannelInstance
        ZFlexFlowSidZIdentityZCustomerFriendlyNameZChatFriendlyNameZChatUniqueNameZPreEngagementDatare   rd   r_   r`   rf   rg   )r   r]   r-   createrW   r   
r&   r   rm   rn   ro   rp   rq   rh   r\   r   r   r   r   rs   \  s&    
   zWebChannelList.createc           
   	      s^   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 WebChannelInstance

        :param flex_flow_sid: The SID of the Flex Flow.
        :param identity: The chat identity.
        :param customer_friendly_name: The chat participant's friendly name.
        :param chat_friendly_name: The chat channel's friendly name.
        :param chat_unique_name: The chat channel's unique name.
        :param pre_engagement_data: The pre-engagement data.

        :returns: The created WebChannelInstance
        rr   re   rd   r_   r`   rf   rg   N)r   r]   r-   create_asyncrW   r   rt   r   r   r   ru     s&    
   zWebChannelList.create_asyncN)limit	page_sizer+   c                 C   s0   | j ||}| j|d d}| j ||d S )a`  
        Streams WebChannelInstance 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
        rw   rw   rv   )r-   read_limitspagestreamr&   rv   rw   Zlimitsrz   r   r   r   r{     s    zWebChannelList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )ao  
        Asynchronously streams WebChannelInstance 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
        rw   rx   Nrv   )r-   ry   
page_asyncstream_asyncr|   r   r   r   r~     s    zWebChannelList.stream_asyncc                 C   s   t | j||dS )a  
        Lists WebChannelInstance 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
        rv   rw   )listr{   r&   rv   rw   r   r   r   r     s    zWebChannelList.listc                    s$   dd | j ||dI dH 2 I dH S )a  
        Asynchronously lists WebChannelInstance 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   )rG   recordr   r   r   
<listcomp>  s   z-WebChannelList.list_async.<locals>.<listcomp>r   N)r~   r   r   r   r   
list_async   s    
zWebChannelList.list_async)
page_tokenpage_numberrw   r+   c                 C   sJ   t |||d}t ddi}d|d< | jjd| j||d}t| j|S )ay  
        Retrieve a single page of WebChannelInstance 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 WebChannelInstance
        Z	PageTokenr   ZPageSizere   rd   r_   r`   ra   rZ   r[   paramsr\   )r   r]   r-   rz   rW   rj   r&   r   r   rw   rh   r\   responser   r   r   rz     s       zWebChannelList.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 WebChannelInstance 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 WebChannelInstance
        r   re   rd   r_   r`   ra   r   N)r   r]   r-   r}   rW   rj   r   r   r   r   r}   <  s       zWebChannelList.page_async)
target_urlr+   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of WebChannelInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebChannelInstance
        ra   )r-   domaintwiliorequestrj   r&   r   r   r   r   r   get_page]  s    	zWebChannelList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of WebChannelInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebChannelInstance
        ra   N)r-   r   r   Zrequest_asyncrj   r   r   r   r   get_page_asynci  s    	zWebChannelList.get_page_async)r   r+   c                 C   s   t | j|dS zs
        Constructs a WebChannelContext

        :param sid: The SID of the WebChannel resource to update.
        r,   r)   r-   r&   r   r   r   r   r#   u  s    zWebChannelList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__}  s    zWebChannelList.__call__r*   c                 C   s   dS )rA   z"<Twilio.FlexApi.V1.WebChannelList>r   r.   r   r   r   rP     s    zWebChannelList.__repr__)NN)NN)NN)NN) r   r   r   r   r"   r   rU   rR   r   rQ   r   rs   ru   r   intr   r{   r	   r~   r   r   r   rj   rz   r}   r   r   r)   r#   r   rP   rV   r   r   r'   r   rl   O  s   

2

.        


#


!rl   N)__doc__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)   rj   rl   r   r   r   r   <module>   s   $   