Skip to main content

opencode_sdk_rs/
lib.rs

1//! # `OpenCode` SDK for Rust
2//!
3//! A Rust client library for the [OpenCode](https://opencode.ai) API,
4//! providing type-safe access to all endpoints.
5//!
6//! ## Quick Start
7//!
8//! ```rust,no_run
9//! use opencode_sdk_rs::Opencode;
10//!
11//! #[tokio::main(flavor = "current_thread")]
12//! async fn main() -> Result<(), opencode_sdk_rs::OpencodeError> {
13//!     // Uses OPENCODE_BASE_URL env var or defaults to localhost:54321
14//!     let client = Opencode::new()?;
15//!
16//!     // Get app info
17//!     let app = client.app().get(None).await?;
18//!     println!("Connected to: {}", app.hostname);
19//!
20//!     // List sessions
21//!     let sessions = client.session().list(None).await?;
22//!     println!("Found {} sessions", sessions.len());
23//!
24//!     Ok(())
25//! }
26//! ```
27
28pub mod client;
29pub mod config;
30pub mod error;
31pub mod resources;
32pub mod streaming;
33pub mod types;
34
35// Re-export key types at the crate root for convenience
36pub use client::{Opencode, OpencodeBuilder, RequestOptions};
37pub use config::ClientOptions;
38pub use error::OpencodeError;
39pub use streaming::SseStream;