U
    ^g%isX                     @   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 - Chat
    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gcmZapnZfcmN)__name__
__module____qualname__ZGCMZAPNZFCM r   r   b/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/chat/v2/service/binding.pyBindingType   s   r   N)versionpayloadservice_sidsidc                    s   t  | |d| _|d| _|d| _t|d| _t|d| _	|d| _
|d| _|d| _|d	| _|d
| _|d| _|d| _||p| jd| _d | _d S )Nr   account_sidr   date_createddate_updatedendpointidentitycredential_sidbinding_typemessage_typesurllinksr   r   )super__init__getr   r   r   r
   Ziso8601_datetimer   r    r!   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-   r1   _versionr,   r.   r   r   r   _proxyQ   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   a   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:   j   s    zBindingInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the BindingInstance


        :returns: The fetched BindingInstance
        )r6   fetchr5   r   r   r   r<   s   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>   |   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.Chat.V2.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>   rN   __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                    s,   t  | ||d| _djf | j| _dS )a:  
        Initialize the BindingContext

        :param version: Version that contains the resource
        :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to fetch the Binding resource from.
        :param sid: The SID of the Binding resource to fetch.
        r(   z&/Services/{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   t i }| jjd| j|dS )r7   DELETEmethoduriheaders)r   ofr4   r8   rU   r.   rZ   r   r   r   r8      s    
zBindingContext.deletec                    s$   t i }| jjd| j|dI dH S )r9   rV   rW   N)r   r[   r4   r:   rU   r\   r   r   r   r:      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GETrW   r   r   r(   )r   r[   r4   r<   rU   r   r,   r.   rZ   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_   rW   Nr   r   r(   )r   r[   r4   r>   rU   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      s     z*BindingContext.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V2.BindingContext {}>rI   rL   r   r   r   rN      s    zBindingContext.__repr__)r   r   r   r   rP   r*   rR   r8   r:   r   r<   r>   rN   rS   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   r   get_instance   s
      zBindingPage.get_instancer2   c                 C   s   dS )r?   z<Twilio.Chat.V2.BindingPage>r   r5   r   r   r   rN      s    zBindingPage.__repr__N)	r   r   r   r   rP   r   r   rb   rN   r   r   r   r   ra      s   
ra   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 )z
        Initialize the BindingList

        :param version: Version that contains the resource
        :param service_sid: The SID of the [Service](https://www.twilio.com/docs/chat/rest/service-resource) to read the Binding resources from.

        r   z /Services/{service_sid}/BindingsNrT   )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 )ab  
        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 [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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
        re   r$   r"   re   rd   )r4   read_limitspagestreamr.   r$   r"   rd   re   Zlimitsrh   r   r   r   ri     s      zBindingList.streamc                    s:   | j ||}| j|||d dI dH }| j ||d S )aq  
        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 [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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
        re   rf   Nrd   )r4   rg   
page_asyncstream_asyncrj   r   r   r   rl   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 [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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"   rd   re   )listri   r.   r$   r"   rd   re   r   r   r   rn   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 [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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>rm   N)rl   ro   r   r   r   
list_asyncw  s    
zBindingList.list_async)r$   r"   
page_tokenpage_numberre   r3   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 )a@  
        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 [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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 rp   r   er   r   r   <lambda>      z"BindingList.page.<locals>.<lambda>c                 S   s   | S rp   r   rv   r   r   r   rx     ry   r   ZIdentityZ	PageTokenr   ZPageSizeContent-Type!application/x-www-form-urlencodedr]   r^   r_   rX   rY   paramsrZ   )	r   r[   r   mapr4   rh   rU   ra   r,   	r.   r$   r"   rt   ru   re   datarZ   responser   r   r   rh     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 )aO  
        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 [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read. See [access tokens](https://www.twilio.com/docs/chat/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 rp   r   rv   r   r   r   rx     ry   z(BindingList.page_async.<locals>.<lambda>c                 S   s   | S rp   r   rv   r   r   r   rx     ry   rz   r{   r|   r]   r^   r_   r}   N)	r   r[   r   r   r4   rk   rU   ra   r,   r   r   r   r   rk     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requestra   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_asyncra   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 zl
        Constructs a BindingContext

        :param sid: The SID of the Binding resource to fetch.
        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.Chat.V2.BindingList>r   r5   r   r   r   rN     s    zBindingList.__repr__)r   r   r   r   rP   r*   r   unsetr   r   rO   r   intr   r   ri   r	   rl   rn   rs   ra   rh   rk   r   r   r1   r+   r   rN   rS   r   r   r/   r   rc     s   !!"#


)


'

rc   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   ra   rc   r   r   r   r   <module>   s   $vc