diff --git a/deltachat-jsonrpc/src/api.rs b/deltachat-jsonrpc/src/api.rs index d1cdc92119..9855df949b 100644 --- a/deltachat-jsonrpc/src/api.rs +++ b/deltachat-jsonrpc/src/api.rs @@ -185,6 +185,16 @@ impl CommandApi { self.accounts.write().await.add_account().await } + /// Imports/migrated an existing account from a database path into this account manager. + /// Returns the ID of new account. + async fn migrate_account(&self, path_to_db: String) -> Result { + self.accounts + .write() + .await + .migrate_account(std::path::PathBuf::from(path_to_db)) + .await + } + async fn remove_account(&self, account_id: u32) -> Result<()> { self.accounts .write() @@ -329,6 +339,11 @@ impl CommandApi { ctx.get_info().await } + async fn get_blob_dir(&self, account_id: u32) -> Result> { + let ctx = self.get_context(account_id).await?; + Ok(ctx.get_blobdir().to_str().map(|s| s.to_owned())) + } + async fn draft_self_report(&self, account_id: u32) -> Result { let ctx = self.get_context(account_id).await?; Ok(ctx.draft_self_report().await?.to_u32())