Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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
17 changes: 16 additions & 1 deletion client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -335,6 +335,7 @@ pub struct BpxClientBuilder {
ws_url: Option<String>,
secret: Option<String>,
headers: Option<BpxHeaders>,
timeout: Option<u64>,
}

impl BpxClientBuilder {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()?,
};

Expand Down
Loading