o
    f>hg                     @   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                       s  e Zd ZG dd deZG dd deZG dd deZ	 	d&ded	eee	f d
ede
e f fddZed'ddZdefddZdefddZd(ddZd(ddZejejejejejfdeeef deee ef deeef dedef dedef dd fd d!Zejejejejejfdeeef deee ef deeef dedef dedef dd fd"d#Zdefd$d%Z  ZS ))WebhookInstancec                   @      e Zd ZdZdZdS )zWebhookInstance.MethodsGETPOSTN)__name__
__module____qualname__r   r    r   r   X/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/verify/v2/service/webhook.pyMethods       r   c                   @   r   )WebhookInstance.StatusenableddisabledN)r   r   r   ENABLEDDISABLEDr   r   r   r   Status   r   r"   c                   @   r   )WebhookInstance.Versionv1v2N)r   r   r   V1V2r   r   r   r   r   #   r   r   Nversionpayloadservice_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
|d	| _t|d
| _t|d| _|d| _||pY| 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(   r0   r1   r
   iso8601_datetimer2   r3   r4   	_solution_context)selfr(   r)   r*   r+   	__class__r   r   r7   6   s.   
zWebhookInstance.__init__returnWebhookContextc                 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: WebhookContext for this WebhookInstance
        Nr*   r+   r5   )r;   r@   _versionr:   r<   r   r   r   _proxyX   s   
zWebhookInstance._proxyc                 C   
   | j  S )j
        Deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        )rC   deleterB   r   r   r   rF   h      
zWebhookInstance.deletec                       | j  I dH S )
        Asynchronous coroutine that deletes the WebhookInstance


        :returns: True if delete succeeds, False otherwise
        N)rC   delete_asyncrB   r   r   r   rJ   q      zWebhookInstance.delete_asyncc                 C   rD   )[
        Fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        )rC   fetchrB   r   r   r   rM   z   rG   zWebhookInstance.fetchc                    rH   )u
        Asynchronous coroutine to fetch the WebhookInstance


        :returns: The fetched WebhookInstance
        N)rC   fetch_asyncrB   r   r   r   rO      rK   zWebhookInstance.fetch_asyncr-   r.   r0   r/   r   r#   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.   r0   r/   r(   )rC   updater<   r-   r.   r0   r/   r(   r   r   r   rR      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
        rQ   N)rC   update_asyncrS   r   r   r   rU      s   zWebhookInstance.update_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr   r   r   	<genexpr>       z+WebhookInstance.__repr__.<locals>.<genexpr>z%<Twilio.Verify.V2.WebhookInstance {}>joinr:   itemsr\   r<   contextr   r   r   __repr__      
zWebhookInstance.__repr__N)r?   r@   )r?   r   )r   r   r   objectr   r"   r   r   strr   r   r7   propertyrC   boolrF   rJ   rM   rO   r   unsetr   r   rR   rU   rh   __classcell__r   r   r=   r   r      st    
"	
	
	









r   c                       s8  e Zd Zdededef fddZdefddZdefd	d
Zde	fddZ
de	fddZejejejejejfdeeef deee ef deeef dedef dedef de	fddZejejejejejfdeeef deee ef deeef dedef dedef de	fddZdefddZ  ZS )r@   r(   r*   r+   c                    s0   t  | ||d| _djdi | 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.
        r5   z&/Services/{service_sid}/Webhooks/{sid}Nr   r6   r7   r:   r\   _uri)r<   r(   r*   r+   r=   r   r   r7      s
   zWebhookContext.__init__r?   c                 C   s   t i }| jjd| j|dS )rE   DELETEmethoduriheaders)r   ofrA   rF   rr   r<   rw   r   r   r   rF      s   
zWebhookContext.deletec                    s&   t i }| jjd| j|dI dH S )rI   rs   rt   N)r   rx   rA   rJ   rr   ry   r   r   r   rJ      s
   
zWebhookContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rL   application/jsonAcceptr   rt   r*   r+   r5   )r   rx   rA   rM   rr   r   r:   r<   rw   r)   r   r   r   rM      s   
zWebhookContext.fetchc                    sL   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rN   rz   r{   r   rt   Nr*   r+   r5   )r   rx   rA   rO   rr   r   r:   r|   r   r   r   rO     s   
zWebhookContext.fetch_asyncr-   r.   r0   r/   r   r#   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 )rP   c                 S      | S rj   r   er   r   r   <lambda><      z'WebhookContext.update.<locals>.<lambda>FriendlyName
EventTypes
WebhookUrlr"   r   !application/x-www-form-urlencodedContent-Typerz   r{   r   ru   rv   datarw   r*   r+   r5   )	r   rx   r   maprA   rR   rr   r   r:   	r<   r-   r.   r0   r/   r(   r   rw   r)   r   r   r   rR   %  s(   
	
