diff --git a/crates/brk_bindgen/src/generators/javascript/client.rs b/crates/brk_bindgen/src/generators/javascript/client.rs index b91e61695..fadf4bcb4 100644 --- a/crates/brk_bindgen/src/generators/javascript/client.rs +++ b/crates/brk_bindgen/src/generators/javascript/client.rs @@ -214,7 +214,7 @@ function _wrapSeriesData(raw) {{ /** * @template T - * @typedef {{Object}} SeriesEndpointBuilder + * @typedef {{Object}} SeriesEndpoint * @property {{(index: number) => SingleItemBuilder}} get - Get single item at index * @property {{(start?: number, end?: number) => RangeBuilder}} slice - Slice by index * @property {{(n: number) => RangeBuilder}} first - Get first n items @@ -228,7 +228,7 @@ function _wrapSeriesData(raw) {{ /** * @template T - * @typedef {{Object}} DateSeriesEndpointBuilder + * @typedef {{Object}} DateSeriesEndpoint * @property {{(index: number | globalThis.Date) => DateSingleItemBuilder}} get - Get single item at index or Date * @property {{(start?: number | globalThis.Date, end?: number | globalThis.Date) => DateRangeBuilder}} slice - Slice by index or Date * @property {{(n: number) => DateRangeBuilder}} first - Get first n items @@ -240,7 +240,7 @@ function _wrapSeriesData(raw) {{ * @property {{string}} path - The endpoint path */ -/** @typedef {{SeriesEndpointBuilder}} AnySeriesEndpointBuilder */ +/** @typedef {{SeriesEndpoint}} AnySeriesEndpoint */ /** @template T @typedef {{Object}} SingleItemBuilder * @property {{(onUpdate?: (value: SeriesData) => void) => Promise>}} fetch - Fetch the item @@ -284,9 +284,9 @@ function _wrapSeriesData(raw) {{ * @template T * @typedef {{Object}} SeriesPattern * @property {{string}} name - The series name - * @property {{Readonly>>>}} by - Index endpoints as lazy getters + * @property {{Readonly>>>}} by - Index endpoints as lazy getters * @property {{() => readonly Index[]}} indexes - Get the list of available indexes - * @property {{(index: Index) => SeriesEndpointBuilder|undefined}} get - Get an endpoint for a specific index + * @property {{(index: Index) => SeriesEndpoint|undefined}} get - Get an endpoint for a specific index */ /** @typedef {{SeriesPattern}} AnySeriesPattern */ @@ -297,7 +297,7 @@ function _wrapSeriesData(raw) {{ * @param {{BrkClientBase}} client * @param {{string}} name - The series vec name * @param {{Index}} index - The index name - * @returns {{DateSeriesEndpointBuilder}} + * @returns {{DateSeriesEndpoint}} */ function _endpoint(client, name, index) {{ const p = `/api/series/${{name}}/${{index}}`; @@ -349,7 +349,7 @@ function _endpoint(client, name, index) {{ then(resolve, reject) {{ return this.fetch().then(resolve, reject); }}, }}); - /** @type {{DateSeriesEndpointBuilder}} */ + /** @type {{DateSeriesEndpoint}} */ const endpoint = {{ get(idx) {{ if (idx instanceof Date) idx = dateToIndex(index, idx); return singleItemBuilder(idx); }}, slice(start, end) {{ @@ -615,7 +615,7 @@ function _mp(client, name, indexes) {{ by, /** @returns {{readonly Index[]}} */ indexes() {{ return indexes; }}, - /** @param {{Index}} index @returns {{SeriesEndpointBuilder|undefined}} */ + /** @param {{Index}} index @returns {{SeriesEndpoint|undefined}} */ get(index) {{ return indexes.includes(index) ? _endpoint(client, name, index) : undefined; }} }}; }} @@ -631,9 +631,9 @@ function _mp(client, name, indexes) {{ .iter() .map(|idx| { let builder = if idx.is_date_based() { - "DateSeriesEndpointBuilder" + "DateSeriesEndpoint" } else { - "SeriesEndpointBuilder" + "SeriesEndpoint" }; format!("readonly {}: {}", idx.name(), builder) }) @@ -642,7 +642,7 @@ function _mp(client, name, indexes) {{ writeln!( output, - "/** @template T @typedef {{{{ name: string, by: {}, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }}}} {} */", + "/** @template T @typedef {{{{ name: string, by: {}, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }}}} {} */", by_type, pattern.name ) .unwrap(); diff --git a/crates/brk_bindgen/src/generators/javascript/tree.rs b/crates/brk_bindgen/src/generators/javascript/tree.rs index 1a50dd582..b94b39da8 100644 --- a/crates/brk_bindgen/src/generators/javascript/tree.rs +++ b/crates/brk_bindgen/src/generators/javascript/tree.rs @@ -152,7 +152,7 @@ pub fn generate_main_client( writeln!(output, " *").unwrap(); writeln!(output, " * @param {{string}} series - The series name").unwrap(); writeln!(output, " * @param {{Index}} index - The index name").unwrap(); - writeln!(output, " * @returns {{SeriesEndpointBuilder}}").unwrap(); + writeln!(output, " * @returns {{SeriesEndpoint}}").unwrap(); writeln!(output, " */").unwrap(); writeln!(output, " seriesEndpoint(series, index) {{").unwrap(); writeln!(output, " return _endpoint(this, series, index);").unwrap(); diff --git a/crates/brk_bindgen/src/generators/python/api.rs b/crates/brk_bindgen/src/generators/python/api.rs index 7ed8426b7..db0137c62 100644 --- a/crates/brk_bindgen/src/generators/python/api.rs +++ b/crates/brk_bindgen/src/generators/python/api.rs @@ -36,7 +36,7 @@ pub fn generate_main_client(output: &mut String, endpoints: &[Endpoint]) { // Generate series_endpoint() method for dynamic series access writeln!( output, - " def series_endpoint(self, series: str, index: Index) -> SeriesEndpointBuilder[Any]:" + " def series_endpoint(self, series: str, index: Index) -> SeriesEndpoint[Any]:" ) .unwrap(); writeln!( @@ -58,7 +58,7 @@ pub fn generate_main_client(output: &mut String, endpoints: &[Endpoint]) { writeln!(output, " \"\"\"").unwrap(); writeln!( output, - " return SeriesEndpointBuilder(self, series, index)" + " return SeriesEndpoint(self, series, index)" ) .unwrap(); writeln!(output).unwrap(); diff --git a/crates/brk_bindgen/src/generators/python/client.rs b/crates/brk_bindgen/src/generators/python/client.rs index a5da7cebd..3721aa9e3 100644 --- a/crates/brk_bindgen/src/generators/python/client.rs +++ b/crates/brk_bindgen/src/generators/python/client.rs @@ -127,7 +127,7 @@ def _p(prefix: str, acc: str) -> str: .unwrap(); } -/// Generate the SeriesData and SeriesEndpointBuilder classes +/// Generate the SeriesData and SeriesEndpoint classes pub fn generate_endpoint_class(output: &mut String) { writeln!( output, @@ -439,7 +439,7 @@ class DateSkippedBuilder(SkippedBuilder[T]): return self._config.get_date_series() -class SeriesEndpointBuilder(Generic[T]): +class SeriesEndpoint(Generic[T]): """Builder for series endpoint queries with int-based indexing. Examples: @@ -489,7 +489,7 @@ class SeriesEndpointBuilder(Generic[T]): return self._config.path() -class DateSeriesEndpointBuilder(Generic[T]): +class DateSeriesEndpoint(Generic[T]): """Builder for series endpoint queries with date-based indexing. Accepts dates in __getitem__ and returns DateSeriesData from fetch(). @@ -553,8 +553,8 @@ class DateSeriesEndpointBuilder(Generic[T]): # Type aliases for non-generic usage -AnySeriesEndpointBuilder = SeriesEndpointBuilder[Any] -AnyDateSeriesEndpointBuilder = DateSeriesEndpointBuilder[Any] +AnySeriesEndpoint = SeriesEndpoint[Any] +AnyDateSeriesEndpoint = DateSeriesEndpoint[Any] class SeriesPattern(Protocol[T]): @@ -569,7 +569,7 @@ class SeriesPattern(Protocol[T]): """Get the list of available indexes for this series.""" ... - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: """Get an endpoint builder for a specific index, if supported.""" ... @@ -605,11 +605,11 @@ pub fn generate_index_accessors(output: &mut String, patterns: &[IndexSetPattern // Generate helper functions writeln!( output, - r#"def _ep(c: BrkClientBase, n: str, i: Index) -> SeriesEndpointBuilder[Any]: - return SeriesEndpointBuilder(c, n, i) + r#"def _ep(c: BrkClientBase, n: str, i: Index) -> SeriesEndpoint[Any]: + return SeriesEndpoint(c, n, i) -def _dep(c: BrkClientBase, n: str, i: Index) -> DateSeriesEndpointBuilder[Any]: - return DateSeriesEndpointBuilder(c, n, i) +def _dep(c: BrkClientBase, n: str, i: Index) -> DateSeriesEndpoint[Any]: + return DateSeriesEndpoint(c, n, i) "# ) .unwrap(); @@ -631,9 +631,9 @@ def _dep(c: BrkClientBase, n: str, i: Index) -> DateSeriesEndpointBuilder[Any]: let method_name = index_to_field_name(index); let index_name = index.name(); let (builder_type, helper) = if index.is_date_based() { - ("DateSeriesEndpointBuilder", "_dep") + ("DateSeriesEndpoint", "_dep") } else { - ("SeriesEndpointBuilder", "_ep") + ("SeriesEndpoint", "_ep") }; writeln!( output, @@ -663,7 +663,7 @@ def _dep(c: BrkClientBase, n: str, i: Index) -> DateSeriesEndpointBuilder[Any]: .unwrap(); writeln!( output, - " def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in {} else None", + " def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in {} else None", idx_var ) .unwrap(); diff --git a/crates/brk_bindgen/src/generators/rust/api.rs b/crates/brk_bindgen/src/generators/rust/api.rs index fb8a6b5fb..dfb9f3a2d 100644 --- a/crates/brk_bindgen/src/generators/rust/api.rs +++ b/crates/brk_bindgen/src/generators/rust/api.rs @@ -50,8 +50,8 @@ impl BrkClient {{ /// .last(10) /// .json::()?; /// ``` - pub fn series_endpoint(&self, series: impl Into, index: Index) -> SeriesEndpointBuilder {{ - SeriesEndpointBuilder::new( + pub fn series_endpoint(&self, series: impl Into, index: Index) -> SeriesEndpoint {{ + SeriesEndpoint::new( self.base.clone(), Arc::from(series.into().as_str()), index, @@ -61,11 +61,11 @@ impl BrkClient {{ /// Create a dynamic date-based series endpoint builder. /// /// Returns `Err` if the index is not date-based. - pub fn date_series_endpoint(&self, series: impl Into, index: Index) -> Result> {{ + pub fn date_series_endpoint(&self, series: impl Into, index: Index) -> Result> {{ if !index.is_date_based() {{ return Err(BrkError {{ message: format!("{{}} is not a date-based index", index.name()) }}); }} - Ok(DateSeriesEndpointBuilder::new( + Ok(DateSeriesEndpoint::new( self.base.clone(), Arc::from(series.into().as_str()), index, @@ -217,7 +217,7 @@ fn param_type_to_rust(param_type: &str) -> String { "string" | "*" => "&str".to_string(), "integer" | "number" => "i64".to_string(), "boolean" => "bool".to_string(), - other => other.to_string(), // Domain types like Index, Series, Format + other => other.to_string(), // Domain types like Index, SeriesName, Format } } diff --git a/crates/brk_bindgen/src/generators/rust/client.rs b/crates/brk_bindgen/src/generators/rust/client.rs index 6c2ab0122..72c72dac7 100644 --- a/crates/brk_bindgen/src/generators/rust/client.rs +++ b/crates/brk_bindgen/src/generators/rust/client.rs @@ -140,7 +140,7 @@ pub trait AnySeriesPattern {{ /// Generic trait for series patterns with endpoint access. pub trait SeriesPattern: AnySeriesPattern {{ /// Get an endpoint builder for a specific index, if supported. - fn get(&self, index: Index) -> Option>; + fn get(&self, index: Index) -> Option>; }} "# @@ -148,7 +148,7 @@ pub trait SeriesPattern: AnySeriesPattern {{ .unwrap(); } -/// Generate the SeriesEndpointBuilder structs with typestate pattern. +/// Generate the SeriesEndpoint structs with typestate pattern. pub fn generate_endpoint(output: &mut String) { writeln!( output, @@ -192,7 +192,7 @@ impl EndpointConfig {{ /// Builder for series endpoint queries. /// /// Parameterized by element type `T` and response type `D` (defaults to `SeriesData`). -/// For date-based indexes, use `DateSeriesEndpointBuilder` which sets `D = DateSeriesData`. +/// For date-based indexes, use `DateSeriesEndpoint` which sets `D = DateSeriesData`. /// /// # Examples /// ```ignore @@ -204,18 +204,18 @@ impl EndpointConfig {{ /// let data = endpoint.last(10).fetch()?; // last 10 /// let data = endpoint.skip(100).take(10).fetch()?; // iterator-style /// ``` -pub struct SeriesEndpointBuilder> {{ +pub struct SeriesEndpoint> {{ config: EndpointConfig, _marker: std::marker::PhantomData (T, D)>, }} /// Builder for date-based series endpoint queries. /// -/// Like `SeriesEndpointBuilder` but returns `DateSeriesData` and provides +/// Like `SeriesEndpoint` but returns `DateSeriesData` and provides /// date-based access methods (`get_date`, `date_range`). -pub type DateSeriesEndpointBuilder = SeriesEndpointBuilder>; +pub type DateSeriesEndpoint = SeriesEndpoint>; -impl SeriesEndpointBuilder {{ +impl SeriesEndpoint {{ pub fn new(client: Arc, name: Arc, index: Index) -> Self {{ Self {{ config: EndpointConfig::new(client, name, index), _marker: std::marker::PhantomData }} }} @@ -286,8 +286,8 @@ impl SeriesEndpointBuilder {{ }} }} -/// Date-specific methods available only on `DateSeriesEndpointBuilder`. -impl SeriesEndpointBuilder> {{ +/// Date-specific methods available only on `DateSeriesEndpoint`. +impl SeriesEndpoint> {{ /// Select a specific date position (for day-precision or coarser indexes). pub fn get_date(self, date: Date) -> SingleItemBuilder> {{ let index = self.config.index.date_to_index(date).unwrap_or(0); @@ -414,13 +414,13 @@ pub fn generate_index_accessors(output: &mut String, patterns: &[IndexSetPattern writeln!( output, r#"#[inline] -fn _ep(c: &Arc, n: &Arc, i: Index) -> SeriesEndpointBuilder {{ - SeriesEndpointBuilder::new(c.clone(), n.clone(), i) +fn _ep(c: &Arc, n: &Arc, i: Index) -> SeriesEndpoint {{ + SeriesEndpoint::new(c.clone(), n.clone(), i) }} #[inline] -fn _dep(c: &Arc, n: &Arc, i: Index) -> DateSeriesEndpointBuilder {{ - DateSeriesEndpointBuilder::new(c.clone(), n.clone(), i) +fn _dep(c: &Arc, n: &Arc, i: Index) -> DateSeriesEndpoint {{ + DateSeriesEndpoint::new(c.clone(), n.clone(), i) }} "# ) @@ -441,14 +441,14 @@ fn _dep(c: &Arc, n: &Arc, i: Index) -> if index.is_date_based() { writeln!( output, - " pub fn {}(&self) -> DateSeriesEndpointBuilder {{ _dep(&self.client, &self.name, Index::{}) }}", + " pub fn {}(&self) -> DateSeriesEndpoint {{ _dep(&self.client, &self.name, Index::{}) }}", method_name, index ) .unwrap(); } else { writeln!( output, - " pub fn {}(&self) -> SeriesEndpointBuilder {{ _ep(&self.client, &self.name, Index::{}) }}", + " pub fn {}(&self) -> SeriesEndpoint {{ _ep(&self.client, &self.name, Index::{}) }}", method_name, index ) .unwrap(); @@ -484,7 +484,7 @@ fn _dep(c: &Arc, n: &Arc, i: Index) -> // Implement SeriesPattern trait writeln!( output, - "impl SeriesPattern for {} {{ fn get(&self, index: Index) -> Option> {{ {}.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) }} }}\n", + "impl SeriesPattern for {} {{ fn get(&self, index: Index) -> Option> {{ {}.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) }} }}\n", pattern.name, idx_const ) .unwrap(); diff --git a/crates/brk_client/examples/basic.rs b/crates/brk_client/examples/basic.rs index 343b34828..eb584bc99 100644 --- a/crates/brk_client/examples/basic.rs +++ b/crates/brk_client/examples/basic.rs @@ -1,7 +1,7 @@ //! Basic example of using the BRK client. use brk_client::{BrkClient, BrkClientOptions}; -use brk_types::{FormatResponse, Index, Metric, RangeIndex}; +use brk_types::{FormatResponse, Index, RangeIndex}; fn main() -> brk_client::Result<()> { // Create client with default options @@ -16,7 +16,7 @@ fn main() -> brk_client::Result<()> { // Fetch price data using the typed metrics API // day1() returns DateMetricEndpointBuilder, so fetch() returns DateMetricData let price_close = client - .metrics() + .series() .prices .split .close @@ -37,7 +37,7 @@ fn main() -> brk_client::Result<()> { // Fetch block data with height index (non-date, returns MetricData) let block_count = client - .metrics() + .series() .blocks .count .total @@ -53,9 +53,9 @@ fn main() -> brk_client::Result<()> { } // Fetch supply data as CSV - dbg!(client.metrics().supply.circulating.btc.by.day1().path()); + dbg!(client.series().supply.circulating.btc.by.day1().path()); let circulating = client - .metrics() + .series() .supply .circulating .btc @@ -67,7 +67,7 @@ fn main() -> brk_client::Result<()> { // Using dynamic metric fetching with date_metric() for date-based indexes let date_metric = client - .date_metric(Metric::from("price_close"), Index::Day1)? + .date_series_endpoint("price_close", Index::Day1)? .last(3) .fetch()?; println!("Dynamic date metric fetch:"); @@ -76,8 +76,8 @@ fn main() -> brk_client::Result<()> { } // Using generic metric fetching (returns FormatResponse) - let metricdata = client.get_metric( - Metric::from("price_close"), + let metricdata = client.get_series( + "price_close".into(), Index::Day1, Some(RangeIndex::Int(-3)), None, diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index 390f9935e..b5fc11e4b 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -120,7 +120,7 @@ pub trait AnySeriesPattern { /// Generic trait for series patterns with endpoint access. pub trait SeriesPattern: AnySeriesPattern { /// Get an endpoint builder for a specific index, if supported. - fn get(&self, index: Index) -> Option>; + fn get(&self, index: Index) -> Option>; } @@ -164,7 +164,7 @@ impl EndpointConfig { /// Builder for series endpoint queries. /// /// Parameterized by element type `T` and response type `D` (defaults to `SeriesData`). -/// For date-based indexes, use `DateSeriesEndpointBuilder` which sets `D = DateSeriesData`. +/// For date-based indexes, use `DateSeriesEndpoint` which sets `D = DateSeriesData`. /// /// # Examples /// ```ignore @@ -176,18 +176,18 @@ impl EndpointConfig { /// let data = endpoint.last(10).fetch()?; // last 10 /// let data = endpoint.skip(100).take(10).fetch()?; // iterator-style /// ``` -pub struct SeriesEndpointBuilder> { +pub struct SeriesEndpoint> { config: EndpointConfig, _marker: std::marker::PhantomData (T, D)>, } /// Builder for date-based series endpoint queries. /// -/// Like `SeriesEndpointBuilder` but returns `DateSeriesData` and provides +/// Like `SeriesEndpoint` but returns `DateSeriesData` and provides /// date-based access methods (`get_date`, `date_range`). -pub type DateSeriesEndpointBuilder = SeriesEndpointBuilder>; +pub type DateSeriesEndpoint = SeriesEndpoint>; -impl SeriesEndpointBuilder { +impl SeriesEndpoint { pub fn new(client: Arc, name: Arc, index: Index) -> Self { Self { config: EndpointConfig::new(client, name, index), _marker: std::marker::PhantomData } } @@ -258,8 +258,8 @@ impl SeriesEndpointBuilder { } } -/// Date-specific methods available only on `DateSeriesEndpointBuilder`. -impl SeriesEndpointBuilder> { +/// Date-specific methods available only on `DateSeriesEndpoint`. +impl SeriesEndpoint> { /// Select a specific date position (for day-precision or coarser indexes). pub fn get_date(self, date: Date) -> SingleItemBuilder> { let index = self.config.index.date_to_index(date).unwrap_or(0); @@ -396,35 +396,35 @@ const _I34: &[Index] = &[Index::FundedAddressIndex]; const _I35: &[Index] = &[Index::EmptyAddressIndex]; #[inline] -fn _ep(c: &Arc, n: &Arc, i: Index) -> SeriesEndpointBuilder { - SeriesEndpointBuilder::new(c.clone(), n.clone(), i) +fn _ep(c: &Arc, n: &Arc, i: Index) -> SeriesEndpoint { + SeriesEndpoint::new(c.clone(), n.clone(), i) } #[inline] -fn _dep(c: &Arc, n: &Arc, i: Index) -> DateSeriesEndpointBuilder { - DateSeriesEndpointBuilder::new(c.clone(), n.clone(), i) +fn _dep(c: &Arc, n: &Arc, i: Index) -> DateSeriesEndpoint { + DateSeriesEndpoint::new(c.clone(), n.clone(), i) } // Index accessor structs pub struct SeriesPattern1By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern1By { - pub fn minute10(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Minute10) } - pub fn minute30(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Minute30) } - pub fn hour1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour1) } - pub fn hour4(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour4) } - pub fn hour12(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour12) } - pub fn day1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Day1) } - pub fn day3(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Day3) } - pub fn week1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Week1) } - pub fn month1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month1) } - pub fn month3(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month3) } - pub fn month6(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month6) } - pub fn year1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Year1) } - pub fn year10(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Year10) } - pub fn halving(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::Halving) } - pub fn epoch(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::Epoch) } - pub fn height(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::Height) } + pub fn minute10(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Minute10) } + pub fn minute30(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Minute30) } + pub fn hour1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour1) } + pub fn hour4(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour4) } + pub fn hour12(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour12) } + pub fn day1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Day1) } + pub fn day3(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Day3) } + pub fn week1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Week1) } + pub fn month1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month1) } + pub fn month3(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month3) } + pub fn month6(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month6) } + pub fn year1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Year1) } + pub fn year10(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Year10) } + pub fn halving(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::Halving) } + pub fn epoch(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::Epoch) } + pub fn height(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::Height) } } pub struct SeriesPattern1 { name: Arc, pub by: SeriesPattern1By } @@ -434,25 +434,25 @@ impl SeriesPattern1 { } impl AnySeriesPattern for SeriesPattern1 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I1 } } -impl SeriesPattern for SeriesPattern1 { fn get(&self, index: Index) -> Option> { _I1.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern1 { fn get(&self, index: Index) -> Option> { _I1.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern2By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern2By { - pub fn minute10(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Minute10) } - pub fn minute30(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Minute30) } - pub fn hour1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour1) } - pub fn hour4(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour4) } - pub fn hour12(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour12) } - pub fn day1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Day1) } - pub fn day3(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Day3) } - pub fn week1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Week1) } - pub fn month1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month1) } - pub fn month3(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month3) } - pub fn month6(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month6) } - pub fn year1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Year1) } - pub fn year10(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Year10) } - pub fn halving(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::Halving) } - pub fn epoch(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::Epoch) } + pub fn minute10(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Minute10) } + pub fn minute30(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Minute30) } + pub fn hour1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour1) } + pub fn hour4(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour4) } + pub fn hour12(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour12) } + pub fn day1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Day1) } + pub fn day3(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Day3) } + pub fn week1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Week1) } + pub fn month1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month1) } + pub fn month3(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month3) } + pub fn month6(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month6) } + pub fn year1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Year1) } + pub fn year10(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Year10) } + pub fn halving(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::Halving) } + pub fn epoch(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::Epoch) } } pub struct SeriesPattern2 { name: Arc, pub by: SeriesPattern2By } @@ -462,11 +462,11 @@ impl SeriesPattern2 { } impl AnySeriesPattern for SeriesPattern2 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I2 } } -impl SeriesPattern for SeriesPattern2 { fn get(&self, index: Index) -> Option> { _I2.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern2 { fn get(&self, index: Index) -> Option> { _I2.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern3By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern3By { - pub fn minute10(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Minute10) } + pub fn minute10(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Minute10) } } pub struct SeriesPattern3 { name: Arc, pub by: SeriesPattern3By } @@ -476,11 +476,11 @@ impl SeriesPattern3 { } impl AnySeriesPattern for SeriesPattern3 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I3 } } -impl SeriesPattern for SeriesPattern3 { fn get(&self, index: Index) -> Option> { _I3.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern3 { fn get(&self, index: Index) -> Option> { _I3.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern4By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern4By { - pub fn minute30(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Minute30) } + pub fn minute30(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Minute30) } } pub struct SeriesPattern4 { name: Arc, pub by: SeriesPattern4By } @@ -490,11 +490,11 @@ impl SeriesPattern4 { } impl AnySeriesPattern for SeriesPattern4 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I4 } } -impl SeriesPattern for SeriesPattern4 { fn get(&self, index: Index) -> Option> { _I4.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern4 { fn get(&self, index: Index) -> Option> { _I4.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern5By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern5By { - pub fn hour1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour1) } + pub fn hour1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour1) } } pub struct SeriesPattern5 { name: Arc, pub by: SeriesPattern5By } @@ -504,11 +504,11 @@ impl SeriesPattern5 { } impl AnySeriesPattern for SeriesPattern5 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I5 } } -impl SeriesPattern for SeriesPattern5 { fn get(&self, index: Index) -> Option> { _I5.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern5 { fn get(&self, index: Index) -> Option> { _I5.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern6By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern6By { - pub fn hour4(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour4) } + pub fn hour4(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour4) } } pub struct SeriesPattern6 { name: Arc, pub by: SeriesPattern6By } @@ -518,11 +518,11 @@ impl SeriesPattern6 { } impl AnySeriesPattern for SeriesPattern6 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I6 } } -impl SeriesPattern for SeriesPattern6 { fn get(&self, index: Index) -> Option> { _I6.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern6 { fn get(&self, index: Index) -> Option> { _I6.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern7By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern7By { - pub fn hour12(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Hour12) } + pub fn hour12(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Hour12) } } pub struct SeriesPattern7 { name: Arc, pub by: SeriesPattern7By } @@ -532,11 +532,11 @@ impl SeriesPattern7 { } impl AnySeriesPattern for SeriesPattern7 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I7 } } -impl SeriesPattern for SeriesPattern7 { fn get(&self, index: Index) -> Option> { _I7.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern7 { fn get(&self, index: Index) -> Option> { _I7.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern8By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern8By { - pub fn day1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Day1) } + pub fn day1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Day1) } } pub struct SeriesPattern8 { name: Arc, pub by: SeriesPattern8By } @@ -546,11 +546,11 @@ impl SeriesPattern8 { } impl AnySeriesPattern for SeriesPattern8 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I8 } } -impl SeriesPattern for SeriesPattern8 { fn get(&self, index: Index) -> Option> { _I8.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern8 { fn get(&self, index: Index) -> Option> { _I8.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern9By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern9By { - pub fn day3(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Day3) } + pub fn day3(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Day3) } } pub struct SeriesPattern9 { name: Arc, pub by: SeriesPattern9By } @@ -560,11 +560,11 @@ impl SeriesPattern9 { } impl AnySeriesPattern for SeriesPattern9 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I9 } } -impl SeriesPattern for SeriesPattern9 { fn get(&self, index: Index) -> Option> { _I9.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern9 { fn get(&self, index: Index) -> Option> { _I9.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern10By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern10By { - pub fn week1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Week1) } + pub fn week1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Week1) } } pub struct SeriesPattern10 { name: Arc, pub by: SeriesPattern10By } @@ -574,11 +574,11 @@ impl SeriesPattern10 { } impl AnySeriesPattern for SeriesPattern10 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I10 } } -impl SeriesPattern for SeriesPattern10 { fn get(&self, index: Index) -> Option> { _I10.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern10 { fn get(&self, index: Index) -> Option> { _I10.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern11By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern11By { - pub fn month1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month1) } + pub fn month1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month1) } } pub struct SeriesPattern11 { name: Arc, pub by: SeriesPattern11By } @@ -588,11 +588,11 @@ impl SeriesPattern11 { } impl AnySeriesPattern for SeriesPattern11 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I11 } } -impl SeriesPattern for SeriesPattern11 { fn get(&self, index: Index) -> Option> { _I11.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern11 { fn get(&self, index: Index) -> Option> { _I11.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern12By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern12By { - pub fn month3(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month3) } + pub fn month3(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month3) } } pub struct SeriesPattern12 { name: Arc, pub by: SeriesPattern12By } @@ -602,11 +602,11 @@ impl SeriesPattern12 { } impl AnySeriesPattern for SeriesPattern12 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I12 } } -impl SeriesPattern for SeriesPattern12 { fn get(&self, index: Index) -> Option> { _I12.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern12 { fn get(&self, index: Index) -> Option> { _I12.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern13By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern13By { - pub fn month6(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Month6) } + pub fn month6(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Month6) } } pub struct SeriesPattern13 { name: Arc, pub by: SeriesPattern13By } @@ -616,11 +616,11 @@ impl SeriesPattern13 { } impl AnySeriesPattern for SeriesPattern13 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I13 } } -impl SeriesPattern for SeriesPattern13 { fn get(&self, index: Index) -> Option> { _I13.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern13 { fn get(&self, index: Index) -> Option> { _I13.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern14By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern14By { - pub fn year1(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Year1) } + pub fn year1(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Year1) } } pub struct SeriesPattern14 { name: Arc, pub by: SeriesPattern14By } @@ -630,11 +630,11 @@ impl SeriesPattern14 { } impl AnySeriesPattern for SeriesPattern14 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I14 } } -impl SeriesPattern for SeriesPattern14 { fn get(&self, index: Index) -> Option> { _I14.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern14 { fn get(&self, index: Index) -> Option> { _I14.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern15By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern15By { - pub fn year10(&self) -> DateSeriesEndpointBuilder { _dep(&self.client, &self.name, Index::Year10) } + pub fn year10(&self) -> DateSeriesEndpoint { _dep(&self.client, &self.name, Index::Year10) } } pub struct SeriesPattern15 { name: Arc, pub by: SeriesPattern15By } @@ -644,11 +644,11 @@ impl SeriesPattern15 { } impl AnySeriesPattern for SeriesPattern15 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I15 } } -impl SeriesPattern for SeriesPattern15 { fn get(&self, index: Index) -> Option> { _I15.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern15 { fn get(&self, index: Index) -> Option> { _I15.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern16By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern16By { - pub fn halving(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::Halving) } + pub fn halving(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::Halving) } } pub struct SeriesPattern16 { name: Arc, pub by: SeriesPattern16By } @@ -658,11 +658,11 @@ impl SeriesPattern16 { } impl AnySeriesPattern for SeriesPattern16 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I16 } } -impl SeriesPattern for SeriesPattern16 { fn get(&self, index: Index) -> Option> { _I16.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern16 { fn get(&self, index: Index) -> Option> { _I16.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern17By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern17By { - pub fn epoch(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::Epoch) } + pub fn epoch(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::Epoch) } } pub struct SeriesPattern17 { name: Arc, pub by: SeriesPattern17By } @@ -672,11 +672,11 @@ impl SeriesPattern17 { } impl AnySeriesPattern for SeriesPattern17 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I17 } } -impl SeriesPattern for SeriesPattern17 { fn get(&self, index: Index) -> Option> { _I17.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern17 { fn get(&self, index: Index) -> Option> { _I17.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern18By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern18By { - pub fn height(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::Height) } + pub fn height(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::Height) } } pub struct SeriesPattern18 { name: Arc, pub by: SeriesPattern18By } @@ -686,11 +686,11 @@ impl SeriesPattern18 { } impl AnySeriesPattern for SeriesPattern18 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I18 } } -impl SeriesPattern for SeriesPattern18 { fn get(&self, index: Index) -> Option> { _I18.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern18 { fn get(&self, index: Index) -> Option> { _I18.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern19By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern19By { - pub fn tx_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::TxIndex) } + pub fn tx_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::TxIndex) } } pub struct SeriesPattern19 { name: Arc, pub by: SeriesPattern19By } @@ -700,11 +700,11 @@ impl SeriesPattern19 { } impl AnySeriesPattern for SeriesPattern19 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I19 } } -impl SeriesPattern for SeriesPattern19 { fn get(&self, index: Index) -> Option> { _I19.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern19 { fn get(&self, index: Index) -> Option> { _I19.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern20By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern20By { - pub fn txin_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::TxInIndex) } + pub fn txin_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::TxInIndex) } } pub struct SeriesPattern20 { name: Arc, pub by: SeriesPattern20By } @@ -714,11 +714,11 @@ impl SeriesPattern20 { } impl AnySeriesPattern for SeriesPattern20 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I20 } } -impl SeriesPattern for SeriesPattern20 { fn get(&self, index: Index) -> Option> { _I20.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern20 { fn get(&self, index: Index) -> Option> { _I20.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern21By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern21By { - pub fn txout_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::TxOutIndex) } + pub fn txout_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::TxOutIndex) } } pub struct SeriesPattern21 { name: Arc, pub by: SeriesPattern21By } @@ -728,11 +728,11 @@ impl SeriesPattern21 { } impl AnySeriesPattern for SeriesPattern21 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I21 } } -impl SeriesPattern for SeriesPattern21 { fn get(&self, index: Index) -> Option> { _I21.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern21 { fn get(&self, index: Index) -> Option> { _I21.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern22By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern22By { - pub fn empty_output_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyOutputIndex) } + pub fn empty_output_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::EmptyOutputIndex) } } pub struct SeriesPattern22 { name: Arc, pub by: SeriesPattern22By } @@ -742,11 +742,11 @@ impl SeriesPattern22 { } impl AnySeriesPattern for SeriesPattern22 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I22 } } -impl SeriesPattern for SeriesPattern22 { fn get(&self, index: Index) -> Option> { _I22.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern22 { fn get(&self, index: Index) -> Option> { _I22.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern23By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern23By { - pub fn op_return_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::OpReturnIndex) } + pub fn op_return_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::OpReturnIndex) } } pub struct SeriesPattern23 { name: Arc, pub by: SeriesPattern23By } @@ -756,11 +756,11 @@ impl SeriesPattern23 { } impl AnySeriesPattern for SeriesPattern23 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I23 } } -impl SeriesPattern for SeriesPattern23 { fn get(&self, index: Index) -> Option> { _I23.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern23 { fn get(&self, index: Index) -> Option> { _I23.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern24By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern24By { - pub fn p2a_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2AAddressIndex) } + pub fn p2a_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2AAddressIndex) } } pub struct SeriesPattern24 { name: Arc, pub by: SeriesPattern24By } @@ -770,11 +770,11 @@ impl SeriesPattern24 { } impl AnySeriesPattern for SeriesPattern24 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I24 } } -impl SeriesPattern for SeriesPattern24 { fn get(&self, index: Index) -> Option> { _I24.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern24 { fn get(&self, index: Index) -> Option> { _I24.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern25By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern25By { - pub fn p2ms_output_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2MSOutputIndex) } + pub fn p2ms_output_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2MSOutputIndex) } } pub struct SeriesPattern25 { name: Arc, pub by: SeriesPattern25By } @@ -784,11 +784,11 @@ impl SeriesPattern25 { } impl AnySeriesPattern for SeriesPattern25 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I25 } } -impl SeriesPattern for SeriesPattern25 { fn get(&self, index: Index) -> Option> { _I25.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern25 { fn get(&self, index: Index) -> Option> { _I25.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern26By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern26By { - pub fn p2pk33_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK33AddressIndex) } + pub fn p2pk33_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2PK33AddressIndex) } } pub struct SeriesPattern26 { name: Arc, pub by: SeriesPattern26By } @@ -798,11 +798,11 @@ impl SeriesPattern26 { } impl AnySeriesPattern for SeriesPattern26 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I26 } } -impl SeriesPattern for SeriesPattern26 { fn get(&self, index: Index) -> Option> { _I26.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern26 { fn get(&self, index: Index) -> Option> { _I26.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern27By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern27By { - pub fn p2pk65_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK65AddressIndex) } + pub fn p2pk65_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2PK65AddressIndex) } } pub struct SeriesPattern27 { name: Arc, pub by: SeriesPattern27By } @@ -812,11 +812,11 @@ impl SeriesPattern27 { } impl AnySeriesPattern for SeriesPattern27 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I27 } } -impl SeriesPattern for SeriesPattern27 { fn get(&self, index: Index) -> Option> { _I27.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern27 { fn get(&self, index: Index) -> Option> { _I27.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern28By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern28By { - pub fn p2pkh_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2PKHAddressIndex) } + pub fn p2pkh_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2PKHAddressIndex) } } pub struct SeriesPattern28 { name: Arc, pub by: SeriesPattern28By } @@ -826,11 +826,11 @@ impl SeriesPattern28 { } impl AnySeriesPattern for SeriesPattern28 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I28 } } -impl SeriesPattern for SeriesPattern28 { fn get(&self, index: Index) -> Option> { _I28.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern28 { fn get(&self, index: Index) -> Option> { _I28.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern29By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern29By { - pub fn p2sh_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2SHAddressIndex) } + pub fn p2sh_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2SHAddressIndex) } } pub struct SeriesPattern29 { name: Arc, pub by: SeriesPattern29By } @@ -840,11 +840,11 @@ impl SeriesPattern29 { } impl AnySeriesPattern for SeriesPattern29 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I29 } } -impl SeriesPattern for SeriesPattern29 { fn get(&self, index: Index) -> Option> { _I29.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern29 { fn get(&self, index: Index) -> Option> { _I29.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern30By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern30By { - pub fn p2tr_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2TRAddressIndex) } + pub fn p2tr_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2TRAddressIndex) } } pub struct SeriesPattern30 { name: Arc, pub by: SeriesPattern30By } @@ -854,11 +854,11 @@ impl SeriesPattern30 { } impl AnySeriesPattern for SeriesPattern30 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I30 } } -impl SeriesPattern for SeriesPattern30 { fn get(&self, index: Index) -> Option> { _I30.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern30 { fn get(&self, index: Index) -> Option> { _I30.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern31By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern31By { - pub fn p2wpkh_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2WPKHAddressIndex) } + pub fn p2wpkh_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2WPKHAddressIndex) } } pub struct SeriesPattern31 { name: Arc, pub by: SeriesPattern31By } @@ -868,11 +868,11 @@ impl SeriesPattern31 { } impl AnySeriesPattern for SeriesPattern31 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I31 } } -impl SeriesPattern for SeriesPattern31 { fn get(&self, index: Index) -> Option> { _I31.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern31 { fn get(&self, index: Index) -> Option> { _I31.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern32By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern32By { - pub fn p2wsh_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::P2WSHAddressIndex) } + pub fn p2wsh_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::P2WSHAddressIndex) } } pub struct SeriesPattern32 { name: Arc, pub by: SeriesPattern32By } @@ -882,11 +882,11 @@ impl SeriesPattern32 { } impl AnySeriesPattern for SeriesPattern32 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I32 } } -impl SeriesPattern for SeriesPattern32 { fn get(&self, index: Index) -> Option> { _I32.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern32 { fn get(&self, index: Index) -> Option> { _I32.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern33By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern33By { - pub fn unknown_output_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::UnknownOutputIndex) } + pub fn unknown_output_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::UnknownOutputIndex) } } pub struct SeriesPattern33 { name: Arc, pub by: SeriesPattern33By } @@ -896,11 +896,11 @@ impl SeriesPattern33 { } impl AnySeriesPattern for SeriesPattern33 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I33 } } -impl SeriesPattern for SeriesPattern33 { fn get(&self, index: Index) -> Option> { _I33.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern33 { fn get(&self, index: Index) -> Option> { _I33.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern34By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern34By { - pub fn funded_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::FundedAddressIndex) } + pub fn funded_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::FundedAddressIndex) } } pub struct SeriesPattern34 { name: Arc, pub by: SeriesPattern34By } @@ -910,11 +910,11 @@ impl SeriesPattern34 { } impl AnySeriesPattern for SeriesPattern34 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I34 } } -impl SeriesPattern for SeriesPattern34 { fn get(&self, index: Index) -> Option> { _I34.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern34 { fn get(&self, index: Index) -> Option> { _I34.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } pub struct SeriesPattern35By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl SeriesPattern35By { - pub fn empty_address_index(&self) -> SeriesEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyAddressIndex) } + pub fn empty_address_index(&self) -> SeriesEndpoint { _ep(&self.client, &self.name, Index::EmptyAddressIndex) } } pub struct SeriesPattern35 { name: Arc, pub by: SeriesPattern35By } @@ -924,7 +924,7 @@ impl SeriesPattern35 { } impl AnySeriesPattern for SeriesPattern35 { fn name(&self) -> &str { &self.name } fn indexes(&self) -> &'static [Index] { _I35 } } -impl SeriesPattern for SeriesPattern35 { fn get(&self, index: Index) -> Option> { _I35.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } +impl SeriesPattern for SeriesPattern35 { fn get(&self, index: Index) -> Option> { _I35.contains(&index).then(|| _ep(&self.by.client, &self.by.name, index)) } } // Reusable pattern structs @@ -8402,8 +8402,8 @@ impl BrkClient { /// .last(10) /// .json::()?; /// ``` - pub fn series_endpoint(&self, series: impl Into, index: Index) -> SeriesEndpointBuilder { - SeriesEndpointBuilder::new( + pub fn series_endpoint(&self, series: impl Into, index: Index) -> SeriesEndpoint { + SeriesEndpoint::new( self.base.clone(), Arc::from(series.into().as_str()), index, @@ -8413,11 +8413,11 @@ impl BrkClient { /// Create a dynamic date-based series endpoint builder. /// /// Returns `Err` if the index is not date-based. - pub fn date_series_endpoint(&self, series: impl Into, index: Index) -> Result> { + pub fn date_series_endpoint(&self, series: impl Into, index: Index) -> Result> { if !index.is_date_based() { return Err(BrkError { message: format!("{} is not a date-based index", index.name()) }); } - Ok(DateSeriesEndpointBuilder::new( + Ok(DateSeriesEndpoint::new( self.base.clone(), Arc::from(series.into().as_str()), index, @@ -8730,7 +8730,7 @@ impl BrkClient { /// Fuzzy search for series by name. Supports partial matches and typos. /// /// Endpoint: `GET /api/series/search` - pub fn search_series(&self, q: Series, limit: Option) -> Result> { + pub fn search_series(&self, q: SeriesName, limit: Option) -> Result> { let mut query = Vec::new(); query.push(format!("q={}", q)); if let Some(v) = limit { query.push(format!("limit={}", v)); } @@ -8744,7 +8744,7 @@ impl BrkClient { /// Returns the supported indexes and value type for the specified series. /// /// Endpoint: `GET /api/series/{series}` - pub fn get_series_info(&self, series: Series) -> Result { + pub fn get_series_info(&self, series: SeriesName) -> Result { self.base.get_json(&format!("/api/series/{series}")) } @@ -8753,7 +8753,7 @@ impl BrkClient { /// Fetch data for a specific series at the given index. Use query parameters to filter by date range and format (json/csv). /// /// Endpoint: `GET /api/series/{series}/{index}` - pub fn get_series(&self, series: Series, index: Index, start: Option, end: Option, limit: Option, format: Option) -> Result> { + pub fn get_series(&self, series: SeriesName, index: Index, start: Option, end: Option, limit: Option, format: Option) -> Result> { let mut query = Vec::new(); if let Some(v) = start { query.push(format!("start={}", v)); } if let Some(v) = end { query.push(format!("end={}", v)); } @@ -8773,7 +8773,7 @@ impl BrkClient { /// Returns just the data array without the SeriesData wrapper. Supports the same range and format parameters as the standard endpoint. /// /// Endpoint: `GET /api/series/{series}/{index}/data` - pub fn get_series_data(&self, series: Series, index: Index, start: Option, end: Option, limit: Option, format: Option) -> Result>> { + pub fn get_series_data(&self, series: SeriesName, index: Index, start: Option, end: Option, limit: Option, format: Option) -> Result>> { let mut query = Vec::new(); if let Some(v) = start { query.push(format!("start={}", v)); } if let Some(v) = end { query.push(format!("end={}", v)); } @@ -8793,7 +8793,7 @@ impl BrkClient { /// Returns the single most recent value for a series, unwrapped (not inside a SeriesData object). /// /// Endpoint: `GET /api/series/{series}/{index}/latest` - pub fn get_series_latest(&self, series: Series, index: Index) -> Result { + pub fn get_series_latest(&self, series: SeriesName, index: Index) -> Result { self.base.get_json(&format!("/api/series/{series}/{}/latest", index.name())) } @@ -8802,7 +8802,7 @@ impl BrkClient { /// Returns the total number of data points for a series at the given index. /// /// Endpoint: `GET /api/series/{series}/{index}/len` - pub fn get_series_len(&self, series: Series, index: Index) -> Result { + pub fn get_series_len(&self, series: SeriesName, index: Index) -> Result { self.base.get_json(&format!("/api/series/{series}/{}/len", index.name())) } @@ -8811,7 +8811,7 @@ impl BrkClient { /// Returns the current version of a series. Changes when the series data is updated. /// /// Endpoint: `GET /api/series/{series}/{index}/version` - pub fn get_series_version(&self, series: Series, index: Index) -> Result { + pub fn get_series_version(&self, series: SeriesName, index: Index) -> Result { self.base.get_json(&format!("/api/series/{series}/{}/version", index.name())) } diff --git a/crates/brk_query/src/impl/series.rs b/crates/brk_query/src/impl/series.rs index 427b5e340..9ad10f3fd 100644 --- a/crates/brk_query/src/impl/series.rs +++ b/crates/brk_query/src/impl/series.rs @@ -4,7 +4,7 @@ use brk_error::{Error, Result}; use brk_traversable::TreeNode; use brk_types::{ Date, DetailedSeriesCount, Epoch, Etag, Format, Halving, Height, Index, IndexInfo, LegacyValue, - Limit, Series, SeriesData, SeriesInfo, SeriesOutput, SeriesOutputLegacy, SeriesSelection, + Limit, SeriesName, SeriesData, SeriesInfo, SeriesOutput, SeriesOutputLegacy, SeriesSelection, Output, OutputLegacy, PaginatedSeries, Pagination, PaginationIndex, RangeIndex, RangeMap, SearchQuery, Timestamp, Version, }; @@ -30,7 +30,7 @@ impl Query { self.vecs().matches(&query.q, query.limit) } - pub fn series_not_found_error(&self, series: &Series) -> Error { + pub fn series_not_found_error(&self, series: &SeriesName) -> Error { // Check if series exists but with different indexes if let Some(indexes) = self.vecs().series_to_indexes(series.clone()) { let supported = indexes @@ -108,7 +108,7 @@ impl Query { } /// Returns the latest value for a single series as a JSON value. - pub fn latest(&self, series: &Series, index: Index) -> Result { + pub fn latest(&self, series: &SeriesName, index: Index) -> Result { let vec = self .vecs() .get(series, index) @@ -117,7 +117,7 @@ impl Query { } /// Returns the length (total data points) for a single series. - pub fn len(&self, series: &Series, index: Index) -> Result { + pub fn len(&self, series: &SeriesName, index: Index) -> Result { let vec = self .vecs() .get(series, index) @@ -126,7 +126,7 @@ impl Query { } /// Returns the version for a single series. - pub fn version(&self, series: &Series, index: Index) -> Result { + pub fn version(&self, series: &SeriesName, index: Index) -> Result { let vec = self .vecs() .get(series, index) @@ -308,7 +308,7 @@ impl Query { self.vecs().index_to_ids(paginated_index) } - pub fn series_info(&self, series: &Series) -> Option { + pub fn series_info(&self, series: &SeriesName) -> Option { let index_to_vec = self.vecs().series_to_index_to_vec.get(series.replace("-", "_").as_str())?; let value_type = index_to_vec.values().next()?.value_type_to_string(); let indexes = index_to_vec.keys().copied().collect(); @@ -318,7 +318,7 @@ impl Query { }) } - pub fn series_to_indexes(&self, series: Series) -> Option<&Vec> { + pub fn series_to_indexes(&self, series: SeriesName) -> Option<&Vec> { self.vecs().series_to_indexes(series) } diff --git a/crates/brk_query/src/vecs.rs b/crates/brk_query/src/vecs.rs index 0f14815d5..c2e165c34 100644 --- a/crates/brk_query/src/vecs.rs +++ b/crates/brk_query/src/vecs.rs @@ -4,7 +4,7 @@ use brk_computer::Computer; use brk_indexer::Indexer; use brk_traversable::{Traversable, TreeNode}; use brk_types::{ - Index, IndexInfo, Limit, PaginatedSeries, Pagination, PaginationIndex, Series, SeriesCount, + Index, IndexInfo, Limit, PaginatedSeries, Pagination, PaginationIndex, SeriesName, SeriesCount, }; use derive_more::{Deref, DerefMut}; use quickmatch::{QuickMatch, QuickMatchConfig}; @@ -182,7 +182,7 @@ impl<'a> Vecs<'a> { } } - pub fn series_to_indexes(&self, series: Series) -> Option<&Vec> { + pub fn series_to_indexes(&self, series: SeriesName) -> Option<&Vec> { self.series_to_indexes .get(series.replace("-", "_").as_str()) } @@ -204,7 +204,7 @@ impl<'a> Vecs<'a> { self.catalog.as_ref().expect("catalog not initialized") } - pub fn matches(&self, series: &Series, limit: Limit) -> Vec<&'_ str> { + pub fn matches(&self, series: &SeriesName, limit: Limit) -> Vec<&'_ str> { if limit.is_zero() { return Vec::new(); } @@ -215,7 +215,7 @@ impl<'a> Vecs<'a> { } /// Look up a vec by series name and index - pub fn get(&self, series: &Series, index: Index) -> Option<&'a dyn AnyExportableVec> { + pub fn get(&self, series: &SeriesName, index: Index) -> Option<&'a dyn AnyExportableVec> { let series_name = series.replace("-", "_"); self.series_to_index_to_vec .get(series_name.as_str()) diff --git a/crates/brk_server/src/api/metrics_legacy/mod.rs b/crates/brk_server/src/api/metrics_legacy/mod.rs index decdeec4b..161eed856 100644 --- a/crates/brk_server/src/api/metrics_legacy/mod.rs +++ b/crates/brk_server/src/api/metrics_legacy/mod.rs @@ -10,7 +10,7 @@ use axum::{ use brk_traversable::TreeNode; use brk_types::{ CostBasisCohortParam, CostBasisFormatted, CostBasisParams, CostBasisQuery, DataRangeFormat, - Date, DetailedSeriesCount, Index, IndexInfo, PaginatedSeries, Pagination, SearchQuery, Series, + Date, DetailedSeriesCount, Index, IndexInfo, PaginatedSeries, Pagination, SearchQuery, SeriesName, SeriesData, SeriesInfo, SeriesList, SeriesSelection, SeriesSelectionLegacy, }; use schemars::JsonSchema; @@ -24,13 +24,13 @@ use super::series::legacy; /// Legacy path parameter for `/api/metric/{metric}` #[derive(Deserialize, JsonSchema)] struct LegacySeriesParam { - metric: Series, + metric: SeriesName, } /// Legacy path parameters for `/api/metric/{metric}/{index}` #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] struct LegacySeriesWithIndex { - metric: Series, + metric: SeriesName, index: Index, } diff --git a/crates/brk_server/src/api/series/mod.rs b/crates/brk_server/src/api/series/mod.rs index 1c203ae99..7971f7a03 100644 --- a/crates/brk_server/src/api/series/mod.rs +++ b/crates/brk_server/src/api/series/mod.rs @@ -10,8 +10,8 @@ use axum::{ use brk_traversable::TreeNode; use brk_types::{ CostBasisCohortParam, CostBasisFormatted, CostBasisParams, CostBasisQuery, DataRangeFormat, - Date, IndexInfo, PaginatedSeries, Pagination, SearchQuery, SeriesCount, SeriesData, - SeriesInfo, SeriesParam, SeriesSelection, SeriesWithIndex, + Date, IndexInfo, PaginatedSeries, Pagination, SearchQuery, SeriesCount, SeriesData, SeriesInfo, + SeriesNameWithIndex, SeriesParam, SeriesSelection, }; use crate::{CacheStrategy, extended::TransformResponseExtended}; @@ -177,7 +177,7 @@ impl ApiSeriesRoutes for ApiRouter { headers: HeaderMap, addr: Extension, state: State, - Path(path): Path, + Path(path): Path, Query(range): Query| -> Response { data::handler( @@ -211,7 +211,7 @@ impl ApiSeriesRoutes for ApiRouter { headers: HeaderMap, addr: Extension, state: State, - Path(path): Path, + Path(path): Path, Query(range): Query| -> Response { data::raw_handler( @@ -244,7 +244,7 @@ impl ApiSeriesRoutes for ApiRouter { async |uri: Uri, headers: HeaderMap, State(state): State, - Path(path): Path| { + Path(path): Path| { state .cached_json(&headers, CacheStrategy::Height, &uri, move |q| { q.latest(&path.series, path.index) @@ -268,7 +268,7 @@ impl ApiSeriesRoutes for ApiRouter { async |uri: Uri, headers: HeaderMap, State(state): State, - Path(path): Path| { + Path(path): Path| { state .cached_json(&headers, CacheStrategy::Height, &uri, move |q| { q.len(&path.series, path.index) @@ -290,7 +290,7 @@ impl ApiSeriesRoutes for ApiRouter { async |uri: Uri, headers: HeaderMap, State(state): State, - Path(path): Path| { + Path(path): Path| { state .cached_json(&headers, CacheStrategy::Height, &uri, move |q| { q.version(&path.series, path.index) diff --git a/crates/brk_types/src/lib.rs b/crates/brk_types/src/lib.rs index 9858d72b8..297f6af7f 100644 --- a/crates/brk_types/src/lib.rs +++ b/crates/brk_types/src/lib.rs @@ -24,13 +24,8 @@ mod blk_metadata; mod blk_position; mod block; mod block_count_param; -mod block_fees_entry; mod block_fee_rates_entry; -mod blockhash; -mod blockhash_param; -mod blockhash_prefix; -mod blockhash_start_index; -mod blockhash_tx_index; +mod block_fees_entry; mod block_info; mod block_rewards_entry; mod block_size_entry; @@ -38,6 +33,11 @@ mod block_sizes_weights; mod block_status; mod block_timestamp; mod block_weight_entry; +mod blockhash; +mod blockhash_param; +mod blockhash_prefix; +mod blockhash_start_index; +mod blockhash_tx_index; mod bytes; mod cents; mod cents_compact; @@ -82,24 +82,13 @@ mod hour1; mod hour12; mod hour4; mod index; -mod indexes; mod index_info; +mod indexes; mod limit; mod limit_param; mod mempool_block; mod mempool_entry_info; mod mempool_info; -mod series; -mod series_count; -mod series_data; -mod series_info; -mod series_output; -mod series_param; -mod series_list; -mod series_selection; -mod series_selection_legacy; -mod series_paginated; -mod series_with_index; mod minute10; mod minute30; mod month1; @@ -135,21 +124,32 @@ mod percentile; mod pool; mod pool_detail; mod pool_info; -mod pools; mod pool_slug; mod pool_slug_param; -mod pools_summary; mod pool_stats; +mod pools; +mod pools_summary; mod port; -mod range_map; mod range_index; +mod range_map; mod raw_locktime; mod recommended_fees; mod reward_stats; mod sats; -mod sats_signed; mod sats_fract; +mod sats_signed; mod search_query; +mod series_count; +mod series_data; +mod series_info; +mod series_list; +mod series_name; +mod series_name_with_index; +mod series_output; +mod series_paginated; +mod series_param; +mod series_selection; +mod series_selection_legacy; mod stored_bool; mod stored_f32; mod stored_f64; @@ -170,19 +170,19 @@ mod timestamp; mod timestamp_param; mod tree_node; mod tx; +mod tx_index; +mod tx_status; +mod tx_version; +mod tx_with_hex; mod txid; mod txid_param; mod txid_prefix; mod txid_vout; mod txin; -mod tx_index; mod txin_index; mod txout; mod txout_index; mod txout_spend; -mod tx_status; -mod tx_version; -mod tx_with_hex; mod type_index; mod unit; mod unknown_output_index; @@ -219,13 +219,8 @@ pub use blk_metadata::*; pub use blk_position::*; pub use block::*; pub use block_count_param::*; -pub use block_fees_entry::*; pub use block_fee_rates_entry::*; -pub use blockhash::*; -pub use blockhash_param::*; -pub use blockhash_prefix::*; -pub use blockhash_start_index::*; -pub use blockhash_tx_index::*; +pub use block_fees_entry::*; pub use block_info::*; pub use block_rewards_entry::*; pub use block_size_entry::*; @@ -233,6 +228,11 @@ pub use block_sizes_weights::*; pub use block_status::*; pub use block_timestamp::*; pub use block_weight_entry::*; +pub use blockhash::*; +pub use blockhash_param::*; +pub use blockhash_prefix::*; +pub use blockhash_start_index::*; +pub use blockhash_tx_index::*; pub use bytes::*; pub use cents::*; pub use cents_compact::*; @@ -277,24 +277,13 @@ pub use hour1::*; pub use hour4::*; pub use hour12::*; pub use index::*; -pub use indexes::*; pub use index_info::*; +pub use indexes::*; pub use limit::*; pub use limit_param::*; pub use mempool_block::*; pub use mempool_entry_info::*; pub use mempool_info::*; -pub use series::*; -pub use series_count::*; -pub use series_data::*; -pub use series_info::*; -pub use series_output::*; -pub use series_param::*; -pub use series_list::*; -pub use series_selection::*; -pub use series_selection_legacy::*; -pub use series_paginated::*; -pub use series_with_index::*; pub use minute10::*; pub use minute30::*; pub use month1::*; @@ -330,21 +319,32 @@ pub use percentile::*; pub use pool::*; pub use pool_detail::*; pub use pool_info::*; -pub use pools::*; pub use pool_slug::*; pub use pool_slug_param::*; -pub use pools_summary::*; pub use pool_stats::*; +pub use pools::*; +pub use pools_summary::*; pub use port::*; -pub use range_map::*; pub use range_index::*; +pub use range_map::*; pub use raw_locktime::*; pub use recommended_fees::*; pub use reward_stats::*; pub use sats::*; -pub use sats_signed::*; pub use sats_fract::*; +pub use sats_signed::*; pub use search_query::*; +pub use series_count::*; +pub use series_data::*; +pub use series_info::*; +pub use series_list::*; +pub use series_name::*; +pub use series_name_with_index::*; +pub use series_output::*; +pub use series_paginated::*; +pub use series_param::*; +pub use series_selection::*; +pub use series_selection_legacy::*; pub use stored_bool::*; pub use stored_f32::*; pub use stored_f64::*; @@ -365,19 +365,19 @@ pub use timestamp::*; pub use timestamp_param::*; pub use tree_node::*; pub use tx::*; +pub use tx_index::*; +pub use tx_status::*; +pub use tx_version::*; +pub use tx_with_hex::*; pub use txid::*; pub use txid_param::*; pub use txid_prefix::*; pub use txid_vout::*; pub use txin::*; -pub use tx_index::*; pub use txin_index::*; pub use txout::*; pub use txout_index::*; pub use txout_spend::*; -pub use tx_status::*; -pub use tx_version::*; -pub use tx_with_hex::*; pub use type_index::*; pub use unit::*; pub use unknown_output_index::*; diff --git a/crates/brk_types/src/search_query.rs b/crates/brk_types/src/search_query.rs index e805c815d..7d65056d6 100644 --- a/crates/brk_types/src/search_query.rs +++ b/crates/brk_types/src/search_query.rs @@ -1,12 +1,12 @@ use schemars::JsonSchema; use serde::Deserialize; -use crate::{Limit, Series}; +use crate::{Limit, SeriesName}; #[derive(Debug, Deserialize, JsonSchema)] pub struct SearchQuery { /// Search query string - pub q: Series, + pub q: SeriesName, /// Maximum number of results #[serde(default)] pub limit: Limit, diff --git a/crates/brk_types/src/series_list.rs b/crates/brk_types/src/series_list.rs index 1921ee962..da389b745 100644 --- a/crates/brk_types/src/series_list.rs +++ b/crates/brk_types/src/series_list.rs @@ -4,7 +4,7 @@ use derive_more::Deref; use schemars::JsonSchema; use serde::Deserialize; -use super::Series; +use super::SeriesName; /// Comma-separated list of series names #[derive(Debug, Deref, JsonSchema)] @@ -15,14 +15,14 @@ use super::Series; example = &"price_close,market_cap", example = &"realized_price,market_cap,mvrv" )] -pub struct SeriesList(Vec); +pub struct SeriesList(Vec); const MAX_VECS: usize = 32; const MAX_STRING_SIZE: usize = 64 * MAX_VECS; -impl From for SeriesList { +impl From for SeriesList { #[inline] - fn from(series: Series) -> Self { + fn from(series: SeriesName) -> Self { Self(vec![series]) } } @@ -30,7 +30,7 @@ impl From for SeriesList { impl From for SeriesList { #[inline] fn from(value: String) -> Self { - Self::from(Series::from(value.replace("-", "_").to_lowercase())) + Self::from(SeriesName::from(value.replace("-", "_").to_lowercase())) } } @@ -40,7 +40,7 @@ impl<'a> From> for SeriesList { Self( value .iter() - .map(|s| Series::from(s.replace("-", "_").to_lowercase())) + .map(|s| SeriesName::from(s.replace("-", "_").to_lowercase())) .collect::>(), ) } @@ -58,7 +58,7 @@ impl<'de> Deserialize<'de> for SeriesList { Ok(Self( sanitize(str.split(",").map(|s| s.to_string())) .into_iter() - .map(Series::from) + .map(SeriesName::from) .collect(), )) } else { @@ -69,7 +69,7 @@ impl<'de> Deserialize<'de> for SeriesList { Ok(Self( sanitize(vec.iter().filter_map(|s| s.as_str().map(String::from))) .into_iter() - .map(Series::from) + .map(SeriesName::from) .collect(), )) } else { diff --git a/crates/brk_types/src/series.rs b/crates/brk_types/src/series_name.rs similarity index 83% rename from crates/brk_types/src/series.rs rename to crates/brk_types/src/series_name.rs index 412a60984..17ccd7d5b 100644 --- a/crates/brk_types/src/series.rs +++ b/crates/brk_types/src/series_name.rs @@ -13,23 +13,23 @@ use serde::{Deserialize, Serialize}; example = &"market_cap", example = &"realized_price" )] -pub struct Series(String); +pub struct SeriesName(String); -impl From for Series { +impl From for SeriesName { #[inline] fn from(series: String) -> Self { Self(series) } } -impl From<&str> for Series { +impl From<&str> for SeriesName { #[inline] fn from(series: &str) -> Self { Self(series.to_owned()) } } -impl Display for Series { +impl Display for SeriesName { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{}", self.0) } diff --git a/crates/brk_types/src/series_with_index.rs b/crates/brk_types/src/series_name_with_index.rs similarity index 56% rename from crates/brk_types/src/series_with_index.rs rename to crates/brk_types/src/series_name_with_index.rs index 2527f0fc5..ff1a62705 100644 --- a/crates/brk_types/src/series_with_index.rs +++ b/crates/brk_types/src/series_name_with_index.rs @@ -1,19 +1,19 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use crate::{Index, Series}; +use crate::{Index, SeriesName}; #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] -pub struct SeriesWithIndex { +pub struct SeriesNameWithIndex { /// Series name - pub series: Series, + pub series: SeriesName, /// Aggregation index pub index: Index, } -impl SeriesWithIndex { - pub fn new(series: impl Into, index: Index) -> Self { +impl SeriesNameWithIndex { + pub fn new(series: impl Into, index: Index) -> Self { Self { series: series.into(), index, @@ -21,13 +21,13 @@ impl SeriesWithIndex { } } -impl From<(Series, Index)> for SeriesWithIndex { - fn from((series, index): (Series, Index)) -> Self { +impl From<(SeriesName, Index)> for SeriesNameWithIndex { + fn from((series, index): (SeriesName, Index)) -> Self { Self { series, index } } } -impl From<(&str, Index)> for SeriesWithIndex { +impl From<(&str, Index)> for SeriesNameWithIndex { fn from((series, index): (&str, Index)) -> Self { Self { series: series.into(), diff --git a/crates/brk_types/src/series_param.rs b/crates/brk_types/src/series_param.rs index 268f0f06d..6b7a02ba7 100644 --- a/crates/brk_types/src/series_param.rs +++ b/crates/brk_types/src/series_param.rs @@ -1,9 +1,9 @@ use schemars::JsonSchema; use serde::Deserialize; -use crate::Series; +use crate::SeriesName; #[derive(Deserialize, JsonSchema)] pub struct SeriesParam { - pub series: Series, + pub series: SeriesName, } diff --git a/crates/brk_types/src/series_selection.rs b/crates/brk_types/src/series_selection.rs index 16003b758..ea133d2eb 100644 --- a/crates/brk_types/src/series_selection.rs +++ b/crates/brk_types/src/series_selection.rs @@ -2,7 +2,7 @@ use derive_more::Deref; use schemars::JsonSchema; use serde::Deserialize; -use crate::{DataRangeFormat, Index, Series, SeriesList}; +use crate::{DataRangeFormat, Index, SeriesName, SeriesList}; /// Selection of series to query #[derive(Debug, Deref, Deserialize, JsonSchema)] @@ -20,9 +20,9 @@ pub struct SeriesSelection { pub range: DataRangeFormat, } -impl From<(Index, Series, DataRangeFormat)> for SeriesSelection { +impl From<(Index, SeriesName, DataRangeFormat)> for SeriesSelection { #[inline] - fn from((index, series, range): (Index, Series, DataRangeFormat)) -> Self { + fn from((index, series, range): (Index, SeriesName, DataRangeFormat)) -> Self { Self { index, series: SeriesList::from(series), diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index b52968d04..70de8f4df 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -449,13 +449,13 @@ * Legacy path parameter for `/api/metric/{metric}` * * @typedef {Object} LegacySeriesParam - * @property {Series} metric + * @property {SeriesName} metric */ /** * Legacy path parameters for `/api/metric/{metric}/{index}` * * @typedef {Object} LegacySeriesWithIndex - * @property {Series} metric + * @property {SeriesName} metric * @property {Index} index */ /** @@ -692,14 +692,9 @@ */ /** * @typedef {Object} SearchQuery - * @property {Series} q - Search query string + * @property {SeriesName} q - Search query string * @property {Limit=} limit - Maximum number of results */ -/** - * Series name - * - * @typedef {string} Series - */ /** * Series count statistics - distinct series and total series-index combinations * @@ -730,9 +725,19 @@ * * @typedef {string} SeriesList */ +/** + * Series name + * + * @typedef {string} SeriesName + */ +/** + * @typedef {Object} SeriesNameWithIndex + * @property {SeriesName} series - Series name + * @property {Index} index - Aggregation index + */ /** * @typedef {Object} SeriesParam - * @property {Series} series + * @property {SeriesName} series */ /** * Selection of series to query @@ -756,11 +761,6 @@ * @property {(Limit|null)=} limit - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l` * @property {Format=} format - Format of the output */ -/** - * @typedef {Object} SeriesWithIndex - * @property {Series} series - Series name - * @property {Index} index - Aggregation index - */ /** @typedef {boolean} StoredBool */ /** * Stored 32-bit floating point value @@ -1170,7 +1170,7 @@ function _wrapSeriesData(raw) { /** * @template T - * @typedef {Object} SeriesEndpointBuilder + * @typedef {Object} SeriesEndpoint * @property {(index: number) => SingleItemBuilder} get - Get single item at index * @property {(start?: number, end?: number) => RangeBuilder} slice - Slice by index * @property {(n: number) => RangeBuilder} first - Get first n items @@ -1184,7 +1184,7 @@ function _wrapSeriesData(raw) { /** * @template T - * @typedef {Object} DateSeriesEndpointBuilder + * @typedef {Object} DateSeriesEndpoint * @property {(index: number | globalThis.Date) => DateSingleItemBuilder} get - Get single item at index or Date * @property {(start?: number | globalThis.Date, end?: number | globalThis.Date) => DateRangeBuilder} slice - Slice by index or Date * @property {(n: number) => DateRangeBuilder} first - Get first n items @@ -1196,7 +1196,7 @@ function _wrapSeriesData(raw) { * @property {string} path - The endpoint path */ -/** @typedef {SeriesEndpointBuilder} AnySeriesEndpointBuilder */ +/** @typedef {SeriesEndpoint} AnySeriesEndpoint */ /** @template T @typedef {Object} SingleItemBuilder * @property {(onUpdate?: (value: SeriesData) => void) => Promise>} fetch - Fetch the item @@ -1240,9 +1240,9 @@ function _wrapSeriesData(raw) { * @template T * @typedef {Object} SeriesPattern * @property {string} name - The series name - * @property {Readonly>>>} by - Index endpoints as lazy getters + * @property {Readonly>>>} by - Index endpoints as lazy getters * @property {() => readonly Index[]} indexes - Get the list of available indexes - * @property {(index: Index) => SeriesEndpointBuilder|undefined} get - Get an endpoint for a specific index + * @property {(index: Index) => SeriesEndpoint|undefined} get - Get an endpoint for a specific index */ /** @typedef {SeriesPattern} AnySeriesPattern */ @@ -1253,7 +1253,7 @@ function _wrapSeriesData(raw) { * @param {BrkClientBase} client * @param {string} name - The series vec name * @param {Index} index - The index name - * @returns {DateSeriesEndpointBuilder} + * @returns {DateSeriesEndpoint} */ function _endpoint(client, name, index) { const p = `/api/series/${name}/${index}`; @@ -1305,7 +1305,7 @@ function _endpoint(client, name, index) { then(resolve, reject) { return this.fetch().then(resolve, reject); }, }); - /** @type {DateSeriesEndpointBuilder} */ + /** @type {DateSeriesEndpoint} */ const endpoint = { get(idx) { if (idx instanceof Date) idx = dateToIndex(index, idx); return singleItemBuilder(idx); }, slice(start, end) { @@ -1511,114 +1511,114 @@ function _mp(client, name, indexes) { by, /** @returns {readonly Index[]} */ indexes() { return indexes; }, - /** @param {Index} index @returns {SeriesEndpointBuilder|undefined} */ + /** @param {Index} index @returns {SeriesEndpoint|undefined} */ get(index) { return indexes.includes(index) ? _endpoint(client, name, index) : undefined; } }; } -/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpointBuilder, readonly minute30: DateSeriesEndpointBuilder, readonly hour1: DateSeriesEndpointBuilder, readonly hour4: DateSeriesEndpointBuilder, readonly hour12: DateSeriesEndpointBuilder, readonly day1: DateSeriesEndpointBuilder, readonly day3: DateSeriesEndpointBuilder, readonly week1: DateSeriesEndpointBuilder, readonly month1: DateSeriesEndpointBuilder, readonly month3: DateSeriesEndpointBuilder, readonly month6: DateSeriesEndpointBuilder, readonly year1: DateSeriesEndpointBuilder, readonly year10: DateSeriesEndpointBuilder, readonly halving: SeriesEndpointBuilder, readonly epoch: SeriesEndpointBuilder, readonly height: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern1 */ +/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpoint, readonly minute30: DateSeriesEndpoint, readonly hour1: DateSeriesEndpoint, readonly hour4: DateSeriesEndpoint, readonly hour12: DateSeriesEndpoint, readonly day1: DateSeriesEndpoint, readonly day3: DateSeriesEndpoint, readonly week1: DateSeriesEndpoint, readonly month1: DateSeriesEndpoint, readonly month3: DateSeriesEndpoint, readonly month6: DateSeriesEndpoint, readonly year1: DateSeriesEndpoint, readonly year10: DateSeriesEndpoint, readonly halving: SeriesEndpoint, readonly epoch: SeriesEndpoint, readonly height: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern1 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern1} */ function createSeriesPattern1(client, name) { return /** @type {SeriesPattern1} */ (_mp(client, name, _i1)); } -/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpointBuilder, readonly minute30: DateSeriesEndpointBuilder, readonly hour1: DateSeriesEndpointBuilder, readonly hour4: DateSeriesEndpointBuilder, readonly hour12: DateSeriesEndpointBuilder, readonly day1: DateSeriesEndpointBuilder, readonly day3: DateSeriesEndpointBuilder, readonly week1: DateSeriesEndpointBuilder, readonly month1: DateSeriesEndpointBuilder, readonly month3: DateSeriesEndpointBuilder, readonly month6: DateSeriesEndpointBuilder, readonly year1: DateSeriesEndpointBuilder, readonly year10: DateSeriesEndpointBuilder, readonly halving: SeriesEndpointBuilder, readonly epoch: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern2 */ +/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpoint, readonly minute30: DateSeriesEndpoint, readonly hour1: DateSeriesEndpoint, readonly hour4: DateSeriesEndpoint, readonly hour12: DateSeriesEndpoint, readonly day1: DateSeriesEndpoint, readonly day3: DateSeriesEndpoint, readonly week1: DateSeriesEndpoint, readonly month1: DateSeriesEndpoint, readonly month3: DateSeriesEndpoint, readonly month6: DateSeriesEndpoint, readonly year1: DateSeriesEndpoint, readonly year10: DateSeriesEndpoint, readonly halving: SeriesEndpoint, readonly epoch: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern2 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern2} */ function createSeriesPattern2(client, name) { return /** @type {SeriesPattern2} */ (_mp(client, name, _i2)); } -/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern3 */ +/** @template T @typedef {{ name: string, by: { readonly minute10: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern3 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern3} */ function createSeriesPattern3(client, name) { return /** @type {SeriesPattern3} */ (_mp(client, name, _i3)); } -/** @template T @typedef {{ name: string, by: { readonly minute30: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern4 */ +/** @template T @typedef {{ name: string, by: { readonly minute30: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern4 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern4} */ function createSeriesPattern4(client, name) { return /** @type {SeriesPattern4} */ (_mp(client, name, _i4)); } -/** @template T @typedef {{ name: string, by: { readonly hour1: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern5 */ +/** @template T @typedef {{ name: string, by: { readonly hour1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern5 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern5} */ function createSeriesPattern5(client, name) { return /** @type {SeriesPattern5} */ (_mp(client, name, _i5)); } -/** @template T @typedef {{ name: string, by: { readonly hour4: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern6 */ +/** @template T @typedef {{ name: string, by: { readonly hour4: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern6 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern6} */ function createSeriesPattern6(client, name) { return /** @type {SeriesPattern6} */ (_mp(client, name, _i6)); } -/** @template T @typedef {{ name: string, by: { readonly hour12: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern7 */ +/** @template T @typedef {{ name: string, by: { readonly hour12: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern7 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern7} */ function createSeriesPattern7(client, name) { return /** @type {SeriesPattern7} */ (_mp(client, name, _i7)); } -/** @template T @typedef {{ name: string, by: { readonly day1: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern8 */ +/** @template T @typedef {{ name: string, by: { readonly day1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern8 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern8} */ function createSeriesPattern8(client, name) { return /** @type {SeriesPattern8} */ (_mp(client, name, _i8)); } -/** @template T @typedef {{ name: string, by: { readonly day3: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern9 */ +/** @template T @typedef {{ name: string, by: { readonly day3: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern9 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern9} */ function createSeriesPattern9(client, name) { return /** @type {SeriesPattern9} */ (_mp(client, name, _i9)); } -/** @template T @typedef {{ name: string, by: { readonly week1: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern10 */ +/** @template T @typedef {{ name: string, by: { readonly week1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern10 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern10} */ function createSeriesPattern10(client, name) { return /** @type {SeriesPattern10} */ (_mp(client, name, _i10)); } -/** @template T @typedef {{ name: string, by: { readonly month1: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern11 */ +/** @template T @typedef {{ name: string, by: { readonly month1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern11 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern11} */ function createSeriesPattern11(client, name) { return /** @type {SeriesPattern11} */ (_mp(client, name, _i11)); } -/** @template T @typedef {{ name: string, by: { readonly month3: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern12 */ +/** @template T @typedef {{ name: string, by: { readonly month3: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern12 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern12} */ function createSeriesPattern12(client, name) { return /** @type {SeriesPattern12} */ (_mp(client, name, _i12)); } -/** @template T @typedef {{ name: string, by: { readonly month6: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern13 */ +/** @template T @typedef {{ name: string, by: { readonly month6: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern13 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern13} */ function createSeriesPattern13(client, name) { return /** @type {SeriesPattern13} */ (_mp(client, name, _i13)); } -/** @template T @typedef {{ name: string, by: { readonly year1: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern14 */ +/** @template T @typedef {{ name: string, by: { readonly year1: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern14 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern14} */ function createSeriesPattern14(client, name) { return /** @type {SeriesPattern14} */ (_mp(client, name, _i14)); } -/** @template T @typedef {{ name: string, by: { readonly year10: DateSeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern15 */ +/** @template T @typedef {{ name: string, by: { readonly year10: DateSeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern15 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern15} */ function createSeriesPattern15(client, name) { return /** @type {SeriesPattern15} */ (_mp(client, name, _i15)); } -/** @template T @typedef {{ name: string, by: { readonly halving: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern16 */ +/** @template T @typedef {{ name: string, by: { readonly halving: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern16 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern16} */ function createSeriesPattern16(client, name) { return /** @type {SeriesPattern16} */ (_mp(client, name, _i16)); } -/** @template T @typedef {{ name: string, by: { readonly epoch: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern17 */ +/** @template T @typedef {{ name: string, by: { readonly epoch: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern17 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern17} */ function createSeriesPattern17(client, name) { return /** @type {SeriesPattern17} */ (_mp(client, name, _i17)); } -/** @template T @typedef {{ name: string, by: { readonly height: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern18 */ +/** @template T @typedef {{ name: string, by: { readonly height: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern18 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern18} */ function createSeriesPattern18(client, name) { return /** @type {SeriesPattern18} */ (_mp(client, name, _i18)); } -/** @template T @typedef {{ name: string, by: { readonly tx_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern19 */ +/** @template T @typedef {{ name: string, by: { readonly tx_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern19 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern19} */ function createSeriesPattern19(client, name) { return /** @type {SeriesPattern19} */ (_mp(client, name, _i19)); } -/** @template T @typedef {{ name: string, by: { readonly txin_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern20 */ +/** @template T @typedef {{ name: string, by: { readonly txin_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern20 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern20} */ function createSeriesPattern20(client, name) { return /** @type {SeriesPattern20} */ (_mp(client, name, _i20)); } -/** @template T @typedef {{ name: string, by: { readonly txout_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern21 */ +/** @template T @typedef {{ name: string, by: { readonly txout_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern21 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern21} */ function createSeriesPattern21(client, name) { return /** @type {SeriesPattern21} */ (_mp(client, name, _i21)); } -/** @template T @typedef {{ name: string, by: { readonly empty_output_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern22 */ +/** @template T @typedef {{ name: string, by: { readonly empty_output_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern22 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern22} */ function createSeriesPattern22(client, name) { return /** @type {SeriesPattern22} */ (_mp(client, name, _i22)); } -/** @template T @typedef {{ name: string, by: { readonly op_return_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern23 */ +/** @template T @typedef {{ name: string, by: { readonly op_return_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern23 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern23} */ function createSeriesPattern23(client, name) { return /** @type {SeriesPattern23} */ (_mp(client, name, _i23)); } -/** @template T @typedef {{ name: string, by: { readonly p2a_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern24 */ +/** @template T @typedef {{ name: string, by: { readonly p2a_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern24 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern24} */ function createSeriesPattern24(client, name) { return /** @type {SeriesPattern24} */ (_mp(client, name, _i24)); } -/** @template T @typedef {{ name: string, by: { readonly p2ms_output_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern25 */ +/** @template T @typedef {{ name: string, by: { readonly p2ms_output_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern25 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern25} */ function createSeriesPattern25(client, name) { return /** @type {SeriesPattern25} */ (_mp(client, name, _i25)); } -/** @template T @typedef {{ name: string, by: { readonly p2pk33_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern26 */ +/** @template T @typedef {{ name: string, by: { readonly p2pk33_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern26 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern26} */ function createSeriesPattern26(client, name) { return /** @type {SeriesPattern26} */ (_mp(client, name, _i26)); } -/** @template T @typedef {{ name: string, by: { readonly p2pk65_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern27 */ +/** @template T @typedef {{ name: string, by: { readonly p2pk65_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern27 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern27} */ function createSeriesPattern27(client, name) { return /** @type {SeriesPattern27} */ (_mp(client, name, _i27)); } -/** @template T @typedef {{ name: string, by: { readonly p2pkh_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern28 */ +/** @template T @typedef {{ name: string, by: { readonly p2pkh_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern28 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern28} */ function createSeriesPattern28(client, name) { return /** @type {SeriesPattern28} */ (_mp(client, name, _i28)); } -/** @template T @typedef {{ name: string, by: { readonly p2sh_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern29 */ +/** @template T @typedef {{ name: string, by: { readonly p2sh_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern29 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern29} */ function createSeriesPattern29(client, name) { return /** @type {SeriesPattern29} */ (_mp(client, name, _i29)); } -/** @template T @typedef {{ name: string, by: { readonly p2tr_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern30 */ +/** @template T @typedef {{ name: string, by: { readonly p2tr_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern30 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern30} */ function createSeriesPattern30(client, name) { return /** @type {SeriesPattern30} */ (_mp(client, name, _i30)); } -/** @template T @typedef {{ name: string, by: { readonly p2wpkh_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern31 */ +/** @template T @typedef {{ name: string, by: { readonly p2wpkh_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern31 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern31} */ function createSeriesPattern31(client, name) { return /** @type {SeriesPattern31} */ (_mp(client, name, _i31)); } -/** @template T @typedef {{ name: string, by: { readonly p2wsh_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern32 */ +/** @template T @typedef {{ name: string, by: { readonly p2wsh_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern32 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern32} */ function createSeriesPattern32(client, name) { return /** @type {SeriesPattern32} */ (_mp(client, name, _i32)); } -/** @template T @typedef {{ name: string, by: { readonly unknown_output_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern33 */ +/** @template T @typedef {{ name: string, by: { readonly unknown_output_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern33 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern33} */ function createSeriesPattern33(client, name) { return /** @type {SeriesPattern33} */ (_mp(client, name, _i33)); } -/** @template T @typedef {{ name: string, by: { readonly funded_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern34 */ +/** @template T @typedef {{ name: string, by: { readonly funded_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern34 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern34} */ function createSeriesPattern34(client, name) { return /** @type {SeriesPattern34} */ (_mp(client, name, _i34)); } -/** @template T @typedef {{ name: string, by: { readonly empty_address_index: SeriesEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpointBuilder|undefined }} SeriesPattern35 */ +/** @template T @typedef {{ name: string, by: { readonly empty_address_index: SeriesEndpoint }, indexes: () => readonly Index[], get: (index: Index) => SeriesEndpoint|undefined }} SeriesPattern35 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {SeriesPattern35} */ function createSeriesPattern35(client, name) { return /** @type {SeriesPattern35} */ (_mp(client, name, _i35)); } @@ -9250,7 +9250,7 @@ class BrkClient extends BrkClientBase { * * @param {string} series - The series name * @param {Index} index - The index name - * @returns {SeriesEndpointBuilder} + * @returns {SeriesEndpoint} */ seriesEndpoint(series, index) { return _endpoint(this, series, index); @@ -9688,7 +9688,7 @@ class BrkClient extends BrkClientBase { * * Endpoint: `GET /api/series/search` * - * @param {Series} [q] - Search query string + * @param {SeriesName} [q] - Search query string * @param {Limit=} [limit] - Maximum number of results * @returns {Promise} */ @@ -9708,7 +9708,7 @@ class BrkClient extends BrkClientBase { * * Endpoint: `GET /api/series/{series}` * - * @param {Series} series + * @param {SeriesName} series * @returns {Promise} */ async getSeriesInfo(series) { @@ -9722,7 +9722,7 @@ class BrkClient extends BrkClientBase { * * Endpoint: `GET /api/series/{series}/{index}` * - * @param {Series} series - Series name + * @param {SeriesName} series - Series name * @param {Index} index - Aggregation index * @param {RangeIndex=} [start] - Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s` * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e` @@ -9751,7 +9751,7 @@ class BrkClient extends BrkClientBase { * * Endpoint: `GET /api/series/{series}/{index}/data` * - * @param {Series} series - Series name + * @param {SeriesName} series - Series name * @param {Index} index - Aggregation index * @param {RangeIndex=} [start] - Inclusive start: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `from`, `f`, `s` * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e` @@ -9780,7 +9780,7 @@ class BrkClient extends BrkClientBase { * * Endpoint: `GET /api/series/{series}/{index}/latest` * - * @param {Series} series - Series name + * @param {SeriesName} series - Series name * @param {Index} index - Aggregation index * @returns {Promise<*>} */ @@ -9795,7 +9795,7 @@ class BrkClient extends BrkClientBase { * * Endpoint: `GET /api/series/{series}/{index}/len` * - * @param {Series} series - Series name + * @param {SeriesName} series - Series name * @param {Index} index - Aggregation index * @returns {Promise} */ @@ -9810,7 +9810,7 @@ class BrkClient extends BrkClientBase { * * Endpoint: `GET /api/series/{series}/{index}/version` * - * @param {Series} series - Series name + * @param {SeriesName} series - Series name * @param {Index} index - Aggregation index * @returns {Promise} */ diff --git a/modules/brk-client/tests/tree.js b/modules/brk-client/tests/tree.js index 50138c8c0..03914f71a 100644 --- a/modules/brk-client/tests/tree.js +++ b/modules/brk-client/tests/tree.js @@ -5,7 +5,7 @@ import { BrkClient } from "../index.js"; /** - * @typedef {import('../index.js').AnyMetricPattern} AnyMetricPattern + * @typedef {import('../index.js').AnySeriesPattern} AnyMetricPattern */ /** @@ -59,7 +59,7 @@ async function testAllEndpoints() { timeout: 15000, }); - const metrics = getAllMetrics(client.metrics); + const metrics = getAllMetrics(client.series); console.log(`\nFound ${metrics.length} metrics`); let success = 0; diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index 095c5428d..3fb32b499 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -105,7 +105,7 @@ Hour1 = int Hour12 = int Hour4 = int # Series name -Series = str +SeriesName = str # Lowest price value for a time period Low = Dollars # Virtual size in vbytes (weight / 4, rounded up) @@ -658,13 +658,13 @@ class LegacySeriesParam(TypedDict): """ Legacy path parameter for `/api/metric/{metric}` """ - metric: Series + metric: SeriesName class LegacySeriesWithIndex(TypedDict): """ Legacy path parameters for `/api/metric/{metric}/{index}` """ - metric: Series + metric: SeriesName index: Index class MempoolBlock(TypedDict): @@ -907,7 +907,7 @@ class SearchQuery(TypedDict): q: Search query string limit: Maximum number of results """ - q: Series + q: SeriesName limit: Limit class SeriesInfo(TypedDict): @@ -921,8 +921,17 @@ class SeriesInfo(TypedDict): indexes: List[Index] type: str +class SeriesNameWithIndex(TypedDict): + """ + Attributes: + series: Series name + index: Aggregation index + """ + series: SeriesName + index: Index + class SeriesParam(TypedDict): - series: Series + series: SeriesName class SeriesSelection(TypedDict): """ @@ -960,15 +969,6 @@ class SeriesSelectionLegacy(TypedDict): limit: Union[Limit, None] format: Format -class SeriesWithIndex(TypedDict): - """ - Attributes: - series: Series name - index: Aggregation index - """ - series: Series - index: Index - class SupplyState(TypedDict): """ Current supply state tracking UTXO count and total value @@ -1519,7 +1519,7 @@ class DateSkippedBuilder(SkippedBuilder[T]): return self._config.get_date_series() -class SeriesEndpointBuilder(Generic[T]): +class SeriesEndpoint(Generic[T]): """Builder for series endpoint queries with int-based indexing. Examples: @@ -1569,7 +1569,7 @@ class SeriesEndpointBuilder(Generic[T]): return self._config.path() -class DateSeriesEndpointBuilder(Generic[T]): +class DateSeriesEndpoint(Generic[T]): """Builder for series endpoint queries with date-based indexing. Accepts dates in __getitem__ and returns DateSeriesData from fetch(). @@ -1633,8 +1633,8 @@ class DateSeriesEndpointBuilder(Generic[T]): # Type aliases for non-generic usage -AnySeriesEndpointBuilder = SeriesEndpointBuilder[Any] -AnyDateSeriesEndpointBuilder = DateSeriesEndpointBuilder[Any] +AnySeriesEndpoint = SeriesEndpoint[Any] +AnyDateSeriesEndpoint = DateSeriesEndpoint[Any] class SeriesPattern(Protocol[T]): @@ -1649,7 +1649,7 @@ class SeriesPattern(Protocol[T]): """Get the list of available indexes for this series.""" ... - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: """Get an endpoint builder for a specific index, if supported.""" ... @@ -1691,32 +1691,32 @@ _i33 = ('unknown_output_index',) _i34 = ('funded_address_index',) _i35 = ('empty_address_index',) -def _ep(c: BrkClientBase, n: str, i: Index) -> SeriesEndpointBuilder[Any]: - return SeriesEndpointBuilder(c, n, i) +def _ep(c: BrkClientBase, n: str, i: Index) -> SeriesEndpoint[Any]: + return SeriesEndpoint(c, n, i) -def _dep(c: BrkClientBase, n: str, i: Index) -> DateSeriesEndpointBuilder[Any]: - return DateSeriesEndpointBuilder(c, n, i) +def _dep(c: BrkClientBase, n: str, i: Index) -> DateSeriesEndpoint[Any]: + return DateSeriesEndpoint(c, n, i) # Index accessor classes class _SeriesPattern1By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def minute10(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'minute10') - def minute30(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'minute30') - def hour1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour1') - def hour4(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour4') - def hour12(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour12') - def day1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'day1') - def day3(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'day3') - def week1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'week1') - def month1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month1') - def month3(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month3') - def month6(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month6') - def year1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'year1') - def year10(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'year10') - def halving(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'halving') - def epoch(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'epoch') - def height(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'height') + def minute10(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'minute10') + def minute30(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'minute30') + def hour1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour1') + def hour4(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour4') + def hour12(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour12') + def day1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'day1') + def day3(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'day3') + def week1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'week1') + def month1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month1') + def month3(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month3') + def month6(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month6') + def year1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'year1') + def year10(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'year10') + def halving(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'halving') + def epoch(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'epoch') + def height(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'height') class SeriesPattern1(Generic[T]): by: _SeriesPattern1By[T] @@ -1724,25 +1724,25 @@ class SeriesPattern1(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i1) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i1 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i1 else None class _SeriesPattern2By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def minute10(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'minute10') - def minute30(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'minute30') - def hour1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour1') - def hour4(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour4') - def hour12(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour12') - def day1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'day1') - def day3(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'day3') - def week1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'week1') - def month1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month1') - def month3(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month3') - def month6(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month6') - def year1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'year1') - def year10(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'year10') - def halving(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'halving') - def epoch(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'epoch') + def minute10(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'minute10') + def minute30(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'minute30') + def hour1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour1') + def hour4(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour4') + def hour12(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour12') + def day1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'day1') + def day3(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'day3') + def week1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'week1') + def month1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month1') + def month3(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month3') + def month6(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month6') + def year1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'year1') + def year10(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'year10') + def halving(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'halving') + def epoch(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'epoch') class SeriesPattern2(Generic[T]): by: _SeriesPattern2By[T] @@ -1750,11 +1750,11 @@ class SeriesPattern2(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i2) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i2 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i2 else None class _SeriesPattern3By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def minute10(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'minute10') + def minute10(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'minute10') class SeriesPattern3(Generic[T]): by: _SeriesPattern3By[T] @@ -1762,11 +1762,11 @@ class SeriesPattern3(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i3) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i3 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i3 else None class _SeriesPattern4By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def minute30(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'minute30') + def minute30(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'minute30') class SeriesPattern4(Generic[T]): by: _SeriesPattern4By[T] @@ -1774,11 +1774,11 @@ class SeriesPattern4(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i4) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i4 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i4 else None class _SeriesPattern5By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def hour1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour1') + def hour1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour1') class SeriesPattern5(Generic[T]): by: _SeriesPattern5By[T] @@ -1786,11 +1786,11 @@ class SeriesPattern5(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i5) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i5 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i5 else None class _SeriesPattern6By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def hour4(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour4') + def hour4(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour4') class SeriesPattern6(Generic[T]): by: _SeriesPattern6By[T] @@ -1798,11 +1798,11 @@ class SeriesPattern6(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i6) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i6 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i6 else None class _SeriesPattern7By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def hour12(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'hour12') + def hour12(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'hour12') class SeriesPattern7(Generic[T]): by: _SeriesPattern7By[T] @@ -1810,11 +1810,11 @@ class SeriesPattern7(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i7) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i7 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i7 else None class _SeriesPattern8By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def day1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'day1') + def day1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'day1') class SeriesPattern8(Generic[T]): by: _SeriesPattern8By[T] @@ -1822,11 +1822,11 @@ class SeriesPattern8(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i8) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i8 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i8 else None class _SeriesPattern9By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def day3(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'day3') + def day3(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'day3') class SeriesPattern9(Generic[T]): by: _SeriesPattern9By[T] @@ -1834,11 +1834,11 @@ class SeriesPattern9(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i9) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i9 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i9 else None class _SeriesPattern10By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def week1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'week1') + def week1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'week1') class SeriesPattern10(Generic[T]): by: _SeriesPattern10By[T] @@ -1846,11 +1846,11 @@ class SeriesPattern10(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i10) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i10 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i10 else None class _SeriesPattern11By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def month1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month1') + def month1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month1') class SeriesPattern11(Generic[T]): by: _SeriesPattern11By[T] @@ -1858,11 +1858,11 @@ class SeriesPattern11(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i11) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i11 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i11 else None class _SeriesPattern12By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def month3(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month3') + def month3(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month3') class SeriesPattern12(Generic[T]): by: _SeriesPattern12By[T] @@ -1870,11 +1870,11 @@ class SeriesPattern12(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i12) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i12 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i12 else None class _SeriesPattern13By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def month6(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'month6') + def month6(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'month6') class SeriesPattern13(Generic[T]): by: _SeriesPattern13By[T] @@ -1882,11 +1882,11 @@ class SeriesPattern13(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i13) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i13 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i13 else None class _SeriesPattern14By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def year1(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'year1') + def year1(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'year1') class SeriesPattern14(Generic[T]): by: _SeriesPattern14By[T] @@ -1894,11 +1894,11 @@ class SeriesPattern14(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i14) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i14 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i14 else None class _SeriesPattern15By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def year10(self) -> DateSeriesEndpointBuilder[T]: return _dep(self._c, self._n, 'year10') + def year10(self) -> DateSeriesEndpoint[T]: return _dep(self._c, self._n, 'year10') class SeriesPattern15(Generic[T]): by: _SeriesPattern15By[T] @@ -1906,11 +1906,11 @@ class SeriesPattern15(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i15) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i15 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i15 else None class _SeriesPattern16By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def halving(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'halving') + def halving(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'halving') class SeriesPattern16(Generic[T]): by: _SeriesPattern16By[T] @@ -1918,11 +1918,11 @@ class SeriesPattern16(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i16) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i16 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i16 else None class _SeriesPattern17By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def epoch(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'epoch') + def epoch(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'epoch') class SeriesPattern17(Generic[T]): by: _SeriesPattern17By[T] @@ -1930,11 +1930,11 @@ class SeriesPattern17(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i17) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i17 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i17 else None class _SeriesPattern18By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def height(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'height') + def height(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'height') class SeriesPattern18(Generic[T]): by: _SeriesPattern18By[T] @@ -1942,11 +1942,11 @@ class SeriesPattern18(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i18) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i18 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i18 else None class _SeriesPattern19By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def tx_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'tx_index') + def tx_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'tx_index') class SeriesPattern19(Generic[T]): by: _SeriesPattern19By[T] @@ -1954,11 +1954,11 @@ class SeriesPattern19(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i19) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i19 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i19 else None class _SeriesPattern20By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def txin_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'txin_index') + def txin_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'txin_index') class SeriesPattern20(Generic[T]): by: _SeriesPattern20By[T] @@ -1966,11 +1966,11 @@ class SeriesPattern20(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i20) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i20 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i20 else None class _SeriesPattern21By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def txout_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'txout_index') + def txout_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'txout_index') class SeriesPattern21(Generic[T]): by: _SeriesPattern21By[T] @@ -1978,11 +1978,11 @@ class SeriesPattern21(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i21) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i21 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i21 else None class _SeriesPattern22By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def empty_output_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'empty_output_index') + def empty_output_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'empty_output_index') class SeriesPattern22(Generic[T]): by: _SeriesPattern22By[T] @@ -1990,11 +1990,11 @@ class SeriesPattern22(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i22) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i22 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i22 else None class _SeriesPattern23By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def op_return_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'op_return_index') + def op_return_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'op_return_index') class SeriesPattern23(Generic[T]): by: _SeriesPattern23By[T] @@ -2002,11 +2002,11 @@ class SeriesPattern23(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i23) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i23 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i23 else None class _SeriesPattern24By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2a_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2a_address_index') + def p2a_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2a_address_index') class SeriesPattern24(Generic[T]): by: _SeriesPattern24By[T] @@ -2014,11 +2014,11 @@ class SeriesPattern24(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i24) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i24 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i24 else None class _SeriesPattern25By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2ms_output_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2ms_output_index') + def p2ms_output_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2ms_output_index') class SeriesPattern25(Generic[T]): by: _SeriesPattern25By[T] @@ -2026,11 +2026,11 @@ class SeriesPattern25(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i25) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i25 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i25 else None class _SeriesPattern26By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2pk33_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pk33_address_index') + def p2pk33_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2pk33_address_index') class SeriesPattern26(Generic[T]): by: _SeriesPattern26By[T] @@ -2038,11 +2038,11 @@ class SeriesPattern26(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i26) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i26 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i26 else None class _SeriesPattern27By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2pk65_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pk65_address_index') + def p2pk65_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2pk65_address_index') class SeriesPattern27(Generic[T]): by: _SeriesPattern27By[T] @@ -2050,11 +2050,11 @@ class SeriesPattern27(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i27) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i27 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i27 else None class _SeriesPattern28By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2pkh_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pkh_address_index') + def p2pkh_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2pkh_address_index') class SeriesPattern28(Generic[T]): by: _SeriesPattern28By[T] @@ -2062,11 +2062,11 @@ class SeriesPattern28(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i28) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i28 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i28 else None class _SeriesPattern29By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2sh_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2sh_address_index') + def p2sh_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2sh_address_index') class SeriesPattern29(Generic[T]): by: _SeriesPattern29By[T] @@ -2074,11 +2074,11 @@ class SeriesPattern29(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i29) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i29 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i29 else None class _SeriesPattern30By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2tr_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2tr_address_index') + def p2tr_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2tr_address_index') class SeriesPattern30(Generic[T]): by: _SeriesPattern30By[T] @@ -2086,11 +2086,11 @@ class SeriesPattern30(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i30) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i30 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i30 else None class _SeriesPattern31By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2wpkh_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2wpkh_address_index') + def p2wpkh_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2wpkh_address_index') class SeriesPattern31(Generic[T]): by: _SeriesPattern31By[T] @@ -2098,11 +2098,11 @@ class SeriesPattern31(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i31) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i31 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i31 else None class _SeriesPattern32By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2wsh_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'p2wsh_address_index') + def p2wsh_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'p2wsh_address_index') class SeriesPattern32(Generic[T]): by: _SeriesPattern32By[T] @@ -2110,11 +2110,11 @@ class SeriesPattern32(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i32) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i32 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i32 else None class _SeriesPattern33By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def unknown_output_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'unknown_output_index') + def unknown_output_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'unknown_output_index') class SeriesPattern33(Generic[T]): by: _SeriesPattern33By[T] @@ -2122,11 +2122,11 @@ class SeriesPattern33(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i33) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i33 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i33 else None class _SeriesPattern34By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def funded_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'funded_address_index') + def funded_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'funded_address_index') class SeriesPattern34(Generic[T]): by: _SeriesPattern34By[T] @@ -2134,11 +2134,11 @@ class SeriesPattern34(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i34) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i34 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i34 else None class _SeriesPattern35By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def empty_address_index(self) -> SeriesEndpointBuilder[T]: return _ep(self._c, self._n, 'empty_address_index') + def empty_address_index(self) -> SeriesEndpoint[T]: return _ep(self._c, self._n, 'empty_address_index') class SeriesPattern35(Generic[T]): by: _SeriesPattern35By[T] @@ -2146,7 +2146,7 @@ class SeriesPattern35(Generic[T]): @property def name(self) -> str: return self._n def indexes(self) -> List[str]: return list(_i35) - def get(self, index: Index) -> Optional[SeriesEndpointBuilder[T]]: return _ep(self.by._c, self._n, index) if index in _i35 else None + def get(self, index: Index) -> Optional[SeriesEndpoint[T]]: return _ep(self.by._c, self._n, index) if index in _i35 else None # Reusable structural pattern classes @@ -6905,13 +6905,13 @@ class BrkClient(BrkClientBase): super().__init__(base_url, timeout) self.series = SeriesTree(self) - def series_endpoint(self, series: str, index: Index) -> SeriesEndpointBuilder[Any]: + def series_endpoint(self, series: str, index: Index) -> SeriesEndpoint[Any]: """Create a dynamic series endpoint builder for any series/index combination. Use this for programmatic access when the series name is determined at runtime. For type-safe access, use the `series` tree instead. """ - return SeriesEndpointBuilder(self, series, index) + return SeriesEndpoint(self, series, index) def index_to_date(self, index: Index, i: int) -> Union[date, datetime]: """Convert an index value to a date/datetime for date-based indexes.""" @@ -7194,7 +7194,7 @@ class BrkClient(BrkClientBase): path = f'/api/series/list{"?" + query if query else ""}' return self.get_json(path) - def search_series(self, q: Series, limit: Optional[Limit] = None) -> List[str]: + def search_series(self, q: SeriesName, limit: Optional[Limit] = None) -> List[str]: """Search series. Fuzzy search for series by name. Supports partial matches and typos. @@ -7207,7 +7207,7 @@ class BrkClient(BrkClientBase): path = f'/api/series/search{"?" + query if query else ""}' return self.get_json(path) - def get_series_info(self, series: Series) -> SeriesInfo: + def get_series_info(self, series: SeriesName) -> SeriesInfo: """Get series info. Returns the supported indexes and value type for the specified series. @@ -7215,7 +7215,7 @@ class BrkClient(BrkClientBase): Endpoint: `GET /api/series/{series}`""" return self.get_json(f'/api/series/{series}') - def get_series(self, series: Series, index: Index, start: Optional[RangeIndex] = None, end: Optional[RangeIndex] = None, limit: Optional[Limit] = None, format: Optional[Format] = None) -> Union[AnySeriesData, str]: + def get_series(self, series: SeriesName, index: Index, start: Optional[RangeIndex] = None, end: Optional[RangeIndex] = None, limit: Optional[Limit] = None, format: Optional[Format] = None) -> Union[AnySeriesData, str]: """Get series data. Fetch data for a specific series at the given index. Use query parameters to filter by date range and format (json/csv). @@ -7232,7 +7232,7 @@ class BrkClient(BrkClientBase): return self.get_text(path) return self.get_json(path) - def get_series_data(self, series: Series, index: Index, start: Optional[RangeIndex] = None, end: Optional[RangeIndex] = None, limit: Optional[Limit] = None, format: Optional[Format] = None) -> Union[List[bool], str]: + def get_series_data(self, series: SeriesName, index: Index, start: Optional[RangeIndex] = None, end: Optional[RangeIndex] = None, limit: Optional[Limit] = None, format: Optional[Format] = None) -> Union[List[bool], str]: """Get raw series data. Returns just the data array without the SeriesData wrapper. Supports the same range and format parameters as the standard endpoint. @@ -7249,7 +7249,7 @@ class BrkClient(BrkClientBase): return self.get_text(path) return self.get_json(path) - def get_series_latest(self, series: Series, index: Index) -> Any: + def get_series_latest(self, series: SeriesName, index: Index) -> Any: """Get latest series value. Returns the single most recent value for a series, unwrapped (not inside a SeriesData object). @@ -7257,7 +7257,7 @@ class BrkClient(BrkClientBase): Endpoint: `GET /api/series/{series}/{index}/latest`""" return self.get_json(f'/api/series/{series}/{index}/latest') - def get_series_len(self, series: Series, index: Index) -> float: + def get_series_len(self, series: SeriesName, index: Index) -> float: """Get series data length. Returns the total number of data points for a series at the given index. @@ -7265,7 +7265,7 @@ class BrkClient(BrkClientBase): Endpoint: `GET /api/series/{series}/{index}/len`""" return self.get_json(f'/api/series/{series}/{index}/len') - def get_series_version(self, series: Series, index: Index) -> Version: + def get_series_version(self, series: SeriesName, index: Index) -> Version: """Get series version. Returns the current version of a series. Changes when the series data is updated. diff --git a/website/scripts/types.js b/website/scripts/types.js index ff516e626..7e3ffb81f 100644 --- a/website/scripts/types.js +++ b/website/scripts/types.js @@ -70,7 +70,7 @@ * @typedef {Brk.BaseCumulativeSumPattern4 | Brk.BaseCumulativeSumPattern | Brk.BaseCumulativeRelPattern} AnyValuePatternType * @typedef {Brk.AnySeriesPattern} AnySeriesPattern * @typedef {Brk.CentsSatsUsdPattern} ActivePricePattern - * @typedef {Brk.AnySeriesEndpointBuilder} AnySeriesEndpoint + * @typedef {Brk.AnySeriesEndpoint} AnySeriesEndpoint * @typedef {Brk.AnySeriesData} AnySeriesData * @typedef {Brk.AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3} AddrCountPattern * Relative patterns by capability: @@ -96,7 +96,7 @@ /** * @template T - * @typedef {Brk.SeriesEndpointBuilder} SeriesEndpoint + * @typedef {Brk.SeriesEndpoint} SeriesEndpoint */ /** * Stats pattern: average, min, max, percentiles (height-only indexes, NO base)