U
    ^g%iy                     @   s   d Z ddlmZ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 - Notify
    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.
    )date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ZdZdS )BindingInstance.BindingTypeZapnZgcmZsmsZfcmzfacebook-messengerZalexaN)	__name__
__module____qualname__ZAPNZGCMZSMSZFCMZFACEBOOK_MESSENGERZALEXA r   r   d/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/notify/v1/service/binding.pyBindingType   s   r   N)versionpayloadservice_sidsidc                    s   t  | |d| _|d| _|d| _|d| _t|d| _	t|d| _
|d| _|d| _|d	| _|d
| _|d| _|d| _|d| _|d| _||p| jd| _d | _d S )Nr   account_sidr   credential_siddate_createddate_updatednotification_protocol_versionendpointidentitybinding_typeaddresstagsurllinksr   r   )super__init__getr   r   r   r    r   Ziso8601_datetimer!   r"   r#   r$   r%   r&   r'   r(   r)   r*   	_solution_context)selfr   r   r   r   	__class__r   r   r-   4   s2    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+   )r0   r4   _versionr/   r1   r   r   r   _proxyX   s    
zBindingInstance._proxyc                 C   s
   | j  S )j
        Deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        )r9   deleter8   r   r   r   r;   h   s    zBindingInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        N)r9   delete_asyncr8   r   r   r   r=   q   s    zBindingInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the BindingInstance


        :returns: The fetched BindingInstance
        )r9   fetchr8   r   r   r   r?   z   s    zBindingInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the BindingInstance


        :returns: The fetched BindingInstance
        N)r9   fetch_asyncr8   r   r   r   rA      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.Notify.V1.BindingInstance {}>joinr/   itemsrF   r1   contextr   r   r   __repr__   s    zBindingInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r-   propertyr9   boolr;   r=   r?   rA   rQ   __classcell__r   r   r2   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 )r4   )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/notify/api/service-resource) to fetch the resource from.
        :param sid: The Twilio-provided string that uniquely identifies the Binding resource to fetch.
        r+   z&/Services/{service_sid}/Bindings/{sid}Nr,   r-   r/   rF   _uri)r1   r   r   r   r2   r   r   r-      s
    zBindingContext.__init__r5   c                 C   s   t i }| jjd| j|dS )r:   DELETEmethoduriheaders)r   ofr7   r;   rX   r1   r]   r   r   r   r;      s    
