o
    eXG                     @   s   d 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 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 )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)	serialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd ZdZ fddZejejejejfddZejejejejddfddZejejejejddfd	d
Z	ejejejejejejejfddZ
dd Zdd Zdd Zdd Z  ZS )BindingListk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c                    s2   t t| | d|i| _djdi | j| _dS )aO  
        Initialize the BindingList

        :param Version version: Version that contains the resource
        :param service_sid: The SID of the Service that the resource is associated with

        :returns: twilio.rest.notify.v1.service.binding.BindingList
        :rtype: twilio.rest.notify.v1.service.binding.BindingList
        service_sidz /Services/{service_sid}/BindingsN )superr	   __init__	_solutionformat_uri)selfversionr   	__class__r   X/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/notify/v1/service/binding.pyr      s   

zBindingList.__init__c           
   
   C   sP   t |||t|dd |||d}| jjd| j|d}	t| j|	| jd dS )a  
        Create the BindingInstance

        :param unicode identity: The `identity` value that identifies the new resource's User
        :param BindingInstance.BindingType binding_type: The type of the Binding
        :param unicode address: The channel-specific address
        :param list[unicode] tag: A tag that can be used to select the Bindings to notify
        :param unicode notification_protocol_version: The protocol version to use to send the notification
        :param unicode credential_sid: The SID of the Credential resource to be used to send notifications to this Binding
        :param unicode endpoint: Deprecated

        :returns: The created BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingInstance
        c                 S      | S Nr   er   r   r   <lambda>;       z$BindingList.create.<locals>.<lambda>)IdentityBindingTypeAddressTagNotificationProtocolVersionCredentialSidEndpointPOST)methoduridatar   r   )	r   ofr   map_versioncreater   BindingInstancer   )
r   identitybinding_typeaddresstagnotification_protocol_versioncredential_sidendpointr'   payloadr   r   r   r,   &   s   
zBindingList.createNc           	      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
        :param date end_date: Only include usage that occurred on or before this date
        :param list[unicode] identity: The `identity` value of the resources to read
        :param list[unicode] tag: Only list Bindings that have all of the specified Tags
        :param int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int 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
        :rtype: list[twilio.rest.notify.v1.service.binding.BindingInstance]
        	page_size)
start_dateend_dater.   r1   r6   limit)r+   read_limitspagestream)	r   r7   r8   r.   r1   r9   r6   limitsr;   r   r   r   r<   E   s   zBindingList.streamc              	   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 date start_date: Only include usage that has occurred on or after this date
        :param date end_date: Only include usage that occurred on or before this date
        :param list[unicode] identity: The `identity` value of the resources to read
        :param list[unicode] tag: Only list Bindings that have all of the specified Tags
        :param int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int 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: Generator that will yield up to limit results
        :rtype: list[twilio.rest.notify.v1.service.binding.BindingInstance]
        )r7   r8   r.   r1   r9   r6   )listr<   )r   r7   r8   r.   r1   r9   r6   r   r   r   r>   g   s   zBindingList.listc           
   
   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 date start_date: Only include usage that has occurred on or after this date
        :param date end_date: Only include usage that occurred on or before this date
        :param list[unicode] identity: The `identity` value of the resources to read
        :param list[unicode] tag: Only list Bindings that have all of the specified Tags
        :param str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingPage
        c                 S   r   r   r   r   r   r   r   r      r   z"BindingList.page.<locals>.<lambda>c                 S   r   r   r   r   r   r   r   r      r   )	StartDateEndDater   r    	PageTokenr   PageSizeGET)r%   r&   params)
r   r)   r   iso8601_dater*   r+   r;   r   BindingPager   )
r   r7   r8   r.   r1   
page_tokenpage_numberr6   r'   responser   r   r   r;      s   
zBindingList.pagec                 C   s"   | j jjd|}t| j || jS )a9  
        Retrieve a specific page of BindingInstance records from the API.
        Request is executed immediately

        :param str target_url: API-generated URL for the requested results page

        :returns: Page of BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingPage
        rC   )r+   domaintwiliorequestrF   r   )r   
