Expand description
§neust
NEU CAS binding for Rust.
§Explanation: Endpoints
See documentation for endpoints.
§Examples
For binary program examples, see neust/examples.
§Query username using token
use neust::{Session, auth};
let token = auth::Token::new("your_token");
let session = Session::new();
let status = session.login(&token).await?;
let username = status.get_username();
§Access intranet service via WebVPN
Should enable feature: webvpn.
use neust::{Session, auth, webvpn};
let credential = auth::Credential::new("username", "password");
let session = Session::new();
if !session.login(&credential).await?.is_active()
|| !session.login_via_webvpn(&credential).await?.is_active() {
panic!("fail");
}
let client = session.client();
let request = client
.get(webvpn::encrypt_url(
"http://219.216.96.4/eams/teach/grade/course/person!search.action?semesterId=0",
))
.build()?;
let response = client.execute(request).await?;
§Use Wechat to login
Should enable feature: wechat.
use neust::{Session, auth};
use tokio::time::{sleep, Duration};
let wechat = auth::Wechat::default();
let session = Session::new();
sleep(Duration::from_secs(10)).await;
let status = session.login(&wechat).await?;
let username = status.get_username();
§Optional Features
- webvpn: supports for WebVPN endpoint.
- wechat: supports for authorization by Wechat.
- native-tls (enabled by default): Enables TLS functionality provided by
native-tls
. - rustls-tls: Enables TLS functionality provided by
rustls
. - json: Provides serialization and deserialization for JSON bodies.
Re-exports§
pub use reqwest;
Modules§
- auth
- Several implementations for
AuthMethod
. - doc
- This module contains explanation documentations.
- webvpn
- Provide helper functions for operations on WebVPN.
Structs§
- Session
- An asynchronous reqwest client with cookie management.
Enums§
- Error
- Errors may occur during session operations.
- User
Status - The endpoint-specific user status in a
Session
.
Traits§
- Auth
Method - An abstraction of auth method used in
Session
.
Type Aliases§
- Result
- A
Result
alias where theErr
case isneust::Error
.