TSAR Rust SDK
The official Rust SDK for TSAR. Rust is our primary focus, so this SDK will be the most maintained.

Example Import
cargo add tsar-sdk
tsar-sdk = "0.1.0-beta.1"
Example Usage
use tsar_sdk::{AuthParams, Client, ClientParams};
const APP_ID: &str = "00000000-0000-0000-0000-000000000000";
const CLIENT_KEY: &str = "MFk...";
fn main() {
let options = ClientParams {
app_id: APP_ID.to_string(),
client_key: CLIENT_KEY.to_string(),
};
let client_init = Client::create(options);
match client_init {
Ok(client) => {
println!(
"Client successfully initialized. {:#?}",
client
);
let mut user_result = client.authenticate(AuthParams::default());
while user_result.is_err() {
println!("Attempting to check if user is valid...");
std::thread::sleep(std::time::Duration::from_secs(3));
user_result = client.authenticate(AuthParams {
open_browser: false,
});
}
let user = user_result.unwrap();
println!("User authorized. {:#?}", user);
loop {
match user.heartbeat() {
Ok(_) => println!("Heartbeat success"),
Err(err) => {
println!("Heartbeat failed: {:?}: {}", err, err)
}
}
std::thread::sleep(std::time::Duration::from_secs(30));
}
}
Err(err) => println!("Failed to initialize client: {:?}: {}", err, err),
}
}
Want to contribute?
This SDK is open for community contribution! All pull requests will be reviewed by our team.
Need help?
Join our discord community if you have any questions. For other contact options, please visit here.