diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..76fad1a --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: cargo + directory: / + schedule: + interval: daily diff --git a/client/src/lib.rs b/client/src/lib.rs index ae5ea05..243efb9 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -54,7 +54,7 @@ use serde_json::Value; use std::{ borrow::Cow, collections::BTreeMap, - time::{SystemTime, UNIX_EPOCH}, + time::{Duration, SystemTime, UNIX_EPOCH}, }; pub mod error; @@ -335,6 +335,7 @@ pub struct BpxClientBuilder { ws_url: Option, secret: Option, headers: Option, + timeout: Option, } impl BpxClientBuilder { @@ -395,6 +396,19 @@ impl BpxClientBuilder { self } + /// Sets a custom Timeout for the underlying http client + /// If not set, a default of 30 seconds is used. + /// + /// # Arguments + /// * `timeout` - The timeout in seconds + /// + /// # Returns + /// * `Self` - The updated builder instance + pub fn timeout(mut self, timeout: u64) -> Self { + self.timeout = Some(timeout); + self + } + /// Builds the `BpxClient` instance with the configured parameters. /// /// # Returns @@ -440,6 +454,7 @@ impl BpxClientBuilder { client: reqwest::Client::builder() .user_agent(API_USER_AGENT) .default_headers(header_map) + .timeout(Duration::from_secs(self.timeout.unwrap_or(30))) .build()?, };