govee_api2/lib.rs
1//! # govee-api2
2//!
3//! A Rust client for Govee's v2 router-based platform API
4//! (`https://openapi.api.govee.com`).
5//!
6//! Supported:
7//! - Device and group discovery
8//! - Device state queries
9//! - Device control (power, brightness, color, color temperature)
10//! - Dynamic light scenes and DIY scenes (list + activate)
11//! - Per-segment color and brightness for segmented lights
12//! - Configurable timeout and retry with backoff, typed rate-limit errors
13//!
14//! ## Example
15//!
16//! ```rust,no_run
17//! use govee_api2::GoveeClient;
18//!
19//! #[tokio::main]
20//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
21//! let client = GoveeClient::new("your-api-key");
22//!
23//! // List all devices
24//! let devices = client.get_devices().await?;
25//! println!("Found {} devices", devices.len());
26//!
27//! // Control a device
28//! if let Some(device) = devices.first() {
29//! client.turn_on(&device.device, &device.sku).await?;
30//! client.set_brightness(&device.device, &device.sku, 80).await?;
31//! }
32//!
33//! Ok(())
34//! }
35//! ```
36
37pub mod client;
38pub mod error;
39pub mod types;
40
41/// Compile the README's code examples as doctests.
42#[cfg(doctest)]
43#[doc = include_str!("../README.md")]
44struct ReadmeDoctests;
45
46pub use client::{ClientConfig, GoveeClient};
47pub use error::{Error, Result};
48pub use types::*;