π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Remove unused HTTP binding wrappers
Manav Rathi0ec347e1fbca
diff --git a/rust/bindings/frb/ente-rust/src/api/http.rs b/rust/bindings/frb/ente-rust/src/api/http.rsdeleted file mode 100644index bc6ef269d9..0000000000--- a/rust/bindings/frb/ente-rust/src/api/http.rs+++ /dev/null@@ -1,65 +0,0 @@-//! FRB bindings for the HTTP client--use ente_core::http_legacy::{Error as CoreError, HttpClient as CoreHttpClient};-use flutter_rust_bridge::frb;--/// HTTP client errors.-#[frb]-pub enum HttpError {- /// Network error - connection failed, timeout, etc.- Network {- /// Error message.- message: String,- },- /// Server return an HTTP error status.- Http {- /// Error message.- message: String,- /// HTTP status code.- status: u16,- },- /// Failed to parse response.- Parse {- /// Error message.- message: String,- },- /// Invalid base URL or request path.- InvalidUrl {- /// Error message.- message: String,- },-}--impl From<CoreError> for HttpError {- fn from(e: CoreError) -> Self {- match e {- CoreError::Network(message) => HttpError::Network { message },- CoreError::Http {- status, message, ..- } => HttpError::Http { status, message },- CoreError::Parse(message) => HttpError::Parse { message },- CoreError::InvalidUrl(message) => HttpError::InvalidUrl { message },- }- }-}--/// HTTP client for making requests to the Ente API.-#[frb(opaque)]-pub struct HttpClient {- inner: CoreHttpClient,-}--impl HttpClient {- /// Create a client with the given base URL.- #[frb(sync)]- pub fn new(base_url: String) -> HttpClient {- Self {- inner: CoreHttpClient::new(&base_url).expect("failed to build HTTP client"),- }- }-- /// GET request, returns response body as text.- pub async fn get(&self, path: String) -> Result<String, HttpError> {- self.inner.get(&path).await.map_err(|e| e.into())- }-}diff --git a/rust/bindings/frb/ente-rust/src/api/mod.rs b/rust/bindings/frb/ente-rust/src/api/mod.rsindex fc5bd2be34..826a58a579 100644--- a/rust/bindings/frb/ente-rust/src/api/mod.rs+++ b/rust/bindings/frb/ente-rust/src/api/mod.rs@@ -1,6 +1,5 @@//! Public API exposed to Dart via Flutter Rust Bridge.pub mod contacts;-pub mod http;pub mod init;pub mod urls;diff --git a/rust/bindings/wasm/ente-wasm/src/http.rs b/rust/bindings/wasm/ente-wasm/src/http.rsdeleted file mode 100644index 3be5c536dc..0000000000--- a/rust/bindings/wasm/ente-wasm/src/http.rs+++ /dev/null@@ -1,84 +0,0 @@-//! WASM bindings for the HTTP client.--use ente_core::http_legacy::{Error as CoreError, HttpClient as CoreHttpClient};-use wasm_bindgen::prelude::*;--/// HTTP client error.-#[wasm_bindgen]-pub struct HttpError {- code: String,- message: String,- status: Option<u16>,-}--#[wasm_bindgen]-impl HttpError {- /// Error code: "invalid_url", "network", "http", or "parse".- #[wasm_bindgen(getter)]- pub fn code(&self) -> String {- self.code.clone()- }-- /// Error message.- #[wasm_bindgen(getter)]- pub fn message(&self) -> String {- self.message.clone()- }-- /// HTTP status code (only for "http" errors).- #[wasm_bindgen(getter)]- pub fn status(&self) -> Option<u16> {- self.status- }-}--impl From<CoreError> for HttpError {- fn from(e: CoreError) -> Self {- match e {- CoreError::InvalidUrl(message) => HttpError {- code: "invalid_url".to_string(),- message,- status: None,- },- CoreError::Network(message) => HttpError {- code: "network".to_string(),- message,- status: None,- },- CoreError::Http {- status, message, ..- } => HttpError {- code: "http".to_string(),- message,- status: Some(status),- },- CoreError::Parse(message) => HttpError {- code: "parse".to_string(),- message,- status: None,- },- }- }-}--/// HTTP client for making requests to the Ente API.-#[wasm_bindgen]-pub struct HttpClient {- inner: CoreHttpClient,-}--#[wasm_bindgen]-impl HttpClient {- /// Create a client with the given base URL.- #[wasm_bindgen(constructor)]- pub fn new(base_url: &str) -> Self {- Self {- inner: CoreHttpClient::new(base_url).expect("failed to build HTTP client"),- }- }-- /// GET request, returns response body as text.- pub async fn get(&self, path: &str) -> Result<String, HttpError> {- self.inner.get(path).await.map_err(|e| e.into())- }-}diff --git a/rust/bindings/wasm/ente-wasm/src/lib.rs b/rust/bindings/wasm/ente-wasm/src/lib.rsindex c94c0ee95d..2e76249441 100644--- a/rust/bindings/wasm/ente-wasm/src/lib.rs+++ b/rust/bindings/wasm/ente-wasm/src/lib.rs@@ -3,6 +3,5 @@mod auth;mod contacts;mod crypto;-mod http;mod legacy_kit;mod urls;