dregs 0.1.0

The official Rust client for Dregs, which scores the users of your application for fraud and abuse.
Documentation
//! 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.

#![warn(missing_docs)]

mod client;
mod error;
mod event;
mod identities;
mod models;
pub mod webhooks;

pub use client::{
    BASE_URL_ENV, Client, ClientBuilder, DEFAULT_BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT,
    SECRET_KEY_ENV,
};
pub use error::{ApiError, ApiErrorKind, Error, Result};
pub use event::{DEFAULT_GROUP_TYPE, Event, Group};
pub use identities::Identities;
pub use models::{Analysis, Badge, Category, Identity, Observation, Score, Scores, TrackResult};