o
    /iQM                     @   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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def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|pA| 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__ Z/var/www/html/philips/venv/lib/python3.10/site-packages/twilio/rest/flex_api/v1/channel.pyr   '   s    

zChannelInstance.__init__returnChannelContextc                 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   
   | j  S )j
        Deletes the ChannelInstance


        :returns: True if delete succeeds, False otherwise
        )r,   deleter+   r%   r%   r&   r/   M      
zChannelInstance.deletec                       | 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&   r3   V      zChannelInstance.delete_asyncc                 C   r-   )[
        Fetch the ChannelInstance


        :returns: The fetched ChannelInstance
        )r,   fetchr+   r%   r%   r&   r6   _   r0   zChannelInstance.fetchc                    r1   )u
        Asynchronous coroutine to fetch the ChannelInstance


        :returns: The fetched ChannelInstance
        N)r,   fetch_asyncr+   r%   r%   r&   r8   h   r4   zChannelInstance.fetch_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>w       z+ChannelInstance.__repr__.<locals>.<genexpr>z&<Twilio.FlexApi.V1.ChannelInstance {}>joinr    itemsr?   r"   contextr%   r%   r&   __repr__q      
zChannelInstance.__repr__N)r'   r(   )r'   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr,   boolr/   r3   r6   r8   rK   __classcell__r%   r%   r#   r&   r      s"    
	
	
		r   c                       sl   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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 ChannelContext

        :param version: Version that contains the resource
        :param sid: The SID of the Flex chat channel resource to fetch.
        r   z/Channels/{sid}Nr%   )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/   rV   r+   r%   r%   r&   r/      s   zChannelContext.deletec                    s   | j jd| jdI dH S )r2   rW   rX   N)r*   r3   rV   r+   r%   r%   r&   r3      s
   zChannelContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )r5   GETrX   r   r)   )r*   r6   rV   r   r    r"   r   r%   r%   r&   r6      s   zChannelContext.fetchc                    s0   | j jd| jdI dH }t| j || jd dS )r7   r[   rX   Nr   r)   )r*   r8   rV   r   r    r\   r%   r%   r&   r8      s   zChannelContext.fetch_asyncc                 C   r9   )r:   r;   c                 s   r<   r=   r>   r@   r%   r%   r&   rD      rE   z*ChannelContext.__repr__.<locals>.<genexpr>z%<Twilio.FlexApi.V1.ChannelContext {}>rF   rI   r%   r%   r&   rK      rL   zChannelContext.__repr__)rN   rO   rP   r   rR   r   rT   r/   r3   r   r6   r8   rK   rU   r%   r%   r#   r&   r(   {   s    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 )ChannelPager   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&   get_instance   s   zChannelPage.get_instancec                 C      dS )r:   z<Twilio.FlexApi.V1.ChannelPage>r%   r+   r%   r%   r&   rK         zChannelPage.__repr__N)	rN   rO   rP   r   rR   r   r   r^   rK   r%   r%   r%   r&   r]      s    r]   c                       s  e Zd Zdef fddZejejejej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ee	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ej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ee	f deee	f deee	f dee
e	f defddZ		d0dee dee dee fddZ		d0dee dee dee fddZ		d0dee dee dee fddZ		d0d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 )1ChannelListr   c                    s   t  | d| _dS )zi
        Initialize the ChannelList

        :param version: Version that contains the resource

        z	/ChannelsN)r   r   rV   )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
        
FlexFlowSidIdentityChatUserFriendlyNameChatFriendlyNameTargetChatUniqueNamePreEngagementDataTaskSidTaskAttributes	LongLivedPOSTrY   rZ   data)r   ofr*   createrV   r   r"   r   rb   rc   rd   re   rf   rg   r   rh   ri   rw   r   r%   r%   r&   ry      s&   zChannelList.createc                    sH   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
        rj   ru   rv   N)r   rx   r*   create_asyncrV   r   rz   r%   r%   r&   r{   %  s(   zChannelList.create_asyncNlimit	page_sizec                 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
        r}   r}   r|   )r*   read_limitspagestreamr"   r|   r}   limitsr   r%   r%   r&   r   Y  s   zChannelList.streamc                    s8   | 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
        r}   r~   Nr|   )r*   r   
page_asyncstream_asyncr   r%   r%   r&   r   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
        r|   r}   )listr   r"   r|   r}   r%   r%   r&   r     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 rM   r%   )rA   recordr%   r%   r&   
<listcomp>  s
    z*ChannelList.list_async.<locals>.<listcomp>r   N)r   r   r%   r%   r&   
list_async  s   
zChannelList.list_async
page_tokenpage_numberc                 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
        	PageTokenr   PageSizer[   rY   rZ   params)r   rx   r*   r   rV   r]   r"   r   r   r}   rw   responser%   r%   r&   r     s   zChannelList.pagec                    s:   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
        r   r[   r   N)r   rx   r*   r   rV   r]   r   r%   r%   r&   r     s   zChannelList.page_async
target_urlc                 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
        r[   )r*   domaintwiliorequestr]   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
        r[   N)r*   r   r   request_asyncr]   r   r%   r%   r&   get_page_async  s   	zChannelList.get_page_asyncr   c                 C      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        zChannelList.getc                 C   r   r   r   r   r%   r%   r&   __call__  r   zChannelList.__call__c                 C   r_   )r:   z<Twilio.FlexApi.V1.ChannelList>r%   r+   r%   r%   r&   rK      r`   zChannelList.__repr__)NN)!rN   rO   rP   r   r   r   unsetrR   r   objectrT   r   ry   r{   r   intr   r   r	   r   r   r   r   r]   r   r   r   r   r(   r   r   rK   rU   r%   r%   r#   r&   ra      s    



	



:



	



6











ra   N)rQ   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(   r]   ra   r%   r%   r%   r&   <module>   s    $aX