pub struct TaskClient<'a> { /* private fields */ }Expand description
Operations on Tasks.
A Task is a saved configuration for an Actor: it stores the Actor ID, input JSON, and run options. Once created, a Task can be invoked repeatedly without re-sending the full input.
Implementations§
Source§impl<'a> TaskClient<'a>
impl<'a> TaskClient<'a>
Sourcepub async fn list(
&self,
params: Option<ListParams>,
) -> Result<ListData<TaskShort>, ApifyError>
pub async fn list( &self, params: Option<ListParams>, ) -> Result<ListData<TaskShort>, ApifyError>
List Tasks with optional pagination.
Sourcepub async fn create<T: Serialize>(
&self,
request: CreateTaskRequest<T>,
) -> Result<Task, ApifyError>
pub async fn create<T: Serialize>( &self, request: CreateTaskRequest<T>, ) -> Result<Task, ApifyError>
Sourcepub async fn get(&self, task_id: &str) -> Result<Task, ApifyError>
pub async fn get(&self, task_id: &str) -> Result<Task, ApifyError>
Fetch a Task by ID or qualified name (username~task-name).
Sourcepub async fn update<T: Serialize>(
&self,
task_id: &str,
request: UpdateTaskRequest<T>,
) -> Result<Task, ApifyError>
pub async fn update<T: Serialize>( &self, task_id: &str, request: UpdateTaskRequest<T>, ) -> Result<Task, ApifyError>
Update a Task. Omitted fields leave the existing value unchanged.
Sourcepub async fn run(
&self,
task_id: &str,
params: Option<RunParams>,
) -> Result<Run, ApifyError>
pub async fn run( &self, task_id: &str, params: Option<RunParams>, ) -> Result<Run, ApifyError>
Start a Task run asynchronously.
Uses the Task’s stored input. Returns a Run
immediately while the container is queued / started.
Sourcepub async fn run_sync(
&self,
task_id: &str,
params: Option<RunParams>,
) -> Result<Run, ApifyError>
pub async fn run_sync( &self, task_id: &str, params: Option<RunParams>, ) -> Result<Run, ApifyError>
Start a Task run synchronously (blocks up to 300 s).
The HTTP response returns the finished Run
if it completes in time, otherwise a timeout error.
Sourcepub async fn run_sync_get_dataset_items<T: DeserializeOwned>(
&self,
task_id: &str,
params: Option<RunParams>,
) -> Result<Vec<T>, ApifyError>
pub async fn run_sync_get_dataset_items<T: DeserializeOwned>( &self, task_id: &str, params: Option<RunParams>, ) -> Result<Vec<T>, ApifyError>
Start a Task run synchronously and return the default Dataset items directly.
This is the shortest path from “invoke Task” to “get typed results”. The request times out after 300 s if the run does not finish.
Sourcepub async fn get_last_run(&self, task_id: &str) -> Result<Run, ApifyError>
pub async fn get_last_run(&self, task_id: &str) -> Result<Run, ApifyError>
Retrieve the most recent Run of a Task.