U
    ^g%ig                     @   s   d Z ddl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 - Verify
    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.
    )datetime)AnyDictListOptionalUnionIteratorAsyncIterator)deserialize	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       sr  e Zd ZG dd deZG dd de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jejejejejfeeef eee ef eeef edef edef d dddZejejejejejfeeef eee ef eeef edef edef d dddZedddZ  ZS )!WebhookInstancec                   @   s   e Zd ZdZdZdS )zWebhookInstance.MethodsGETPOSTN)__name__
__module____qualname__r   r    r   r   d/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/verify/v2/service/webhook.pyMethods   s   r   c                   @   s   e Zd ZdZdZdS )WebhookInstance.StatusenableddisabledN)r   r   r   ZENABLEDZDISABLEDr   r   r   r   Status   s   r   c                   @   s   e Zd ZdZdZdS )WebhookInstance.VersionZv1Zv2N)r   r   r   ZV1ZV2r   r   r   r   r   #   s   r   N)versionpayloadservice_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
|d	| _t|d
| _t|d| _|d| _||p| jd| _d | _d S )Nr#   r"   account_sidfriendly_nameevent_typesstatusr    webhook_urlwebhook_methoddate_createddate_updatedurlr"   r#   )super__init__getr#   r"   r$   r%   r&   r'   r    r(   r)   r
   Ziso8601_datetimer*   r+   r,   	_solution_context)selfr    r!   r"   r#   	__class__r   r   r/   6   s.    zWebhookInstance.__init__WebhookContextreturnc                 C   s.   | j dk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: WebhookContext for this WebhookInstance
        Nr"   r#   r-   )r2   r6   _versionr1   r3   r   r   r   _proxyX   s    
zWebhookInstance._proxyc                 C   s
   | j  S )j
        Deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        )r;   deleter:   r   r   r   r=   h   s    zWebhookInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        N)r;   delete_asyncr:   r   r   r   r?   q   s    zWebhookInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        )r;   fetchr:   r   r   r   rA   z   s    zWebhookInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        N)r;   fetch_asyncr:   r   r   r   rC      s    zWebhookInstance.fetch_asyncr   r   r%   r&   r(   r'   r    r8   c                 C   s   | j j|||||dS )  
        Update the WebhookInstance

        :param friendly_name: The string that you assigned to describe the webhook. **This value should not contain PII.**
        :param event_types: The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied`
        :param webhook_url: The URL associated with this Webhook.
        :param status:
        :param version:

        :returns: The updated WebhookInstance
        r%   r&   r(   r'   r    )r;   updater3   r%   r&   r(   r'   r    r   r   r   rG      s    zWebhookInstance.updatec                    s   | j j|||||dI dH S )'  
        Asynchronous coroutine to update the WebhookInstance

        :param friendly_name: The string that you assigned to describe the webhook. **This value should not contain PII.**
        :param event_types: The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied`
        :param webhook_url: The URL associated with this Webhook.
        :param status:
        :param version:

        :returns: The updated WebhookInstance
        rF   N)r;   update_asyncrH   r   r   r   rJ      s    zWebhookInstance.update_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>   s     z+WebhookInstance.__repr__.<locals>.<genexpr>z%<Twilio.Verify.V2.WebhookInstance {}>joinr1   itemsrO   r3   contextr   r   r   __repr__   s    zWebhookInstance.__repr__)N)r   r   r   objectr   r   r   r   strr   r   r/   propertyr;   boolr=   r?   rA   rC   r   unsetr   r   rG   rJ   rZ   __classcell__r   r   r4   r   r      sV    
"			







r   c                       s   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jejejejejfeeef eee ef eeef edef edef e	dddZejejejejejfeeef eee ef eeef edef edef e	dddZedddZ  ZS )r6   )r    r"   r#   c                    s,   t  | ||d| _djf | j| _dS )a  
        Initialize the WebhookContext

        :param version: Version that contains the resource
        :param service_sid: The unique SID identifier of the Service.
        :param sid: The Twilio-provided string that uniquely identifies the Webhook resource to update.
        r-   z&/Services/{service_sid}/Webhooks/{sid}Nr.   r/   r1   rO   _uri)r3   r    r"   r#   r4   r   r   r/      s
    zWebhookContext.__init__r7   c                 C   s   t i }| jjd| j|dS )r<   DELETEmethoduriheaders)r   ofr9   r=   rb   r3   rg   r   r   r   r=      s    
