Use the google-workspace Rust library
mainThe google-workspace crate is a core Rust library for interacting with Google Workspace APIs using dynamic discovery. Instead of using pre-generated client crates, it fetches Google's Discovery Documents at runtime, allowing your code to automatically pick up new or updated API endpoints. It provides foundational types for discovery, service resolution, error handling, and HTTP client management.
use google_workspace::discovery::fetch_discovery_document;
use google_workspace::services::resolve_service;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let (api, version) = resolve_service("drive").unwrap();
let doc = fetch_discovery_document(api, version, None).await?;
println!("{} {} — {} resources",
doc.name, doc.version,
doc.resources.len(),
);
Ok(())
}