
    i?1i                    n   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mZ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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$m%Z% dddddd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)#encode_key_value_store_record_valueencode_webhook_list_to_base64
pluck_data)ResourceClientResourceClientAsync)ActorVersionClientActorVersionClientAsync)ActorVersionCollectionClient!ActorVersionCollectionClientAsync)BuildCollectionClientBuildCollectionClientAsync)	RunClientRunClientAsync)RunCollectionClientRunCollectionClientAsync)WebhookCollectionClientWebhookCollectionClientAsync)ActorJobStatus
MetaOriginN)titledescription	seo_titleseo_descriptionversionsrestart_on_error	is_publicis_deprecatedis_anonymously_runnable
categoriesdefault_run_builddefault_run_max_itemsdefault_run_memory_mbytesdefault_run_timeout_secsexample_run_input_bodyexample_run_input_content_typec                2    | |||||||||	|
||||d||ddS )z+Get dictionary representation of the Actor.)buildmaxItemsmemoryMbytestimeoutSecs)bodycontentType)namer   r   seoTitleseoDescriptionr!   restartOnErrorisPublicisDeprecatedisAnonymouslyRunnabler&   defaultRunOptionsexampleRunInput r4   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   s                    u/home/www/therecruiter.miabetepe.com/venv/lib/python3.12/site-packages/apify_client/clients/resource_clients/actor.pyget_actor_representationr@      sM    , ")*%!8 &-53	
 +9
