U
    ^g%iY                     @   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ZdS )BindingInstance.BindingTypeZapnZgcmZfcmZtwilsockN)__name__
__module____qualname__ZAPNZGCMZFCMZTWILSOCK r   r   k/var/www/html/api-medvista/venv/lib/python3.8/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
   Z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k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,   r0   _versionr+   r-   r   r   r   _proxyP   s    
zBindingInstance._proxyc                 C   s
   | j  S )j
        Deletes the BindingInstance


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


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


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


        :returns: The fetched BindingInstance
        N)r5   fetch_asyncr4   r   r   r   r=   {   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>   s     z+BindingInstance.__repr__.<locals>.<genexpr>z,<Twilio.Conversations.V1.BindingInstance {}>joinr+   itemsrB   r-   contextr   r   r   __repr__   s    zBindingInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r)   propertyr5   boolr7   r9   r;   r=   rM   __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 )r0   )r   r   r   c                    s,   t  | ||d| _djf | 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+   rB   _uri)r-   r   r   r   r.   r   r   r)      s    zBindingContext.__init__r1   c                 C   s   t i }| jjd| j|dS )r6   DELETEmethoduriheaders)r   ofr3   r7   rT   r-   rY   r   r   r   r7      s    
zBindingContext.deletec                    s$   t i }| jjd| j|dI dH S )r8   rU   rV   N)r   rZ   r3   r9   rT   r[   r   r   r   r9      s    
  zBindingContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r:   application/jsonAcceptGETrV   r   r   r'   )r   rZ   r3   r;   rT   r   r+   r-   rY   r   r   r   r   r;      s    
zBindingContext.fetchc                    sJ   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	r<   r\   r]   r^   rV   Nr   r   r'   )r   rZ   r3   r=   rT   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 r@   rA   rC   r   r   r   rG      s     z*BindingContext.__repr__.<locals>.<genexpr>z+<Twilio.Conversations.V1.BindingContext {}>rH   rK   r   r   r   rM      s    zBindingContext.__repr__)r   r   r   r   rO   r)   rQ   r7   r9   r   r;   r=   rM   rR   r   r   r.   r   r0      s   r0   c                   @   s2   e Zd Zeeef edddZedddZdS )BindingPage)r   r2   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   r3   r+   )r-   r   r   r   r   get_instance   s
      zBindingPage.get_instancer1   c                 C   s   dS )r>   z%<Twilio.Conversations.V1.BindingPage>r   r4   r   r   r   rM      s    zBindingPage.__repr__N)	r   r   r   r   rO   r   r   ra   rM   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 | 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}/BindingsNrS   )r-   r   r   r.   r   r   r)   
  s
     zBindingList.__init__Nr   )r$   r#   limit	page_sizer2   c                 C   s4   | j ||}| j|||d d}| j ||d S )a  
        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`, `fcm`, or `twilsock`.  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
        rd   r$   r#   rd   rc   )r3   read_limitspagestreamr-   r$   r#   rc   rd   Zlimitsrg   r   r   r   rh     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`, `fcm`, or `twilsock`.  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
        rd   re   Nrc   )r3   rf   
page_asyncstream_asyncri   r   r   r   rk   9  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`, `fcm`, or `twilsock`.  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#   rc   rd   )listrh   r-   r$   r#   rc   rd   r   r   r   rm   X  s    zBindingList.listc                    s(   dd | j ||||dI dH 2 I dH S )a2  
        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`, `fcm`, or `twilsock`.  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   )rD   recordr   r   r   
<listcomp>  s   z*BindingList.list_async.<locals>.<listcomp>rl   N)rk   rn   r   r   r   
list_asyncx  s    
zBindingList.list_async)r$   r#   
page_tokenpage_numberrd   r2   c           	      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 )ad  
        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`, `fcm`, or `twilsock`.  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 ro   r   er   r   r   <lambda>      z"BindingList.page.<locals>.<lambda>c                 S   s   | S ro   r   ru   r   r   r   rw     rx   r   ZIdentityZ	PageTokenr   ZPageSizeContent-Type!application/x-www-form-urlencodedr\   r]   r^   rW   rX   paramsrY   )	r   rZ   r   mapr3   rg   rT   r`   r+   	r-   r$   r#   rs   rt   rd   datarY   responser   r   r   rg     s"    
   zBindingList.pagec           	         sp   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 )as  
        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`, `fcm`, or `twilsock`.  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 ro   r   ru   r   r   r   rw     rx   z(BindingList.page_async.<locals>.<lambda>c                 S   s   | S ro   r   ru   r   r   r   rw     rx   ry   rz   r{   r\   r]   r^   r|   N)	r   rZ   r   r~   r3   rj   rT   r`   r+   r   r   r   r   rj     s"    
   zBindingList.page_async)
target_urlr2   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^   )r3   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)r3   r   r   Zrequest_asyncr`   r+   r   r   r   r   get_page_async  s    	zBindingList.get_page_async)r   r2   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'   r0   r3   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__r1   c                 C   s   dS )r>   z%<Twilio.Conversations.V1.BindingList>r   r4   r   r   r   rM     s    zBindingList.__repr__)r   r   r   r   rO   r)   r   unsetr   r   rN   r   intr   r   rh   r	   rk   rm   rr   r`   rg   rj   r   r   r0   r*   r   rM   rR   r   r   r.   r   rb     s   !!"#


)


'

rb   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   r0   r`   rb   r   r   r   r   <module>   s   $ue