o
    f>hy                     @   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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ZdZdZdS )BindingInstance.BindingTypeapngcmsmsfcmzfacebook-messengeralexaN)	__name__
__module____qualname__APNGCMSMSFCMFACEBOOK_MESSENGERALEXA r#   r#   X/var/www/html/venv/lib/python3.10/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| _||pe| 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   iso8601_datetimer,   r-   r.   r/   r0   r1   r2   r3   r4   r5   	_solution_context)selfr&   r'   r(   r)   	__class__r#   r$   r8   4   s2   
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)   r6   )r<   rA   _versionr;   r=   r#   r#   r$   _proxyX   s   
zBindingInstance._proxyc                 C   
   | j  S )j
        Deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        )rD   deleterC   r#   r#   r$   rG   h      
zBindingInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        N)rD   delete_asyncrC   r#   r#   r$   rK   q      zBindingInstance.delete_asyncc                 C   rE   )[
        Fetch the BindingInstance


        :returns: The fetched BindingInstance
        )rD   fetchrC   r#   r#   r$   rN   z   rH   zBindingInstance.fetchc                    rI   )u
        Asynchronous coroutine to fetch the BindingInstance


        :returns: The fetched BindingInstance
        N)rD   fetch_asyncrC   r#   r#   r$   rP      rL   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.Notify.V1.BindingInstance {}>joinr;   itemsrW   r=   contextr#   r#   r$   __repr__      
zBindingInstance.__repr__N)r@   rA   )r@   r   )r   r   r   objectr%   r   r   strr   r   r8   propertyrD   boolrG   rK   rN   rP   rc   __classcell__r#   r#   r>   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 )rA   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/notify/api/service-resource) to fetch the resource from.
        :param sid: The Twilio-provided string that uniquely identifies the Binding resource to fetch.
        r6   z&/Services/{service_sid}/Bindings/{sid}Nr#   r7   r8   r;   rW   _uri)r=   r&   r(   r)   r>   r#   r$   r8      s
   zBindingContext.__init__r@   c                 C   s   t i }| jjd| j|dS )rF   DELETEmethoduriheaders)r   ofrB   rG   rl   r=   rq   r#   r#   r$   rG      s   
zBindingContext.deletec                    s&   t i }| jjd| j|dI dH S )rJ   rm   rn   N)r   rr   rB   rK   rl   rs   r#   r#   r$   rK      s
   
zBindingContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rM   application/jsonAcceptGETrn   r(   r)   r6   )r   rr   rB   rN   rl   r   r;   r=   rq   r'   r#   r#   r$   rN      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 )	rO   rt   ru   rv   rn   Nr(   r)   r6   )r   rr   rB   rP   rl   r   r;   rw   r#   r#   r$   rP      s   
zBindingContext.fetch_asyncc                 C   rQ   )rR   rS   c                 s   rT   rU   rV   rX   r#   r#   r$   r\      r]   z*BindingContext.__repr__.<locals>.<genexpr>z$<Twilio.Notify.V1.BindingContext {}>r^   ra   r#   r#   r$   rc      rd   zBindingContext.__repr__)r   r   r   r   rg   r8   ri   rG   rK   r   rN   rP   rc   rj   r#   r#   r>   r$   rA      s    rA   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'   r@   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   rB   r;   )r=   r'   r#   r#   r$   get_instance      zBindingPage.get_instancec                 C      dS )rR   z<Twilio.Notify.V1.BindingPage>r#   rC   r#   r#   r$   rc        zBindingPage.__repr__N)	r   r   r   r   rg   r   r   rz   rc   r#   r#   r#   r$   rx      s    
rx   c                       s  e Zd Zdedef fddZejejejejfdeddde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fdeddde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ddfdeee
f deee
f dee	e 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ddfdeee
f deee
f dee	e 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ddfdeee
f deee
f dee	e 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ddfdeee
f deee
f dee	e 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ejejfdeee
f deee
f dee	e 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ejejfdeee
f deee
f dee	e 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/d0Z  Z S )1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/notify/api/service-resource) to read the resource from.

        r(   z /Services/{service_sid}/BindingsNr#   rk   )r=   r&   r(   r>   r#   r$   r8     s   zBindingList.__init__r0   r1   r   r2   tagr.   r+   r/   r@   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 re   r#   er#   r#   r$   <lambda>=      z$BindingList.create.<locals>.<lambda>Identityr%   AddressTagNotificationProtocolVersionCredentialSidEndpointContent-Type!application/x-www-form-urlencodedrt   ru   POSTro   rp   datarq   r(   ry   )	r   rr   r   maprB   createrl   r   r;   r=   r0   r1   r2   r   r.   r+   r/   r   rq   r'   r#   r#   r$   r      s&   
zBindingList.createc              
      sx   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   r   re   r#   r   r#   r#   r$   r   n  r   z*BindingList.create_async.<locals>.<lambda>r   r   r   rt   ru   r   r   Nr(   ry   )	r   rr   r   r   rB   create_asyncrl   r   r;   r   r#   r#   r$   r   Q  s(   
zBindingList.create_asyncN
start_dateend_datelimit	page_sizec           	      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   r   r   r0   r   r   r   )rB   read_limitspagestream	r=   r   r   r0   r   r   r   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   )rB   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
        r   r   r0   r   r   r   )listr   r=   r   r   r0   r   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 re   r#   )rY   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
page_tokenpage_numberc              
   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   r   re   r#   r   r#   r#   r$   r   9  r   z"BindingList.page.<locals>.<lambda>c                 S   r   re   r#   r   r#   r#   r$   r   :  r   	StartDateEndDater   r   	PageTokenr   PageSizer   r   rt   ru   rv   ro   rp   paramsrq   )
r   rr   r   iso8601_dater   rB   r   rl   rx   r;   r=   r   r   r0   r   r   r   r   r   rq   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   r   re   r#   r   r#   r#   r$   r   f  r   z(BindingList.page_async.<locals>.<lambda>c                 S   r   re   r#   r   r#   r#   r$   r   g  r   r   r   r   rt   ru   rv   r   N)
r   rr   r   r   r   rB   r   rl   rx   r;   r   r#   r#   r$   r   J  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
        rv   )rB   domaintwiliorequestrx   r;   r=   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
        rv   N)rB   r   r   request_asyncrx   r;   r   r#   r#   r$   get_page_async  s   	zBindingList.get_page_asyncr)   c                 C      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(   r6   rA   rB   r;   r=   r)   r#   r#   r$   r9     r{   zBindingList.getc                 C   r   r   r   r   r#   r#   r$   __call__  r{   zBindingList.__call__c                 C   r|   )rR   z<Twilio.Notify.V1.BindingList>r#   rC   r#   r#   r$   rc     r}   zBindingList.__repr__)!r   r   r   r   rg   r8   r   unsetr   r   rf   r   r   r   r   r   intr	   r   r
   r   r   r   rx   r   r   r   r   rA   r9   r   rc   rj   r#   r#   r>   r$   r~     sj   


	
6


	
3


)


)


(


)




	
/




	
-

r~   N)__doc__r   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   rA   rx   r~   r#   r#   r#   r$   <module>   s    $}c