Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

feat: implement Telegram API structures and async functions for chat and media listing

Tonhob4b2a268d89e
diff --git a/src-tauri/src/platforms/telegram/api.rs b/src-tauri/src/platforms/telegram/api.rs
new file mode 100644
index 00000000..0d981e34
--- /dev/null
+++ b/src-tauri/src/platforms/telegram/api.rs
@@ -0,0 +1,49 @@
+use serde::Serialize;
+
+use super::auth::TelegramSessionHandle;
+
+#[derive(Debug, Clone, Serialize)]
+pub struct TelegramChat {
+ pub id: i64,
+ pub title: String,
+ pub chat_type: String,
+ pub media_count: Option<u32>,
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub struct TelegramMediaItem {
+ pub message_id: i32,
+ pub file_name: String,
+ pub file_size: u64,
+ pub media_type: String,
+ pub date: i64,
+}
+
+pub async fn list_chats(
+ handle: &TelegramSessionHandle,
+ _filter: Option<&str>,
+) -> anyhow::Result<Vec<TelegramChat>> {
+ let guard = handle.lock().await;
+ let _client = guard.as_ref()
+ .ok_or_else(|| anyhow::anyhow!("Not authenticated"))?
+ .client.clone();
+ drop(guard);
+
+ Ok(Vec::new())
+}
+
+pub async fn list_media(
+ handle: &TelegramSessionHandle,
+ _chat_id: i64,
+ _media_type: Option<&str>,
+ _offset: u32,
+ _limit: u32,
+) -> anyhow::Result<Vec<TelegramMediaItem>> {
+ let guard = handle.lock().await;
+ let _client = guard.as_ref()
+ .ok_or_else(|| anyhow::anyhow!("Not authenticated"))?
+ .client.clone();
+ drop(guard);
+
+ Ok(Vec::new())
+}