
    i?1ik                         d dl mZ d dlmZmZ d dl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  G d d	e	      Z G d
 de
      Zy)    )annotations)TYPE_CHECKINGAny)"filter_out_none_values_recursivelyignore_docs)ResourceCollectionClientResourceCollectionClientAsync)get_webhook_representation)WebhookEventType)ListPagec            	           e Zd ZdZed fd       Zdddd	 	 	 	 	 	 	 	 	 d	dZddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
dZ xZS )WebhookCollectionClientz%Sub-client for manipulating webhooks.c                L    |j                  dd      }t        |   |d|i| y)z'Initialize the WebhookCollectionClient.resource_pathwebhooksNpopsuper__init__selfargskwargsr   	__class__s       /home/www/therecruiter.miabetepe.com/venv/lib/python3.12/site-packages/apify_client/clients/resource_clients/webhook_collection.pyr   z WebhookCollectionClient.__init__   ,     

?J?$FmFvF    Nlimitoffsetdescc               *    | j                  |||      S )  List the available webhooks.

        https://docs.apify.com/api/v2#/reference/webhooks/webhook-collection/get-list-of-webhooks

        Args:
            limit (int, optional): How many webhooks to retrieve
            offset (int, optional): What webhook to include as first when retrieving the list
            desc (bool, optional): Whether to sort the webhooks in descending order based on their date of creation

        Returns:
            ListPage: The list of available webhooks matching the specified filters.
        r   _listr   r   r    r!   s       r   listzWebhookCollectionClient.list   s    & zzf4z@@r   payload_templateactor_idactor_task_idactor_run_idignore_ssl_errorsdo_not_retryidempotency_key	is_ad_hocc       
        `    t        |||||||||	|

      }| j                  t        |            S )O  Create a new webhook.

        You have to specify exactly one out of actor_id, actor_task_id or actor_run_id.

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

        Args:
            event_types (list of WebhookEventType): List of event types that should trigger the webhook. At least one is required.
            request_url (str): URL that will be invoked once the webhook is triggered.
            payload_template (str, optional): Specification of the payload that will be sent to request_url
            actor_id (str, optional): Id of the actor whose runs should trigger the webhook.
            actor_task_id (str, optional): Id of the actor task whose runs should trigger the webhook.
            actor_run_id (str, optional): Id of the actor run which should trigger the webhook.
            ignore_ssl_errors (bool, optional): Whether the webhook should ignore SSL errors returned by request_url
            do_not_retry (bool, optional): Whether the webhook should retry sending the payload to request_url upon
                                           failure.
            idempotency_key (str, optional): A unique identifier of a webhook. You can use it to ensure that you won't
                                             create the same webhook multiple times.
            is_ad_hoc (bool, optional): 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.

        Returns:
            dict: The created webhook
        
event_typesrequest_urlr)   r*   r+   r,   r-   r.   r/   r0   r
   _creater   r   r4   r5   r)   r*   r+   r,   r-   r.   r/   r0   webhook_representations               r   createzWebhookCollectionClient.create-   sF    L "<##-'%/%+"
 ||>?UVWWr   )r   r   r   r   r   r   returnNone)
r   r   r   
int | Noner    r=   r!   bool | Noner;   ListPage[dict])r   r   r4   list[WebhookEventType]r5   strr)   
str | Noner*   rB   r+   rB   r,   rB   r-   r>   r.   r>   r/   rB   r0   r>   r;   dict	__name__
__module____qualname____doc__r   r   r'   r:   __classcell__r   s   @r   r   r      s   /G G !! A%A A 	A
 A 
A4 (,#$(#')-$(&*!%3X%3X ,3X 	3X
 %3X 3X "3X !3X '3X "3X $3X 3X 
3Xr   r   c            	           e Zd ZdZed fd       Zdddd	 	 	 	 	 	 	 	 	 d	dZddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d
dZ xZS )WebhookCollectionClientAsyncz+Async sub-client for manipulating webhooks.c                L    |j                  dd      }t        |   |d|i| y)z,Initialize the WebhookCollectionClientAsync.r   r   Nr   r   s       r   r   z%WebhookCollectionClientAsync.__init__f   r   r   Nr   c               F   K   | j                  |||       d{   S 7 w)r#   r   Nr$   r&   s       r   r'   z!WebhookCollectionClientAsync.listl   s#     & ZZeFZFFFFs   !!r(   c       
        |   K   t        |||||||||	|

      }| j                  t        |             d{   S 7 w)r2   r3   Nr6   r8   s               r   r:   z#WebhookCollectionClientAsync.create   sP     L "<##-'%/%+"
 \\"DE["\]]]]s   3<:<)r   rL   r   r   r   r   r;   r<   )
r   rL   r   r=   r    r=   r!   r>   r;   r?   )r   rL   r4   r@   r5   rA   r)   rB   r*   rB   r+   rB   r,   rB   r-   r>   r.   r>   r/   rB   r0   r>   r;   rC   rD   rJ   s   @r   rL   rL   c   s   5G G !! G*G G 	G
 G 
G4 (,#$(#')-$(&*!%3^*3^ ,3^ 	3^
 %3^ 3^ "3^ !3^ '3^ "3^ $3^ 3^ 
3^r   rL   N)
__future__r   typingr   r   apify_shared.utilsr   r   apify_client.clients.baser   r	   -apify_client.clients.resource_clients.webhookr
   apify_shared.constsr   apify_shared.modelsr   r   rL    r   r   <module>rX      s@    " % N ] T4,QX6 QXhQ^#@ Q^r   