o
    eD                     @   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fddZdddZdd	d
Z	ejejejfddZ
dd Zdd Zdd Zdd Z  ZS )WebhookListk 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 )a   
        Initialize the WebhookList

        :param Version version: Version that contains the resource
        :param service_sid: Service Sid.

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

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

        :param unicode friendly_name: The string that you assigned to describe the webhook
        :param list[unicode] event_types: The array of events that this Webhook is subscribed to.
        :param unicode webhook_url: The URL associated with this Webhook.
        :param WebhookInstance.Status status: The webhook status
        :param WebhookInstance.Version version: The webhook version

        :returns: The created WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        c                 S      | S Nr   er   r   r   <lambda>6       z$WebhookList.create.<locals>.<lambda>FriendlyName
EventTypes
WebhookUrlStatusVersionPOSTmethoduridatar   r   )	r   ofr   map_versioncreater   WebhookInstancer   r   friendly_nameevent_typeswebhook_urlstatusr   r'   payloadr   r   r   r,   &   s   zWebhookList.createNc                 C   s0   | j ||}| j|d d}| j ||d S )a  
        Streams WebhookInstance 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 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.verify.v2.service.webhook.WebhookInstance]
        	page_size)r4   limit)r+   read_limitspagestream)r   r5   r4   limitsr7   r   r   r   r8   @   s   zWebhookList.streamc                 C   s   t | j||dS )aa  
        Lists WebhookInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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.verify.v2.service.webhook.WebhookInstance]
        )r5   r4   )listr8   )r   r5   r4   r   r   r   r:   W   s   zWebhookList.listc                 C   s6   t |||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of WebhookInstance records from the API.
        Request is executed immediately

        :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 WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookPage
        )	PageTokenr   PageSizeGET)r%   r&   params)r   r)   r+   r7   r   WebhookPager   )r   
page_tokenpage_numberr4   r'   responser   r   r   r7   i   s   zWebhookList.pagec                 C   s"   | j jjd|}t| j || jS )a9  
        Retrieve a specific page of WebhookInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookPage
        r=   )r+   domaintwiliorequestr?   r   )r   
target_urlrB   r   r   r   get_page|   s
   

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

        :param sid: The unique string that identifies the resource to fetch

        :returns: twilio.rest.verify.v2.service.webhook.WebhookContext
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookContext
        r   r   sidWebhookContextr+   r   r   rK   r   r   r   get      	zWebhookList.getc                 C   rH   rI   rL   rN   r   r   r   __call__   rP   zWebhookList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Verify.V2.WebhookList>r   r   r   r   r   __repr__      zWebhookList.__repr__)NN)__name__
__module____qualname____doc__r   r   unsetr,   r8   r:   r7   rG   rO   rQ   rU   __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 )r?   r
   c                    s   t t| || || _dS )aX  
        Initialize the WebhookPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param service_sid: Service Sid.

        :returns: twilio.rest.verify.v2.service.webhook.WebhookPage
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookPage
        N)r   r?   r   r   )r   r   rB   solutionr   r   r   r      s   
zWebhookPage.__init__c                 C   s   t | j|| jd dS )a  
        Build an instance of WebhookInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.verify.v2.service.webhook.WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        r   r(   )r-   r+   r   r   r3   r   r   r   get_instance   rP   zWebhookPage.get_instancec                 C   rR   )rS   z<Twilio.Verify.V2.WebhookPage>r   rT   r   r   r   rU      rV   zWebhookPage.__repr__)rW   rX   rY   rZ   r   r_   rU   r\   r   r   r   r   r?      s
    r?   c                       sV   e Zd ZdZ fddZejejejejejfddZdd Zdd	 Z	d
d Z
  ZS )rM   r
   c                    s4   t t| | ||d| _djdi | j| _dS )au  
        Initialize the WebhookContext

        :param Version version: Version that contains the resource
        :param service_sid: Service Sid.
        :param sid: The unique string that identifies the resource to fetch

        :returns: twilio.rest.verify.v2.service.webhook.WebhookContext
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookContext
        rJ   z&/Services/{service_sid}/Webhooks/{sid}Nr   )r   rM   r   r   r   r   )r   r   r   rK   r   r   r   r      s   zWebhookContext.__init__c                 C   sT   t |t|dd |||d}| jjd| j|d}t| j|| jd | jd dS )	.  
        Update the WebhookInstance

        :param unicode friendly_name: The string that you assigned to describe the webhook
        :param list[unicode] event_types: The array of events that this Webhook is subscribed to.
        :param unicode webhook_url: The URL associated with this Webhook.
        :param WebhookInstance.Status status: The webhook status
        :param WebhookInstance.Version version: The webhook version

        :returns: The updated WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        c                 S   r   r   r   r   r   r   r   r      r   z'WebhookContext.update.<locals>.<lambda>r   r#   r$   r   rK   rJ   )	r   r)   r   r*   r+   updater   r-   r   r.   r   r   r   ra      s   zWebhookContext.updatec                 C   s   | j jd| jdS )~
        Deletes the WebhookInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETEr%   r&   )r+   deleter   rT   r   r   r   re   
  s   zWebhookContext.deletec                 C   s0   | j jd| jd}t| j || jd | jd dS )
        Fetch the WebhookInstance

        :returns: The fetched WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        r=   rd   r   rK   rJ   )r+   fetchr   r-   r   r^   r   r   r   rg     s   zWebhookContext.fetchc                 C   $   d dd | j D }d|S )rS    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>*      z*WebhookContext.__repr__.<locals>.<genexpr>z$<Twilio.Verify.V2.WebhookContext {}>joinr   itemsr   r   contextr   r   r   rU   #     
