diff --git a/crates/antelope/src/api/client.rs b/crates/antelope/src/api/client.rs index 4e1574d..32609e7 100644 --- a/crates/antelope/src/api/client.rs +++ b/crates/antelope/src/api/client.rs @@ -40,15 +40,19 @@ pub struct APIClient { } impl APIClient

{ - pub fn default_provider(base_url: String) -> Result, String> { - Self::default_provider_debug(base_url, false) + pub fn default_provider( + base_url: String, + timeout: Option, + ) -> Result, String> { + Self::default_provider_debug(base_url, timeout, false) } pub fn default_provider_debug( base_url: String, + timeout: Option, debug: bool, ) -> Result, String> { - let mut provider = DefaultProvider::new(base_url).unwrap(); + let mut provider = DefaultProvider::new(base_url, timeout).unwrap(); provider.set_debug(debug); APIClient::custom_provider(provider) diff --git a/crates/antelope/src/api/default_provider.rs b/crates/antelope/src/api/default_provider.rs index 6cc4a1c..9d4a8ae 100644 --- a/crates/antelope/src/api/default_provider.rs +++ b/crates/antelope/src/api/default_provider.rs @@ -12,8 +12,13 @@ pub struct DefaultProvider { } impl DefaultProvider { - pub fn new(base_url: String) -> Result { - let client = Client::builder().build(); + pub fn new(base_url: String, timeout: Option) -> Result { + let mut client_builder = Client::builder(); + if timeout.is_some() { + client_builder = + client_builder.timeout(std::time::Duration::from_secs(timeout.unwrap())); + } + let client = client_builder.build(); if client.is_err() { let err = client.err(); let mut err_message = String::from("Error building http client"); diff --git a/crates/antelope/src/api/v1/structs.rs b/crates/antelope/src/api/v1/structs.rs index 0f5ffb8..dee7af4 100644 --- a/crates/antelope/src/api/v1/structs.rs +++ b/crates/antelope/src/api/v1/structs.rs @@ -440,6 +440,7 @@ impl GetTableRowsParams { } } +#[derive(Debug)] pub struct GetTableRowsResponse { pub rows: Vec, pub more: bool,