Skip to main content

cloudreve_sdk_api/
lib.rs

1//! # Cloudreve API Client
2//!
3//! A comprehensive Rust client for the Cloudreve API with automatic token refresh support.
4//!
5//! ## Features
6//!
7//! - Automatic access token refresh when expired
8//! - Comprehensive error handling
9//! - Type-safe API methods
10//! - Support for all Cloudreve API endpoints
11//!
12//! ## Example
13//!
14//! ```no_run
15//! use cloudreve_sdk_api::{Client, ClientConfig};
16//! use cloudreve_sdk_api::api::user::UserApi;
17//!
18//! #[tokio::main]
19//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
20//!     let config = ClientConfig::new("https://your-cloudreve-instance.com");
21//!     let client = Client::new(config);
22//!     
23//!     // Login and get tokens
24//!     let login_response = client.login("user@example.com", "password").await?;
25//!     
26//!     // Set tokens for subsequent requests
27//!     client.set_tokens(
28//!         login_response.token.access_token,
29//!         login_response.token.refresh_token
30//!     ).await;
31//!     
32//!     // Use the API - tokens will be automatically refreshed if needed
33//!     let user = client.get_user_me().await?;
34//!     println!("Hello, {}!", user.nickname);
35//!     
36//!     Ok(())
37//! }
38//! ```
39
40pub mod api;
41pub mod boolset;
42pub mod client;
43pub mod error;
44pub mod models;
45
46pub use boolset::Boolset;
47pub use client::{Client, ClientConfig};
48pub use error::{ApiError, ApiResult};