mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-19 22:34:46 -07:00
global: fixes
This commit is contained in:
@@ -159,6 +159,14 @@ impl EndpointConfig {
|
||||
fn get_text(&self, format: Option<&str>) -> Result<String> {
|
||||
self.client.get_text(&self.build_path(format))
|
||||
}
|
||||
|
||||
fn get_len(&self) -> Result<i64> {
|
||||
self.client.get_json(&format!("/api/series/{}/{}/len", self.name, self.index.name()))
|
||||
}
|
||||
|
||||
fn get_version(&self) -> Result<Version> {
|
||||
self.client.get_json(&format!("/api/series/{}/{}/version", self.name, self.index.name()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Builder for series endpoint queries.
|
||||
@@ -252,6 +260,17 @@ impl<T: DeserializeOwned, D: DeserializeOwned> SeriesEndpoint<T, D> {
|
||||
self.config.get_text(Some("csv"))
|
||||
}
|
||||
|
||||
/// Total number of data points for this series.
|
||||
#[allow(clippy::len_without_is_empty)]
|
||||
pub fn len(&self) -> Result<i64> {
|
||||
self.config.get_len()
|
||||
}
|
||||
|
||||
/// Current version of the series.
|
||||
pub fn version(&self) -> Result<Version> {
|
||||
self.config.get_version()
|
||||
}
|
||||
|
||||
/// Get the base endpoint path.
|
||||
pub fn path(&self) -> String {
|
||||
self.config.path()
|
||||
|
||||
Reference in New Issue
Block a user