mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-08 05:09:10 -07:00
server: api doc
This commit is contained in:
@@ -42,23 +42,25 @@ The API uses `brk_query` and so inherites all of its features including formats.
|
||||
|
||||
## Endpoints
|
||||
|
||||
### `GET /api/vecs/indexes`
|
||||
### API
|
||||
|
||||
A list of all possible vec indexes and their accepted format
|
||||
#### `GET /api/vecs/indexes`
|
||||
|
||||
### `GET /api/vecs/ids`
|
||||
A list of all possible vec indexes and their accepted variants
|
||||
|
||||
#### `GET /api/vecs/ids`
|
||||
|
||||
A list of all possible vec ids
|
||||
|
||||
### `GET /api/vecs/id-to-indexes`
|
||||
#### `GET /api/vecs/id-to-indexes`
|
||||
|
||||
A list of all possible vec ids and their supported vec indexes
|
||||
|
||||
### `GET /api/vecs/index-to-ids`
|
||||
#### `GET /api/vecs/index-to-ids`
|
||||
|
||||
A list of all possible vec indexes and their supported vec ids
|
||||
|
||||
### `GET /api/query`
|
||||
#### `GET /api/query`
|
||||
|
||||
This endpoint retrieves data based on the specified vector index and values.
|
||||
|
||||
@@ -79,11 +81,15 @@ GET /api/query?index=date&values=ohlc
|
||||
GET /api/query?index=week&values=ohlc,block-interval-average&from=0&to=20&format=md
|
||||
```
|
||||
|
||||
### `GET /version`
|
||||
### Meta
|
||||
|
||||
#### `GET /version`
|
||||
|
||||
The version of the server and thus BRK.
|
||||
|
||||
### `GET /*`
|
||||
### Files
|
||||
|
||||
#### `GET /*`
|
||||
|
||||
Catch all.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::collections::BTreeMap;
|
||||
use axum::{
|
||||
Router,
|
||||
extract::State,
|
||||
response::{IntoResponse, Response},
|
||||
response::{IntoResponse, Redirect, Response},
|
||||
routing::get,
|
||||
};
|
||||
|
||||
@@ -20,11 +20,19 @@ pub trait ApiRoutes {
|
||||
|
||||
impl ApiRoutes for Router<AppState> {
|
||||
fn add_api_routes(self) -> Self {
|
||||
self.route("/api/query", get(query::handler))
|
||||
.route("/api/vecs/ids", get(vecids_handler))
|
||||
.route("/api/vecs/indexes", get(vecindexes_handler))
|
||||
.route("/api/vecs/id-to-indexes", get(vecid_to_vecindexes_handler))
|
||||
.route("/api/vecs/index-to-ids", get(vecindex_to_vecids_handler))
|
||||
self.route(
|
||||
"/api",
|
||||
get(|| async {
|
||||
Redirect::permanent(
|
||||
"https://github.com/bitcoinresearchkit/brk/tree/main/crates/brk_server#api",
|
||||
)
|
||||
}),
|
||||
)
|
||||
.route("/api/query", get(query::handler))
|
||||
.route("/api/vecs/ids", get(vecids_handler))
|
||||
.route("/api/vecs/indexes", get(vecindexes_handler))
|
||||
.route("/api/vecs/id-to-indexes", get(vecid_to_vecindexes_handler))
|
||||
.route("/api/vecs/index-to-ids", get(vecindex_to_vecids_handler))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user