o
    f>hY                     @   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 - Conversations
    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G dd deZ	 	ddedeeef de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 )BindingInstancec                   @   s   e Zd ZdZdZdZdS )BindingInstance.BindingTypeapngcmfcmN)__name__
__module____qualname__APNGCMFCM r   r   _/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/conversations/v1/service/binding.pyBindingType   s    r   Nversionpayloadchat_service_sidsidc                    s   t  | |d| _|d| _|d| _|d| _t|d| _	t|d| _
|d| _|d| _|d	| _|d
| _|d| _||pS| jd| _d | _d S )Nr#   account_sidr"   credential_siddate_createddate_updatedendpointidentitybinding_typemessage_typesurlr"   r#   )super__init__getr#   r$   r"   r%   r
   iso8601_datetimer&   r'   r(   r)   r*   r+   r,   	_solution_context)selfr    r!   r"   r#   	__class__r   r   r/   .   s,   
zBindingInstance.__init__returnBindingContextc                 C   s.   | j du rt| j| jd | 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: BindingContext for this BindingInstance
        Nr"   r#   r-   )r3   r8   _versionr2   r4   r   r   r   _proxyO   s   
zBindingInstance._proxyc                 C   
   | j  S )j
        Deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        )r;   deleter:   r   r   r   r>   _      
zBindingInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        N)r;   delete_asyncr:   r   r   r   rB   h      zBindingInstance.delete_asyncc                 C   r<   )[
        Fetch the BindingInstance


        :returns: The fetched BindingInstance
        )r;   fetchr:   r   r   r   rE   q   r?   zBindingInstance.fetchc                    r@   )u
        Asynchronous coroutine to fetch the BindingInstance


        :returns: The fetched BindingInstance
        N)r;   fetch_asyncr:   r   r   r   rG   z   rC   zBindingInstance.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>       z+BindingInstance.__repr__.<locals>.<genexpr>z,<Twilio.Conversations.V1.BindingInstance {}>joinr2   itemsrN   r4   contextr   r   r   __repr__      
zBindingInstance.__repr__N)r7   r8   )r7   r   )r   r   r   objectr   r   r   strr   r   r/   propertyr;   boolr>   rB   rE   rG   rZ   __classcell__r   r   r5   r   r      s(    
!	
	
		r   c                       sp   e Zd Zde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 )r8   r    r"   r#   c                    s0   t  | ||d| _djdi | j| _dS )am  
        Initialize the BindingContext

        :param version: Version that contains the resource
        :param chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Binding resource is associated with.
        :param sid: A 34 character string that uniquely identifies this resource.
        r-   z+/Services/{chat_service_sid}/Bindings/{sid}Nr   r.   r/   r2   rN   _uri)r4   r    r"   r#   r5   r   r   r/      s   zBindingContext.__init__r7   c                 C   s   t i }| jjd| j|dS )r=   DELETEmethoduriheaders)r   ofr9   r>   rc   r4   rh   r   r   r   r>      s   
zBindingContext.deletec                    s&   t i }| jjd| j|dI dH S )rA   rd   re   N)r   ri   r9   rB   rc   rj   r   r   r   rB      s
   
zBindingContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rD   application/jsonAcceptGETre   r"   r#   r-   )r   ri   r9   rE   rc   r   r2   r4   rh   r!   r   r   r   rE      s   
zBindingContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rF   rk   rl   rm   re   Nr"   r#   r-   )r   ri   r9   rG   rc   r   r2   rn   r   r   r   rG      s   
zBindingContext.fetch_asyncc                 C   rH   )rI   rJ   c                 s   rK   rL   rM   rO   r   r   r   rS      rT   z*BindingContext.__repr__.<locals>.<genexpr>z+<Twilio.Conversations.V1.BindingContext {}>rU   rX   r   r   r   rZ      r[   zBindingContext.__repr__)r   r   r   r   r^   r/   r`   r>   rB   r   rE   rG   rZ   ra   r   r   r5   r   r8      s    r8   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 )BindingPager!   r7   c                 C   s   t | j|| jd dS )zm
        Build an instance of BindingInstance

        :param payload: Payload response from the API
        r"   )r"   )r   r9   r2   )r4   r!   r   r   r   get_instance      zBindingPage.get_instancec                 C      dS )rI   z%<Twilio.Conversations.V1.BindingPage>r   r:   r   r   r   rZ         zBindingPage.__repr__N)	r   r   r   r   r^   r   r   rp   rZ   r   r   r   r   ro      s    
ro   c                       s  e Zd Zdedef fddZejejddfdee	d e
f dee	e e
f d	ee d
ee dee f
ddZejejddfdee	d e
f dee	e e
f d	ee d
ee dee f
ddZejejddfdee	d e
f dee	e e
f d	ee d
ee de	e f
ddZejejddfdee	d e
f dee	e e
f d	ee d
ee de	e f
ddZejejejejejfdee	d e
f de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fdee	d e
f de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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 )&BindingListr    r"   c                    s.   t  | d|i| _djdi | j| _dS )a  
        Initialize the BindingList

        :param version: Version that contains the resource
        :param chat_service_sid: The SID of the [Conversation Service](https://www.twilio.com/docs/conversations/api/service-resource) the Binding resource is associated with.

        r"   z%/Services/{chat_service_sid}/BindingsNr   rb   )r4   r    r"   r5   r   r   r/   	  s   zBindingList.__init__Nr*   r   r)   limit	page_sizer7   c                 C   s4   | j ||}| j|||d d}| j ||d S )az  
        Streams BindingInstance 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 List[&quot;BindingInstance.BindingType&quot;] binding_type: The push technology used by the Binding resources to read.  Can be: `apn`, `gcm`, or `fcm`.  See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info.
        :param List[str] identity: The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details.
        :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
        rv   r*   r)   rv   ru   )r9   read_limitspagestreamr4   r*   r)   ru   rv   limitsry   r   r   r   rz     s
   
zBindingList.streamc                    s<   | j ||}| j|||d dI dH }| j ||d S )a  
        Asynchronously streams BindingInstance 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 List[&quot;BindingInstance.BindingType&quot;] binding_type: The push technology used by the Binding resources to read.  Can be: `apn`, `gcm`, or `fcm`.  See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info.
        :param List[str] identity: The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details.
        :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
        rv   rw   Nru   )r9   rx   
page_asyncstream_asyncr{   r   r   r   r~   8  s   
zBindingList.stream_asyncc                 C   s   t | j||||dS )a  
        Lists BindingInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param List[&quot;BindingInstance.BindingType&quot;] binding_type: The push technology used by the Binding resources to read.  Can be: `apn`, `gcm`, or `fcm`.  See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info.
        :param List[str] identity: The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details.
        :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)   ru   rv   )listrz   r4   r*   r)   ru   rv   r   r   r   r   W  s   zBindingList.listc                    s*   dd | j ||||dI dH 2 I dH S )a&  
        Asynchronously lists BindingInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param List[&quot;BindingInstance.BindingType&quot;] binding_type: The push technology used by the Binding resources to read.  Can be: `apn`, `gcm`, or `fcm`.  See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info.
        :param List[str] identity: The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details.
        :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 r\   r   )rP   recordr   r   r   
<listcomp>  s
    z*BindingList.list_async.<locals>.<listcomp>r   N)r~   r   r   r   r   
list_asyncw  s   
zBindingList.list_async
page_tokenpage_numberc           	      C   sj   t t|dd t|dd |||d}t ddi}d|d< | jjd	| j||d
}t| j|| jS )aX  
        Retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :param binding_type: The push technology used by the Binding resources to read.  Can be: `apn`, `gcm`, or `fcm`.  See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info.
        :param identity: The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details.
        :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 BindingInstance
        c                 S      | S r\   r   er   r   r   <lambda>      z"BindingList.page.<locals>.<lambda>c                 S   r   r\   r   r   r   r   r   r     r   r   Identity	PageTokenr   PageSizeContent-Type!application/x-www-form-urlencodedrk   rl   rm   rf   rg   paramsrh   )	r   ri   r   mapr9   ry   rc   ro   r2   	r4   r*   r)   r   r   rv   datarh   responser   r   r   ry     s   

zBindingList.pagec           	         sr   t t|dd t|dd |||d}t ddi}d|d< | jjd	| j||d
I dH }t| j|| jS )ag  
        Asynchronously retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :param binding_type: The push technology used by the Binding resources to read.  Can be: `apn`, `gcm`, or `fcm`.  See [push notification configuration](https://www.twilio.com/docs/chat/push-notification-configuration) for more info.
        :param identity: The identity of a [Conversation User](https://www.twilio.com/docs/conversations/api/user-resource) this binding belongs to. See [access tokens](https://www.twilio.com/docs/conversations/create-tokens) for more details.
        :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 BindingInstance
        c                 S   r   r\   r   r   r   r   r   r     r   z(BindingList.page_async.<locals>.<lambda>c                 S   r   r\   r   r   r   r   r   r     r   r   r   r   rk   rl   rm   r   N)	r   ri   r   r   r9   r}   rc   ro   r2   r   r   r   r   r}     s   

zBindingList.page_async
target_urlc                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of BindingInstance records from the API.
        Request is executed immediately

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

        :returns: Page of BindingInstance
        rm   )r9   domaintwiliorequestro   r2   r4   r   r   r   r   r   get_page  s   	zBindingList.get_pagec                    s*   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of BindingInstance records from the API.
        Request is executed immediately

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

        :returns: Page of BindingInstance
        rm   N)r9   r   r   request_asyncro   r2   r   r   r   r   get_page_async  s   	zBindingList.get_page_asyncr#   c                 C      t | j| jd |dS z
        Constructs a BindingContext

        :param sid: A 34 character string that uniquely identifies this resource.
        r"   r-   r8   r9   r2   r4   r#   r   r   r   r0     rq   zBindingList.getc                 C   r   r   r   r   r   r   r   __call__  rq   zBindingList.__call__c                 C   rr   )rI   z%<Twilio.Conversations.V1.BindingList>r   r:   r   r   r   rZ     rs   zBindingList.__repr__)r   r   r   r   r^   r/   r   unsetr   r   r]   r   intr   r   rz   r	   r~   r   r   ro   ry   r}   r   r   r8   r0   r   rZ   ra   r   r   r5   r   rt     s    
!
!
"
#



)



'

rt   N)__doc__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   r8   ro   rt   r   r   r   r   <module>   s    $te