
    i?1i)                        d dl mZ d dlmZmZ d dlmZmZmZm	Z	 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 erd dlmZ d	d	d	d	d	d	d	d	d	d	d

	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ G d de      Z G d de      Zy	)    )annotations)TYPE_CHECKINGAny)"filter_out_none_values_recursivelyignore_docsmaybe_extract_enum_member_valueparse_date_fields)ApifyApiError)catch_not_found_or_throw
pluck_data)ResourceClientResourceClientAsync)WebhookDispatchCollectionClient$WebhookDispatchCollectionClientAsync)WebhookEventTypeN)
event_typesrequest_urlpayload_templateactor_idactor_task_idactor_run_idignore_ssl_errorsdo_not_retryidempotency_key	is_ad_hocc        
   
     v    ||||||	|||dd}
|d|
d<   | | D cg c]  }t        |       c}|
d<   |
S c c}w )z6Prepare webhook dictionary representation for clients.)
actorRunIdactorTaskIdactorId)
requestUrlpayloadTemplateignoreSslErrors
doNotRetryidempotencyKeyisAdHoc	conditionTr%   
eventTypes)r   )r   r   r   r   r   r   r   r   r   r   webhook
event_types               w/home/www/therecruiter.miabetepe.com/venv/lib/python3.12/site-packages/apify_client/clients/resource_clients/webhook.pyget_webhook_representationr+      sj     "+,")&(
G !	_j kQ[!@!L kN !ls   6c            
           e Zd ZdZed
 fd       ZddZdddddddddd		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZ	dd	Z
 xZS )WebhookClientz-Sub-client for manipulating a single webhook.c                L    |j                  dd      }t        |   |d|i| y)zInitialize the WebhookClient.resource_pathwebhooksNpopsuper__init__selfargskwargsr/   	__class__s       r*   r4   zWebhookClient.__init__=   ,     

?J?$FmFvF    c                "    | j                         S )Retrieve the webhook.

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

        Returns:
            dict, optional: The retrieved webhook, or None if it does not exist
        _getr6   s    r*   getzWebhookClient.getC   s     yy{r;   N	r   r   r   r   r   r   r   r   r   c       	        ^    t        |||||||||		      }
| j                  t        |
            S )8  Update the webhook.

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

        Args:
            event_types (list of WebhookEventType, optional): List of event types that should trigger the webhook. At least one is required.
            request_url (str, optional): 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.
            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 updated webhook
        rB   r+   _updater   r6   r   r   r   r   r   r   r   r   r   webhook_representations              r*   updatezWebhookClient.updateM   sC    B "<##-'%/%
"
 ||>?UVWWr;   c                "    | j                         S )uDelete the webhook.

        https://docs.apify.com/api/v2#/reference/webhooks/webhook-object/delete-webhook
        _deleter@   s    r*   deletezWebhookClient.delete|   s    
 ||~r;   c                    	 | j                   j                  | j                  d      d| j                               }t	        t        |j                                     S # t        $ r}t        |       Y d}~yd}~ww xY wzTest a webhook.

        Creates a webhook dispatch with a dummy payload.

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

        Returns:
            dict, optional: The webhook dispatch created by the test
        testPOST)urlmethodparamsN	http_clientcall_url_paramsr	   r   jsonr
   r   r6   responseexcs      r*   rQ   zWebhookClient.test   sp    
	*'',,IIf%||~ - H %Z%@AA 	*$S))	*s   AA 	A=(A88A=c                8    t        di | j                  d      S )a  Get dispatches of the webhook.

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

        Returns:
            WebhookDispatchCollectionClient: A client allowing access to dispatches of this webhook using its list method
        
dispatchesr/    )r   _sub_resource_init_optionsr@   s    r*   r`   zWebhookClient.dispatches   s'     / 
--L-I
 	
r;   )r6   r-   r7   r   r8   r   returnNone)r6   r-   rd   dict | None)r6   r-   r   list[WebhookEventType] | Noner   
str | Noner   rh   r   rh   r   rh   r   rh   r   bool | Noner   ri   r   ri   rd   dict)r6   r-   rd   re   )r6   r-   rd   r   __name__
__module____qualname____doc__r   r4   rA   rI   rN   rQ   r`   __classcell__r9   s   @r*   r-   r-   :   s    7G G
 6:"&'+#$(#')-$(!%-X-X 3-X  	-X
 %-X -X "-X !-X '-X "-X -X 
-X^0

r;   r-   c            
           e Zd ZdZed
 fd       ZddZdddddddddd		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZ	dd	Z
 xZS )WebhookClientAsyncz3Async sub-client for manipulating a single webhook.c                L    |j                  dd      }t        |   |d|i| y)z"Initialize the WebhookClientAsync.r/   r0   Nr1   r5   s       r*   r4   zWebhookClientAsync.__init__   r:   r;   c                >   K   | j                          d{   S 7 w)r=   Nr>   r@   s    r*   rA   zWebhookClientAsync.get   s      YY[      NrB   c       	        z   K   t        |||||||||		      }
| j                  t        |
             d{   S 7 w)rD   rB   NrE   rG   s              r*   rI   zWebhookClientAsync.update   sM     B "<##-'%/%
"
 \\"DE["\]]]]s   2;9;c                >   K   | j                          d{   S 7 w)rK   NrL   r@   s    r*   rN   zWebhookClientAsync.delete   s     
 \\^###rv   c                  K   	 | j                   j                  | j                  d      d| j                                d{   }t	        t        |j                                     S 7 &# t        $ r}t        |       Y d}~yd}~ww xY wwrP   rV   r\   s      r*   rQ   zWebhookClientAsync.test   s     
	*!--22IIf%||~ 3  H %Z%@AA  	*$S))	*s@   B>A+ A)%A+ (B)A+ +	B	4B?BB		Bc                8    t        di | j                  d      S )a  Get dispatches of the webhook.

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

        Returns:
            WebhookDispatchCollectionClientAsync: A client allowing access to dispatches of this webhook using its list method
        r`   ra   rb   )r   rc   r@   s    r*   r`   zWebhookClientAsync.dispatches	  s'     4 
--L-I
 	
r;   )r6   rs   r7   r   r8   r   rd   re   )r6   rs   rd   rf   )r6   rs   r   rg   r   rh   r   rh   r   rh   r   rh   r   rh   r   ri   r   ri   r   ri   rd   rj   )r6   rs   rd   re   )r6   rs   rd   r   rk   rq   s   @r*   rs   rs      s    =G G
! 6:"&'+#$(#')-$(!%-^ -^ 3-^  	-^
 %-^ -^ "-^ !-^ '-^ "-^ -^ 
-^^$0

r;   rs   )r   rg   r   rh   r   rh   r   rh   r   rh   r   rh   r   ri   r   ri   r   rh   r   ri   rd   rj   )
__future__r   typingr   r   apify_shared.utilsr   r   r   r	   apify_client._errorsr
   apify_client._utilsr   r   apify_client.clients.baser   r   Aapify_client.clients.resource_clients.webhook_dispatch_collectionr   r   apify_shared.constsr   r+   r-   rs   rb   r;   r*   <module>r      s    " %  / D I T4
 26"#' $#%) $"&!"." " !	"
 " " " #" "  " " 
"Jk
N k
\k
, k
r;   