o
    f>h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dedeeef de	e f fddZ
edddZd	efddZd	efddZd ddZd ddZejejfdedef deeef d	d fddZejejfdedef deeef d	d fddZd	efddZ  ZS )!WebChannelInstancec                   @   s   e Zd ZdZdS )WebChannelInstance.ChatStatusinactiveN)__name__
__module____qualname__INACTIVE r   r   V/var/www/html/venv/lib/python3.10/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|p5| ji| _d | _d S )Naccount_sidflex_flow_sidr   urldate_createddate_updated)super__init__getr   r   r   r    r
   iso8601_datetimer!   r"   	_solution_context)selfr   r   r   	__class__r   r   r$   '   s   

zWebChannelInstance.__init__returnWebChannelContextc                 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: WebChannelContext for this WebChannelInstance
        Nr   r   )r(   r-   _versionr'   r)   r   r   r   _proxy<   s   
zWebChannelInstance._proxyc                 C   
   | j  S )m
        Deletes the WebChannelInstance


        :returns: True if delete succeeds, False otherwise
        )r1   deleter0   r   r   r   r4   K      
zWebChannelInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the WebChannelInstance


        :returns: True if delete succeeds, False otherwise
        N)r1   delete_asyncr0   r   r   r   r8   T      zWebChannelInstance.delete_asyncc                 C   r2   )a
        Fetch the WebChannelInstance


        :returns: The fetched WebChannelInstance
        )r1   fetchr0   r   r   r   r;   ]   r5   zWebChannelInstance.fetchc                    r6   ){
        Asynchronous coroutine to fetch the WebChannelInstance


        :returns: The fetched WebChannelInstance
        N)r1   fetch_asyncr0   r   r   r   r=   f   r9   zWebChannelInstance.fetch_asyncchat_statusr   post_engagement_datac                 C   s   | j j||dS )
        Update the WebChannelInstance

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

        :returns: The updated WebChannelInstance
        r>   r?   )r1   updater)   r>   r?   r   r   r   rB   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
        rA   N)r1   update_asyncrC   r   r   r   rE      s
   zWebChannelInstance.update_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr   r   r   	<genexpr>       z.WebChannelInstance.__repr__.<locals>.<genexpr>z)<Twilio.FlexApi.V1.WebChannelInstance {}>joinr'   itemsrL   r)   contextr   r   r   __repr__      
zWebChannelInstance.__repr__N)r,   r-   )r,   r   )r   r   r   objectr   r   r   strr   r   r$   propertyr1   boolr4   r8   r;   r=   r   unsetr   rB   rE   rX   __classcell__r   r   r*   r   r      sH    

	
	
	





r   c                       s   e Zd Zdedef fddZdefddZdefdd	Zde	fd
dZ
de	fddZejejfdedef deeef de	fddZejejfdedef deeef de	fddZdefddZ  ZS )r-   r   r   c                    s.   t  | d|i| _djdi | 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}Nr   )r#   r$   r'   rL   _uri)r)   r   r   r*   r   r   r$      s   zWebChannelContext.__init__r,   c                 C   s   t i }| jjd| j|dS )r3   DELETEmethoduriheaders)r   ofr/   r4   ra   r)   rf   r   r   r   r4      s   
zWebChannelContext.deletec                    s&   t i }| jjd| j|dI dH S )r7   rb   rc   N)r   rg   r/   r8   ra   rh   r   r   r   r8      s
   
zWebChannelContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r:   application/jsonAcceptGETrc   r   r.   )r   rg   r/   r;   ra   r   r'   r)   rf   r   r   r   r   r;      s   
zWebChannelContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r<   ri   rj   rk   rc   Nr   r.   )r   rg   r/   r=   ra   r   r'   rl   r   r   r   r=      s   
zWebChannelContext.fetch_asyncr>   r   r?   c                 C   sV   t ||d}t i }d|d< d|d< | jjd| j||d}t| j|| jd d	S )
r@   r   PostEngagementData!application/x-www-form-urlencodedContent-Typeri   rj   POSTrd   re   datarf   r   r.   )r   rg   r/   rB   ra   r   r'   r)   r>   r?   rs   rf   r   r   r   r   rB      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 )rD   rm   ro   rp   ri   rj   rq   rr   Nr   r.   )r   rg   r/   rE   ra   r   r'   rt   r   r   r   rE     s   

