Skip to main content

ApifyClient

Struct ApifyClient 

Source
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

Source

pub fn builder() -> ApifyClientBuilder

Returns a ApifyClientBuilder for configuring a client.

Source

pub fn new(token: impl Into<String>) -> Self

Creates a client authenticated with the given API token and default settings.

Source

pub fn user_agent(&self) -> &str

The User-Agent header value this client sends.

Source

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.

Source

pub fn actors(&self) -> ActorCollectionClient

Returns a client for the Actor collection (list & create Actors).

Source

pub fn actor(&self, id: impl Into<String>) -> ActorClient

Returns a client for a specific Actor, addressed by ID or username~name.

Source

pub fn builds(&self) -> BuildCollectionClient

Returns a client for the Actor build collection (list builds).

Source

pub fn build(&self, id: impl Into<String>) -> BuildClient

Returns a client for a specific Actor build.

Source

pub fn runs(&self) -> RunCollectionClient

Returns a client for the Actor run collection (list runs).

Source

pub fn run(&self, id: impl Into<String>) -> RunClient

Returns a client for a specific Actor run.

Source

pub fn datasets(&self) -> DatasetCollectionClient

Returns a client for the dataset collection (list & get-or-create datasets).

Source

pub fn dataset(&self, id: impl Into<String>) -> DatasetClient

Returns a client for a specific dataset, addressed by ID or name.

Source

pub fn key_value_stores(&self) -> KeyValueStoreCollectionClient

Returns a client for the key-value store collection.

Source

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.

Source

pub fn request_queues(&self) -> RequestQueueCollectionClient

Returns a client for the request queue collection.

Source

pub fn request_queue(&self, id: impl Into<String>) -> RequestQueueClient

Returns a client for a specific request queue, addressed by ID or name.

Source

pub fn tasks(&self) -> TaskCollectionClient

Returns a client for the Actor task collection (list & create tasks).

Source

pub fn task(&self, id: impl Into<String>) -> TaskClient

Returns a client for a specific Actor task.

Source

pub fn schedules(&self) -> ScheduleCollectionClient

Returns a client for the schedule collection (list & create schedules).

Source

pub fn schedule(&self, id: impl Into<String>) -> ScheduleClient

Returns a client for a specific schedule.

Source

pub fn webhooks(&self) -> WebhookCollectionClient

Returns a client for the webhook collection (list & create webhooks).

Source

pub fn webhook(&self, id: impl Into<String>) -> WebhookClient

Returns a client for a specific webhook.

Source

pub fn webhook_dispatches(&self) -> WebhookDispatchCollectionClient

Returns a client for the webhook dispatch collection.

Source

pub fn webhook_dispatch(&self, id: impl Into<String>) -> WebhookDispatchClient

Returns a client for a specific webhook dispatch.

Source

pub fn store(&self) -> StoreCollectionClient

Returns a client for browsing the Apify Store.

Source

pub fn log(&self, build_or_run_id: impl Into<String>) -> LogClient

Returns a client for accessing a build’s or run’s log.

Source

pub fn me(&self) -> UserClient

Returns a client for the current user (/users/me).

Source

pub fn user(&self, id: impl Into<String>) -> UserClient

Returns a client for a specific user by ID or username.

Source

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

Source§

fn clone(&self) -> ApifyClient

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ApifyClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more