%     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dddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Z	ddddddddd
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
ddddd	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZddd	 	 	 	 	 	 	 ddZddZd dZd!dZ xZS )"ActorClientz+Sub-client for manipulating a single actor.c                L    |j                  dd      }t        |   |d|i| y)zInitialize the ActorClient.resource_pathactsNpopsuper__init__selfargskwargsrE   	__class__s       r?   rJ   zActorClient.__init__J   ,     

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

        https://docs.apify.com/api/v2#/reference/actors/actor-object/get-actor

        Returns:
            dict, optional: The retrieved actor
        _getrL   s    r?   getzActorClient.getP   s     yy{rA   Nr>   c                   t        di d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|}| j                  t        |            S )  Update the actor with the specified fields.

        https://docs.apify.com/api/v2#/reference/actors/actor-object/update-actor

        Args:
            name (str, optional): The name of the actor
            title (str, optional): The title of the actor (human-readable)
            description (str, optional): The description for the actor
            seo_title (str, optional): The title of the actor optimized for search engines
            seo_description (str, optional): The description of the actor optimized for search engines
            versions (list of dict, optional): The list of actor versions
            restart_on_error (bool, optional): If true, the main actor run process will be restarted whenever it exits with a non-zero status code.
            is_public (bool, optional): Whether the actor is public.
            is_deprecated (bool, optional): Whether the actor is deprecated.
            is_anonymously_runnable (bool, optional): Whether the actor is anonymously runnable.
            categories (list of str, optional): The categories to which the actor belongs to.
            default_run_build (str, optional): Tag or number of the build that you want to run by default.
            default_run_max_items (int, optional): Default limit of the number of results that will be returned by runs of this Actor,
                                                   if the Actor is charged per result.
            default_run_memory_mbytes (int, optional): Default amount of memory allocated for the runs of this actor, in megabytes.
            default_run_timeout_secs (int, optional): Default timeout for the runs of this actor in seconds.
            example_run_input_body (Any, optional): Input to be prefilled as default input to new users of this actor.
            example_run_input_content_type (str, optional): The content type of the example run input.

        Returns:
            dict: The updated actor
        r4   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r=   r@   _updater   rL   r4   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   actor_representations                      r?   updatezActorClient.updateZ   s    `  8  
 
 
 $ 
  	 

 , 
  
 . 
   
 ( 
 %< 
 " 
 0 
 #8 
 '@ 
 &> 
  $:! 
" ,J# 
( ||>?STUUrA   c                "    | j                         S )mDelete the actor.

        https://docs.apify.com/api/v2#/reference/actors/actor-object/delete-actor
        _deleterU   s    r?   deletezActorClient.delete   s    
 ||~rA   	run_inputcontent_typer.   	max_itemsmemory_mbytestimeout_secswait_for_finishwebhooksc          
        t        ||      \  }}| j                  ||||||t        |      nd      }	| j                  j	                  | j                  d      dd|i||	      }
t        t        |
j                                     S a	  Start the actor and immediately return the Run object.

        https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor

        Args:
            run_input (Any, optional): The input to pass to the actor run.
            content_type (str, optional): The content type of the input.
            build (str, optional): Specifies the actor build to run. It can be either a build tag or build number.
                                   By default, the run uses the build specified in the default run configuration for the actor (typically latest).
            max_items (int, optional): Maximum number of results that will be returned by this run.
                                       If the Actor is charged per result, you will not be charged for more results than the given limit.
            memory_mbytes (int, optional): Memory limit for the run, in megabytes.
                                           By default, the run uses a memory limit specified in the default run configuration for the actor.
            timeout_secs (int, optional): Optional timeout for the run, in seconds.
                                          By default, the run uses timeout specified in the default run configuration for the actor.
            wait_for_finish (int, optional): The maximum number of seconds the server waits for the run to finish.
                                               By default, it is 0, the maximum value is 60.
            webhooks (list of dict, optional): Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks)
                                               associated with the actor run which can be used to receive a notification,
                                               e.g. when the actor finished or failed.
                                               If you already have a webhook set up for the actor or task, you do not have to add it again here.
                                               Each webhook is represented by a dictionary containing these items:
                                               * ``event_types``: list of ``WebhookEventType`` values which trigger the webhook
                                               * ``request_url``: URL to which to send the webhook HTTP request
                                               * ``payload_template`` (optional): Optional template for the request payload

        Returns:
            dict: The run object
        N)r.   r/   memorytimeoutwaitForFinishrj   runsPOSTzcontent-type)urlmethodheadersdataparams	r
   _paramsr   http_clientcall_urlr	   r   jsonrL   rd   re   r.   rf   rg   rh   ri   rj   request_paramsresponses              r?   startzActorClient.start   s    R #FiQ]"^	<  )@H@T28<Z^ & 
 ##((		&!#\2! ) 
 !HMMO!<==rA   rd   re   r.   rf   rg   rh   rj   	wait_secsc          	         | j                  |||||||      }	| j                  j                  |	d         j                  |      S )|  Start the actor and wait for it to finish before returning the Run object.

        It waits indefinitely, unless the wait_secs argument is provided.

        https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor

        Args:
            run_input (Any, optional): The input to pass to the actor run.
            content_type (str, optional): The content type of the input.
            build (str, optional): Specifies the actor build to run. It can be either a build tag or build number.
                                   By default, the run uses the build specified in the default run configuration for the actor (typically latest).
            max_items (int, optional): Maximum number of results that will be returned by this run.
                                       If the Actor is charged per result, you will not be charged for more results than the given limit.
            memory_mbytes (int, optional): Memory limit for the run, in megabytes.
                                           By default, the run uses a memory limit specified in the default run configuration for the actor.
            timeout_secs (int, optional): Optional timeout for the run, in seconds.
                                          By default, the run uses timeout specified in the default run configuration for the actor.
            webhooks (list, optional): Optional webhooks (https://docs.apify.com/webhooks) associated with the actor run,
                                       which can be used to receive a notification, e.g. when the actor finished or failed.
                                       If you already have a webhook set up for the actor, you do not have to add it again here.
            wait_secs (int, optional): The maximum number of seconds the server waits for the run to finish. If not provided, waits indefinitely.

        Returns:
            dict: The run object
        rd   re   r.   rf   rg   rh   rj   idr   r   root_clientrunri   
rL   rd   re   r.   rf   rg   rh   rj   r   started_runs
             r?   rz   zActorClient.call   sZ    J jj%'% ! 
 ##K$56FFQZF[[rA   beta_packagestag	use_cacheri   c                   | j                  |||||      }| j                  j                  | j                  d      d|      }t	        t        |j                                     S )  Build the actor.

        https://docs.apify.com/api/v2#/reference/actors/build-collection/build-actor

        Args:
            version_number (str): Actor version number to be built.
            beta_packages (bool, optional): If True, then the actor is built with beta versions of Apify NPM packages.
                                            By default, the build uses latest stable packages.
            tag (str, optional): Tag to be applied to the build on success. By default, the tag is taken from the actor version's buildTag property.
            use_cache (bool, optional): If true, the actor's Docker container will be rebuilt using layer cache
                                        (https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#leverage-build-cache).
                                        This is to enable quick rebuild during development.
                                        By default, the cache is not used.
            wait_for_finish (int, optional): The maximum number of seconds the server waits for the build to finish before returning.
                                             By default it is 0, the maximum value is 60.

        Returns:
            dict: The build object
        versionbetaPackagesr   useCachero   buildsrq   rr   rs   rv   rx   ry   rz   r{   r	   r   r|   rL   version_numberr   r   r   ri   r~   r   s           r?   r.   zActorClient.build  sm    8 "&) & 
 ##((		(#! ) 
 !HMMO!<==rA   c                8    t        di | j                  d      S z/Retrieve a client for the builds of this actor.r   rE   r=   )r   _sub_resource_init_optionsrU   s    r?   r   zActorClient.buildsB  s    $_t'F'FU]'F'^__rA   c                8    t        di | j                  d      S z-Retrieve a client for the runs of this actor.rp   r   r=   )r   r   rU   s    r?   rp   zActorClient.runsF  s    "[T%D%DSY%D%Z[[rA   statusoriginc                   t        di | j                  dd| j                  t        |      t        |                  S )a  Retrieve the client for the last run of this actor.

        Last run is retrieved based on the start time of the runs.

        Args:
            status (ActorJobStatus, optional): Consider only runs with this status.
            origin (MetaOrigin, optional): Consider only runs started with this origin.

        Returns:
            RunClient: The resource client for the last run of this actor.
        lastrp   r   resource_idrE   rv   r=   )r   r   rx   r   rL   r   r   s      r?   last_runzActorClient.last_runJ  sP    "  	
--"$||:6B:6B $  . 	
 		
rA   c                4    t        di | j                         S z1Retrieve a client for the versions of this actor.r=   )r   r   rU   s    r?   r!   zActorClient.versionsf      +Pd.M.M.OPPrA   c                8    t        di | j                  |      S )a  Retrieve the client for the specified version of this actor.

        Args:
            version_number (str): The version number for which to retrieve the resource client.

        Returns:
            ActorVersionClient: The resource client for the specified actor version.
        r   r=   )r   r   rL   r   s     r?   r   zActorClient.versionj  s!     "`D$C$CP^$C$_``rA   c                4    t        di | j                         S z:Retrieve a client for webhooks associated with this actor.r=   )r   r   rU   s    r?   rj   zActorClient.webhooksu  s    &K)H)H)JKKrA   )rL   rC   rM   r   rN   r   returnNone)rL   rC   r   dict | None)&rL   rC   r4   
