grow_casdoor/lib.rs
1// Skeleton created by sdk-kit 0.3.0; owned by this repository (edit freely).
2//! # grow-casdoor
3//!
4//! Rust SDK for [Casdoor](https://grow-codes-packages.github.io/casdoor/) by Grow Codes.
5//!
6//! ```no_run
7//! # async fn demo() -> grow_casdoor::Result<()> {
8//! use grow_casdoor::{CasdoorClient, CasdoorConfig};
9//!
10//! let client = CasdoorClient::new(CasdoorConfig::from_env()?)?;
11//! let health = client.health().await?;
12//! println!("healthy: {}", health.healthy);
13//! client.close().await;
14//! # Ok(())
15//! # }
16//! ```
17//!
18//! Features: `blocking` (a blocking client), `testing` (in-memory fakes and the conformance
19//! runner)
20//! .
21#![cfg_attr(docsrs, feature(doc_cfg))]
22
23pub mod core;
24
25pub mod casdoor;
26mod client;
27mod config;
28
29#[cfg(feature = "blocking")]
30#[cfg_attr(docsrs, doc(cfg(feature = "blocking")))]
31pub mod blocking;
32
33#[cfg(feature = "testing")]
34#[cfg_attr(docsrs, doc(cfg(feature = "testing")))]
35pub mod testing;
36
37pub use crate::core::{Error, ErrorCode, HealthStatus, Result, RetryPolicy, Secret};
38
39pub use crate::config::{DEFAULT_SCOPE, DEFAULT_URL};
40
41pub use crate::casdoor::{pkce_challenge, random_state, Pkce, TokenSet};
42pub use crate::client::{CasdoorClient, SignInInput};
43
44pub use crate::config::CasdoorConfig;
45
46pub use crate::config::CasdoorConfigBuilder;
47
48/// Service-prefixed alias of [`Error`].
49pub type CasdoorError = Error;