zWebhookContext.deletec                    s$   t i }| jjd| j|dI dH S )r>   rc   rd   N)r   rh   r9   r?   rb   ri   r   r   r   r?      s    
  zWebhookContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )r@   application/jsonAcceptr   rd   r"   r#   r-   )r   rh   r9   rA   rb   r   r1   r3   rg   r!   r   r   r   rA      s    
zWebhookContext.fetchc                    sJ   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rB   rj   rk   r   rd   Nr"   r#   r-   )r   rh   r9   rC   rb   r   r1   rl   r   r   r   rC     s    
  zWebhookContext.fetch_asyncr   r   rD   c           	      C   sp   t |t|dd |||d}t i }d|d< d|d< | jjd| j||d	}t| j|| jd
 | jd dS )rE   c                 S   s   | S Nr   er   r   r   <lambda><      z'WebhookContext.update.<locals>.<lambda>ZFriendlyNameZ
EventTypesZ
WebhookUrlr   r   !application/x-www-form-urlencodedContent-Typerj   rk   r   re   rf   datarg   r"   r#   r-   )	r   rh   r   mapr9   rG   rb   r   r1   	r3   r%   r&   r(   r'   r    rv   rg   r!   r   r   r   rG   %  s.    	
   zWebhookContext.updatec           	         sv   t |t|dd |||d}t i }d|d< d|d< | jjd| j||d	I d
H }t| j|| jd | jd dS )rI   c                 S   s   | S rm   r   rn   r   r   r   rp   j  rq   z-WebhookContext.update_async.<locals>.<lambda>rr   rs   rt   rj   rk   r   ru   Nr"   r#   r-   )	r   rh   r   rw   r9   rJ   rb   r   r1   rx   r   r   r   rJ   S  s.    	
   zWebhookContext.update_asyncc                 C   s$   d dd | j D }d|S )rK   rL   c                 s   s   | ]\}}d  ||V  qdS rM   rN   rP   r   r   r   rT     s     z*WebhookContext.__repr__.<locals>.<genexpr>z$<Twilio.Verify.V2.WebhookContext {}>rU   rX   r   r   r   rZ     s    zWebhookContext.__repr__)r   r   r   r   r\   r/   r^   r=   r?   r   rA   rC   r   r_   r   r[   r   rG   rJ   rZ   r`   r   r   r4   r   r6      s@   



0



.r6   c                   @   s2   e Zd Zeeef edddZedddZdS )WebhookPage)r!   r8   c                 C   s   t | j|| jd dS )zm
        Build an instance of WebhookInstance

        :param payload: Payload response from the API
        r"   r"   )r   r9   r1   )r3   r!   r   r   r   get_instance  s
      zWebhookPage.get_instancer7   c                 C   s   dS )rK   z<Twilio.Verify.V2.WebhookPage>r   r:   r   r   r   rZ     s    zWebhookPage.__repr__N)	r   r   r   r   r\   r   r   r{   rZ   r   r   r   r   ry     s   
ry   c                       s  e Zd Zeed fddZejejfeee ee	de
f e	de
f edddZejejfeee ee	de
f e	de
f edd	d
Zd'ee ee ee dddZd(ee ee ee dddZd)ee ee ee dddZd*ee ee ee dddZejejejfe	ee
f e	ee
f e	ee
f edddZejejej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 )+WebhookList)r    r"   c                    s*   t  | d|i| _djf | j| _dS )z
        Initialize the WebhookList

        :param version: Version that contains the resource
        :param service_sid: The unique SID identifier of the Service.

        r"   z /Services/{service_sid}/WebhooksNra   )r3   r    r"   r4   r   r   r/     s
     zWebhookList.__init__r   r   rD   c           	      C   sl   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 WebhookInstance

        :param friendly_name: The string that you assigned to describe the webhook. **This value should not contain PII.**
        :param event_types: The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied`
        :param webhook_url: The URL associated with this Webhook.
        :param status:
        :param version:

        :returns: The created WebhookInstance
        c                 S   s   | S rm   r   rn   r   r   r   rp     rq   z$WebhookList.create.<locals>.<lambda>rr   rt   rs   rj   rk   r   ru   r"   rz   )	r   rh   r   rw   r9   createrb   r   r1   rx   r   r   r   r}     s,    	     zWebhookList.createc           	         sr   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 )a  
        Asynchronously create the WebhookInstance

        :param friendly_name: The string that you assigned to describe the webhook. **This value should not contain PII.**
        :param event_types: The array of events that this Webhook is subscribed to. Possible event types: `*, factor.deleted, factor.created, factor.verified, challenge.approved, challenge.denied`
        :param webhook_url: The URL associated with this Webhook.
        :param status:
        :param version:

        :returns: The created WebhookInstance
        c                 S   s   | S rm   r   rn   r   r   r   rp     rq   z*WebhookList.create_async.<locals>.<lambda>rr   rt   rs   rj   rk   r   ru   Nr"   rz   )	r   rh   r   rw   r9   create_asyncrb   r   r1   rx   r   r   r   r~     s,    	     zWebhookList.create_asyncN)limit	page_sizer8   c                 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 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   )r9   read_limitspagestreamr3   r   r   Zlimitsr   r   r   r   r     s    zWebhookList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )al  
        Asynchronously 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 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   )r9   r   