str | Noner   r   r   r   r   r   r    r   r!   list[dict] | Noner"   bool | Noner#   r   r$   r   r%   r   r&   list[str] | Noner'   r   r(   
int | Noner)   r   r*   r   r+   r   r,   r   r   dict)rL   rC   r   r   )rL   rC   rd   r   re   r   r.   r   rf   r   rg   r   rh   r   ri   r   rj   r   r   r   )rL   rC   rd   r   re   r   r.   r   rf   r   rg   r   rh   r   rj   r   r   r   r   r   )rL   rC   r   strr   r   r   r   r   r   ri   r   r   r   )rL   rC   r   r   )rL   rC   r   r   )rL   rC   r   ActorJobStatus | Noner   MetaOrigin | Noner   r   )rL   rC   r   r   )rL   rC   r   r   r   r   )rL   rC   r   r   __name__
__module____qualname____doc__r   rJ   rV   r]   rb   r   rz   r.   r   rp   r   r!   r   rj   __classcell__rO   s   @r?   rC   rC   G   s   5G G
   "& $&*&*(,!%%)/3'+(,,004/3&*59'DVDV DV 	DV
  DV DV $DV $DV &DV DV #DV "-DV %DV &DV  *DV  $.!DV" #-#DV$ !$%DV& )3'DV( 
)DVL #'  $$(#'&*&*<><> <> !	<>
 <> <> "<> !<> $<> $<> 
<>B #'  $$(#'&* $/\/\ /\ !	/\
 /\ /\ "/\ !/\ $/\ /\ 
/\j &*!%&**>*> *> #	*>
 *> *> $*> 
*>X`\ )-$(	

 &
 "	

 

8Q	aLrA   rC   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dddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddddddddd	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd	Z	ddddddddd
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ
ddddd	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddZddZdddddZddZd dZd!dZ xZS )"ActorClientAsyncz1Async sub-client for manipulating a single actor.c                L    |j                  dd      }t        |   |d|i| y)z Initialize the ActorClientAsync.rE   rF   NrG   rK   s       r?   rJ   zActorClientAsync.__init__}  rP   rA   c                >   K   | j                          d{   S 7 w)rR   NrS   rU   s    r?   rV   zActorClientAsync.get  s      YY[      Nr>   c                  K   t        di d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|}| j                  t        |             d{   S 7 w)rX   r4   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   Nr=   rY   r[   s                      r?   r]   zActorClientAsync.update  s     `  8  
 
 
 $ 
  	 

 , 
  
 . 
   
 ( 
 %< 
 " 
 0 
 #8 
 '@ 
 &> 
  $:! 
" ,J# 
( \\"DEY"Z[[[[s   AA#A!A#c                >   K   | j                          d{   S 7 w)r_   Nr`   rU   s    r?   rb   zActorClientAsync.delete  s     
 \\^###r   rc   c          
     *  K   t        ||      \  }}| j                  ||||||t        |      nd      }	| j                  j	                  | j                  d      dd|i||	       d{   }
t        t        |
j                                     S 7 &wrl   rw   r}   s              r?   r   zActorClientAsync.start  s     R #FiQ]"^	<  )@H@T28<Z^ & 
 ))..		&!#\2! / 
 
 !HMMO!<==
