Skip to content

Commit

Permalink
jsonrpc: add api migrate_account and get_blob_dir (#5584)
Browse files Browse the repository at this point in the history
closes #5533

adds the functions that were still missing for migration to jsonrpc (the
ones that the cffi already had, so just should be quick to review ;)
  • Loading branch information
Simon-Laux authored May 17, 2024
1 parent ef6c3f8 commit 517cb82
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions deltachat-jsonrpc/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u32> {
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()
Expand Down Expand Up @@ -329,6 +339,11 @@ impl CommandApi {
ctx.get_info().await
}

async fn get_blob_dir(&self, account_id: u32) -> Result<Option<String>> {
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<u32> {
let ctx = self.get_context(account_id).await?;
Ok(ctx.draft_self_report().await?.to_u32())
Expand Down

0 comments on commit 517cb82

Please sign in to comment.