mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-25 01:38:12 -07:00
global: cost basis -> urpd
This commit is contained in:
@@ -1,29 +0,0 @@
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
|
||||
use brk_types::{Cohort, CostBasisBucket, CostBasisValue, Date};
|
||||
|
||||
/// Path parameters for cost basis distribution endpoint.
|
||||
#[derive(Deserialize, JsonSchema)]
|
||||
pub struct CostBasisParams {
|
||||
pub cohort: Cohort,
|
||||
#[schemars(with = "String", example = &"2024-01-01")]
|
||||
pub date: Date,
|
||||
}
|
||||
|
||||
/// Path parameters for cost basis dates endpoint.
|
||||
#[derive(Deserialize, JsonSchema)]
|
||||
pub struct CostBasisCohortParam {
|
||||
pub cohort: Cohort,
|
||||
}
|
||||
|
||||
/// Query parameters for cost basis distribution endpoint.
|
||||
#[derive(Deserialize, JsonSchema)]
|
||||
pub struct CostBasisQuery {
|
||||
/// Bucket type for aggregation. Default: raw (no aggregation).
|
||||
#[serde(default)]
|
||||
pub bucket: CostBasisBucket,
|
||||
/// Value type to return. Default: supply.
|
||||
#[serde(default)]
|
||||
pub value: CostBasisValue,
|
||||
}
|
||||
@@ -4,7 +4,6 @@ mod block_count_param;
|
||||
mod blockhash_param;
|
||||
mod blockhash_start_index;
|
||||
mod blockhash_tx_index;
|
||||
mod cost_basis_params;
|
||||
mod height_param;
|
||||
mod limit_param;
|
||||
mod pool_slug_param;
|
||||
@@ -15,6 +14,7 @@ mod tx_index_param;
|
||||
mod txid_param;
|
||||
mod txid_vout;
|
||||
mod txids_param;
|
||||
mod urpd_params;
|
||||
mod validate_addr_param;
|
||||
|
||||
pub use addr_param::*;
|
||||
@@ -23,7 +23,6 @@ pub use block_count_param::*;
|
||||
pub use blockhash_param::*;
|
||||
pub use blockhash_start_index::*;
|
||||
pub use blockhash_tx_index::*;
|
||||
pub use cost_basis_params::*;
|
||||
pub use height_param::*;
|
||||
pub use limit_param::*;
|
||||
pub use pool_slug_param::*;
|
||||
@@ -34,4 +33,5 @@ pub use tx_index_param::*;
|
||||
pub use txid_param::*;
|
||||
pub use txid_vout::*;
|
||||
pub use txids_param::*;
|
||||
pub use urpd_params::*;
|
||||
pub use validate_addr_param::*;
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
use schemars::JsonSchema;
|
||||
use serde::Deserialize;
|
||||
|
||||
use brk_types::{Cohort, Date, UrpdAggregation};
|
||||
|
||||
/// Path parameters for `/api/urpd/{cohort}/{date}`.
|
||||
#[derive(Deserialize, JsonSchema)]
|
||||
pub struct UrpdParams {
|
||||
pub cohort: Cohort,
|
||||
#[schemars(with = "String", example = &"2024-01-01")]
|
||||
pub date: Date,
|
||||
}
|
||||
|
||||
/// Path parameters for per-cohort URPD endpoints.
|
||||
#[derive(Deserialize, JsonSchema)]
|
||||
pub struct UrpdCohortParam {
|
||||
pub cohort: Cohort,
|
||||
}
|
||||
|
||||
/// Query parameters for URPD endpoints.
|
||||
#[derive(Deserialize, JsonSchema)]
|
||||
pub struct UrpdQuery {
|
||||
/// Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
|
||||
#[serde(default, rename = "agg", alias = "bucket")]
|
||||
pub aggregation: UrpdAggregation,
|
||||
}
|
||||
Reference in New Issue
Block a user