target_urlrI   r   r   r   get_page   s
   

zBindingList.get_pagec                 C      t | j| jd |dS z
        Constructs a BindingContext

        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.notify.v1.service.binding.BindingContext
        :rtype: twilio.rest.notify.v1.service.binding.BindingContext
        r   r   sidBindingContextr+   r   r   rR   r   r   r   get      	zBindingList.getc                 C   rO   rP   rS   rU   r   r   r   __call__   rW   zBindingList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Notify.V1.BindingList>r   r   r   r   r   __repr__      zBindingList.__repr__)__name__
__module____qualname____doc__r   r   unsetr,   r<   r>   r;   rN   rV   rX   r\   __classcell__r   r   r   r   r	      s*    

"

 r	   c                       s0   e Zd ZdZ fddZdd Zdd Z  ZS )rF   r
   c                    s   t t| || || _dS )a  
        Initialize the BindingPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param service_sid: The SID of the Service that the resource is associated with

        :returns: twilio.rest.notify.v1.service.binding.BindingPage
        :rtype: twilio.rest.notify.v1.service.binding.BindingPage
        N)r   rF   r   r   )r   r   rI   solutionr   r   r   r      s   
zBindingPage.__init__c                 C   s   t | j|| jd dS )a  
        Build an instance of BindingInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.notify.v1.service.binding.BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingInstance
        r   r(   )r-   r+   r   r   r5   r   r   r   get_instance   rW   zBindingPage.get_instancec                 C   rY   )rZ   z<Twilio.Notify.V1.BindingPage>r   r[   r   r   r   r\      r]   zBindingPage.__repr__)r^   r_   r`   ra   r   rf   r\   rc   r   r   r   r   rF      s
    rF   c                       s8   e Zd ZdZ fddZdd Zdd Zdd	 Z  ZS )
rT   r
   c                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the BindingContext

        :param Version version: Version that contains the resource
        :param service_sid: The SID of the Service to fetch the resource from
        :param sid: The unique string that identifies the resource

        :returns: twilio.rest.notify.v1.service.binding.BindingContext
        :rtype: twilio.rest.notify.v1.service.binding.BindingContext
        rQ   z&/Services/{service_sid}/Bindings/{sid}Nr   )r   rT   r   r   r   r   )r   r   r   rR   r   r   r   r     s   zBindingContext.__init__c                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the BindingInstance

        :returns: The fetched BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingInstance
        rC   r%   r&   r   rR   rQ   )r+   fetchr   r-   r   re   r   r   r   ri     s   zBindingContext.fetchc                 C   s   | j jd| jdS )~
        Deletes the BindingInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETErh   )r+   deleter   r[   r   r   r   rl   $  s   zBindingContext.deletec                 C   $   d dd | j D }d|S )rZ    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>4      z*BindingContext.__repr__.<locals>.<genexpr>z$<Twilio.Notify.V1.BindingContext {}>joinr   itemsr   r   contextr   r   r   r\   -     
zBindingContext.__repr__)	r^   r_   r`   ra   r   ri   rl   r\   rc   r   r   r   r   rT      s    	rT   c                       s   e Zd ZdZG dd deZd+ fdd	Zedd Zed	d
 Z	edd Z