zWebhookContext.__repr__)rW   rX   rY   rZ   r   r   r[   ra   re   rg   rU   r\   r   r   r   r   rM      s    
	rM   c                       s$  e Zd ZdZG dd deZG dd de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jejejejejfd%d&Zd'd( Zd)d* Zd+d, Z  ZS ).r-   r
   c                   @      e Zd ZdZdZdS )zWebhookInstance.StatusenableddisabledN)rW   rX   rY   ENABLEDDISABLEDr   r   r   r   r!   2      r!   c                   @   ry   )zWebhookInstance.Versionv1v2N)rW   rX   rY   V1V2r   r   r   r   r"   6  r~   r"   c                   @   ry   )zWebhookInstance.Methodsr=   r#   N)rW   rX   rY   r=   r#   r   r   r   r   Methods:  r~   r   Nc                    s   t t| | |d|d|d|d|d|d|d|d|d	t|d
t|d|dd| _d| _||pL| jd d| _dS )z
        Initialize the WebhookInstance

        :returns: twilio.rest.verify.v2.service.webhook.WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        rK   r   account_sidr/   r0   r2   r   r1   webhook_methoddate_createddate_updatedurl)rK   r   r   r/   r0   r2   r   r1   r   r   r   r   NrJ   )	r   r-   r   rO   r   iso8601_datetime_properties_contextr   )r   r   r3   r   rK   r   r   r   r   >  s    zWebhookInstance.__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: WebhookContext for this WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookContext
        Nr   rK   rJ   )r   rM   r+   r   rT   r   r   r   _proxy[  s   
	zWebhookInstance._proxyc                 C   
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        rK   r   rT   r   r   r   rK   l     
zWebhookInstance.sidc                 C   r   )z@
        :returns: Service Sid.
        :rtype: unicode
        r   r   rT   r   r   r   r   t  r   zWebhookInstance.service_sidc                 C   r   )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        r   r   rT   r   r   r   r   |  r   zWebhookInstance.account_sidc                 C   r   )zh
        :returns: The string that you assigned to describe the webhook
        :rtype: unicode
        r/   r   rT   r   r   r   r/     r   zWebhookInstance.friendly_namec                 C   r   )zq
        :returns: The array of events that this Webhook is subscribed to.
        :rtype: list[unicode]
        r0   r   rT   r   r   r   r0     r   zWebhookInstance.event_typesc                 C   r   )zU
        :returns: The webhook status
        :rtype: WebhookInstance.Status
        r2   r   rT   r   r   r   r2     r   zWebhookInstance.statusc                 C   r   )zW
        :returns: The webhook version
        :rtype: WebhookInstance.Version
        r   r   rT   r   r   r   r     r   zWebhookInstance.versionc                 C   r   )zY
        :returns: The URL associated with this Webhook.
        :rtype: unicode
        r1   r   rT   r   r   r   r1     r   zWebhookInstance.webhook_urlc                 C   r   )zs
        :returns: The method used when calling the webhook's URL.
        :rtype: WebhookInstance.Methods
        r   r   rT   r   r   r   r     r   zWebhookInstance.webhook_methodc                 C   r   )zt
        :returns: The ISO 8601 date and time in GMT when the resource was created
        :rtype: datetime
        r   r   rT   r   r   r   r     r   zWebhookInstance.date_createdc                 C   r   )zy
        :returns: The ISO 8601 date and time in GMT when the resource was last updated
        :rtype: datetime
        r   r   rT   r   r   r   r     r   zWebhookInstance.date_updatedc                 C   r   )z\
        :returns: The absolute URL of the Webhook resource
        :rtype: unicode
        r   r   rT   r   r   r   r     r   zWebhookInstance.urlc                 C   s   | j j|||||dS )r`   )r/   r0   r1   r2   r   )r   ra   )r   r/   r0   r1   r2   r   r   r   r   ra     s   zWebhookInstance.updatec                 C   
   | j  S )rb   )r   re   rT   r   r   r   re        
zWebhookInstance.deletec                 C   r   )rf   )r   rg   rT   r   r   r   rg     r   zWebhookInstance.fetchc                 C   rh   )rS   ri   c                 s   rj   rk   rl   rm   r   r   r   rq     rr   z+WebhookInstance.__repr__.<locals>.<genexpr>z%<Twilio.Verify.V2.WebhookInstance {}>rs   rv   r   r   r   rU     rx   zWebhookInstance.__repr__r   )rW   rX   rY   rZ   objectr!   r"   r   r   propertyr   rK   r   r   r/   r0   r2   r   r1   r   r   r   r   r   r[   ra   re   rg   rU   r\   r   r   r   r   r-   .  sL    













		r-   N)rZ   twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r?   rM   r-   r   r   r   r   <module>   s    )X