mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-29 00:59:58 -07:00
vecs: add trait + derive crates
This commit is contained in:
@@ -35,7 +35,7 @@ struct TxResponse {
|
||||
impl ApiExplorerRoutes for Router<AppState> {
|
||||
fn add_api_explorer_routes(self) -> Self {
|
||||
self.route(
|
||||
"/api/address/{address}",
|
||||
"/api/chain/address/{address}",
|
||||
get(
|
||||
async |Path(address): Path<String>, state: State<AppState>| -> Response {
|
||||
let Ok(address) = Address::from_str(&address) else {
|
||||
@@ -148,7 +148,7 @@ impl ApiExplorerRoutes for Router<AppState> {
|
||||
),
|
||||
)
|
||||
.route(
|
||||
"/api/tx/{txid}",
|
||||
"/api/chain/tx/{txid}",
|
||||
get(
|
||||
async |Path(txid): Path<String>, state: State<AppState>| -> Response {
|
||||
let Ok(txid) = bitcoin::Txid::from_str(&txid) else {
|
||||
@@ -35,8 +35,19 @@ impl ApiMetricsRoutes for Router<AppState> {
|
||||
Json(app_state.interface.get_indexes()).into_response()
|
||||
}),
|
||||
)
|
||||
.route(
|
||||
"/api/metrics/list",
|
||||
get(
|
||||
async |State(app_state): State<AppState>,
|
||||
Query(pagination): Query<PaginationParam>|
|
||||
-> Response {
|
||||
Json(app_state.interface.get_metrics(pagination)).into_response()
|
||||
},
|
||||
),
|
||||
)
|
||||
// TODO:
|
||||
// .route(
|
||||
// "/api/vecs/metrics",
|
||||
// "/api/metrics/search",
|
||||
// get(
|
||||
// async |State(app_state): State<AppState>,
|
||||
// Query(pagination): Query<PaginationParam>|
|
||||
@@ -45,16 +56,6 @@ impl ApiMetricsRoutes for Router<AppState> {
|
||||
// },
|
||||
// ),
|
||||
// )
|
||||
// .route(
|
||||
// "/api/vecs/index-to-metrics",
|
||||
// get(
|
||||
// async |State(app_state): State<AppState>,
|
||||
// Query(paginated_index): Query<PaginatedIndexParam>|
|
||||
// -> Response {
|
||||
// Json(app_state.interface.get_index_to_vecids(paginated_index)).into_response()
|
||||
// },
|
||||
// ),
|
||||
// )
|
||||
.route(
|
||||
"/api/metrics/{metric}",
|
||||
get(
|
||||
@@ -85,7 +86,7 @@ impl ApiMetricsRoutes for Router<AppState> {
|
||||
),
|
||||
)
|
||||
// !!!
|
||||
// DEPRECATED
|
||||
// DEPRECATED: Do not use
|
||||
// !!!
|
||||
.route(
|
||||
"/api/vecs/query",
|
||||
@@ -100,7 +101,7 @@ impl ApiMetricsRoutes for Router<AppState> {
|
||||
),
|
||||
)
|
||||
// !!!
|
||||
// DEPRECATED
|
||||
// DEPRECATED: Do not use
|
||||
// !!!
|
||||
.route(
|
||||
"/api/vecs/{variant}",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
use axum::{Router, response::Redirect, routing::get};
|
||||
|
||||
use crate::api::{explorer::ApiExplorerRoutes, metrics::ApiMetricsRoutes};
|
||||
use crate::api::{chain::ApiExplorerRoutes, metrics::ApiMetricsRoutes};
|
||||
|
||||
use super::AppState;
|
||||
|
||||
mod explorer;
|
||||
mod chain;
|
||||
mod metrics;
|
||||
|
||||
pub trait ApiRoutes {
|
||||
|
||||
Reference in New Issue
Block a user