1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//! Dregs: fraud and abuse scoring for the users of your application.
//!
//! Send events from your backend, read back the scores and the observations behind them:
//!
//! ```no_run
//! use dregs::{Client, Event};
//! use serde_json::json;
//!
//! # async fn hold_for_review(_: &str) {}
//! # async fn run() -> dregs::Result<()> {
//! let client = Client::from_env()?;
//!
//! client
//! .track(
//! Event::new("user.signup", "user_12345")
//! .data(json!({ "plan": "pro" }))
//! .identity_data(json!({ "email": "ada@example.com" })),
//! )
//! .await?;
//!
//! let scores = client.identities().scores("user_12345").await?;
//!
//! if scores.authenticity().is_some_and(|authenticity| authenticity < 40) {
//! hold_for_review("user_12345").await;
//! }
//! # Ok(())
//! # }
//! ```
//!
//! Scoring is asynchronous, so scores appear moments after the events that move them rather than
//! in the same breath. See <https://dregs.com/manual/api/> for the API this wraps.
//!
//! The client is async and runs on [Tokio](https://tokio.rs), through
//! [reqwest](https://docs.rs/reqwest).
//!
//! # Features
//!
//! - `rustls` (default): TLS through rustls, verifying certificates with the platform's verifier.
//! - `native-tls`: TLS through the operating system's library instead. Turn off default features
//! to drop rustls.
pub use ;
pub use ;
pub use ;
pub use Identities;
pub use ;