pub struct RunClient { /* private fields */ }Expand description
Client for a specific Actor run.
In addition to CRUD-style operations, this client exposes the run’s lifecycle actions (abort, metamorph, reboot, resurrect, charge) and provides access to the run’s default dataset, key-value store, request queue and log.
Implementations§
Source§impl RunClient
impl RunClient
Sourcepub async fn get(&self) -> ApifyClientResult<Option<ActorRun>>
pub async fn get(&self) -> ApifyClientResult<Option<ActorRun>>
Fetches the run object, or None if it does not exist.
Sourcepub async fn update<T: Serialize>(
&self,
new_fields: &T,
) -> ApifyClientResult<ActorRun>
pub async fn update<T: Serialize>( &self, new_fields: &T, ) -> ApifyClientResult<ActorRun>
Updates the run (e.g. its status message) and returns the updated object.
Sourcepub async fn delete(&self) -> ApifyClientResult<()>
pub async fn delete(&self) -> ApifyClientResult<()>
Deletes the run.
Sourcepub async fn abort(
&self,
gracefully: Option<bool>,
) -> ApifyClientResult<ActorRun>
pub async fn abort( &self, gracefully: Option<bool>, ) -> ApifyClientResult<ActorRun>
Aborts the run. gracefully is optional, matching the reference client’s optional
gracefully option and the Go sibling’s Option<bool>: Some(true) lets the run
perform cleanup first, Some(false) aborts immediately, and None omits the parameter
entirely so the server applies its default (immediate abort).
Sourcepub async fn metamorph<T: Serialize>(
&self,
target_actor_id: &str,
input: Option<&T>,
options: RunMetamorphOptions,
) -> ApifyClientResult<ActorRun>
pub async fn metamorph<T: Serialize>( &self, target_actor_id: &str, input: Option<&T>, options: RunMetamorphOptions, ) -> ApifyClientResult<ActorRun>
Transforms the run into a run of another Actor (metamorph).
options.content_type sets the content type of the input body (defaulting to
application/json), matching the reference client’s metamorph(..., { contentType }).
Sourcepub async fn reboot(&self) -> ApifyClientResult<ActorRun>
pub async fn reboot(&self) -> ApifyClientResult<ActorRun>
Reboots the run (restarts its container, preserving the run ID and storages).
Sourcepub async fn resurrect(
&self,
options: RunResurrectOptions,
) -> ApifyClientResult<ActorRun>
pub async fn resurrect( &self, options: RunResurrectOptions, ) -> ApifyClientResult<ActorRun>
Resurrects a finished run, starting it again with (optionally overridden) settings.
Sourcepub async fn charge(&self, options: RunChargeOptions) -> ApifyClientResult<()>
pub async fn charge(&self, options: RunChargeOptions) -> ApifyClientResult<()>
Charges the run for a pay-per-event run, recording occurrences of a named event.
An idempotency key is always sent (auto-generated when options.idempotency_key is
None), so a charge that is retried by the transport is applied at most once — matching
the reference client and preventing double-charging.
The charge endpoint returns an empty body on success, so this issues the request directly and treats any 2xx response as success (errors still surface normally).
Sourcepub async fn wait_for_finish(
&self,
wait_secs: Option<i64>,
) -> ApifyClientResult<ActorRun>
pub async fn wait_for_finish( &self, wait_secs: Option<i64>, ) -> ApifyClientResult<ActorRun>
Waits (by client-side polling) for the run to reach a terminal state.
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 fn dataset(&self) -> DatasetClient
pub fn dataset(&self) -> DatasetClient
Returns a client for the run’s default dataset.
Sourcepub fn key_value_store(&self) -> KeyValueStoreClient
pub fn key_value_store(&self) -> KeyValueStoreClient
Returns a client for the run’s default key-value store.
Sourcepub fn request_queue(&self) -> RequestQueueClient
pub fn request_queue(&self) -> RequestQueueClient
Returns a client for the run’s default request queue.
Sourcepub async fn get_streamed_log(
&self,
) -> ApifyClientResult<impl Stream<Item = ApifyClientResult<Vec<u8>>>>
pub async fn get_streamed_log( &self, ) -> ApifyClientResult<impl Stream<Item = ApifyClientResult<Vec<u8>>>>
Opens a live stream of the run’s log for redirection.
Convenience equivalent to run.log().stream() (mirrors the reference client’s
getStreamedLog): yields log chunks as they arrive, so callers can forward them to
their own logger/stdout while the run is in progress.
Sourcepub async fn get_streamed_log_with_options(
&self,
options: LogOptions,
) -> ApifyClientResult<impl Stream<Item = ApifyClientResult<Vec<u8>>>>
pub async fn get_streamed_log_with_options( &self, options: LogOptions, ) -> ApifyClientResult<impl Stream<Item = ApifyClientResult<Vec<u8>>>>
Opens a live stream of the run’s log for redirection, applying the given
[LogOptions] (e.g. [LogOptions::raw] to stream the unprocessed log, which is the
form the JS reference’s log redirection consumes internally).
This is a Rust-specific convenience that simply forwards LogOptions to
LogClient::stream_with_options; it is not a 1:1 mirror of the JS getStreamedLog
method’s signature (which takes redirect options and returns a StreamedLog object).