Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Comments

Manav Rathi1d24bc10c7e7
diff --git a/rust/core/Cargo.toml b/rust/core/Cargo.toml
index 2c0cb3d922..b7d70f1388 100644
--- a/rust/core/Cargo.toml
+++ b/rust/core/Cargo.toml
@@ -8,3 +8,6 @@ reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "2"
+
+[lints.rust]
+missing_docs = "warn"
diff --git a/rust/core/src/http.rs b/rust/core/src/http.rs
index 7e7bac5567..d6e9fe899a 100644
--- a/rust/core/src/http.rs
+++ b/rust/core/src/http.rs
@@ -1,7 +1,11 @@
+//! HTTP client for communicating with the Ente API.
+
use thiserror::Error;
+/// HTTP client errors.
#[derive(Error, Debug)]
pub enum Error {
+ /// A network or HTTP protocol error occurred during the request.
#[error("HTTP request failed: {0}")]
Request(#[from] reqwest::Error),
}
@@ -14,12 +18,14 @@ pub enum Error {
// - Retry logic
// - Configurable timeouts
+/// HTTP client for making requests to the Ente API.
pub struct HttpClient {
client: reqwest::Client,
base_url: String,
}
impl HttpClient {
+ /// Create a client with the given base URL.
pub fn new(base_url: &str) -> Self {
Self {
client: reqwest::Client::new(),
@@ -27,6 +33,7 @@ impl HttpClient {
}
}
+ /// GET request, returns response body as text.
pub async fn get(&self, path: &str) -> Result<String, Error> {
let url = format!("{}{}", self.base_url, path);
let response = self.client.get(&url).send().await?;
diff --git a/rust/core/src/lib.rs b/rust/core/src/lib.rs
index 57e037cc25..d70864eb81 100644
--- a/rust/core/src/lib.rs
+++ b/rust/core/src/lib.rs
@@ -1,2 +1,4 @@
+//! Core library for Ente clients.
+
pub mod http;
pub mod urls;
diff --git a/rust/core/src/urls.rs b/rust/core/src/urls.rs
index 47b9653cf5..518ea819b1 100644
--- a/rust/core/src/urls.rs
+++ b/rust/core/src/urls.rs
@@ -1,3 +1,5 @@
+//! URL construction utilities for Ente API and S3 endpoints.
+
/// Generate the download URL for a file.
///
/// - If api_base_url is production (https://api.ente.io), return CDN URL