# `echoscan` (Rust)
## 中文
### 可用调用方式
- `LiteClient::new()`
- `ProClient::new(api_key)`
方法:
- Lite: `get_report(&self, imprint)`
- Pro: `get_report(&self, imprint)`, `get_history(&self, imprint, query)`
History 查询:
仅 Pro 客户端可用(需要 Pro API Key)。
- `HistoryQuery::Days { days, recent }`
- `HistoryQuery::Range { from, to, recent }`(日期格式 `YYYY-MM-DD`)
### 返回值与错误
`get_report()` 顶层结构:
```json
{
"analysis": {},
"lyingCount": 0,
"projection": {}
}
```
`get_history()` 顶层结构:
```json
{
"imprint": "fp_session_...",
"range": {},
"recent": [],
"summary": {},
"timeline": []
}
```
完整字段说明链接:[echoscan](https://echoscan.org)
### 示例
```rust
use echoscan::{HistoryQuery, ProClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let pro = ProClient::new(std::env::var("ECHOSCAN_PRO_KEY")?)?;
let report = pro.get_report("fp_session_123").await?;
let history = pro
.get_history(
"fp_session_123",
HistoryQuery::Range {
from: "2026-03-01".to_string(),
to: "2026-03-18".to_string(),
recent: Some(20),
},
)
.await?;
println!("{report}");
println!("{history}");
Ok(())
}
```
---
## English
### Usage
- `LiteClient::new()`
- `ProClient::new(api_key)`
Methods:
- Lite: `get_report(&self, imprint)`
- Pro: `get_report(&self, imprint)`, `get_history(&self, imprint, query)`
History query:
Pro-only (requires a Pro API key).
- `HistoryQuery::Days { days, recent }`
- `HistoryQuery::Range { from, to, recent }` where date format is `YYYY-MM-DD`
### Response and errors
`get_report()` top-level shape:
```json
{
"analysis": {},
"lyingCount": 0,
"projection": {}
}
```
`get_history()` top-level shape:
```json
{
"imprint": "fp_session_...",
"range": {},
"recent": [],
"summary": {},
"timeline": []
}
```
Full field reference: [echoscan](https://echoscan.org)
### Example
```rust
use echoscan::{HistoryQuery, ProClient};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let pro = ProClient::new(std::env::var("ECHOSCAN_PRO_KEY")?)?;
let report = pro.get_report("fp_session_123").await?;
let history = pro
.get_history(
"fp_session_123",
HistoryQuery::Range {
from: "2026-03-01".to_string(),
to: "2026-03-18".to_string(),
recent: Some(20),
},
)
.await?;
println!("{report}");
println!("{history}");
Ok(())
}
```