zWebhookContext.updatec           	         sx   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 )rT   c                 S   r}   rj   r   r~   r   r   r   r   j  r   z-WebhookContext.update_async.<locals>.<lambda>r   r   r   rz   r{   r   r   Nr*   r+   r5   )	r   rx   r   r   rA   rU   rr   r   r:   r   r   r   r   rU   S  s*   
	
zWebhookContext.update_asyncc                 C   rV   )rW   rX   c                 s   rY   rZ   r[   r]   r   r   r   ra     rb   z*WebhookContext.__repr__.<locals>.<genexpr>z$<Twilio.Verify.V2.WebhookContext {}>rc   rf   r   r   r   rh     ri   zWebhookContext.__repr__)r   r   r   r   rl   r7   rn   rF   rJ   r   rM   rO   r   ro   r   rk   r   rR   rU   rh   rp   r   r   r=   r   r@      sV    




0




.r@   c                   @   s4   e Zd Zdeeef defddZdefddZdS )WebhookPager)   r?   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   rA   r:   )r<   r)   r   r   r   get_instance     zWebhookPage.get_instancec                 C      dS )rW   z<Twilio.Verify.V2.WebhookPage>r   rB   r   r   r   rh        zWebhookPage.__repr__N)	r   r   r   r   rl   r   r   r   rh   r   r   r   r   r     s    
r   c                       s  e Zd Zdedef fddZejejfdedee dede	d	e
f de	d
e
f defddZejejfdedee dede	d	e
f de	d
e
f defddZ		d-dee dee dee fddZ		d-dee dee dee fddZ		d-dee dee dee fddZ		d-dee dee dee fddZejejejfde	ee
f de	ee
f de	ee
f defddZejejejfde	ee
f de	ee
f de	ee
f defdd Zd!edefd"d#Zd!edefd$d%Zd&edefd'd(Zd&edefd)d*Zdefd+d,Z  ZS ).WebhookListr(   r*   c                    s.   t  | d|i| _djdi | 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}/WebhooksNr   rq   )r<   r(   r*   r=   r   r   r7     s   zWebhookList.__init__r-   r.   r0   r/   r   r#   r?   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   r}   rj   r   r~   r   r   r   r     r   z$WebhookList.create.<locals>.<lambda>r   r   r   rz   r{   r   r   r*   r   )	r   rx   r   r   rA   createrr   r   r:   r   r   r   r   r     s"   	
zWebhookList.createc           	         st   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   r}   rj   r   r~   r   r   r   r     r   z*WebhookList.create_async.<locals>.<lambda>r   r   r   rz   r{   r   r   Nr*   r   )	r   rx   r   r   rA   create_asyncrr   r   r:   r   r   r   r   r     s$   	
zWebhookList.create_asyncNlimit	page_sizec                 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   )rA   read_limitspagestreamr<   r   r   limitsr   r   r   r   r     s   zWebhookList.streamc                    s8   | 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   )rA   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   r<   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 rj   r   )r^   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_numberc                 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
        	PageTokenr   PageSizer   r   rz   r{   r   ru   rv   paramsrw   )r   rx   rA   r   rr   r   r:   r<   r   r   r   r   rw   responser   r   r   r   o  s   
zWebhookList.pagec                    sV   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   r   r   rz   r{   r   r   N)r   rx   rA   r   rr   r   r:   r   r   r   r   r     s   
zWebhookList.page_async
target_urlc                 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   )rA   domaintwiliorequestr   r:   r<   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)rA   r   r   request_asyncr   r:   r   r   r   r   get_page_async  s   	zWebhookList.get_page_asyncr+   c                 C      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*   r5   r@   rA   r:   r<   r+   r   r   r   r8     r   zWebhookList.getc                 C   r   r   r   r   r   r   r   __call__  r   zWebhookList.__call__c                 C   r   )rW   z<Twilio.Verify.V2.WebhookList>r   rB   r   r   r   rh     r   zWebhookList.__repr__)NN) r   r   r   r   rl   r7   r   ro   r   r   rk   r   r   r   r   intr   r   r	   r   r   r   r   r   r   r   r   r@   r8   r   rh   rp   r   r   r=   r   r     s    


0


-







#



!

r   N)__doc__r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r@   r   r   r   r   r   r   <module>   s    $ 4 @