edd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd Zedd  Zed!d" Zed#d$ Zd%d& Zd'd( Zd)d* Z  ZS ),r-   r
   c                   @   s$   e Zd ZdZdZdZdZdZdZdS )zBindingInstance.BindingTypeapngcmsmsfcmzfacebook-messengeralexaN)	r^   r_   r`   APNGCMSMSFCMFACEBOOK_MESSENGERALEXAr   r   r   r   r   <  s    r   Nc                    s   t t| | |d|d|d|dt|dt|d|d|d|d	|d
|d|d|d|dd| _d| _||pT| jd d| _dS )z
        Initialize the BindingInstance

        :returns: twilio.rest.notify.v1.service.binding.BindingInstance
        :rtype: twilio.rest.notify.v1.service.binding.BindingInstance
        rR   account_sidr   r3   date_createddate_updatedr2   r4   r.   r/   r0   tagsurllinks)rR   r   r   r3   r   r   r2   r4   r.   r/   r0   r   r   r   NrQ   )	r   r-   r   rV   r   iso8601_datetime_properties_contextr   )r   r   r5   r   rR   r   r   r   r   D  s$   zBindingInstance.__init__c                 C   s.   | j du rt| j| jd | jd d| _ | j S )a/  
        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
        :rtype: twilio.rest.notify.v1.service.binding.BindingContext
        Nr   rR   rQ   )r   rT   r+   r   r[   r   r   r   _proxyc  s   
	zBindingInstance._proxyc                 C   
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rR   r   r[   r   r   r   rR   t     
zBindingInstance.sidc                 C   r   )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        r   r   r[   r   r   r   r   |  r   zBindingInstance.account_sidc                 C   r   )zo
        :returns: The SID of the Service that the resource is associated with
        :rtype: unicode
        r   r   r[   r   r   r   r     r   zBindingInstance.service_sidc                 C   r   )z
        :returns: The SID of the Credential resource to be used to send notifications to this Binding
        :rtype: unicode
        r3   r   r[   r   r   r   r3     r   zBindingInstance.credential_sidc                 C   r   )zt
        :returns: The RFC 2822 date and time in GMT when the resource was created
        :rtype: datetime
        r   r   r[   r   r   r   r     r   zBindingInstance.date_createdc                 C   r   )zy
        :returns: The RFC 2822 date and time in GMT when the resource was last updated
        :rtype: datetime
        r   r   r[   r   r   r   r     r   zBindingInstance.date_updatedc                 C   r   )zh
        :returns: The protocol version to use to send the notification
        :rtype: unicode
        r2   r   r[   r   r   r   r2     r   z-BindingInstance.notification_protocol_versionc                 C   r   )z>
        :returns: Deprecated
        :rtype: unicode
        r4   r   r[   r   r   r   r4     r   zBindingInstance.endpointc                 C   r   )zp
        :returns: The `identity` value that identifies the new resource's User
        :rtype: unicode
        r.   r   r[   r   r   r   r.     r   zBindingInstance.identityc                 C   r   )zK
        :returns: The type of the Binding
        :rtype: unicode
        r/   r   r[   r   r   r   r/     r   zBindingInstance.binding_typec                 C   r   )zP
        :returns: The channel-specific address
        :rtype: unicode
        r0   r   r[   r   r   r   r0     r   zBindingInstance.addressc                 C   r   )zg
        :returns: The list of tags associated with this Binding
        :rtype: list[unicode]
        r   r   r[   r   r   r   r     r   zBindingInstance.tagsc                 C   r   )z\
        :returns: The absolute URL of the Binding resource
        :rtype: unicode
        r   r   r[   r   r   r   r     r   zBindingInstance.urlc                 C   r   )zQ
        :returns: The URLs of related resources
        :rtype: unicode
        r   r   r[   r   r   r   r     r   zBindingInstance.linksc                 C   
   | j  S )rg   )r   ri   r[   r   r   r   ri        
zBindingInstance.fetchc                 C   r   )rj   )r   rl   r[   r   r   r   rl     r   zBindingInstance.deletec                 C   rm   )rZ   rn   c                 s   ro   rp   rq   rr   r   r   r   rv     rw   z+BindingInstance.__repr__.<locals>.<genexpr>z%<Twilio.Notify.V1.BindingInstance {}>rx   r{   r   r   r   r\     r}   zBindingInstance.__repr__r   )r^   r_   r`   ra   objectr   r   propertyr   rR   r   r   r3   r   r   r2   r4   r.   r/   r0   r   r   r   ri   rl   r\   rc   r   r   r   r   r-   8  sJ    














		r-   N)ra   twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   rF   rT   r-   r   r   r   r   <module>   s    E)9