zWebChannelContext.update_asyncc                 C   rF   )rG   rH   c                 s   rI   rJ   rK   rM   r   r   r   rQ   8  rR   z-WebChannelContext.__repr__.<locals>.<genexpr>z(<Twilio.FlexApi.V1.WebChannelContext {}>rS   rV   r   r   r   rX   2  rY   zWebChannelContext.__repr__)r   r   r   r   r\   r$   r^   r4   r8   r   r;   r=   r   r_   r   r[   rB   rE   rX   r`   r   r   r*   r   r-      s2    


"


 r-   c                   @   s4   e Zd Zdeeef defddZdefddZdS )WebChannelPager   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_instancec                 C      dS )rG   z"<Twilio.FlexApi.V1.WebChannelPage>r   r0   r   r   r   rX   F     zWebChannelPage.__repr__N)	r   r   r   r   r\   r   r   rv   rX   r   r   r   r   ru   <  s    ru   c                       s  e Zd Zdef fddZejejfdededededeee	f d	eee	f d
e
fddZejejfdededededeee	f d	eee	f d
e
fddZ		d,dee dee d
ee
 fddZ		d,dee dee d
ee
 fddZ		d,dee dee d
ee
 fddZ		d,dee dee d
ee
 fddZejejejfdeee	f deee	f deee	f d
efddZejejejfdeee	f deee	f deee	f d
efddZd ed
efd!d"Zd ed
efd#d$Zd%ed
efd&d'Zd%ed
efd(d)Zd
efd*d+Z  ZS )-WebChannelListr   c                    s   t  | d| _dS )zl
        Initialize the WebChannelList

        :param version: Version that contains the resource

        z/WebChannelsN)r#   r$   ra   )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
        FlexFlowSidIdentityCustomerFriendlyNameChatFriendlyNameChatUniqueNamePreEngagementDatarp   ro   ri   rj   rq   rr   )r   rg   r/   createra   r   
r)   r   rz   r{   r|   r}   r~   rs   rf   r   r   r   r   r   \  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
        r   rp   ro   ri   rj   rq   rr   N)r   rg   r/   create_asyncra   r   r   r   r   r   r     s"   

zWebChannelList.create_asyncNlimit	page_sizec                 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
        r   r   r   )r/   read_limitspagestreamr)   r   r   limitsr   r   r   r   r     s   zWebChannelList.streamc                    s8   | 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
        r   r   Nr   )r/   r   
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
        r   r   )listr   r)   r   r   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 rZ   r   )rN   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_numberc                 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
        	PageTokenr   PageSizerp   ro   ri   rj   rk   rd   re   paramsrf   )r   rg   r/   r   ra   ru   r)   r   r   r   rs   rf   responser   r   r   r     s   
zWebChannelList.pagec                    sR   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   rp   ro   ri   rj   rk   r   N)r   rg   r/   r   ra   ru   r   r   r   r   r   <  s   
zWebChannelList.page_async
target_urlc                 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
        rk   )r/   domaintwiliorequestru   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
        rk   N)r/   r   r   request_asyncru   r   r   r   r   get_page_asynci  s   	zWebChannelList.get_page_asyncr   c                 C      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     zWebChannelList.getc                 C   r   r   r   r   r   r   r   __call__}  r   zWebChannelList.__call__c                 C   rw   )rG   z"<Twilio.FlexApi.V1.WebChannelList>r   r0   r   r   r   rX     rx   zWebChannelList.__repr__)NN) r   r   r   r   r$   r   r_   r\   r   r[   r   r   r   r   intr   r   r	   r   r   r   r   ru   r   r   r   r   r-   r%   r   rX   r`   r   r   r*   r   ry   O  s    


2


.







#



!ry   N)__doc__r   typingr   r   r   r   r   r   r	   twilio.baser
   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r-   ru   ry   r   r   r   r   <module>   s    $   