xplane_web_api/lib.rs
1//! Typed client crate for the documented X-Plane local web API.
2//!
3//! - REST API: generated from OpenAPI at build time with Progenitor.
4//! - WebSocket API: typed request/response models and a small async client.
5//! - CLI: optional command-line interface for REST operations.
6//! - Error: shared typed REST error classification helpers.
7//!
8//! # Basic REST Example
9//!
10//! ```rust
11//! use xplane_web_api::error::RestClientError;
12//! use xplane_web_api::rest::{Client, DEFAULT_REST_API_BASE_URL};
13//!
14//! async fn fetch_capabilities() -> Result<(), RestClientError> {
15//! let client = Client::new(DEFAULT_REST_API_BASE_URL);
16//! let response = client
17//! .get_capabilities()
18//! .await
19//! .map_err(RestClientError::from)?;
20//!
21//! println!("{:#?}", response.as_ref());
22//! Ok(())
23//! }
24//! ```
25
26#![warn(missing_docs, clippy::unwrap_used, clippy::expect_used, clippy::panic)]
27
28/// Generated REST client and OpenAPI-derived request/response types.
29#[allow(clippy::unwrap_used, missing_docs)]
30pub mod rest {
31 /// Default base URL for the local X-Plane REST API.
32 pub const DEFAULT_REST_API_BASE_URL: &str = "http://localhost:8086";
33
34 include!(concat!(env!("OUT_DIR"), "/xplane_web_api.rs"));
35}
36
37/// Shared REST error classification helpers for generated client operations.
38pub mod error;
39
40#[cfg(feature = "websocket")]
41/// Typed websocket request/response models and an async convenience client.
42pub mod websocket;