pub struct ActorClient { /* private fields */ }Expand description
Client for a specific Actor.
Provides CRUD methods plus convenience helpers to start/call the Actor, build it, and access its runs, builds, versions and webhooks.
Implementations§
Source§impl ActorClient
impl ActorClient
Sourcepub async fn get(&self) -> ApifyClientResult<Option<Actor>>
pub async fn get(&self) -> ApifyClientResult<Option<Actor>>
Fetches the Actor object, or None if it does not exist.
Sourcepub async fn update<T: Serialize>(
&self,
new_fields: &T,
) -> ApifyClientResult<Actor>
pub async fn update<T: Serialize>( &self, new_fields: &T, ) -> ApifyClientResult<Actor>
Updates the Actor with the given fields and returns the updated object.
Sourcepub async fn delete(&self) -> ApifyClientResult<()>
pub async fn delete(&self) -> ApifyClientResult<()>
Deletes the Actor.
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 Actor and returns immediately with the created run.
input is any JSON-serializable value (or None for no 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 Actor 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 build(
&self,
version_number: &str,
options: ActorBuildOptions,
) -> ApifyClientResult<Build>
pub async fn build( &self, version_number: &str, options: ActorBuildOptions, ) -> ApifyClientResult<Build>
Builds the given version of the Actor and returns the created build.
Sourcepub async fn default_build(
&self,
wait_for_finish: Option<i64>,
) -> ApifyClientResult<BuildClient>
pub async fn default_build( &self, wait_for_finish: Option<i64>, ) -> ApifyClientResult<BuildClient>
Resolves the Actor’s default build and returns a client for it.
wait_for_finish optionally bounds how long (in seconds) the API waits for the build
to finish before responding, matching the reference client’s defaultBuild(options).
Sourcepub async fn validate_input<T: Serialize>(
&self,
input: &T,
) -> ApifyClientResult<Value>
pub async fn validate_input<T: Serialize>( &self, input: &T, ) -> ApifyClientResult<Value>
Validates the given input against the Actor’s input schema.
Uses the Actor’s default build for the input schema. To validate against a specific
build, use ActorClient::validate_input_for_build.
Sourcepub async fn validate_input_for_build<T: Serialize>(
&self,
input: &T,
build: Option<&str>,
) -> ApifyClientResult<Value>
pub async fn validate_input_for_build<T: Serialize>( &self, input: &T, build: Option<&str>, ) -> ApifyClientResult<Value>
Validates the given input against the input schema of a specific Actor build.
build is the optional tag or number of the Actor build whose input schema is used for
validation (e.g. "latest" or "1.2.34"); passing None uses the default build, which
is equivalent to ActorClient::validate_input. This maps to the spec’s optional build
query parameter on POST /v2/actors/{actorId}/validate-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 Actor, 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/actors/{actorId}/runs/last and mirrors the reference client’s lastRun({ status }).
To also filter by origin, use ActorClient::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 Actor, applying the given LastRunOptions
(e.g. LastRunOptions::status and/or LastRunOptions::origin).
status filters by run status (e.g. "SUCCEEDED", "FAILED", "RUNNING") and is the
spec’s documented filter on GET /v2/actors/{actorId}/runs/last. origin filters by how
the run was started; accepted values are the platform’s run origins (e.g. "DEVELOPMENT",
"WEB", "API", "SCHEDULER"). origin is not declared by the OpenAPI spec and is sent
only for parity with the reference client’s lastRun({ status, origin }). Both are sent as
query parameters; leave a field as None to omit it.
Sourcepub fn builds(&self) -> BuildCollectionClient
pub fn builds(&self) -> BuildCollectionClient
Returns a client for this Actor’s build collection.
Sourcepub fn runs(&self) -> RunCollectionClient
pub fn runs(&self) -> RunCollectionClient
Returns a client for this Actor’s run collection.
Sourcepub fn version(&self, version_number: &str) -> ActorVersionClient
pub fn version(&self, version_number: &str) -> ActorVersionClient
Returns a client for a specific version of this Actor.
Sourcepub fn versions(&self) -> ActorVersionCollectionClient
pub fn versions(&self) -> ActorVersionCollectionClient
Returns a client for this Actor’s version collection.
Sourcepub fn webhooks(&self) -> WebhookCollectionClient
pub fn webhooks(&self) -> WebhookCollectionClient
Returns a client for this Actor’s webhook collection.
Trait Implementations§
Source§impl Clone for ActorClient
impl Clone for ActorClient
Source§fn clone(&self) -> ActorClient
fn clone(&self) -> ActorClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more