page_asyncstream_asyncr   r   r   r   r   !  s    zWebhookList.stream_asyncc                 C   s   t | j||dS )a  
        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 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   )listr   r3   r   r   r   r   r   r   :  s    zWebhookList.listc                    s$   dd | j ||dI dH 2 I dH S )a	  
        Asynchronously 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 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 rm   r   )rQ   recordr   r   r   
<listcomp>g  s   z*WebhookList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_asyncT  s    
zWebhookList.list_async)
page_tokenpage_numberr   r8   c                 C   sN   t |||d}t ddi}d|d< | jjd| j||d}t| j|| jS )as  
        Retrieve a single page of WebhookInstance records from the API.
        Request is executed immediately

        :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 WebhookInstance
        Z	PageTokenr   ZPageSizert   rs   rj   rk   r   re   rf   paramsrg   )r   rh   r9   r   rb   ry   r1   r3   r   r   r   rv   rg   responser   r   r   r   o  s       zWebhookList.pagec                    sT   t |||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 WebhookInstance records from the API.
        Request is executed immediately

        :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 WebhookInstance
        r   rt   rs   rj   rk   r   r   N)r   rh   r9   r   rb   ry   r1   r   r   r   r   r     s       zWebhookList.page_async)
target_urlr8   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of WebhookInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebhookInstance
        r   )r9   domaintwiliorequestry   r1   r3   r   r   r   r   r   get_page  s    	zWebhookList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of WebhookInstance records from the API.
        Request is executed immediately

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

        :returns: Page of WebhookInstance
        r   N)r9   r   r   Zrequest_asyncry   r1   r   r   r   r   get_page_async  s    	zWebhookList.get_page_async)r#   r8   c                 C   s   t | j| jd |dS z
        Constructs a WebhookContext

        :param sid: The Twilio-provided string that uniquely identifies the Webhook resource to update.
        r"   r-   r6   r9   r1   r3   r#   r   r   r   r0     s
      zWebhookList.getc                 C   s   t | j| jd |dS r   r   r   r   r   r   __call__  s
      zWebhookList.__call__r7   c                 C   s   dS )rK   z<Twilio.Verify.V2.WebhookList>r   r:   r   r   r   rZ     s    zWebhookList.__repr__)NN)NN)NN)NN) r   r   r   r   r\   r/   r   r_   r   r   r[   r   r}   r~   r   intr   r   r	   r   r   r   ry   r   r   r   r   r6   r0   r   rZ   r`   r   r   r4   r   r|     s   

0

-        


#


!

r|   N)__doc__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   r6   ry   r|   r   r   r   r   <module>   s   $ 4 @