pub struct TaskClient { /* private fields */ }Expand description
Client for a specific Actor task.
Implementations§
Source§impl TaskClient
impl TaskClient
Sourcepub async fn get(&self) -> ApifyClientResult<Option<Task>>
pub async fn get(&self) -> ApifyClientResult<Option<Task>>
Fetches the task object, or None if it does not exist.
Sourcepub async fn update<T: Serialize>(
&self,
new_fields: &T,
) -> ApifyClientResult<Task>
pub async fn update<T: Serialize>( &self, new_fields: &T, ) -> ApifyClientResult<Task>
Updates the task with the given fields.
Sourcepub async fn delete(&self) -> ApifyClientResult<()>
pub async fn delete(&self) -> ApifyClientResult<()>
Deletes the task.
Sourcepub async fn start<T: Serialize>(
&self,
input: Option<&T>,
options: ActorStartOptions,
) -> ApifyClientResult<ActorRun>
pub async fn start<T: Serialize>( &self, input: Option<&T>, options: ActorStartOptions, ) -> ApifyClientResult<ActorRun>
Starts the task and returns immediately with the created run.
input overrides the task’s saved input (or None to use the saved input).
Sourcepub async fn call<T: Serialize>(
&self,
input: Option<&T>,
options: ActorStartOptions,
wait_secs: Option<i64>,
) -> ApifyClientResult<ActorRun>
pub async fn call<T: Serialize>( &self, input: Option<&T>, options: ActorStartOptions, wait_secs: Option<i64>, ) -> ApifyClientResult<ActorRun>
Starts the task and waits (client-side polling) for it to finish.
wait_secs controls the wait budget:
Nonepolls indefinitely until the run reaches a terminal state.Some(n)bounds the wait to roughlynseconds; if the run has not finished by then, the last fetched (still non-terminal) run is returned rather than an error. Checkstatus/is_terminal()on the result when usingSome.
Sourcepub async fn get_input(&self) -> ApifyClientResult<Option<Value>>
pub async fn get_input(&self) -> ApifyClientResult<Option<Value>>
Fetches the task’s saved input, or None if not set.
Sourcepub async fn update_input<T: Serialize>(
&self,
input: &T,
) -> ApifyClientResult<Value>
pub async fn update_input<T: Serialize>( &self, input: &T, ) -> ApifyClientResult<Value>
Updates the task’s saved input.
Sourcepub fn last_run(&self, status: Option<&str>) -> RunClient
pub fn last_run(&self, status: Option<&str>) -> RunClient
Returns a client for the last run of this task, optionally filtered by run status.
status filters by run status (e.g. "SUCCEEDED", "FAILED", "RUNNING"); pass None
to leave it unfiltered. This maps to the status query parameter on
GET /v2/actor-tasks/{actorTaskId}/runs/last and mirrors the reference client’s
lastRun({ status }). To also filter by origin, use TaskClient::last_run_with_options.
Sourcepub fn last_run_with_options(&self, options: LastRunOptions) -> RunClient
pub fn last_run_with_options(&self, options: LastRunOptions) -> RunClient
Returns a client for the last run of this task, applying the given LastRunOptions
(e.g. LastRunOptions::status and/or LastRunOptions::origin).
status filters by run status (e.g. "SUCCEEDED", "FAILED", "RUNNING"); origin filters
by how the run was started, with accepted values being the platform’s run origins (e.g.
"DEVELOPMENT", "WEB", "API", "SCHEDULER"). Both are documented optional query
parameters on GET /v2/actor-tasks/{actorTaskId}/runs/last and match the reference client’s
lastRun({ status, origin }); leave a field as None to omit it.
Sourcepub fn runs(&self) -> RunCollectionClient
pub fn runs(&self) -> RunCollectionClient
Returns a client for this task’s run collection.
Sourcepub fn webhooks(&self) -> WebhookCollectionClient
pub fn webhooks(&self) -> WebhookCollectionClient
Returns a client for this task’s webhook collection.
Trait Implementations§
Source§impl Clone for TaskClient
impl Clone for TaskClient
Source§fn clone(&self) -> TaskClient
fn clone(&self) -> TaskClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more