zBindingContext.deletec                    s$   t i }| jjd| j|dI dH S )r<   rY   rZ   N)r   r^   r7   r=   rX   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GETrZ   r   r   r+   )r   r^   r7   r?   rX   r   r/   r1   r]   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`   ra   rb   rZ   Nr   r   r+   )r   r^   r7   rA   rX   r   r/   rc   r   r   r   rA      s    
  zBindingContext.fetch_asyncc                 C   s$   d dd | j D }d|S )rB   rC   c                 s   s   | ]\}}d  ||V  qdS rD   rE   rG   r   r   r   rK      s     z*BindingContext.__repr__.<locals>.<genexpr>z$<Twilio.Notify.V1.BindingContext {}>rL   rO   r   r   r   rQ      s    zBindingContext.__repr__)r   r   r   r   rS   r-   rU   r;   r=   r   r?   rA   rQ   rV   r   r   r2   r   r4      s   r4   c                   @   s2   e Zd Zeeef edddZedddZdS )BindingPage)r   r6   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   r7   r/   )r1   r   r   r   r   get_instance   s
      zBindingPage.get_instancer5   c                 C   s   dS )rB   z<Twilio.Notify.V1.BindingPage>r   r8   r   r   r   rQ     s    zBindingPage.__repr__N)	r   r   r   r   rS   r   r   rf   rQ   r   r   r   r   rd      s   
rd   c                
       s  e Zd Zeed fddZejejejejfede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fede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d
d
feee
f eee
f ee	e 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d
d
feee
f eee
f ee	e 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d
d
feee
f eee
f ee	e 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d
d
feee
f eee
f ee	e 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ejejfeee
f eee
f ee	e 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ejejfeee
f eee
f ee	e 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/notify/api/service-resource) to read the resource from.

        r   z /Services/{service_sid}/BindingsNrW   )r1   r   r   r2   r   r   r-     s
     zBindingList.__init__r   )r%   r&   r'   tagr#   r    r$   r6   c              
   C   sp   t |||t|dd |||d}t ddi}	d|	d< d|	d< | jjd| j||	d	}
t| j|
| jd
 dS )a]  
        Create the BindingInstance

        :param identity: The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service.
        :param binding_type:
        :param address: The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format.
        :param tag: A tag that can be used to select the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 20 tags.
        :param notification_protocol_version: The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` for the protocol in the [Service](https://www.twilio.com/docs/notify/api/service-resource). The current version is `\"3\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed.
        :param credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applies to only `apn`, `fcm`, and `gcm` type Bindings.
        :param endpoint: Deprecated.

        :returns: The created BindingInstance
        c                 S   s   | S Nr   er   r   r   <lambda>=      z$BindingList.create.<locals>.<lambda>Identityr   ZAddressTagZNotificationProtocolVersionZCredentialSidZEndpointContent-Type!application/x-www-form-urlencodedr`   ra   POSTr[   r\   datar]   r   re   )	r   r^   r   mapr7   createrX   r   r/   r1   r%   r&   r'   rh   r#   r    r$   ru   r]   r   r   r   r   rw      s0         zBindingList.createc              
      sv   t |||t|dd |||d}t ddi}	d|	d< d|	d< | jjd| j||	d	I d
H }
t| j|
| jd dS )al  
        Asynchronously create the BindingInstance

        :param identity: The `identity` value that uniquely identifies the new resource's [User](https://www.twilio.com/docs/chat/rest/user-resource) within the [Service](https://www.twilio.com/docs/notify/api/service-resource). Up to 20 Bindings can be created for the same Identity in a given Service.
        :param binding_type:
        :param address: The channel-specific address. For APNS, the device token. For FCM and GCM, the registration token. For SMS, a phone number in E.164 format. For Facebook Messenger, the Messenger ID of the user or a phone number in E.164 format.
        :param tag: A tag that can be used to select the Bindings to notify. Repeat this parameter to specify more than one tag, up to a total of 20 tags.
        :param notification_protocol_version: The protocol version to use to send the notification. This defaults to the value of `default_xxxx_notification_protocol_version` for the protocol in the [Service](https://www.twilio.com/docs/notify/api/service-resource). The current version is `\"3\"` for `apn`, `fcm`, and `gcm` type Bindings. The parameter is not applicable to `sms` and `facebook-messenger` type Bindings as the data format is fixed.
        :param credential_sid: The SID of the [Credential](https://www.twilio.com/docs/notify/api/credential-resource) resource to be used to send notifications to this Binding. If present, this overrides the Credential specified in the Service resource. Applies to only `apn`, `fcm`, and `gcm` type Bindings.
        :param endpoint: Deprecated.

        :returns: The created BindingInstance
        c                 S   s   | S ri   r   rj   r   r   r   rl   n  rm   z*BindingList.create_async.<locals>.<lambda>rn   rq   rr   r`   ra   rs   rt   Nr   re   )	r   r^   r   rv   r7   create_asyncrX   r   r/   rx   r   r   r   ry   Q  s0         zBindingList.create_asyncN)
start_dateend_dater%   rh   limit	page_sizer6   c           	      C   s8   | 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 date start_date: Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param date end_date: Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param List[str] identity: The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read.
        :param List[str] tag: Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed.
        :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
        r}   rz   r{   r%   rh   r}   r|   )r7   read_limitspagestream	r1   rz   r{   r%   rh   r|   r}   Zlimitsr   r   r   r   r     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 date start_date: Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param date end_date: Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param List[str] identity: The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read.
        :param List[str] tag: Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed.
        :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
        r}   r~   Nr|   )r7   r   
page_asyncstream_asyncr   r   r   r   r     s    zBindingList.stream_asyncc              	   C   s   t | j||||||dS )ay  
        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 date start_date: Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param date end_date: Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param List[str] identity: The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read.
        :param List[str] tag: Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed.
        :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
        rz   r{   r%   rh   r|   r}   )listr   r1   rz   r{   r%   rh   r|   r}   r   r   r   r     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 date start_date: Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param date end_date: Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param List[str] identity: The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read.
        :param List[str] tag: Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed.
        :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 ri   r   )rH   recordr   r   r   
<listcomp>  s   z*BindingList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async  s    
zBindingList.list_async)rz   r{   r%   rh   
page_tokenpage_numberr}   r6   c              
   C   sz   t t|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 start_date: Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param end_date: Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param identity: The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read.
        :param tag: Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed.
        :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 ri   r   rj   r   r   r   rl   9  rm   z"BindingList.page.<locals>.<lambda>c                 S   s   | S ri   r   rj   r   r   r   rl   :  rm   Z	StartDateZEndDatero   rp   Z	PageTokenr   ZPageSizerq   rr   r`   ra   rb   r[   r\   paramsr]   )
r   r^   r   iso8601_daterv   r7   r   rX   rd   r/   r1   rz   r{   r%   rh   r   r   r}   ru   r]   responser   r   r   r     s&       zBindingList.pagec              
      s   t t|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 )a  
        Asynchronously retrieve a single page of BindingInstance records from the API.
        Request is executed immediately

        :param start_date: Only include usage that has occurred on or after this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param end_date: Only include usage that occurred on or before this date. Specify the date in GMT and format as `YYYY-MM-DD`.
        :param identity: The [User](https://www.twilio.com/docs/chat/rest/user-resource)'s `identity` value of the resources to read.
        :param tag: Only list Bindings that have all of the specified Tags. The following implicit tags are available: `all`, `apn`, `fcm`, `gcm`, `sms`, `facebook-messenger`. Up to 5 tags are allowed.
        :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 ri   r   rj   r   r   r   rl   f  rm   z(BindingList.page_async.<locals>.<lambda>c                 S   s   | S ri   r   rj   r   r   r   rl   g  rm   r   rq   rr   r`   ra   rb   r   N)
r   r^   r   r   rv   r7   r   rX   rd   r/   r   r   r   r   r   J  s&       zBindingList.page_async)
target_urlr6   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
        rb   )r7   domaintwiliorequestrd   r/   r1   r   r   r   r   r   get_pagew  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
        rb   N)r7   r   r   Zrequest_asyncrd   r/   r   r   r   r   get_page_async  s    	zBindingList.get_page_async)r   r6   c                 C   s   t | j| jd |dS z
        Constructs a BindingContext

        :param sid: The Twilio-provided string that uniquely identifies the Binding resource to fetch.
        r   r+   r4   r7   r/   r1   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__r5   c                 C   s   dS )rB   z<Twilio.Notify.V1.BindingList>r   r8   r   r   r   rQ     s    zBindingList.__repr__)!r   r   r   r   rS   r-   r   unsetr   r   rR   r   rw   ry   r   r   intr	   r   r
   r   r   r   rd   r   r   r   r   r4   r.   r   rQ   rV   r   r   r2   r   rg     s   


6


3

)

)

(

)




/




-

rg   N)__doc__r   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   r4   rd   rg   r   r   r   r   <module>   s   $}c