pub struct ApifyClientBuilder { /* private fields */ }Expand description
Builder for ApifyClient.
§Example
use apify_client::ApifyClient;
let client = ApifyClient::builder()
.token("my-api-token")
.max_retries(5)
.build();Implementations§
Source§impl ApifyClientBuilder
impl ApifyClientBuilder
Sourcepub fn token(self, token: impl Into<String>) -> Self
pub fn token(self, token: impl Into<String>) -> Self
Sets the API token used for authentication (sent as a Bearer token).
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Overrides the base URL of the API. The /v2 suffix is appended automatically.
Defaults to https://api.apify.com.
Sourcepub fn public_base_url(self, public_base_url: impl Into<String>) -> Self
pub fn public_base_url(self, public_base_url: impl Into<String>) -> Self
Overrides the base URL used when building public, shareable resource URLs (e.g. a
signed dataset-items URL). Defaults to the API base URL. The /v2 suffix is appended
automatically.
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Sets the maximum number of retries for failed requests (default 8).
Sourcepub fn min_delay_between_retries(self, delay: Duration) -> Self
pub fn min_delay_between_retries(self, delay: Duration) -> Self
Sets the minimum delay between retries (default 500ms).
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Sets the overall per-request timeout (default 360s).
Sourcepub fn user_agent_suffix(self, suffix: impl Into<String>) -> Self
pub fn user_agent_suffix(self, suffix: impl Into<String>) -> Self
Appends a custom suffix to the User-Agent header.
Sourcepub fn http_backend(self, backend: Arc<dyn HttpBackend>) -> Self
pub fn http_backend(self, backend: Arc<dyn HttpBackend>) -> Self
Replaces the default reqwest-based HTTP backend with a custom implementation.
This is the seam that makes the transport a replaceable component.
Sourcepub fn build(self) -> ApifyClient
pub fn build(self) -> ApifyClient
Builds the configured ApifyClient.