s   A(B*B+'Br   c          	        K   | j                  |||||||       d{   }	| j                  j                  |	d         j                  |       d{   S 7 :7 w)r   r   Nr   r   r   r   s
             r?   rz   zActorClientAsync.call  sr     J !JJ%'% ' 
 
 %%))+d*;<LLW`Laaa
 bs!   AA5AAAAr   c                  K   | j                  |||||      }| j                  j                  | j                  d      d|       d{   }t	        t        |j                                     S 7 &w)r   r   r   rq   r   Nr   r   s           r?   r.   zActorClientAsync.buildI  s{     8 "&) & 
 ))..		(#! / 
 
 !HMMO!<==
s   AA2	A0
'A2c                8    t        di | j                  d      S r   )r   r   rU   s    r?   r   zActorClientAsync.buildsu  s    )dD,K,KZb,K,cddrA   c                8    t        di | j                  d      S r   )r   r   rU   s    r?   rp   zActorClientAsync.runsy  s    '`$*I*IX^*I*_``rA   r   c                   t        di | j                  dd| j                  t        |      t        |                  S )a  Retrieve the client for the last run of this actor.

        Last run is retrieved based on the start time of the runs.

        Args:
            status (ActorJobStatus, optional): Consider only runs with this status.
            origin (MetaOrigin, optional): Consider only runs started with this origin.

        Returns:
            RunClientAsync: The resource client for the last run of this actor.
        r   rp   r   r   r=   )r   r   rx   r   r   s      r?   r   zActorClientAsync.last_run}  sP      	
--"$||:6B:6B $  . 	
 		
rA   c                4    t        di | j                         S r   )r   r   rU   s    r?   r!   zActorClientAsync.versions  s    0U43R3R3TUUrA   c                8    t        di | j                  |      S )a   Retrieve the client for the specified version of this actor.

        Args:
            version_number (str): The version number for which to retrieve the resource client.

        Returns:
            ActorVersionClientAsync: The resource client for the specified actor version.
        r   r=   )r   r   r   s     r?   r   zActorClientAsync.version  s!     'e)H)HUc)H)deerA   c                4    t        di | j                         S r   )r   r   rU   s    r?   rj   zActorClientAsync.webhooks  r   rA   )rL   r   rM   r   rN   r   r   r   )rL   r   r   r   )&rL   r   r4   r   r   r   r   r   r   r   r    r   r!   r   r"   r   r#   r   r$   r   r%   r   r&   r   r'   r   r(   r   r)   r   r*   r   r+   r   r,   r   r   r   )rL   r   r   r   )rL   r   rd   r   re   r   r.   r   rf   r   rg   r   rh   r   ri   r   rj   r   r   r   )rL   r   rd   r   re   r   r.   r   rf   r   rg   r   rh   r   rj   r   r   r   r   r   )rL   r   r   r   r   r   r   r   r   r   ri   r   r   r   )rL   r   r   r   )rL   r   r   r   )rL   r   r   r   r   r   r   r   )rL   r   r   r   )rL   r   r   r   r   r   )rL   r   r   r   r   r   s   @r?   r   r   z  s   ;G G
!   "& $&*&*(,!%%)/3'+(,,004/3&*59'D\D\ D\ 	D\
  D\ D\ $D\ $D\ &D\ D\ #D\ "-D\ %D\ &D\  *D\  $.!D\" #-#D\$ !$%D\& )3'D\( 
)D\L$ #'  $$(#'&*&*<><> <> !	<>
 <> <> "<> !<> $<> $<> 
<>B #'  $$(#'&* $/b/b /b !	/b
 /b /b "/b !/b $/b /b 
/bj &*!%&**>*> *> #	*>
 *> *> $*> 
*>Xea MQnr 
.V	fQrA   r   )$r4   r   r   r   r   r   r   r   r    r   r!   r   r"   r   r#   r   r$   r   r%   r   r&   r   r'   r   r(   r   r)   r   r*   r   r+   r   r,   r   r   r   ))
__future__r   typingr   r   apify_shared.utilsr   r   r   r	   apify_client._utilsr
   r   r   apify_client.clients.baser   r   3apify_client.clients.resource_clients.actor_versionr   r   >apify_client.clients.resource_clients.actor_version_collectionr   r   6apify_client.clients.resource_clients.build_collectionr   r   )apify_client.clients.resource_clients.runr   r   4apify_client.clients.resource_clients.run_collectionr   r   8apify_client.clients.resource_clients.webhook_collectionr   r   apify_shared.constsr   r   r@   rC   r   r=   rA   r?   <module>r      sH   " %  o n I k K t O n z> " "&"&$(!!%+/#'$((,,0+/"&15%+
+ + 	+
 +  +  + "+ + + )+ !+ "+ &+  *+  )!+"  #+$ %/%+& 
'+\pL. pLf	kQ* kQrA   