B
    `A                 @   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                   sx   e Zd ZdZ fddZ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 )WebhookListzk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c                s.   t t| | d|i| _djf | 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__ T/home/dcms/DCMS/lib/python3.7/site-packages/twilio/rest/verify/v2/service/webhook.pyr      s    

zWebhookList.__init__c             C   sJ   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 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

        :returns: The created WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        c             S   s   | S )Nr   )er   r   r   <lambda>4       z$WebhookList.create.<locals>.<lambda>)FriendlyName
EventTypes
WebhookUrlStatusPOST)methoduridatar
   )r
   )	r   ofr   map_versioncreater   WebhookInstancer   )r   friendly_nameevent_typeswebhook_urlstatusr   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)r*   limit)r"   Zread_limitspagestream)r   r+   r*   Zlimitsr,   r   r   r   r-   =   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]
        )r+   r*   )listr-   )r   r+   r*   r   r   r   r.   T   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
        )Z	PageTokenr   ZPageSizeGET)r   r   params)r   r    r"   r,   r   WebhookPager   )r   Z
page_tokenZpage_numberr*   r   responser   r   r   r,   f   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"   domainZtwiliorequestr1   r   )r   
target_urlr2   r   r   r   get_pagey   s    

zWebhookList.get_pagec             C   s   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   r7   r   r   r   get   s    	zWebhookList.getc             C   s   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
   r7   )r8   r"   r   )r   r7   r   r   r   __call__   s    	zWebhookList.__call__c             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Verify.V2.WebhookList>r   )r   r   r   r   __repr__   s    zWebhookList.__repr__)NN)NN)__name__
__module____qualname____doc__r   r   unsetr#   r-   r.   r,   r6   r9   r:   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 )r1   zk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. 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   r1   r   r   )r   r   r2   Zsolution)r   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   r)   r   r   r   get_instance   s    	zWebhookPage.get_instancec             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Verify.V2.WebhookPage>r   )r   r   r   r   r;      s    zWebhookPage.__repr__)r<   r=   r>   r?   r   rB   r;   rA   r   r   )r   r   r1      s   r1   c                   sR   e Zd ZdZ fddZejejejejfddZdd Zdd	 Z	d
d Z
  ZS )r8   zk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c                s0   t t| | ||d| _djf | 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
        )r
   r7   z&/Services/{service_sid}/Webhooks/{sid}N)r   r8   r   r   r   r   )r   r   r
   r7   )r   r   r   r      s    zWebhookContext.__init__c             C   sR   t |t|dd ||d}| jjd| j|d}t| j|| jd | jd dS )	a  
        Update the WebhookInstance

        :param unicode friendly_name: The string that you assigned to describe the webhook
        :param 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

        :returns: The updated WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        c             S   s   | S )Nr   )r   r   r   r   r      r   z'WebhookContext.update.<locals>.<lambda>)r   r   r   r   r   )r   r   r   r
   r7   )r
   r7   )	r   r    r   r!   r"   updater   r$   r   )r   r%   r&   r'   r(   r   r)   r   r   r   rC      s    
zWebhookContext.updatec             C   s   | j jd| jdS )z~
        Deletes the WebhookInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETE)r   r   )r"   deleter   )r   r   r   r   rE     s    zWebhookContext.deletec             C   s0   | j jd| jd}t| j || jd | jd dS )z
        Fetch the WebhookInstance

        :returns: The fetched WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        r/   )r   r   r
   r7   )r
   r7   )r"   fetchr   r$   r   )r   r)   r   r   r   rF     s    zWebhookContext.fetchc             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
         c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   ).0kvr   r   r   	<genexpr>%  s    z*WebhookContext.__repr__.<locals>.<genexpr>z$<Twilio.Verify.V2.WebhookContext {}>)joinr   itemsr   )r   contextr   r   r   r;     s    zWebhookContext.__repr__)r<   r=   r>   r?   r   r   r@   rC   rE   rF   r;   rA   r   r   )r   r   r8      s   	r8   c                   s  e Zd Zd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jejejejfd!d"Zd#d$ Zd%d& Zd'd( Z  ZS )*r$   zk PLEASE NOTE that this class contains beta products that are subject to
    change. Use them with caution. c               @   s   e Zd ZdZdZdS )zWebhookInstance.StatusZenableddisabledN)r<   r=   r>   ZENABLEDZDISABLEDr   r   r   r   r   -  s   r   c               @   s   e Zd ZdZdZdS )zWebhookInstance.Methodsr/   r   N)r<   r=   r>   r/   r   r   r   r   r   Methods1  s   rP   Nc                s   t t| | |d|d|d|d|d|d|d|dt|d	t|d
|dd| _d| _||p| 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
        r7   r
   account_sidr%   r&   r(   r'   webhook_methoddate_createddate_updatedurl)r7   r
   rQ   r%   r&   r(   r'   rR   rS   rT   rU   N)r
   r7   )	r   r$   r   r9   r   iso8601_datetime_properties_contextr   )r   r   r)   r
   r7   )r   r   r   r   5  s    zWebhookInstance.__init__c             C   s.   | j dk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
   r7   )r
   r7   )rX   r8   r"   r   )r   r   r   r   _proxyQ  s    	
zWebhookInstance._proxyc             C   s
   | j d S )zb
        :returns: The unique string that identifies the resource
        :rtype: unicode
        r7   )rW   )r   r   r   r   r7   b  s    zWebhookInstance.sidc             C   s
   | j d S )z@
        :returns: Service Sid.
        :rtype: unicode
        r
   )rW   )r   r   r   r   r
   j  s    zWebhookInstance.service_sidc             C   s
   | j d S )zd
        :returns: The SID of the Account that created the resource
        :rtype: unicode
        rQ   )rW   )r   r   r   r   rQ   r  s    zWebhookInstance.account_sidc             C   s
   | j d S )zh
        :returns: The string that you assigned to describe the webhook
        :rtype: unicode
        r%   )rW   )r   r   r   r   r%   z  s    zWebhookInstance.friendly_namec             C   s
   | j d S )zk
        :returns: The array of events that this Webhook is subscribed to.
        :rtype: unicode
        r&   )rW   )r   r   r   r   r&     s    zWebhookInstance.event_typesc             C   s
   | j d S )zU
        :returns: The webhook status
        :rtype: WebhookInstance.Status
        r(   )rW   )r   r   r   r   r(     s    zWebhookInstance.statusc             C   s
   | j d S )zY
        :returns: The URL associated with this Webhook.
        :rtype: unicode
        r'   )rW   )r   r   r   r   r'     s    zWebhookInstance.webhook_urlc             C   s
   | j d S )zs
        :returns: The method used when calling the webhook's URL.
        :rtype: WebhookInstance.Methods
        rR   )rW   )r   r   r   r   rR     s    zWebhookInstance.webhook_methodc             C   s
   | j d S )zt
        :returns: The RFC 2822 date and time in GMT when the resource was created
        :rtype: datetime
        rS   )rW   )r   r   r   r   rS     s    zWebhookInstance.date_createdc             C   s
   | j d S )zy
        :returns: The RFC 2822 date and time in GMT when the resource was last updated
        :rtype: datetime
        rT   )rW   )r   r   r   r   rT     s    zWebhookInstance.date_updatedc             C   s
   | j d S )z\
        :returns: The absolute URL of the Webhook resource
        :rtype: unicode
        rU   )rW   )r   r   r   r   rU     s    zWebhookInstance.urlc             C   s   | j j||||dS )a  
        Update the WebhookInstance

        :param unicode friendly_name: The string that you assigned to describe the webhook
        :param 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

        :returns: The updated WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        )r%   r&   r'   r(   )rY   rC   )r   r%   r&   r'   r(   r   r   r   rC     s
    zWebhookInstance.updatec             C   s
   | j  S )z~
        Deletes the WebhookInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        )rY   rE   )r   r   r   r   rE     s    zWebhookInstance.deletec             C   s
   | j  S )z
        Fetch the WebhookInstance

        :returns: The fetched WebhookInstance
        :rtype: twilio.rest.verify.v2.service.webhook.WebhookInstance
        )rY   rF   )r   r   r   r   rF     s    zWebhookInstance.fetchc             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        rG   c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   )rH   rI   rJ   r   r   r   rK     s    z+WebhookInstance.__repr__.<locals>.<genexpr>z%<Twilio.Verify.V2.WebhookInstance {}>)rL   r   rM   r   )r   rN   r   r   r   r;     s    zWebhookInstance.__repr__)N)r<   r=   r>   r?   objectr   rP   r   propertyrY   r7   r
   rQ   r%   r&   r(   r'   rR   rS   rT   rU   r   r@   rC   rE   rF   r;   rA   r   r   )r   r   r$   )  s*   		r$   N)r?   Ztwilio.baser   r   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.pager   r	   r1   r8   r$   r   r   r   r   <module>   s    )V