a
    !fW                     @   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eeeef e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dddZ  ZS )BindingInstancec                   @   s   e Zd ZdZdZdZdS )BindingInstance.BindingTypeZapnZgcmZfcmN)__name__
__module____qualname__ZAPNZGCMZFCM r   r   m/var/www/html/python-backend/venv/lib/python3.9/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| _||p| 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__BindingContextreturnc                 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'   )r-   r1   _versionr,   r.   r   r   r   _proxyO   s    
zBindingInstance._proxyc                 C   s
   | j  S )j
        Deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        )r6   deleter5   r   r   r   r8   _   s    zBindingInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        N)r6   delete_asyncr5   r   r   r   r:   h   s    zBindingInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the BindingInstance


        :returns: The fetched BindingInstance
        )r6   fetchr5   r   r   r   r<   q   s    zBindingInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the BindingInstance


        :returns: The fetched BindingInstance
        N)r6   fetch_asyncr5   r   r   r   r>   z   s    zBindingInstance.fetch_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>       z+BindingInstance.__repr__.<locals>.<genexpr>z,<Twilio.Conversations.V1.BindingInstance {}>joinr,   itemsrC   r.   contextr   r   r   __repr__   s    zBindingInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r)   propertyr6   boolr8   r:   r<   r>   rO   __classcell__r   r   r/   r   r      s    
!				r   c                       sl   e Zd Ze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dddZ  ZS )r1   )r   r   r   c                    s0   t  | ||d| _djf 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}Nr(   r)   r,   rC   _uri)r.   r   r   r   r/   r   r   r)      s    zBindingContext.__init__r2   c                 C   s   | j jd| jdS )r7   DELETEmethoduri)r4   r8   rV   r5   r   r   r   r8      s    zBindingContext.deletec                    s   | j jd| jdI dH S )r9   rW   rX   N)r4   r:   rV   r5   r   r   r   r:      s    zBindingContext.delete_asyncc                 C   s0   | j jd| jd}t| j || jd | jd dS )r;   GETrX   r   r   r'   )r4   r<   rV   r   r,   r.   r   r   r   r   r<      s    zBindingContext.fetchc                    s6   | j jd| jdI dH }t| j || jd | jd dS )r=   r[   rX   Nr   r   r'   )r4   r>   rV   r   r,   r\   r   r   r   r>      s    zBindingContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r?   r@   c                 s   s   | ]\}}d  ||V  qdS rA   rB   rD   r   r   r   rH      rI   z*BindingContext.__repr__.<locals>.<genexpr>z+<Twilio.Conversations.V1.BindingContext {}>rJ   rM   r   r   r   rO      s    zBindingContext.__repr__)r   r   r   r   rQ   r)   rS   r8   r:   r   r<   r>   rO   rT   r   r   r/   r   r1      s   r1   c                   @   s2   e Zd Zeeef edddZedddZdS )BindingPage)r   r3   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   r4   r,   r\   r   r   r   get_instance   s    zBindingPage.get_instancer2   c                 C   s   dS )r?   z%<Twilio.Conversations.V1.BindingPage>r   r5   r   r   r   rO      s    zBindingPage.__repr__N)	r   r   r   r   rQ   r   r   r^   rO   r   r   r   r   r]      s   
r]   c                       sN  e Zd Zeed fddZejejddfee	d e
f ee	e e
f ee ee ee dddZejejddfee	d e
f ee	e e
f ee ee ee dd	d
Zejejddfee	d e
f ee	e e
f ee ee e	e dddZejejddfee	d e
f ee	e e
f ee ee e	e dddZejejejejejfee	d e
f ee	e e
f eee
f eee
f eee
f edddZejejejejejfee	d e
f ee	e e
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 )!BindingList)r   r   c                    s.   t  | d|i| _djf 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}/BindingsNrU   )r.   r   r   r/   r   r   r)      s    zBindingList.__init__Nr   )r$   r#   limit	page_sizer3   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
        ra   r$   r#   ra   r`   )r4   read_limitspagestreamr.   r$   r#   r`   ra   Zlimitsrd   r   r   r   re     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
        ra   rb   Nr`   )r4   rc   
page_asyncstream_asyncrf   r   r   r   rh   /  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#   r`   ra   )listre   r.   r$   r#   r`   ra   r   r   r   rj   N  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 Nr   )rE   recordr   r   r   
<listcomp>  s   z*BindingList.list_async.<locals>.<listcomp>ri   N)rh   rk   r   r   r   
list_asyncn  s    
zBindingList.list_async)r$   r#   
page_tokenpage_numberra   r3   c                 C   sR   t t|dd t|d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   | S rl   r   er   r   r   <lambda>  rI   z"BindingList.page.<locals>.<lambda>c                 S   s   | S rl   r   rr   r   r   r   rt     rI   r   ZIdentityZ	PageTokenr   ZPageSizer[   rY   rZ   params)	r   ofr   mapr4   rd   rV   r]   r,   r.   r$   r#   rp   rq   ra   dataresponser   r   r   rd     s    
zBindingList.pagec                    sX   t t|dd t|d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   s   | S rl   r   rr   r   r   r   rt     rI   z(BindingList.page_async.<locals>.<lambda>c                 S   s   | S rl   r   rr   r   r   r   rt     rI   ru   r[   rv   N)	r   rx   r   ry   r4   rg   rV   r]   r,   rz   r   r   r   rg     s    
zBindingList.page_async)
target_urlr3   c                 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
        r[   )r4   domaintwiliorequestr]   r,   r.   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
        r[   N)r4   r~   r   Zrequest_asyncr]   r,   r   r   r   r   get_page_async  s    	zBindingList.get_page_async)r   r3   c                 C   s   t | j| jd |dS z
        Constructs a BindingContext

        :param sid: A 34 character string that uniquely identifies this resource.
        r   r'   r1   r4   r,   r.   r   r   r   r   r*     s    zBindingList.getc                 C   s   t | j| jd |dS r   r   r   r   r   r   __call__  s    zBindingList.__call__r2   c                 C   s   dS )r?   z%<Twilio.Conversations.V1.BindingList>r   r5   r   r   r   rO     s    zBindingList.__repr__)r   r   r   r   rQ   r)   r   unsetr   r   rP   r   intr   r   re   r	   rh   rj   ro   r]   rd   rg   r   r   r1   r*   r   rO   rT   r   r   r/   r   r_      s   !!"#


#


#

r_   N)__doc__r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   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   r1   r]   r_   r   r   r   r   <module>   s   $s^