1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//! # NLECloud SDK for Rust
//!
//! An idiomatic, asynchronous, thread-safe Rust SDK for the NLECloud (新大陆物联网云平台) IoT platform.
//!
//! ## Overview
//!
//! - **Async & Non-blocking**: Built on `tokio` and `reqwest` (with `rustls-tls`).
//! - **Immutable Client**: [`NleCloudClient`] configured via [`NleCloudClientBuilder`].
//! - **Generic Envelope Unwrapping**: Responses wrapped in upstream `ResultMsg` envelopes
//! are automatically intercepted, mapping non-zero API statuses into [`SdkError::Api`].
//! - **Complete Model Coverage**: Strongly typed structs matching all NLECloud DTOs,
//! including legacy PascalCase aliases (e.g. [`DeviceInfoDTO`]) for easy migration.
//!
//! ## Modules & Core APIs
//!
//! The client exposes operations across several domains:
//!
//! | Module | Core Methods | Description |
//! |---|---|---|
//! | [`api::auth`] | [`login`](NleCloudClient::login), [`get_current_token`](NleCloudClient::get_current_token) | User authentication & token management |
//! | [`api::projects`] | [`get_projects`](NleCloudClient::get_projects), [`add_project`](NleCloudClient::add_project), [`get_project_sensors`](NleCloudClient::get_project_sensors) | Project lifecycle & hierarchy queries |
//! | [`api::devices`] | [`get_devices`](NleCloudClient::get_devices), [`get_device_info`](NleCloudClient::get_device_info), [`get_devices_status`](NleCloudClient::get_devices_status) | Device CRUD & online status checks |
//! | [`api::sensors`] | [`get_sensors`](NleCloudClient::get_sensors), [`add_sensor_datas`](NleCloudClient::add_sensor_datas), [`get_sensor_datas`](NleCloudClient::get_sensor_datas) | Sensor management & telemetry time-series |
//! | [`api::commands`] | [`send_cmd`](NleCloudClient::send_cmd) | Actuator control & command dispatching |
//!
//! ## Quick Start
//!
//! ```no_run
//! use nle_cloud_sdk::prelude::*;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! // 1. Build an unauthenticated client
//! let client = NleCloudClient::builder()
//! .base_url("http://api.nlecloud.com")
//! .build()?;
//!
//! // 2. Authenticate
//! let login_res = client.login_with_credentials("your_account", "your_password", false).await?;
//! println!("Logged in! Token: {}", login_res.access_token);
//!
//! // 3. Create an authenticated client clone
//! let auth_client = client.with_token(login_res.access_token);
//!
//! // 4. Query sensors for a device
//! let sensors = auth_client.get_sensors(10367, None, None).await?;
//! println!("Sensors found: {}", sensors.len());
//!
//! // 5. Dispatch an actuator command (e.g. Turn On = 1)
//! auth_client.send_cmd(10367, "nl_fan", &1, None).await?;
//!
//! Ok(())
//! }
//! ```
pub
pub use ;
pub use ;
pub use *;
/// Convenient prelude module for re-exporting common types.