pub struct ApifyClient { /* private fields */ }Expand description
The entry point for interacting with the Apify API.
Construct it with ApifyClient::builder (or ApifyClient::new for a quick
token-only setup), then obtain resource clients via the accessor methods, e.g.
ApifyClient::actor, ApifyClient::dataset, ApifyClient::run.
The client is cheap to clone — all internal state is reference-counted.
Implementations§
Source§impl ApifyClient
impl ApifyClient
Sourcepub fn builder() -> ApifyClientBuilder
pub fn builder() -> ApifyClientBuilder
Returns a ApifyClientBuilder for configuring a client.
Sourcepub fn new(token: impl Into<String>) -> Self
pub fn new(token: impl Into<String>) -> Self
Creates a client authenticated with the given API token and default settings.
Sourcepub fn user_agent(&self) -> &str
pub fn user_agent(&self) -> &str
The User-Agent header value this client sends.
Sourcepub fn api_base_url(&self) -> &str
pub fn api_base_url(&self) -> &str
The fully-qualified API base URL this client targets (including the /v2 suffix),
e.g. https://api.apify.com/v2. Reflects any base_url override.
Sourcepub fn actors(&self) -> ActorCollectionClient
pub fn actors(&self) -> ActorCollectionClient
Returns a client for the Actor collection (list & create Actors).
Sourcepub fn actor(&self, id: impl Into<String>) -> ActorClient
pub fn actor(&self, id: impl Into<String>) -> ActorClient
Returns a client for a specific Actor, addressed by ID or username~name.
Sourcepub fn builds(&self) -> BuildCollectionClient
pub fn builds(&self) -> BuildCollectionClient
Returns a client for the Actor build collection (list builds).
Sourcepub fn build(&self, id: impl Into<String>) -> BuildClient
pub fn build(&self, id: impl Into<String>) -> BuildClient
Returns a client for a specific Actor build.
Sourcepub fn runs(&self) -> RunCollectionClient
pub fn runs(&self) -> RunCollectionClient
Returns a client for the Actor run collection (list runs).
Sourcepub fn run(&self, id: impl Into<String>) -> RunClient
pub fn run(&self, id: impl Into<String>) -> RunClient
Returns a client for a specific Actor run.
Sourcepub fn datasets(&self) -> DatasetCollectionClient
pub fn datasets(&self) -> DatasetCollectionClient
Returns a client for the dataset collection (list & get-or-create datasets).
Sourcepub fn dataset(&self, id: impl Into<String>) -> DatasetClient
pub fn dataset(&self, id: impl Into<String>) -> DatasetClient
Returns a client for a specific dataset, addressed by ID or name.
Sourcepub fn key_value_stores(&self) -> KeyValueStoreCollectionClient
pub fn key_value_stores(&self) -> KeyValueStoreCollectionClient
Returns a client for the key-value store collection.
Sourcepub fn key_value_store(&self, id: impl Into<String>) -> KeyValueStoreClient
pub fn key_value_store(&self, id: impl Into<String>) -> KeyValueStoreClient
Returns a client for a specific key-value store, addressed by ID or name.
Sourcepub fn request_queues(&self) -> RequestQueueCollectionClient
pub fn request_queues(&self) -> RequestQueueCollectionClient
Returns a client for the request queue collection.
Sourcepub fn request_queue(&self, id: impl Into<String>) -> RequestQueueClient
pub fn request_queue(&self, id: impl Into<String>) -> RequestQueueClient
Returns a client for a specific request queue, addressed by ID or name.
Sourcepub fn tasks(&self) -> TaskCollectionClient
pub fn tasks(&self) -> TaskCollectionClient
Returns a client for the Actor task collection (list & create tasks).
Sourcepub fn task(&self, id: impl Into<String>) -> TaskClient
pub fn task(&self, id: impl Into<String>) -> TaskClient
Returns a client for a specific Actor task.
Sourcepub fn schedules(&self) -> ScheduleCollectionClient
pub fn schedules(&self) -> ScheduleCollectionClient
Returns a client for the schedule collection (list & create schedules).
Sourcepub fn schedule(&self, id: impl Into<String>) -> ScheduleClient
pub fn schedule(&self, id: impl Into<String>) -> ScheduleClient
Returns a client for a specific schedule.
Sourcepub fn webhooks(&self) -> WebhookCollectionClient
pub fn webhooks(&self) -> WebhookCollectionClient
Returns a client for the webhook collection (list & create webhooks).
Sourcepub fn webhook(&self, id: impl Into<String>) -> WebhookClient
pub fn webhook(&self, id: impl Into<String>) -> WebhookClient
Returns a client for a specific webhook.
Sourcepub fn webhook_dispatches(&self) -> WebhookDispatchCollectionClient
pub fn webhook_dispatches(&self) -> WebhookDispatchCollectionClient
Returns a client for the webhook dispatch collection.
Sourcepub fn webhook_dispatch(&self, id: impl Into<String>) -> WebhookDispatchClient
pub fn webhook_dispatch(&self, id: impl Into<String>) -> WebhookDispatchClient
Returns a client for a specific webhook dispatch.
Sourcepub fn store(&self) -> StoreCollectionClient
pub fn store(&self) -> StoreCollectionClient
Returns a client for browsing the Apify Store.
Sourcepub fn log(&self, build_or_run_id: impl Into<String>) -> LogClient
pub fn log(&self, build_or_run_id: impl Into<String>) -> LogClient
Returns a client for accessing a build’s or run’s log.
Sourcepub fn me(&self) -> UserClient
pub fn me(&self) -> UserClient
Returns a client for the current user (/users/me).
Sourcepub fn user(&self, id: impl Into<String>) -> UserClient
pub fn user(&self, id: impl Into<String>) -> UserClient
Returns a client for a specific user by ID or username.
Sourcepub async fn set_status_message(
&self,
message: &str,
is_terminal: bool,
) -> ApifyClientResult<ActorRun>
pub async fn set_status_message( &self, message: &str, is_terminal: bool, ) -> ApifyClientResult<ActorRun>
Sets the status message of the current Actor run.
This convenience method updates the run identified by the ACTOR_RUN_ID environment
variable, so it only works when called from inside an Actor run. If
is_terminal is true, the message becomes final and won’t be overwritten.
Returns ApifyClientError::InvalidArgument
if ACTOR_RUN_ID is not set.
Trait Implementations§
Source§impl Clone for ApifyClient
impl Clone for ApifyClient
Source§fn clone(&self) -> ApifyClient
fn clone(&self) -> ApifyClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more