claude_api/blocking/mod.rs
1//! Blocking (synchronous) variants of the HTTP surface.
2//!
3//! Mirrors the async API in [`crate::client`] / [`crate::messages::api`] /
4//! [`crate::models`] but uses [`reqwest::blocking`] under the hood, so no
5//! tokio runtime is required.
6//!
7//! Gated on the `sync` feature.
8//!
9//! ```no_run
10//! use claude_api::blocking::Client;
11//! use claude_api::messages::CreateMessageRequest;
12//! use claude_api::types::ModelId;
13//!
14//! let client = Client::new(std::env::var("ANTHROPIC_API_KEY").unwrap());
15//! let req = CreateMessageRequest::builder()
16//! .model(ModelId::SONNET_4_6)
17//! .max_tokens(64)
18//! .user("hi")
19//! .build()
20//! .unwrap();
21//! let resp = client.messages().create(req).unwrap();
22//! # let _ = resp;
23//! ```
24//!
25//! # Scope
26//!
27//! v0.2 ships sync support for the **transport layer only**: [`Client`],
28//! [`Messages`], [`Models`]. Higher-level helpers (`Conversation`,
29//! `ToolRegistry`, `Client::run`, streaming) remain async-only. Most apps
30//! that want sync are looking for "I just need a simple HTTP client" --
31//! reach for the async path if you need the multi-turn or agent helpers.
32
33#![cfg(feature = "sync")]
34
35mod client;
36mod messages;
37mod models;
38
39pub use client::{Client, ClientBuilder};
40pub use messages::Messages;
41pub use models::Models;