Ë
    8ø»j³+  ã                  óø   — d dl mZ d dlmZmZ d dlmZ d dlmZ d dl	m
Z
mZmZmZmZmZ d dlmZmZ d dlmZ erd dlmZ d d	lmZmZ d d
lmZ  ed«       G d„ de«      «       Z ed«       G d„ de«      «       Zy)é    )Úannotations)ÚTYPE_CHECKINGÚAny)ÚAnyUrl)Ú
docs_group)ÚTestWebhookResponseÚWebhookÚWebhookConditionÚWebhookDispatchÚWebhookResponseÚWebhookUpdate)ÚResourceClientÚResourceClientAsync)Úresponse_to_dict)ÚWebhookEventType)ÚWebhookDispatchCollectionClientÚ$WebhookDispatchCollectionClientAsync)ÚTimeoutzResource clientsc                  óº   ‡ — e Zd ZdZddœ	 	 	 	 	 	 	 dˆ fd„Zddœdd„Zdddddddddddd	œ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„Zddœdd„Zddœdd„Zdd„Z	ˆ xZ
S )ÚWebhookClientzÑSub-client for managing a specific webhook.

    Provides methods to manage a specific webhook, e.g. get, update, or delete it. Obtain an instance via an
    appropriate method on the `ApifyClient` class.
    Úwebhooks©Úresource_pathc               ó*   •— t        ‰| �  d||dœ|¤Ž y ©N)Úresource_idr   © ©ÚsuperÚ__init__©Úselfr   r   ÚkwargsÚ	__class__s       €ú]/var/www/html/GAP/venv/lib/python3.12/site-packages/apify_client/_resource_clients/webhook.pyr    zWebhookClient.__init__!   ó'   ø€ ô 	‰Ñð 	
Ø#Ø'ñ	
ð ó	
ó    Úshort©Útimeoutc               ój   — | j                  |¬«      }|€yt        j                  |«      j                  S ©a  Retrieve the webhook.

        https://docs.apify.com/api/v2#/reference/webhooks/webhook-object/get-webhook

        Args:
            timeout: Timeout for the API HTTP request.

        Returns:
            The retrieved webhook, or None if it does not exist.
        r)   N©Ú_getr   Úmodel_validateÚdata©r"   r*   Úresults      r%   ÚgetzWebhookClient.get.   s3   € ð —‘ 7�Ó+ˆØˆ>ØÜ×-Ñ-¨fÓ5×:Ñ:Ð:r'   N©Úevent_typesÚrequest_urlÚpayload_templateÚheaders_templateÚactor_idÚactor_task_idÚactor_run_idÚignore_ssl_errorsÚdo_not_retryÚ	is_ad_hocr*   c               ó  — t        |�t        |«      nd|�t        |«      nd||||	|r|
ndt        |||¬«      ¬«      } | j                  dd|i|j                  dd¬«      ¤Ž}t        j                  |«      j                  S ©aÍ  Update the webhook.

        https://docs.apify.com/api/v2#/reference/webhooks/webhook-object/update-webhook

        Args:
            event_types: List of event types that should trigger the webhook. At least one is required.
            request_url: URL that will be invoked once the webhook is triggered.
            payload_template: Specification of the payload that will be sent to request_url.
            headers_template: Headers that will be sent to the request_url.
            actor_id: Id of the Actor whose runs should trigger the webhook.
            actor_task_id: Id of the Actor task whose runs should trigger the webhook.
            actor_run_id: Id of the Actor run which should trigger the webhook.
            ignore_ssl_errors: Whether the webhook should ignore SSL errors returned by request_url.
            do_not_retry: Whether the webhook should retry sending the payload to request_url upon failure.
            is_ad_hoc: Set to True if you want the webhook to be triggered only the first time the condition
                is fulfilled. Only applicable when actor_run_id is filled.
            timeout: Timeout for the API HTTP request.

        Returns:
            The updated webhook.
        N)r;   r:   r9   )r5   r6   r7   r8   r<   r=   r>   Ú	conditionr*   T)Úby_aliasÚexclude_noner   ©	r   Úlistr   r
   Ú_updateÚ
