o
    f>hsX                     @   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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gcmapnfcmN)__name__
__module____qualname__GCMAPNFCM r   r   V/var/www/html/venv/lib/python3.10/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| _||pY| 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   r0   /   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.   )r4   r9   _versionr3   r5   r   r   r   _proxyQ   s   
zBindingInstance._proxyc                 C   
   | j  S )j
        Deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        )r<   deleter;   r   r   r   r?   a      
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   rC   j      zBindingInstance.delete_asyncc                 C   r=   )[
        Fetch the BindingInstance


        :returns: The fetched BindingInstance
        )r<   fetchr;   r   r   r   rF   s   r@   zBindingInstance.fetchc                    rA   )u
        Asynchronous coroutine to fetch the BindingInstance


        :returns: The fetched BindingInstance
        N)r<   fetch_asyncr;   r   r   r   rH   |   rD   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.Chat.V2.BindingInstance {}>joinr3   itemsrO   r5   contextr   r   r   __repr__      
zBindingInstance.__repr__N)r8   r9   )r8   r   )r   r   r   objectr   r   r   strr   r   r0   propertyr<   boolr?   rC   rF   rH   r[   __classcell__r   r   r6   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 )r9   r    r"   r#   c                    s0   t  | ||d| _djd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}Nr   r/   r0   r3   rO   _uri)r5   r    r"   r#   r6   r   r   r0      s
   zBindingContext.__init__r8   c                 C   s   t i }| jjd| j|dS )r>   DELETEmethoduriheaders)r   ofr:   r?   rd   r5   ri   r   r   r   r?      s   
zBindingContext.deletec                    s&   t i }| jjd| j|dI dH S )rB   re   rf   N)r   rj   r:   rC   rd   rk   r   r   r   rC      s
   
zBindingContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rE   application/jsonAcceptGETrf   r"   r#   r.   )r   rj   r:   rF   rd   r   r3   r5   ri   r!   r   r   r   rF      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 )	rG   rl   rm   rn   rf   Nr"   r#   r.   )r   rj   r:   rH   rd   r   r3   ro   r   r   r   rH      s   
zBindingContext.fetch_asyncc                 C   rI   )rJ   rK   c                 s   rL   rM   rN   rP   r   r   r   rT      rU   z*BindingContext.__repr__.<locals>.<genexpr>z"<Twilio.Chat.V2.BindingContext {}>rV   rY   r   r   r   r[      r\   zBindingContext.__repr__)r   r   r   r   r_   r0   ra   r?   rC   r   rF   rH   r[   rb   r   r   r6   r   r9      s    r9   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!   r8   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   r:   r3   )r5   r!   r   r   r   get_instance      zBindingPage.get_instancec                 C      dS )rJ   z<Twilio.Chat.V2.BindingPage>r   r;   r   r   r   r[         zBindingPage.__repr__N)	r   r   r   r   r_   r   r   rq   r[   r   r   r   r   rp      s    
rp   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 )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}/BindingsNr   rc   )r5   r    r"   r6   r   r   r0   	  s   zBindingList.__init__Nr*   r   r(   limit	page_sizer8   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
        rw   r*   r(   rw   rv   )r:   read_limitspagestreamr5   r*   r(   rv   rw   limitsrz   r   r   r   r{     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
        rw   rx   Nrv   )r:   ry   
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 [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(   rv   rw   )listr{   r5   r*   r(   rv   rw   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 [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 r]   r   )rQ   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 )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 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-urlencodedrl   rm   rn   rg   rh   paramsri   )	r   rj   r   mapr:   rz   rd   rp   r3   	r5   r*   r(   r   r   rw   datari   responser   r   r   rz     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 )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   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   rl   rm   rn   r   N)	r   rj   r   r   r:   r~   rd   rp   r3   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
        rn   )r:   domaintwiliorequestrp   r3   r5   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
        rn   N)r:   r   r   request_asyncrp   r3   r   r   r   r   get_page_async  s   	zBindingList.get_page_asyncr#   c                 C      t | j| jd |dS zl
        Constructs a BindingContext

        :param sid: The SID of the Binding resource to fetch.
        r"   r.   r9   r:   r3   r5   r#   r   r   r   r1     rr   zBindingList.getc                 C   r   r   r   r   r   r   r   __call__  rr   zBindingList.__call__c                 C   rs   )rJ   z<Twilio.Chat.V2.BindingList>r   r;   r   r   r   r[     rt   zBindingList.__repr__)r   r   r   r   r_   r0   r   unsetr   r   r^   r   intr   r   r{   r	   r   r   r   rp   rz   r~   r   r   r9   r1   r   r[   rb   r   r   r6   r   ru     s    
!
!
"
#



)



'

ru   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   r9   rp   ru   r   r   r   r   <module>   s    $vc