altair_rest/lib.rs
1//! Resilient HTTP client built on `reqwest` with retry and `OTel`-aware
2//! tracing middleware baked in.
3//!
4//! Wraps `reqwest_middleware::ClientWithMiddleware` with a sensible-default
5//! middleware chain so each outgoing request automatically gets exponential
6//! backoff on transient failures plus a per-request tracing span. The
7//! underlying `reqwest` and `reqwest_middleware` crates are re-exported
8//! at the crate root so consumers don't need to add them separately.
9//!
10//! # Example
11//!
12//! ```no_run
13//! use altair_rest::Client;
14//!
15//! # async fn run() -> altair_rest::Result<()> {
16//! let client = Client::builder()
17//! .base_url("https://api.example.com")?
18//! .bearer_token("secret-token")
19//! .build()?;
20//!
21//! let response = client.get("/users/42").send().await?;
22//! # let _ = response;
23//! # Ok(()) }
24//! ```
25
26#![deny(missing_docs)]
27#![forbid(unsafe_code)]
28#![warn(clippy::pedantic)]
29#![allow(clippy::module_name_repetitions)]
30#![allow(clippy::missing_errors_doc)]
31
32mod client;
33mod config;
34mod error;
35mod json;
36
37pub mod prelude;
38
39pub use client::Client;
40pub use config::ClientBuilder;
41pub use error::{Error, Result};
42
43// Re-exports for one-dep ergonomics
44pub use ::http;
45pub use ::reqwest;
46pub use ::reqwest_middleware;
47pub use ::url;
48
49// Commonly-needed http/reqwest types lifted to the crate root so
50// consumers don't write `altair_rest::http::HeaderMap` every time.
51pub use ::http::{HeaderMap, HeaderName, HeaderValue, Method, StatusCode};
52pub use ::reqwest::Response;