model_dumpr   r/   r0   ©r"   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r*   Úwebhook_updater2   s                 r%   ÚupdatezWebhookClient.update>   s”   € ôH 'Ø-8Ð-Dœ˜[Ô)È$Ø/:Ð/Fœ˜{Ô+ÈDØ-Ø-Ø/Ø%Ù#/‘i°TÜ&Ø)Ø+Ø!ôô
ˆð �—‘Ñm gÐm°×1JÑ1JÐTXÐgkÐ1JÓ1lÑmˆÜ×-Ñ-¨fÓ5×:Ñ:Ð:r'   c               ó(   — | j                  |¬«       y©z»Delete the webhook.

        https://docs.apify.com/api/v2#/reference/webhooks/webhook-object/delete-webhook

        Args:
            timeout: Timeout for the API HTTP request.
        r)   N©Ú_delete©r"   r*   s     r%   ÚdeletezWebhookClient.deletes   s   € ð 	�‰˜WˆÕ%r'   Úmediumc               óÎ   — | j                   j                  | j                  d«      d| j                  «       |¬«      }t	        |«      }t        j                  |«      j                  S )á€  Test a webhook.

        Creates a webhook dispatch with a dummy payload.

        https://docs.apify.com/api/v2#/reference/webhooks/webhook-test/test-webhook

        Args:
            timeout: Timeout for the API HTTP request.

        Returns:
            The webhook dispatch created by the test.

        Raises:
            NotFoundError: If the webhook does not exist.
        ÚtestÚPOST©ÚurlÚmethodÚparamsr*   ©Ú_http_clientÚcallÚ
_build_urlÚ_build_paramsr   r   r/   r0   ©r"   r*   Úresponser2   s       r%   rT   zWebhookClient.test}   s`   € ð  ×$Ñ$×)Ñ)Ø—‘ Ó'ØØ×%Ñ%Ó'Øð	 *ó 
ˆô " (Ó+ˆÜ"×1Ñ1°&Ó9×>Ñ>Ð>r'   c                óR   —  | j                   j                  dddi| j                  ¤ŽS ©zóGet dispatches of the webhook.

        https://docs.apify.com/api/v2#/reference/webhooks/dispatches-collection/get-collection

        Returns:
            A client allowing access to dispatches of this webhook using its list method.
        r   Ú
dispatchesr   ©Ú_client_registryÚ"webhook_dispatch_collection_clientÚ_base_client_kwargs©r"   s    r%   rc   zWebhookClient.dispatches—   ó6   € ð Hˆt×$Ñ$×GÑGñ 
Ø&ð
à×&Ñ&ñ
ð 	
r'   ©r   Ústrr   rk   r#   r   ÚreturnÚNone©r*   r   rl   zWebhook | None©r5   zlist[WebhookEventType] | Noner6   ú
str | Noner7   rp   r8   rp   r9   rp   r:   rp   r;   rp   r<   úbool | Noner=   rq   r>   rq   r*   r   rl   r	   ©r*   r   rl   rm   ©r*   r   rl   r   )rl   r   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r    r3   rJ   rP   rT   rc   Ú__classcell__©r$   s   @r%   r   r      sþ   ø„ ñð (ñ	
ð ð
ð ð	
ð
 ð
ð 
õ
ð )0õ ;ð& 6:Ø"&Ø'+Ø'+Ø#Ø$(Ø#'Ø)-Ø$(Ø!%Ø"ñ3;ð 3ð3;ð  ð	3;ð
 %ð3;ð %ð3;ð ð3;ð "ð3;ð !ð3;ð 'ð3;ð "ð3;ð ð3;ð ð3;ð 
