a
    !ffV                     @   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   d/var/www/html/python-backend/venv/lib/python3.9/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
   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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.   r2   _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
        )r7   deleter6   r   r   r   r9   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)r7   delete_asyncr6   r   r   r   r;   j   s    zBindingInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the BindingInstance


        :returns: The fetched BindingInstance
        )r7   fetchr6   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)r7   fetch_asyncr6   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>       z+BindingInstance.__repr__.<locals>.<genexpr>z#<Twilio.Chat.V2.BindingInstance {}>joinr-   itemsrD   r/   contextr   r   r   __repr__   s    zBindingInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r*   propertyr7   boolr9   r;   r=   r?   rP   __classcell__r   r   r0   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 )r2   )r   r   r   c                    s0   t  | ||d| _djf i | 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-   rD   _uri)r/   r   r   r   r0   r   r   r*      s
    zBindingContext.__init__r3   c                 C   s   | j jd| jdS )r8   DELETEmethoduri)r5   r9   rW   r6   r   r   r   r9      s    zBindingContext.deletec                    s   | j jd| jdI dH S )r:   rX   rY   N)r5   r;   rW   r6   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<   GETrY   r   r   r(   )r5   r=   rW   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\   rY   Nr   r   r(   )r5   r?   rW   r   r-   r]   r   r   r   r?      s    zBindingContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r@   rA   c                 s   s   | ]\}}d  ||V  qdS rB   rC   rE   r   r   r   rI      rJ   z*BindingContext.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V2.BindingContext {}>rK   rN   r   r   r   rP      s    zBindingContext.__repr__)r   r   r   r   rR   r*   rT   r9   r;   r   r=   r?   rP   rU   r   r   r0   r   r2      s   r2   c                   @   s2   e Zd Zeeef edddZedddZdS )BindingPage)r   r4   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   r5   r-   r]   r   r   r   get_instance   s    zBindingPage.get_instancer3   c                 C   s   dS )r@   z<Twilio.Chat.V2.BindingPage>r   r6   r   r   r   rP      s    zBindingPage.__repr__N)	r   r   r   r   rR   r   r   r_   rP   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 )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}/BindingsNrV   )r/   r   r   r0   r   r   r*      s    zBindingList.__init__Nr   )r$   r"   limit	page_sizer4   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
        rb   r$   r"   rb   ra   )r5   read_limitspagestreamr/   r$   r"   ra   rb   Zlimitsre   r   r   r   rf     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
        rb   rc   Nra   )r5   rd   
page_asyncstream_asyncrg   r   r   r   ri   /  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"   ra   rb   )listrf   r/   r$   r"   ra   rb   r   r   r   rk   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 [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   )rF   recordr   r   r   
<listcomp>  s   z*BindingList.list_async.<locals>.<listcomp>rj   N)ri   rl   r   r   r   
list_asyncn  s    
zBindingList.list_async)r$   r"   
page_tokenpage_numberrb   r4   c                 C   sR   t t|dd t|d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 rm   r   er   r   r   <lambda>  rJ   z"BindingList.page.<locals>.<lambda>c                 S   s   | S rm   r   rs   r   r   r   ru     rJ   r   ZIdentityZ	PageTokenr   ZPageSizer\   rZ   r[   params)	r   ofr   mapr5   re   rW   r^   r-   r/   r$   r"   rq   rr   rb   dataresponser   r   r   re     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 )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 rm   r   rs   r   r   r   ru     rJ   z(BindingList.page_async.<locals>.<lambda>c                 S   s   | S rm   r   rs   r   r   r   ru     rJ   rv   r\   rw   N)	r   ry   r   rz   r5   rh   rW   r^   r-   r{   r   r   r   rh     s    
zBindingList.page_async)
target_urlr4   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\   )r5   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)r5   r   r   Zrequest_asyncr^   r-   r   r   r   r   get_page_async  s    	zBindingList.get_page_async)r   r4   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(   r2   r5   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__r3   c                 C   s   dS )r@   z<Twilio.Chat.V2.BindingList>r   r6   r   r   r   rP     s    zBindingList.__repr__)r   r   r   r   rR   r*   r   unsetr   r   rQ   r   intr   r   rf   r	   ri   rk   rp   r^   re   rh   r   r   r2   r+   r   rP   rU   r   r   r0   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   r2   r^   r`   r   r   r   r   <module>   s   $u\