π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add example
Manav Rathi9aa6e93f1b00
diff --git a/rust/core/Cargo.lock b/rust/core/Cargo.lockindex d91a4dc7e3..d0f463f7c4 100644--- a/rust/core/Cargo.lock+++ b/rust/core/Cargo.lock@@ -92,6 +92,7 @@ dependencies = ["serde","serde_json","thiserror",+ "tokio",][[package]]@@ -1018,9 +1019,21 @@ dependencies = ["mio","pin-project-lite","socket2",+ "tokio-macros","windows-sys 0.61.2",]+[[package]]+name = "tokio-macros"+version = "2.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"+dependencies = [+ "proc-macro2",+ "quote",+ "syn",+]+[[package]]name = "tokio-native-tls"version = "0.3.1"diff --git a/rust/core/Cargo.toml b/rust/core/Cargo.tomlindex b7d70f1388..76b6466e86 100644--- a/rust/core/Cargo.toml+++ b/rust/core/Cargo.toml@@ -9,5 +9,8 @@ serde = { version = "1", features = ["derive"] }serde_json = "1"thiserror = "2"+[dev-dependencies]+tokio = { version = "1", features = ["rt-multi-thread", "macros"] }+[lints.rust]missing_docs = "warn"diff --git a/rust/core/examples/ping.rs b/rust/core/examples/ping.rsnew file mode 100644index 0000000000..0a5bf00047--- /dev/null+++ b/rust/core/examples/ping.rs@@ -0,0 +1,19 @@+//! Example: ping the Ente API.+//!+//! ```sh+//! cargo run --example ping -- https://api.ente.io+//! ```++use ente_core::http::HttpClient;++#[tokio::main]+async fn main() {+ let base_url = std::env::args().nth(1).expect("Usage: ping <base_url>");++ let client = HttpClient::new(&base_url);++ match client.get("/ping").await {+ Ok(response) => println!("{}", response),+ Err(e) => eprintln!("Error: {}", e),+ }+}