ó3;ðj ,3õ &ð *2õ ?÷4
r'   r   c                  óº   ‡ — e Zd ZdZddœ	 	 	 	 	 	 	 dˆ fd„Zddœdd„Zdddddddddddd	œ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„Zddœdd„Zddœdd„Zdd„Z	ˆ xZ
S )ÚWebhookClientAsynczÖSub-client for managing a specific webhook.

    Provides methods to manage a specific webhook, e.g. get, update, or delete it. Obtain an instance via an
    appropriate method on the `ApifyClientAsync` class.
    r   r   c               ó*   •— t        ‰| �  d||dœ|¤Ž y r   r   r!   s       €r%   r    zWebhookClientAsync.__init__­   r&   r'   r(   r)   c             ƒ  ó†   K  — | j                  |¬«      ƒ d{  –—† }|€yt        j                  |«      j                  S 7 Œ&­wr,   r-   r1   s      r%   r3   zWebhookClientAsync.getº   s?   è ø€ ð —y‘y¨�yÓ1×1ˆØˆ>ØÜ×-Ñ-¨fÓ5×:Ñ:Ð:ð 2ús   ‚A˜?™'ANr4   c             ƒ  ó   K  — t        |�t        |«      nd|�t        |«      nd||||	|r|
ndt        |||¬«      ¬«      } | j                  dd|i|j                  dd¬«      ¤Žƒ d{  –—† }t        j                  |«      j                  S 7 Œ#­wr@   rD   rH   s                 r%   rJ   zWebhookClientAsync.updateÊ   s¡   è ø€ ôH 'Ø-8Ð-Dœ˜[Ô)È$Ø/:Ð/Fœ˜{Ô+ÈDØ-Ø-Ø/Ø%Ù#/‘i°TÜ&Ø)Ø+Ø!ôô
ˆð $�t—|‘|Ñs¨GÐs°~×7PÑ7PÐZ^ÐmqÐ7PÓ7rÑs×sˆÜ×-Ñ-¨fÓ5×:Ñ:Ð:ð tús   ‚A&BÁ(BÁ)$Bc             ƒ  óD   K  — | j                  |¬«      ƒ d{  –—†  y7 Œ­wrL   rM   rO   s     r%   rP   zWebhookClientAsync.deleteÿ   s   è ø€ ð �l‰l 7ˆlÓ+×+Ò+ús   ‚ ˜™ rQ   c             ƒ  óê   K  — | j                   j                  | j                  d«      d| j                  «       |¬«      ƒ d{  –—† }t	        |«      }t        j                  |«      j                  S 7 Œ.­w)rS   rT   rU   rV   NrZ   r_   s       r%   rT   zWebhookClientAsync.test	  sn   è ø€ ð  ×*Ñ*×/Ñ/Ø—‘ Ó'ØØ×%Ñ%Ó'Øð	 0ó 
÷ 
ˆô " (Ó+ˆÜ"×1Ñ1°&Ó9×>Ñ>Ð>ð
ús   ‚A A3ÁA1Á/A3c                óR   —  | j                   j                  dddi| j                  ¤ŽS rb   rd   rh   s    r%   rc   zWebhookClientAsync.dispatches#  ri   r'   rj   rn   ro   rr   rs   )rl   r   rt   rz   s   @r%   r|   r|   ¥   sþ   ø„ ñð (ñ	
ð ð
ð ð	
ð
 ð
ð 
õ
ð /6õ ;ð& 6:Ø"&Ø'+Ø'+Ø#Ø$(Ø#'Ø)-Ø$(Ø!%Ø"ñ3;ð 3ð3;ð  ð	3;ð
 %ð3;ð %ð3;ð ð3;ð "ð3;ð !ð3;ð 'ð3;ð "ð3;ð ð3;ð ð3;ð 
ó3;ðj 29õ ,ð 08õ ?÷4
r'   r|   N)Ú
__future__r   Útypingr   r   Úpydanticr   Úapify_client._docsr   Úapify_client._modelsr   r	   r
   r   r   r   Ú/apify_client._resource_clients._resource_clientr   r   Úapify_client._utils.httpr   Úapify_client._literalsr   Úapify_client._resource_clientsr   r   Úapify_client.typesr   r   r|   r   r'   r%   ú<module>r�      sz   ðÝ "ç %å å )÷÷ ÷ `Ý 5áÝ7ßtÝ*ñ ÐÓôH
�Nó H
ó  ðH
ñV ÐÓôH
Ð,ó H
ó  ñH
r'   