o
    ix-                     @   s   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mZ d dlmZmZmZmZmZmZ d dlmZmZmZ er`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d ed ed e	d Z"dS )    )CreateableAPIResource)DeletableAPIResource)
ListObject)ListableAPIResource)UpdateableAPIResource)class_method_variantsanitize_id)ClassVarDictListOptionalcastoverload)LiteralUnpackTYPE_CHECKING)WebhookEndpointCreateParams)WebhookEndpointDeleteParams)WebhookEndpointListParams)WebhookEndpointModifyParams)WebhookEndpointRetrieveParamsc                   @   s  e Zd ZU dZdZeed  ed< ee	 ed< 	 ee	 ed< 	 e
ed< 	 eed  ed< 	 ee	 ed	< 	 ee	 ed
< 	 e	ed< 	 eed< 	 ee	e	f ed< 	 ed ed< 	 ee	 ed< 	 e	ed< 	 e	ed< 	 eded dd fddZeded dd fddZede	ded dd fddZeede	ded dd fddZeded dd fddZed ded dd fd!dZede	ded dd fd"d#Zeede	ded dd fd$d%Zeded dd fd&d%Zed'ded dd fd(d%Zeded) ded  fd*d+Zeded) ded  fd,d-Zede	ded. dd fd/d0Zede	ded. dd fd1d2Zede	ded3 dd fd4d5Zede	ded3 dd fd6d7Zd8S )9WebhookEndpointa  
    You can configure [webhook endpoints](https://docs.stripe.com/webhooks/) via the API to be
    notified about events that happen in your Stripe account or connected
    accounts.

    Most users configure webhooks from [the dashboard](https://dashboard.stripe.com/webhooks), which provides a user interface for registering and testing your webhook endpoints.

    Related guide: [Setting up webhooks](https://docs.stripe.com/webhooks/configure)
    webhook_endpointOBJECT_NAMEapi_versionapplicationcreatedTdeleteddescriptionenabled_eventsidlivemodemetadataobjectsecretstatusurlparamsr   returnc                 K   s   t d| jd|  |dS )  
        A webhook endpoint must have a url and a list of enabled_events. You may optionally specify the Boolean connect parameter. If set to true, then a Connect webhook endpoint that notifies the specified url about events from all connected accounts is created; otherwise an account webhook endpoint that notifies the specified url only about events from your account is created. You can also create webhook endpoints in the [webhooks settings](https://dashboard.stripe.com/account/webhooks) section of the Dashboard.
        r   postr'   )r   _static_request	class_urlclsr'    r0   x/var/www/snowflake_co_dev_github/snow_flake_back_end_deploy/env/lib/python3.10/site-packages/stripe/_webhook_endpoint.pycreated   s   zWebhookEndpoint.createc                    s"   t d| jd|  |dI dH S )r)   r   r*   r+   N)r   _static_request_asyncr-   r.   r0   r0   r1   create_asynct   s   
zWebhookEndpoint.create_asyncsidr   c                 K   *   d|   t|f }td| jd||dS )
        You can also delete webhook endpoints via the [webhook endpoint management](https://dashboard.stripe.com/account/webhooks) page of the Stripe dashboard.
        %s/%sr   deleter+   r-   r   r   r,   r/   r5   r'   r&   r0   r0   r1   _cls_delete      zWebhookEndpoint._cls_deletec                 K      dS r7   Nr0   r5   r'   r0   r0   r1   r9      s   zWebhookEndpoint.deletec                 K   r>   r?   r0   selfr'   r0   r0   r1   r9      s   r<   c                 K   s   | j d|  |dS )r7   r9   r+   )_request_and_refreshinstance_urlrA   r0   r0   r1   r9      s
   c                    2   d|   t|f }td| jd||dI dH S )r7   r8   r   r9   r+   Nr-   r   r   r3   r;   r0   r0   r1   _cls_delete_async      
z!WebhookEndpoint._cls_delete_asyncc                       dS r?   r0   r@   r0   r0   r1   delete_async   s   zWebhookEndpoint.delete_asyncc                    rI   r?   r0   rA   r0   r0   r1   rJ      s   rG   c                    s   | j d|  |dI dH S )r7   r9   r+   N)_request_and_refresh_asyncrD   rA   r0   r0   r1   rJ      s   r   c                 K   s4   | j d|  |d}t|tstdt|j |S );
        Returns a list of your webhook endpoints.
        getr+   %Expected list object from API, got %s)r,   r-   
isinstancer   	TypeErrortype__name__r/   r'   resultr0   r0   r1   list   s   
zWebhookEndpoint.listc                    s<   | j d|  |dI dH }t|tstdt|j |S )rL   rM   r+   NrN   )r3   r-   rO   r   rP   rQ   rR   rS   r0   r0   r1   
list_async   s   
zWebhookEndpoint.list_asyncr   c                 K   r6   )
        Updates the webhook endpoint. You may edit the url, the list of enabled_events, and the status of your endpoint.
        r8   r   r*   r+   r:   r/   r    r'   r&   r0   r0   r1   modify  r=   zWebhookEndpoint.modifyc                    rE   )rW   r8   r   r*   r+   NrF   rX   r0   r0   r1   modify_async  rH   zWebhookEndpoint.modify_asyncr   c                 K   s   | |fi |}|   |S )C
        Retrieves the webhook endpoint with the given ID.
        )refreshr/   r    r'   instancer0   r0   r1   retrieve0  s   zWebhookEndpoint.retrievec                    s$   | |fi |}|  I dH  |S )r[   N)refresh_asyncr]   r0   r0   r1   retrieve_async;  s   zWebhookEndpoint.retrieve_asyncN) rR   
__module____qualname____doc__r   r	   r   __annotations__r   strintr   boolr
   classmethodr   r2   r4   r<   r   staticmethodr9   r   rG   rJ   r   rU   rV   rY   rZ   r_   ra   r0   r0   r0   r1   r      s  
 

r   N)#stripe._createable_api_resourcer   stripe._deletable_api_resourcer   stripe._list_objectr   stripe._listable_api_resourcer   stripe._updateable_api_resourcer   stripe._utilr   r   typingr	   r
   r   r   r   r   typing_extensionsr   r   r   -stripe.params._webhook_endpoint_create_paramsr   -stripe.params._webhook_endpoint_delete_paramsr   +stripe.params._webhook_endpoint_list_paramsr   -stripe.params._webhook_endpoint_modify_paramsr   /stripe.params._webhook_endpoint_retrieve_paramsr   r   r0   r0   r0   r1   <module>   s(    
