a
    !f@v                     @   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   f/var/www/html/python-backend/venv/lib/python3.9/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   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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+   )r1   r5   _versionr0   r2   r   r   r   _proxyX   s    
zBindingInstance._proxyc                 C   s
   | j  S )j
        Deletes the BindingInstance


        :returns: True if delete succeeds, False otherwise
        )r:   deleter9   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)r:   delete_asyncr9   r   r   r   r>   q   s    zBindingInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the BindingInstance


        :returns: The fetched BindingInstance
        )r:   fetchr9   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)r:   fetch_asyncr9   r   r   r   rB      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.Notify.V1.BindingInstance {}>joinr0   itemsrG   r2   contextr   r   r   __repr__   s    zBindingInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r-   propertyr:   boolr<   r>   r@   rB   rS   __classcell__r   r   r3   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 )r5   )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/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-   r0   rG   _uri)r2   r   r   r   r3   r   r   r-      s
    zBindingContext.__init__r6   c                 C   s   | j jd| jdS )r;   DELETEmethoduri)r8   r<   rZ   r9   r   r   r   r<      s    zBindingContext.deletec                    s   | j jd| jdI dH S )r=   r[   r\   N)r8   r>   rZ   r9   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?   GETr\   r   r   r+   )r8   r@   rZ   r   r0   r2   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 )rA   r_   r\   Nr   r   r+   )r8   rB   rZ   r   r0   r`   r   r   r   rB      s    zBindingContext.fetch_asyncc                 C   s$   d dd | j D }d|S )rC   rD   c                 s   s   | ]\}}d  ||V  qdS rE   rF   rH   r   r   r   rL      rM   z*BindingContext.__repr__.<locals>.<genexpr>z$<Twilio.Notify.V1.BindingContext {}>rN   rQ   r   r   r   rS      s    zBindingContext.__repr__)r   r   r   r   rU   r-   rW   r<   r>   r   r@   rB   rS   rX   r   r   r3   r   r5      s   r5   c                   @   s2   e Zd Zeeef edddZedddZdS )BindingPage)r   r7   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   r8   r0   r`   r   r   r   get_instance   s    zBindingPage.get_instancer6   c                 C   s   dS )rC   z<Twilio.Notify.V1.BindingPage>r   r9   r   r   r   rS      s    zBindingPage.__repr__N)	r   r   r   r   rU   r   r   rc   rS   r   r   r   r   ra      s   
ra   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 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}/BindingsNrY   )r2   r   r   r3   r   r   r-     s    zBindingList.__init__r   )r%   r&   r'   tagr#   r    r$   r7   c           
   
   C   sP   t |||t|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>3  rM   z$BindingList.create.<locals>.<lambda>Identityr   ZAddressTagZNotificationProtocolVersionZCredentialSidZEndpointPOSTr]   r^   datar   rb   )	r   ofr   mapr8   createrZ   r   r0   
r2   r%   r&   r'   re   r#   r    r$   ro   r   r   r   r   rr     s$    zBindingList.createc           
   
      sV   t |||t|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 rf   r   rg   r   r   r   ri   `  rM   z*BindingList.create_async.<locals>.<lambda>rj   rm   rn   Nr   rb   )	r   rp   r   rq   r8   create_asyncrZ   r   r0   rs   r   r   r   rt   D  s$    zBindingList.create_asyncN)
start_dateend_dater%   re   limit	page_sizer7   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
        rx   ru   rv   r%   re   rx   rw   )r8   read_limitspagestream	r2   ru   rv   r%   re   rw   rx   Zlimitsr{   r   r   r   r|   q  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
        rx   ry   Nrw   )r8   rz   
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
        ru   rv   r%   re   rw   rx   )listr|   r2   ru   rv   r%   re   rw   rx   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 rf   r   )rI   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)ru   rv   r%   re   
page_tokenpage_numberrx   r7   c           
   
   C   sb   t t|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 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 rf   r   rg   r   r   r   ri   (  rM   z"BindingList.page.<locals>.<lambda>c                 S   s   | S rf   r   rg   r   r   r   ri   )  rM   Z	StartDateZEndDaterk   rl   Z	PageTokenr   ZPageSizer_   r]   r^   params)
r   rp   r   iso8601_daterq   r8   r{   rZ   ra   r0   
r2   ru   rv   r%   re   r   r   rx   ro   responser   r   r   r{     s    zBindingList.pagec           
   
      sh   t t|t|t|dd t|d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 rf   r   rg   r   r   r   ri   O  rM   z(BindingList.page_async.<locals>.<lambda>c                 S   s   | S rf   r   rg   r   r   r   ri   P  rM   r   r_   r   N)
r   rp   r   r   rq   r8   r~   rZ   ra   r0   r   r   r   r   r~   3  s    zBindingList.page_async)
target_urlr7   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_   )r8   domaintwiliorequestra   r0   r2   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)r8   r   r   Zrequest_asyncra   r0   r   r   r   r   get_page_asynch  s    	zBindingList.get_page_async)r   r7   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+   r5   r8   r0   r2   r   r   r   r   r.   t  s    zBindingList.getc                 C   s   t | j| jd |dS r   r   r   r   r   r   __call__~  s    zBindingList.__call__r6   c                 C   s   dS )rC   z<Twilio.Notify.V1.BindingList>r   r9   r   r   r   rS     s    zBindingList.__repr__)!r   r   r   r   rU   r-   r   unsetr   r   rT   r   rr   rt   r   r   intr	   r|   r
   r   r   r   ra   r{   r~   r   r   r5   r.   r   rS   rX   r   r   r3   r   rd     s   


2


/

)

)

(

)




)




)

rd   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   r5   ra   rd   r   r   r   r   <module>   s   $|\