o
    f>h'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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__ R/var/www/html/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'   r0   K      
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'   r4   T      zChannelInstance.delete_asyncc                 C   r.   )[
        Fetch the ChannelInstance


        :returns: The fetched ChannelInstance
        )r-   fetchr,   r&   r&   r'   r7   ]   r1   zChannelInstance.fetchc                    r2   )u
        Asynchronous coroutine to fetch the ChannelInstance


        :returns: The fetched ChannelInstance
        N)r-   fetch_asyncr,   r&   r&   r'   r9   f   r5   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>u       z+ChannelInstance.__repr__.<locals>.<genexpr>z&<Twilio.FlexApi.V1.ChannelInstance {}>joinr!   itemsr@   r#   contextr&   r&   r'   __repr__o      
zChannelInstance.__repr__N)r(   r)   )r(   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr0   r4   r7   r9   rL   __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   t i }| jjd| j|dS )r/   DELETEmethoduriheaders)r   ofr+   r0   rW   r#   r\   r&   r&   r'   r0      s   
zChannelContext.deletec                    s&   t i }| jjd| j|dI dH S )r3   rX   rY   N)r   r]   r+   r4   rW   r^   r&   r&   r'   r4      s
   
zChannelContext.delete_asyncc                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r6   application/jsonAcceptGETrY   r   r*   )r   r]   r+   r7   rW   r   r!   r#   r\   r   r&   r&   r'   r7      s   
zChannelContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r8   r_   r`   ra   rY   Nr   r*   )r   r]   r+   r9   rW   r   r!   rb   r&   r&   r'   r9      s   
zChannelContext.fetch_asyncc                 C   r:   )r;   r<   c                 s   r=   r>   r?   rA   r&   r&   r'   rE      rF   z*ChannelContext.__repr__.<locals>.<genexpr>z%<Twilio.FlexApi.V1.ChannelContext {}>rG   rJ   r&   r&   r'   rL      rM   zChannelContext.__repr__)rO   rP   rQ   r   rS   r   rU   r0   r4   r   r7   r9   rL   rV   r&   r&   r$   r'   r)   y   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&   r'   get_instance   s   zChannelPage.get_instancec                 C      dS )r;   z<Twilio.FlexApi.V1.ChannelPage>r&   r,   r&   r&   r'   rL         zChannelPage.__repr__N)	rO   rP   rQ   r   rS   r   r   rd   rL   r&   r&   r&   r'   rc      s    rc   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   rW   )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
        
FlexFlowSidIdentityChatUserFriendlyNameChatFriendlyNameTargetChatUniqueNamePreEngagementDataTaskSidTaskAttributes	LongLivedContent-Type!application/x-www-form-urlencodedr_   r`   POSTrZ   r[   datar\   )r   r]   r   boolean_to_stringr+   createrW   r   r#   r   rh   ri   rj   rk   rl   rm   r   rn   ro   r   r\   r   r&   r&   r'   r      s(   
zChannelList.createc                    sn   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
        rp   r{   r|   r_   r`   r}   r~   N)r   r]   r   r   r+   create_asyncrW   r   r   r&   r&   r'   r   0  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   h  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     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 rN   r&   )rB   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   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
        	PageTokenr   PageSizer{   r|   r_   r`   ra   rZ   r[   paramsr\   )r   r]   r+   r   rW   rc   r#   r   r   r   r   r\   responser&   r&   r'   r     s   
zChannelList.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 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|   r_   r`   ra   r   N)r   r]   r+   r   rW   rc   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
        ra   )r+   domaintwiliorequestrc   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
        ra   N)r+   r   r   request_asyncrc   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__1  r   zChannelList.__call__c                 C   re   )r;   z<Twilio.FlexApi.V1.ChannelList>r&   r,   r&   r&   r'   rL   9  rf   zChannelList.__repr__)NN)!rO   rP   rQ   r   r   r   unsetrS   r   objectrU   r   r   r   r   intr   r   r	   r   r   r   r   rc   r   r   r   r   r)   r   r   rL   rV   r&   r&   r$   r'   rg      s    



	

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



:







#



!rg   N)rR   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r)   rc   rg   r&   r&   r&   r'   <module>   s    $`_